Someone Willing to Help?

Posted on Sunday 5th August 2007 at 08:07 PM
-=InSaNe=-
-=InSaNe=-'s Avatar
I was wondering, since im struggeling to do it myself, if someone could help me. For some reason, when I make my members.php/editprofile.php with the following options:

Main Hotel:
Habbo Name:
Favorite Norm:
Favorite Rare:
Favorite Habbo X:
Favorite Habbo Staff:
Favorite WeHabbo Staff:
Favorite Color:
Location:
Habbo Home:

If someone could edit members.php, editprofile.php and the phpMyAdmin code for that, and if possible explain how you did some things, that would help me ALOT!

Thanks in advance!
`Devon
Posted on Tuesday 7th August 2007 at 08:29 AM
SkillMaster
SkillMaster's Avatar
I would help sorry mate I am busy working on another fansite
that i am joint owner with HabboZone
Posted on Tuesday 7th August 2007 at 02:15 PM
Diablosblizz
Diablosblizz's Avatar
Okay, I don't know if this will work because I am not good with phpmyadmin querys... anyways lets try this:
(also, the location is already in the database, so I am going to skip that)

Code
ALTER TABLE `members` ADD `mainhotel` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `habboname` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `favn` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `favr` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `favx` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `favs` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `fws` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `fc` VARCHAR(225) NOT NULL DEFAULT '';
ALTER TABLE `members` ADD `hm` VARCHAR(225) NOT NULL DEFAULT '';


Personally, I have NO idea if this will work... Okay, now for members.php:

Code
<?php
session_start(); //allows session
include "config.php";
echo "<center>";
if(isset($_GET['user'])){ //if there trying to view a profile
//gets the user name and makes it safe
$username = addslashes($_GET[user]);
//querys the db to find the username
$getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$username'");
//checks see if the username exists in the db

$usernum = mysql_num_rows($getuser);
//if it don't exist
if ($usernum == 0)

{
//don't exist

echo ("User Not Found");

}
//if it does exist then show there profile
else
{
$user = mysql_fetch_array($getuser);
echo "<fieldset style='width: 350'>
<b>$user[username]'s Profile</b><br><br>
Email: $user[email]<br>
Location: $user[location]<br>
Sex: $user[sex]<br>
Age: $user[age]<BR>
Main Hotel: $user[mainhotel]<BR>
Habbo Name: $user[habboname]<BR>
Favorite Norm: $user[favn]<BR>
Favorite rare: $user[favr]<BR>
Favorite Habbo X: $user[favx]<BR>
Favorite Habbo Staff: $user[favs]<BR>
Favorite WeHabbo Staff: $user[fws]<BR>
Favorite Color: $user[fc]<BR>
Habbo Home: $user[hm]
</fieldset>";

}
}
else
{
//gets all the members from the database
$getusers = mysql_query("SELECT * FROM `members` ORDER BY `id` ASC") or die(mysql_error());
//loops there name out
while ($user = mysql_fetch_array($getusers))
{
echo "<a href='members.php?user=$user[username]'>$user[username]</a><br>";
}
}
echo "<center>";
?>


Okay, this is the default one, so if you have added stuff you will either have to post your members.php or just update this one!

I hope this works, and helps.
Posted on Tuesday 7th August 2007 at 03:25 PM
-=InSaNe=-
-=InSaNe=-'s Avatar
Um just a question, what about 'EditProfile.php' Also testing that now to see if it works..
Posted on Tuesday 7th August 2007 at 03:43 PM
Diablosblizz
Diablosblizz's Avatar
Oh, whoops I totally forgot about editprofile! Here we go:


PHP Code
  1. <?php
  2. session_start(); //allows session
  3. include "config.php";
  4. echo "<center>";
  5. //checks see if there logged in
  6. if($logged[id])
  7. {
  8. if(isset($_GET['update'])){
  9.  
  10. $mh = $_POST[mh];
  11. $hn = $_POST[hn];
  12. $fn = $_POST[fn];
  13. $fr = $_POST[fr];
  14. $x = $_POST[x];
  15. $fhs = $_POST[fhs];
  16. $wes = $_POST[weh];
  17. $fc = $_POST[fc];
  18. $hh = $_POST[hh];
  19. $email = addslashes(htmlspecialchars($_POST[email]));
  20. $location = addslashes(htmlspecialchars($_POST[location]));
  21. $age = (int)addslashes(htmlspecialchars($_POST[age]));
  22. $sex = addslashes(htmlspecialchars($_POST[sex]));
  23. //checks the sex if its ok
  24. if(($sex == "Male") || ($sex == "Female")){
  25. //updates there profile in the db
  26. $update = mysql_query("UPDATE `members` SET `email` = '$email', `sex` = '$sex', `age` = '$age', `location` = '$location' `mainhotel` = '$mh' `habboname` = '$hn' `favn` = '$fn' `favr` = '$fr' `favx` = '$x' `favs` = '$fhs' `fws` = '$wes' `fc` = '$fc' `hm` = '$hh' WHERE `username` = '$logged[username]'");
  27. echo "Profile updated!";
  28. }
  29. //if the sex is invalid
  30. else
  31. {
  32. echo "Invalid sex input!";
  33. }
  34. }
  35. else
  36. {
  37. $getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$logged[username]'");
  38. $user = mysql_fetch_array($getuser);
  39. echo "<form action='editprofile.php?update' method='post'>
  40. <fieldset style='width: 350'>
  41. Email: <input type='text' name='email' size='30' maxlength='55' value='$user[email]'><br>
  42. Location: <input type='text' name='location' size='30' maxlength='40' value='$user[location]'><br>
  43. Age: <input type='text' name='age' size='3' maxlength='3' value='$user[age]'><br>
  44. Sex: <select size='1' name='sex' value='$user[sex]'>
  45. <option value='Male' "; if($user[sex] == Male) {
  46. echo "selected"; }
  47. echo ">Male</option>
  48. <option value='Female' "; if($user[sex] == Female) {
  49. echo "selected"; }
  50. echo ">Female</option>
  51. </select><br>
  52. Main Hotel: <input type='text' name='mh'><BR>
  53. Habbo Name: <input type='text' name='hn'><BR>
  54. Favorite Norm: <input type='text' name='fn'><BR>
  55. Favorite Rare: <input type='text' name='fr'><BR>
  56. Favorite Habbo X: <input type='text' name='x'><BR>
  57. Favorite Habbo Staff: <input type='text' name='fhs'><BR>
  58. Favorite WeHabbo Staff: <input type='text' name='weh'><BR>
  59. Favorite Color: <input type='text' name='fc'><BR>
  60. Habbo Home: <input type='text' name='hh'><BR>
  61. <input type='submit' value='Update'>
  62. </fieldset></form>";
  63. }
  64. }
  65. else
  66. {
  67. echo "You are not logged in.";
  68. }
  69. echo "<center>";
  70. ?>


Should work. Sorry about that.
Posted on Tuesday 7th August 2007 at 03:57 PM
-=InSaNe=-
-=InSaNe=-'s Avatar
When I edit my profile, it sais "Edit Sucesfull" or whatever, but under 'members.php' it does not change, why?
Posted on Tuesday 7th August 2007 at 03:58 PM
Diablosblizz
Diablosblizz's Avatar
It should work..... everything is right. Post your members.php and your editprofile.php. :)
Posted on Tuesday 7th August 2007 at 04:11 PM
-=InSaNe=-
-=InSaNe=-'s Avatar
Its Exactly the one you put here.
Posted on Tuesday 7th August 2007 at 04:39 PM
Diablosblizz
Diablosblizz's Avatar
Do me a fav, go into your phpmyadmin and check if your profile has been updated.

Did it put in the fields you added?
Posted on Tuesday 7th August 2007 at 05:23 PM
-=InSaNe=-
-=InSaNe=-'s Avatar
When I put it in it said it did, ill check.
Topic is locked