electricbeat
Account Closed
- Impact
- 0
When I go to my page called edit.php - to edit a profile. If i edit the location to london, when i view the profile, it goes to 0. I've checked that the field is text and not a number and I just cant see why it is going to 0.
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-2" />
<link rel="stylesheet" href="images/style.css" type="text/css" />
<title>MusicInterests</title>
</head>
<body>
<div class="content">
<div class="header_right">
<div class="top_info">
<div class="top_info_right">
<p><?php include("logged.php"); ?></p>
</div>
</div>
<div class="bar">
<ul>
<li class="slogan">Navigation:</li>
<?php include("navigation.php"); ?>
</ul>
</div>
</div>
<div class="logo">
<h1><a href="#" title="The best music on the net!">Music <span class="red">Interests</span></a></h1>
<p>What are you listening too?</p>
</div>
<div class="search_field">
<?php include("searchform.php"); ?>
</div>
<div class="newsletter">
<p>Subscribe for the Newsletter!</p>
</div>
<div class="subheader">
<p><?php include("top.php"); ?></p>
</div>
<div class="left">
<div class="left_articles">
<h2>Search</h2>
<p>
<?
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("
<form method=\"POST\">
Location:<br />
<input type=\"text\" size=\"25\" maxlength=\"25\" name=\"location\" value=\"$profile[location]\"><br />
Email Address:<br />
<input size=\"25\" name=\"email\" value=\"$profile[email]\"><br />
<br />
<b>Song one</b><br>
Artist - <input size=\"25\" name=\"artist1\" value=\"$profile[artist1]\"> Song - <input size=\"25\" name=\"song1\" value=\"$profile[song1]\"><br />
<b>Song two</b><br>
Artist - <input size=\"25\" name=\"artist2\" value=\"$profile[artist2]\"> Song - <input size=\"25\" name=\"song2\" value=\"$profile[song2]\"><br>
<b>Song three</b><br>
Artist - <input size=\"25\" name=\"artist3\" value=\"$profile[artist3]\"> Song - <input size=\"25\" name=\"song3\" value=\"$profile[song3]\"><br>
<b>Song four</b><br>
Artist - <input size=\"25\" name=\"artist4\" value=\"$profile[artist4]\"> Song - <input size=\"25\" name=\"song4\" value=\"$profile[song4]\"><br>
<b>Song five</b><br>
Artist - <input size=\"25\" name=\"artist5\" value=\"$profile[artist5]\"> Song - <input size=\"25\" name=\"song5\" value=\"$profile[song5]\"><br>
<b>Song six</b><br>
Artist - <input size=\"25\" name=\"artist6\" value=\"$profile[artist6]\"> Song - <input size=\"25\" name=\"song6\" value=\"$profile[song6]\"><br>
<b>Song seven</b><br>
Artist - <input size=\"25\" name=\"artist7\" value=\"$profile[artist7]\"> Song - <input size=\"25\" name=\"song7\" value=\"$profile[song7]\"><br>
<b>Song eight</b><br>
Artist - <input size=\"25\" name=\"artist8\" value=\"$profile[artist8]\"> Song - <input size=\"25\" name=\"song8\" value=\"$profile[song8]\"><br>
<b>Song nine</b><br>
Artist - <input size=\"25\" name=\"artist9\" value=\"$profile[artist9]\"> Song - <input size=\"25\" name=\"song9\" value=\"$profile[song9]\"><br>
<b>Song ten</b><br>
Artist - <input size=\"25\" name=\"artist10\" value=\"$profile[artist10]\"> Song - <input size=\"25\" name=\"song10\" value=\"$profile[song10]\"><br>
<br /><input type=\"submit\" name=\"update\" value=\"Update\">
</form>
");
}
else
{
$email = htmlspecialchars($_POST[email]);
if (!eregi ('^[A-Za-z0-9\._-]+@([A-Za-z][A-Za-z0-9-]{1,62})(\.[A-Za-z][A-Za-z0-9-]{1,62})+$', stripslashes(trim($email)))){
$problem = TRUE;
}
if (!$problem){
$location = htmlspecialchars($_POST[location]);
$artist1 = htmlspecialchars($_POST[artist1]);
$song1 = htmlspecialchars($_POST[song1]);
$artist2 = htmlspecialchars($_POST[artist2]);
$song2 = htmlspecialchars($_POST[song2]);
$artist3 = htmlspecialchars($_POST[artist3]);
$song3 = htmlspecialchars($_POST[song3]);
$artist4 = htmlspecialchars($_POST[artist4]);
$song4 = htmlspecialchars($_POST[song4]);
$artist5 = htmlspecialchars($_POST[artist5]);
$song5 = htmlspecialchars($_POST[song5]);
$artist6 = htmlspecialchars($_POST[artist6]);
$song6 = htmlspecialchars($_POST[song6]);
$artist7 = htmlspecialchars($_POST[artist4]);
$song7 = htmlspecialchars($_POST[song7]);
$artist8 = htmlspecialchars($_POST[artist8]);
$song8 = htmlspecialchars($_POST[song8]);
$artist9 = htmlspecialchars($_POST[artist9]);
$song9 = htmlspecialchars($_POST[song9]);
$artist10 = htmlspecialchars($_POST[artist10]);
$song10 = htmlspecialchars($_POST[song10]);
if($location=NULL|$email==NULL|$artist1==NULL|$song1==NULL|$artist2==NULL|$son g2==NULL|$artist3==NULL|$song3==NULL|$artist4==NULL|$song4==NULL|$artist5==NUL L|$song5==NULL|$artist6==NULL|$song6==NULL|$artist7==NULL|$song7==NULL|$artist 8==NULL|$song8==NULL|$artist9==NULL|$song9==NULL|$artist10==NULL|$song10==NULL ) {
//checks to make sure no fields were left blank
echo "<font color=\"red\">A field was left blank or you did not enter all your songs.<br /><br />
<a href=\"#\" onClick=\"history.go(-1)\">Click here to go back</a>
</font>
";
}else{
// the above lines get rid of all html.
echo ("Your profile has been updated!");
$update = mysql_query("Update users set email = '$email',
location = '$location', artist1 = '$artist1', song1 = '$song1', artist2 = '$artist2', song2 = '$song2', artist3 = '$artist3', song3 = '$song3', artist4 = '$artist4', song4 = '$song4', artist5 = '$artist5', song5 = '$song5', artist6 = '$artist6', song6 = '$song6', artist7 = '$artist7', song7 = '$song7', artist8 = '$artist8', song8 = '$song8', artist9 = '$artist9', song9 = '$song9', artist10 = '$artist10', song10 = '$song10' where username = '$logged[username]'");
}
}else{
echo 'Invalid Email';
}
}
}else{
// updates the information in the database.
}
?>
</p>
</div>
</div>
<div class="right">
<div class="rt"></div>
<div class="right_articles">
<p><b>Most viewed</b><br />The most viewed tool allows you too find the 30 most viewed profiles on musicinterests!</p>
</div>
<div class="rt"></div>
<div class="right_articles">
<p><b>Links</b><br />
<?php include("links.php"); ?></p>
</div>
<div class="rt"></div>
<div class="right_articles">
<p><?php include("sponsor.php"); ?></p>
</div>
</div>
<div class="footer">
<p><?php include("footer.php"); ?></p>
</div>
</div>
</body>
</html>






