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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sirrusdi
Forum Newbie
Posts: 12
Joined: Thu Nov 14, 2002 7:40 pm
Location: Seattle, WA

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

Post 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
JPlush76
Forum Regular
Posts: 819
Joined: Thu Aug 01, 2002 5:42 pm
Location: Los Angeles, CA
Contact:

Post by JPlush76 »

what doesn't work about it? getting errors? not submitting to the database? not reading the form values?
kitsch
Forum Newbie
Posts: 12
Joined: Mon Nov 11, 2002 3:29 pm

Post 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...
sirrusdi
Forum Newbie
Posts: 12
Joined: Thu Nov 14, 2002 7:40 pm
Location: Seattle, WA

Post by sirrusdi »

Thanks Guys! It works!
Post Reply