[PHP] Help please >:)

Status
Not open for further replies.
Newbie Spellweaver
Joined
Jan 22, 2007
Messages
10
Reaction score
0
Location
Behind you
does any one know why this code dont work its ment to change your profile on my usersystem :S

Code:
<html>
<head>
<title>Home</title>
<style type="text/css">
a {
font-size: 10px;
color: #000000;
}
a:link {
text-decoration: none;
color: #000000;
}
a:visited {
text-decoration: none;
color: #000000;
}
a:hover {
text-decoration: underline;
color: #000000;
}
a:active {
text-decoration: none;
color: #000000;
}
body,td,th,p {
font-family: Verdana;
font-size: 10px;
color: #000000;
}
.12 { color: red; }
.11 { color: navy; }
.10 { color: ; }
.9 { color: darkorchid; }
.8 { color: darkorchid; }
.7 { color: darkorchid; }
.6 { color: darkorchid; }
.5 { color: green; }
.4 { color: green; }
.3 { color: green; }
.2 { color: green; }
.1 { color: black; }
</style>
</head>
<body bgcolor="#ffffff">
</body>
</html>
<? 
ob_start(); 
include("config.php"); 
if ($logged[username] && $logged[level] > 0) 
{ 
// 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>"); 
} 
?> 
<?
if ($logged[banned] == 'banned'){
echo ("<meta http-equiv=\"Refresh\" content=\"0; URL=banned.php\"/>");
}
?>
Any help is great ;)
 
First thing I see wrong:

PHP:
if ($logged[username] && $logged[level] > 0)

Array indices should ALWAYS be delimited by a quotation sign, you retard.

Now, you don't present any error messages, any indication of what you did, anything at all, yet you expect us to crawl trough dozens of lines of irrelevant, BADLY written code to fix YOUR problem after you've called us retards?

Damn, you must be American, no other people I know are THIS stupid and ignorant.

Now, what I want you to do first is learn how to code properly, how to seperate logic from layout and look at the error messages you got.

Next, if that didn't solve it, look at specific parts of your code - find out exactly what line of code is not working properly.

Once you've done that, you can most likely fix it yourself, but if you can't you can open a new topic here with only those few lines of code you KNOW to contain the error. Not just dump your entire file here and expect people to read trough that crap.

And when you've done all that you'd better also learn to show some respect for your fellow RageZoners or there'll be another infraction coming your way.

*locked*
 
Status
Not open for further replies.
Back