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

    Join Date
    Aug 2000
    Posts
    6
    Rep Power
    0
    hello..
    i have kind of a big problem..
    i am pretty new into php, but i have maked a userregistration and login stuff..
    but i need a new login, and in that login it should be a menu option so the user can change his/her profile.. can anyone help me?
    please.. (http://xermin.net/party/ is my current)

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

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    i am pretty new into php, but i have maked a userregistration and login stuff..
    >>


    Since you have already created that script,i would suggest you to add a link for editing the profiles of the user after login.When the user logs in take his userid in a cookie or session variable(Make sure that this userid is unique).

    The edit link should be something like..

    echo "<a href="editprofile.phtml?userid=$userid">Edit Profile</a>n";

    //$userid may be a cookie or a session variable.

    -----------------

    In editprofile.phtml
    -------------------

    <?


    if(isset($userid)){

    //when user clicks on edit link..

    //After connection functions..

    $result=mysql_query("SELECT * FROM login WHERE userid='$userid'",$con);
    //Get the user records issueing above sql.

    $row=mysql_fetch_array($result);

    if(mysql_num_rows>0){

    echo "<form action="$PHP_SELF" method="post">n";

    echo "UserName : <input type="text" name="username" value=".$row["userid"].">n";
    //put the userid to the text box.

    echo "Password : <input type="text" name="pwd" value=".$row["pwd"].">n";

    echo "<input type="submit" name="submit" value="Update">n";
    echo "<form>n";
    }else{
    echo "Sorry Your record is not fetchingn";
    exit;
    }
    }elseif (isset($submit)){
    //if user clicks on update his profile..

    $sql="UPDATE login SET userid='$username',pwd='$pwd' WHERE userid='$username'";

    $result=mysql_query($sql,$con);
    //Update the database issueing above sql statement..
    if(mysql_affected_rows[$result]==1){
    //database updated
    echo "Thank You!!! Profile has been changed successfullyn";
    }else{
    //couldn't update..
    echo "Couldn't update the databasen";
    exit;
    }
    }else{
    echo "Error !! Invalid accessn";
    exit;
    }

    ?>

    Good Luck!!!

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

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited August 07, 2000).]

Similar Threads

  1. Replies: 6
    Last Post: September 27th, 2004, 09:12 AM
  2. User login setup
    By mdhall in forum MySQL Help
    Replies: 18
    Last Post: November 18th, 2003, 12:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo