#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    8
    Rep Power
    0
    Hi,

    I've set up a PHP3/MySQL authentication system (which I downloaded off the web) that requires members to register and login.

    I would like to personalize my web content after a user logs into the system. For example: "Welcome back DMC! It's been awhile."

    If the fields (in MySQL database) are:

    - user_id,
    - user_name,
    - real_name,
    - email,
    - password,

    ..can I set a cookie for each field listed above to become varibles? And can I use these varibles throughout my site? For example: A member can fill out a Quiz and their "Real_name" and "email" shows up already within the HTML form.

    This Login script includes an example of how to make a page look for a cookie. However, the ONLY cookie is set up for "user_name"

    <?php

    include('include/user.php');

    if (!user_isloggedin())
    {
    header("Location: *need to be logged in page*.html");
    }

    echo "<html>";
    echo "<body>";

    echo "<P>You are logged in as <B>$user_name</B>.</P>";

    phpinfo();

    ?>

    1. Do you think the login.php script somehow set the $user_name cookie already?

    2. Can I easly set other cookies?

    3. Am I on the right track....??

    Thanks,

    DMC


  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    DMC,
    when you check the username and password from the database ,take other values in cookies..so you can track the user through out your site...


    <<
    1. Do you think the login.php script somehow set the $user_name cookie already?
    >>

    please post your login.php here ...


    <<
    2. Can I easly set other cookies?
    >>


    yea...just set this up when user login..

    cookie eg:
    setcookie("cookiename","cookievalue", time()+94608000, "/","www.yourdomain.com");


    <<
    3. Am I on the right track....??
    >>


    yea..

    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    8
    Rep Power
    0
    Here is the login.php

    <?php

    include($DOCUMENT_ROOT.'/include/database.php');
    include($DOCUMENT_ROOT.'/include/pre.php');
    include($DOCUMENT_ROOT.'/include/user.php');

    if (user_isloggedin()) {
    user_logout();
    $user_name='';
    }

    if ($submit) {
    user_login($user_name,$password);
    }

    site_header('Login');

    if ($feedback) {
    echo '<FONT COLOR="RED"><H2>'.$feedback.'</H2></FONT>';
    }

    echo '<H3>Login</H3>
    <P>
    Enter your user name and password and we'll set a cookie so we know you're logged in.
    <P>
    <FORM ACTION="'. $PHP_SELF .'" METHOD="POST">
    <B>User Name:</B><BR>
    <INPUT TYPE="TEXT" NAME="user_name" VALUE="" SIZE="10" MAXLENGTH="15">
    <P>
    <B>Password:</B><BR>
    <INPUT TYPE="password" NAME="password" VALUE="" SIZE="10" MAXLENGTH="15">
    <P>
    <INPUT TYPE="SUBMIT" NAME="submit" VALUE="Login To PHPBuilder">
    </FORM>
    <P>
    <A HREF="register.php">[ Register A New Account ]</A>
    <P>
    <A HREF="changepass.php">[ Change Your Password ]</A>
    <P>

    <A HREF="changeemail.php">[ Change Your Email Address ]</A>';

    site_footer();

    ?>

    Do I set these cookies within this file?

    Thank,

    -DMC

Similar Threads

  1. Problem calling web pages by name... HELP
    By mumick in forum PHP Development
    Replies: 5
    Last Post: February 23rd, 2004, 04:34 PM
  2. Web Pages & Security
    By MrT in forum Perl Programming
    Replies: 22
    Last Post: January 11th, 2004, 11:13 PM
  3. Printer-friendly web pages
    By altyfc in forum HTML Programming
    Replies: 3
    Last Post: January 8th, 2004, 06:29 AM
  4. Don't allow caching of web pages
    By abones in forum ASP Programming
    Replies: 1
    Last Post: December 30th, 2003, 11:48 PM

IMN logo majestic logo threadwatch logo seochat tools logo