Page 1 of 1

Please Help! Site Going live in 2 days....

Posted: Fri Dec 13, 2002 5:52 pm
by sirrusdi
I need help fast! The site is going live in two days and i have a big problem. I have built a log-in script that works but i want to allow the user to change their password and email address. Below is the code but it doen't work.

Code: Select all

<?php

include 'db.php';
session_start();

$first_name = $_SESSION&#1111;'first_name'];
$last_name = $_SESSION&#1111;'last_name'];

// Current Settings
$query = "SELECT first_name, last_name, email_address, username, password, last_login FROM users WHERE first_name = '$first_name'";
$result = mysql_query($query);
$query_data = mysql_fetch_array($result);


$password = $query_data&#1111;"password"];
$email = $query_data&#1111;"email_address"];

if ($submit) &#123;
// Updated Settings
$new_password = $_POST&#1111;'new_password'];
$new_email = $_POST&#1111;'new_email'];

if($new_passowrd) &#123;
mysql_query("UPDATE users SET password='$new_password' WHERE first_name='$first_name'");
echo "<center><font color='red'>Password Updated.</font></center>";
setcookie("EwaldGroup_Password", $password, time()-9999);
&#125;

if($new_email) &#123;
mysql_query("UPDATE users SET email_address='$new_email' WHERE first_name='$first_name'");
echo "<center><font color='red'>Email Address Updated.</font></center>";
&#125;
&#125;
?>
Thanks for your help!
-Michael Ewald

Posted: Fri Dec 13, 2002 6:11 pm
by JPlush76
what doesn't work about it? getting errors? not submitting to the database? not reading the form values?

Posted: Fri Dec 13, 2002 6:13 pm
by kitsch
We all have big problems. :)

At the beginning of your script insert these:

Code: Select all

$submit = $_POST&#1111;'submit'];
$new_password = $_POST&#1111;'new_password'];
$new_email = $_POST&#1111;'new_email'];
And whatever else is coming from your form. I hope you receive it by the post method...

You also have a typo here:

Code: Select all

if($new_passowrd) &#123;
I think you meant new_password...

Posted: Fri Dec 13, 2002 9:15 pm
by sirrusdi
Thanks Guys! It works!