Posted on Monday 7th April 2008 at 11:32 PM
Ok so Im using DanielXP's User system and adding new fields.
Whenever I updated my profile I get: 0 for website name and nothing for avatar and weburl.
Here is my editprofile.php
and here is members.php
and my myphpadmin seems fine. But just incase- can ya give me the text to add them to the DB? Like ADD `avatar` VARCHAR( 255 ) NOT NULL default 'https://img91.imageshack.us/img91/5952/noavvysi4.png';? Right? I don't know.
Whenever I updated my profile I get: 0 for website name and nothing for avatar and weburl.
Here is my editprofile.php
PHP Code
<?php session_start(); //allows session ?> <html><?php echo "<title>Editing profile for $user[username] | sodaDome.com</title>"; ?> <head> <link rel="stylesheet" href="https://sodadome.com/images/CoolWater.css" type="text/css" /> </head> <body> <?php include "config.php"; echo "<center>"; //checks see if there logged in if($logged[id]) { if(isset($_GET['update'])){ $email = addslashes(htmlspecialchars($_POST[email])); //Where you are $location = addslashes(htmlspecialchars($_POST[location])); //Your Age $age = (int)addslashes(htmlspecialchars($_POST[age])); //Gender $sex = addslashes(htmlspecialchars($_POST[sex])); //Sodaplay.com account $sodaname = addslashes(htmlspecialchars($_POST[sodaname])); //Avatar $avatar = addslashes(htmlspecialchars($_POST[avatar])); //MSN $msn = (int)addslashes(htmlspecialchars($_POST[msn])); //AIM $aim = (int)addslashes(htmlspecialchars($_POST[aim])); //WebPage $sitename = addslashes(htmlspecialchars($_POST[sitename])); //Site URL $siteurl = addslashes(htmlspecialchars($_POST[siteurl])); //Small Biography $smallbio = (int)addslashes(htmlspecialchars($_POST[smallbio])); //Personal Text $customeheader = (int)addslashes(htmlspecialchars($_POST[customeheader])); //Interests $interests = (int)addslashes(htmlspecialchars($_POST[interests])); //checks the sex if its ok if(($sex == "Male") || ($sex == "Female")){ //updates there profile in the db $update = mysql_query("UPDATE `members` SET `email` = '$email', `sex` = '$sex', `siteurl` = '$siteurl', `customeheader` = '$customeheader', `avatar` = '$avatar', `interests` = '$interests', `sitename` = '$sitename', `aim` = '$aim', `msn` = '$msn', `sodaname` = '$sodaname', `age` = '$age', `location` = '$location' WHERE `username` = '$logged[username]'"); echo "Profile updated!"; } //if the sex is invalid else{ echo "Invalid sex input!"; } }else{ $getuser = mysql_query("SELECT * FROM `members` WHERE `username` = '$logged[username]'"); $user = mysql_fetch_array($getuser); echo "<form name='form1' action='editprofile.php?update' method='post'> <fieldset style='width: 500'> <b>Avatar:</b> <input type='text' name='avatar' size='30' value='$user[avatar]'><br> <b>Email:</b> <input type='text' name='email' size='30' maxlength='55' value='$user[email]'><br> <b>Location:</b> <input type='text' name='location' size='30' maxlength='40' value='$user[location]'><br> <b>Age:</b> <input type='text' name='age' size='3' maxlength='3' value='$user[age]'><br> <b>Sex:</b> <select size='1' name='sex' value='$user[sex]'> <option value='Male' "; if($user[sex] == Male) { echo "selected"; } echo ">Male</option> <option value='Female' "; if($user[sex] == Female) { echo "selected"; } echo ">Female</option> </select><br> <B>Site Name:</b> <input type='text' name='siteurl' size='30' maxlength='55' value='$user[siteurl]'><br> <B>Site URL:</b> <input type='text' name='webpage' size='30' maxlength='55' value='$user[webpage]'><br> <b>sodaplay account:</b> https://sodaplay.com/creators/<input type=text name=sodaname size=20 maxlength=25 onkeydown=change_case(); onBlur=change_case(); value=$user[sodaname]><br><br> <input type='submit' value='Update'> </fieldset></form>"; } } else { echo "You are not logged in."; } echo "<center>"; ?> <script type="text/javascript"> function change_case() { document.form1.sodaname.value=document.form1.sodaname.value.toLowerCase(); } </script> </body></html>
and here is members.php
PHP Code
<?php session_start(); //allows session ?> <html><?php echo "<title>Member List | sodaDome.com</title>"; ?> <head> <link rel="stylesheet" href="https://sodadome.com/images/CoolWaterTable.css" type="text/css" /> </head> <body> <?php 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: 500'> <b>$user[username]'s Profile | sodaDome.com</b><br><br> <img src=$user[avatar] width=150px height=150px border=0><br><br> Last Seen: $user[last_seen]<br> <a href='friendrequest.php?user=$user[username]'>Add as Friend</a><br> Email: $user[email]<br> Member No.: $user[id]<br> Website: <a href=$user[siteurl] target=_blank>$user[sitename]</a><br> Location: $user[location]<br> Sex: $user[sex]<br> Age: $user[age]<br> sodaplay account: <a href=https://sodaplay.com/creators/$user[sodaname] target=_blank>$user[sodaname]</a> </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>"; ?> </body></html>
and my myphpadmin seems fine. But just incase- can ya give me the text to add them to the DB? Like ADD `avatar` VARCHAR( 255 ) NOT NULL default 'https://img91.imageshack.us/img91/5952/noavvysi4.png';? Right? I don't know.