Hi i have this problem with my usersystem when i try and edit my profile it shows the page that it worked but when i view my profile it hasent can anyone help me please Code below
I dont know if this can help but this code works when i use it to change my password in the same usersystem
i did not code this
Code:
<?
ob_start();
include("config.php");
if ($logged[username] && $logged[level] > 1)
{
// the user is logged in! We continue...
if (!$_POST[update])
{
echo("<span class='contentHeading'>Update Profile</span><br><br>Share some information with the members. Let them get to know you.<br><br>");
// the form hasn't been submitted. We continue...
$profile = mysql_query("SELECT * from users where username = '$logged[username]'");
$profile = mysql_fetch_array($profile);
// the above lines get the information so that it can be displayed in the html form.
echo("
<center><form method=\"POST\">
<table width='379' border='0' class='contentTable' align='center'>
<tr class='contentTableHeader'>
<td colspan='2' align='center'>Update Profile</td></tr>
");
if($logged[level] > 1){
echo(" <tr>
<td align=\"right\" width=\"25%\">
Mission
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" name=\"mission\" value=\"$profile[mission]\"></td>
</tr> ");
}
echo("<tr>
<td align=\"right\" width=\"25%\">
Location
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"locate\" value=\"$profile[location]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Homepage</td>
<td align=\"left\">
<input size=\"25\" name=\"homepage\" value=\"$profile[homepage]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Email Address</td>
<td align=\"left\">
<input size=\"25\" name=\"email\" value=\"$profile[email]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Picture</td>
<td align=\"left\">
<input size=\"25\" name=\"picture\" value=\"$profile[picture]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
HabboName
</td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"habboname\" value=\"$profile[habboname]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Favourite Hotel
</td>
<td align=\"left\">
<select name=\"hotels\" id=\"hotels\" size=\"1\">
<option value=\"UK Hotel\">UK Hotel</option>
<option value=\"USA Hotel\">USA Hotel</option>
<option value=\"CA Hotel\">CA Hotel</option>
<option value=\"AU Hotel\">AU Hotel</option>
<option value=\"Other Hotel\">Other Hotel</option>
</select>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Favourite Food</td>
<td align=\"left\">
<input size=\"25\" name=\"fav_food\" value=\"$profile[fav_food]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Best Habbo</td>
<td align=\"left\">
<input size=\"25\" name=\"best_habbo\" value=\"$profile[best_habbo]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Occupation</td>
<td align=\"left\">
<input size=\"25\" name=\"occupation\" value=\"$profile[occupation]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Gender</td>
<td align=\"left\">
<select name=\"gender\" id=\"gender\" size=\"1\">
<option value=\"Male\">Male</option>
<option value=\"Female\">Female</option>
<option value=\"Prefer not to disclose\">Prefer not to disclose</option>
</select>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
Favourite Colour</td>
<td align=\"left\">
<input size=\"25\" name=\"fav_color\" value=\"$profile[fav_color]\"></td>
</tr>
<tr>
<td align=\"center\">
</td>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update Profile\"></td>
</tr>
</tr>
<tr class='footerText'>
<td colspan='2'> </td>
</tr>
</table>
</form>
</center>");
}
else
{
$email = htmlspecialchars(addslashes($_POST[email]));
$aim = htmlspecialchars(addslashes($_POST[aim]));
$msn = htmlspecialchars(addslashes($_POST[msn]));
$picture = htmlspecialchars(addslashes($_POST[picture]));
$locate = htmlspecialchars(addslashes($_POST[locate]));
$habboname = htmlspecialchars(addslashes($_POST[habboname]));
$hotels = htmlspecialchars(addslashes($_POST[hotels]));
$homepage = htmlspecialchars(addslashes($_POST[homepage]));
$fav_food = htmlspecialchars(addslashes($_POST[fav_food]));
$best_habbo = htmlspecialchars(addslashes($_POST[best_habbo]));
$occupation = htmlspecialchars(addslashes($_POST[occupation]));
$gender = htmlspecialchars(addslashes($_POST[gender]));
$fav_color = htmlspecialchars(addslashes($_POST[fav_color]));
$mission = addslashes($_POST[mission]);
// the above lines get rid of all html.
echo ("Your profile has been updated!");
$update = mysql_query("Update users set email = '$email',
msn = '$msn', aim = '$aim', picture = '$picture', location = '$locate', habboname = '$habboname', homepage = '$homepage', hotels = '$hotels', fav_food = '$fav_food', best_habbo = '$best_habbo', mission = '$mission', occupation = '$occupation', gender = '$gender', fav_color = '$fav_color' where username = '$logged[username]'");
// updates the information in the database.
}
}
else
{
// They aren't logged in!
echo ("<a href=\"login.php\">You must login</a>");
}
?>
Code:
<?php
ob_start();
include("config.php");
include("online.php");
if ($logged[username] && $logged[level] > 0)
{
switch($_GET['action']) {
default:
//form action and method
echo("<span class='contentHeading'>Change Password</span><br><br>Here you can update your password. <b>We recommend you do this reguarly for security</b><br>");
echo "<form method='POST' action='changepass.php?action=change'>";
//table with old pass, new pass and conferm pass
echo "<br><table width='379' border='0' class='contentTable' align='center'>
<tr class='contentTableHeader'>
<td colspan='2' align='center'>Change Password</td></tr>
<tr>
<td width='153'>Old Password: </td>
<td width='150'><input type='password' name='oldpass' size='15'></td>
</tr>
<tr>
<td>New Password: </td>
<td><input type='password' name='newpass' size='15'></td>
</tr>
<tr>
<td>Conform Password: </td>
<td><input type='password' name='conpass' size='15'></td>
</tr>
<tr class=''>
<td colspan='2' align='center'><input type='submit' value='Update Pass' name='update'></td>
</tr>
<tr class='footerText'>
<td colspan='2'> </td>
</tr>
</table>";
//Submit button
break;
case "change":
//posts the old password and md5s it
$oldpass = md5($_POST[oldpass]);
//posts the new password and md5s it
$newpass = md5($_POST[newpass]);
//posts the conformation password and md5s it
$conpass = md5($_POST[conpass]);
//get the users old info from the database
$info = mysql_query("SELECT * from users where username = '$logged[username]'");
$info = mysql_fetch_array($info);
//if the old password matches the password in the database we continue
if($info[password] == $oldpass) {
//if the new password and conformation password are the same continue
if($newpass == $conpass) {
//Updates the new password into the database where username is logged in
$update = mysql_query("Update users set password = '$newpass' where username = '$logged[username]'");
//displays message when updated
echo "Password Updated, You will need to relogin with your new password.";
//logs them out so they login with there new password
setcookie("id", 2132421,time()+(60*60*24*5), "/", "");
setcookie("pass", loggedout,time()+(60*60*24*5), "/", "");
}
else
{
//error message is the new password and the conformation password do not match
echo "Your new password and conformation passwords do not match!";
}
}
else
{
//error message is the old password does not match their database password
echo "Your old password does not match the database password!";
}
break;
}
}
else
{
//if the person is not logged in
die("You are not logged in!");
}
?>
i did not code this
