August 6th, 2000, 09:21 PM
-
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-
August 7th, 2000, 04:40 AM
-
<<
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).]