Jump to content

[SOLVED] Quick Code Help


Cetanu

Recommended Posts

The following code is for a profile-editing page and there is something wrong with it. I have no idea where, but there is something wrong. I've searched high and low. I bet it's small and easy to find, but can someone help?

<?php
session_start();
include "db_connect.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=UTF-8" />

<title><?php echo $_SESSION['username']; ?>'s Profile</title> 
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="shortcut icon" href="fav.png">

<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style-ie.css" />
<![endif]-->


</head> 

<body>

<div id="page-wrap">

<div id="inside">

<div id="header">
<img src="button.png" alt="mythscape"/> <br/>
MythScape -v. 1.5-!
</div>

<div style="clear:both;"></div>

<div id="left-sidebar"><?php 
include "home.php";
?>
</div>
<div id="main-content">

<?php

if($_SESSION['id'])
{

echo "<a href=\"home.php\">Home</a><br/>";
echo "<a href=\"logout.php\">Logout</a><br/>";

$sql="SELECT * from `users` WHERE `id`='".$_SESSION['id']."'";
$res=mysql_query($sql);
$row=mysql_fetch_assoc($res);

//-----------------------PRINT FORM-----------------------

if(!$_POST['update'])
{	
       <form method="post" action="profilecp.php">
<br/><strong>Profile Control Panel</strong><br/><br/>

<label for="first">First Name</label>
<input id="first" type="text" name="first" maxlength="32" value="<?php echo $row['first']; ?>">

<label for="email">Email</label>
<input id="email" type="text" name="email" maxlength="255" value="<?php echo $row['email']; ?>">

<label for="about">About</label>
<textarea id="about" cols="40" rows="6" name="about"><?php echo $row['about']; ?></textarea>


<input type="submit" name="update" value="Update">
</form>

//-----------------------UPDATE DATABASE-------------------------
    }
else
{

	$first_name=protect($_POST['first']);
	$about=protect($_POST['about']);
	$email=protect($_POST['email']);

	$sql3 =	"UPDATE `users` SET `first`='$first_name',`email`='$email',`about`='$about' WHERE `id`='".$_SESSION['id']."'";
	$res3 = mysql_query($sql3) or die(mysql_error());
	echo "Your profile has been successfully updated!";

}

}
else {
echo "<script language=\"Javascript\" type=\"text/javascript\">document.location.href='index.php'</script>";
}
?>
        

</div> 
<div style="clear: both;"></div>

<div id="footer">

<p><div id="footer"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/us/"><img class="center" alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-nc-nd/3.0/us/88x31.png" /></a><br /></div></p>

</div></div>

<div style="clear: both;"></div>

</div>

<?php 
include "analytics.php";
?>
</body>
</html> 

  

Link to comment
https://forums.phpfreaks.com/topic/164631-solved-quick-code-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.