espfutbol98
New Member
- Messages
- 200
- Reaction score
- 2
- Points
- 0
I'm trying to update some info from a php page to a MySQL table. I get the error: Parse error: syntax error, unexpected T_ELSE in page.php on line 41. Even if I troubleshoot, there is always another problem and I'm not to good at PHP. So far the variables are:
The php page code is:
PHP:
$username = $_SESSION['user']
$id = $_SESSION['user_id']
$user_email = $_SESSION['user_email']
$country = $_SESSION['country']
PHP:
<?php
session_start();
if (!isset($_SESSION['user']))
{
header("Location: login.php");
}
include ('dbc.php');
if ($_POST['Submit']=='Change')
{
$rsPwd = mysql_query("select user_pwd from users where user_name='$_SESSION[user]'") or die(mysql_error());
list ($oldpwd) = mysql_fetch_row($rsPwd);
if ($oldpwd == md5($_POST['oldpwd']))
{
$newpasswd = md5($_POST['newpwd']);
mysql_query("Update users
SET user_pwd = '$newpasswd'
WHERE user_name = '$_SESSION[user]'
") or die(mysql_error());
header("Location: settings.php?kvar");
} else
{ header("Location: settings.php?uspjeh"); }
}
if ($_POST['Submit']=='Update')
{
$rsPwd = mysql_query("select user_email and user_coutry from users where user_name='$_SESSION[user]'") or die(mysql_error());
list ($oldpwd) = mysql_fetch_row($rsPwd);
if ($newemail == ($_POST['newemail'])) { ($newcountry == ($_POST['newcountry']));
{
mysql_query("Update users
SET user_email = '$newemail' AND country = '$newcountry'
WHERE user_name = '$_SESSION[user]'
") or die(mysql_error());
}
//Line 41 below
else { header("Location: #"); }
}
?>
<html>
<head>
</head>
<body>
<p>
<?php if (isset($_GET['kvar'])) { echo '<div class="msg" style="color: green;">Password Updated</div>'; } ?>
<?php if (isset($_GET['uspjeh'])) { echo '<div class="msg" style="color: red;">Password does not match.</div>'; } ?>
</p>
<h2>Change Password</h2>
<form action="page.php" method="post" name="form3" id="form3">
<p>Old Password
<input name="oldpwd" type="password" id="oldpwd">
</p>
<p>New Password:
<input name="newpwd" type="password" id="newpwd">
</p>
<p>
<input name="Submit" type="submit" id="Submit" value="Change">
</p>
<br />
Current e-mail:<div style="font-weight: bold;"><?php echo $_SESSION['user_email']; ?></div>
<br />
New: <input name="newemail" id="newemail">
<br />
<br />
Current location:<div style="font-weight: bold;"><?php echo $_SESSION['country']; ?></div>
<br />
New: <input name="newcountry" id="newcountry">
<br />
<input name="Submit" type="submit" id="Submit" value="Update">
</form>
</body>
</html>