PDA

View Full Version : Needing User System Help.



Moh
25-11-2006, 10:35 PM
Well, Its not realy a user system, its just a Staff Profile thing.
The Content of the File is what isnt working.

A Demo is here.
http://www.crazyhabbo.net/profile/login.php
User: Demo
Pass: demo

The Edit Profile isnt saving.
The content of the file is below

<?
ob_start();
include("config.php");
if ($logged[username])
{
// the user is logged in! We continue...
if (!$_POST[update])
{
// 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=\"100%\">
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Habbo Name:</font></b></td>
<td align=\"left\">
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"habboname\" value=\"$profile[habboname]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Forum Name:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"forumname\" value=\"$profile[forumname]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Age:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"age\" value=\"$profile[age]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Main Hotel:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"hotel\" value=\"$profile[hotel]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Gender:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"gender\" value=\"$profile[gender]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Favourite Song:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"favouritesong\" value=\"$profile[favouritesong]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Favourite Genre:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"favouritegenre\" value=\"$profile[favouritegenre]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Favourite CH Management:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"favmanagement\" value=\"$profile[favmangement]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Best Habbo Friend:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"besthabbofriend\" value=\"$profile[besthabbofriend]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Best Real Friend:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"bestfriend\" value=\"$profile[bestfriend]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b>
<font size=\"1\" face=\"Verdana\">Interests:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"interests\" value=\"$profile[interests]\"></td>
</tr>
<tr>
<td align=\"right\" width=\"25%\">
<b><font face=\"Verdana\" size=\"1\">About You:</font></b></td>
<td align=\"left\">
<input size=\"25\" name=\"about\" value=\"$profile[about]\"></td>
</tr>
<tr>
<td align=\"center\">
&nbsp;</td>
<td align=\"left\">
<input type=\"submit\" name=\"update\" value=\"Update\"></td>
</tr>
</table>
</form>
</center>
");
}
else
{
$habboname = htmlspecialchars($_POST[habboname]);
$forumname = htmlspecialchars($_POST[forumname]);
$age = htmlspecialchars($_POST[age]);
$hotel = htmlspecialchars($_POST[hotel]);
$gender = htmlspecialchars($_POST[gender]);
$favouritesong = htmlspecialchars($_POST[favouritesong]);
$favouritegenre = htmlspecialchars($_POST[favouritegenre]);
$favmanagement = htmlspecialchars($_POST[favmanagement]);
$besthabbofriend = htmlspecialchars($_POST[besthabbofriend]);
$bestfriend = htmlspecialchars($_POST[bestfriend]);
$interests = htmlspecialchars($_POST[interests]);
$about = htmlspecialchars($_POST[about]);
// the above lines get rid of all html.
echo ("<font face=\"Verdana\" size=\"1\">Your profile has been updated!</font>");
$update = mysql_query("habboname = '$habboname', forumname = '$forumname', age = '$age', hotel = '$hotel', gender = '$gender', favouritesong = '$favouritesong', favouritegenre = '$favouritegenre', favmanagement = '$favmanagement', besthabbofriend = '$besthabbofriend', bestfriend = '$bestfriend', interests = '$interests', about = '$about' where username = '$logged[username]'");
// updates the information in the database.
}
}
else
{
// They aren't logged in!
echo ("<a href=\"login.php\"><font face=\"Verdana\" size=\"1\">You must login</font></a>");
}
?>
<body link="#000000" vlink="#000000" alink="#000000">

Can any one find the problem and like send me a fixed file?
Also.... If you need the mysql file, ill send u the user bit :D

Belacme
01-12-2006, 01:20 AM
Your using thinkhabbo's 404 page....

nets
01-12-2006, 06:01 PM
<?php

define("TABLE_NAME", "userprofiles"); // Table name for the profiles?

ob_start();
require("config.php");


function sanitize($str)
{
if (get_magic_quotes_gpc()) {
$str = stripslashes($str);
}

$str = htmlentities($str);
return mysql_real_escape_string($str);
}


function insert_field(&$value)
{
$SQL = sprintf("UPDATE `%s` SET `%s` = '%s' WHERE user = '%s'",
TABLE_NAME,
$value,
sanitize($_POST[$value]),
sanitize($logged['username']));

mysql_query($SQL);
}


if($logged['username'] && !$_POST['update']) {

$SQL = mysql_query("SELECT * from `users` where `username` = '$logged[username]'");
$profile = mysql_fetch_array($SQL);

print <<<HTML

<center><form method="POST">

<table width="100%">

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Habbo Name:</td>
<td align="left"><input type="text" size="25" maxlength="25" name="habboname" value="{$profile['habboname']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Forum Name:</td>
<td align="left"><input size="25" name="forumname" value="{$profile['forumname']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Age:</td>
<td align="left"><input size="25" name="age" value="{$profile['age']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Main Hotel:</td>
<td align="left"><input size="25" name="hotel" value="{$profile['hotel']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Gender:</td>
<td align="left"><input size="25" name="gender" value="{$profile['gender']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Favourite Song:</td>
<td align="left"><input size="25" name="favouritesong" value="{$profile['favouritesong']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Favourite Genre:</td>
<td align="left"><input size="25" name="favouritegenre" value="{$profile['favouritegenre']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Favourite CH Management:</td>
<td align="left"><input size="25" name="favmanagement" value="{$profile['favmangement']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Best Habbo Friend:</td>
<td align="left"><input size="25" name="besthabbofriend" value="{$profile['besthabbofriend']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Best Real Friend:</td>
<td align="left"> <input size="25" name="bestfriend" value="{$profile['bestfriend']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">Interests:</td>
<td align="left"><input size="25" name="interests" value="{$profile['interests']}" /></td>
</tr>

<tr>
<td align="right" width="25%" style="font-weight: bold; font: 12px verdana;">About You:</td>
<td align="left"><input size="25" name="about" value="{$profile['about']}" /></td>
</tr>

<tr>
<td align="center">&nbsp;</td>
<td align="left"><input type="submit" name="update" value="Update"></td>
</tr>

</table>

</form></center>

HTML;
} elseif($logged['username']) {

$load = array('habboname', 'forumname', 'age', 'hotel', 'gender', 'favouritesong', 'favouritegenre',
'favmanagement', 'besthabbofriend', 'bestfriend', 'interests', 'about');

array_walk($load, 'insert_field');

} else {

print '<a href="login.php"><font face="Verdana" size="1">You must login</font></a>';

} ?>
<body link="#000000" vlink="#000000" alink="#000000">

Haven't tested, and you'll need to change the table name defined at the top.

grahamuk123
23-12-2006, 07:57 PM
you should look on techtuts.com forum, they got a user system which has loads of FAQ's

Invent
23-12-2006, 08:41 PM
He is using techtuts profile system :\

Want to hide these adverts? Register an account for free!