the comments cover what I know so far or am stuck on
Thank you very much
Code: Select all
<?php
function addmember($db,$un,$pw)
{
//encrypt password and insert
$e_pw = md5(trim($pw));
$query = "INSERT INTO 'members' SET password,
='{$e_pw}', username = '{$un}'";
$db->query($query);
unset($query);
}
?>
<?php
//process the new user form request
//for a social network site, records username
//encrypted password, email, birthday, home,
//wondering if someone could help me with email confirmation
//and why this script keeps getting caught at email.php
//the names of the location's arn't actual scripts just for testing
require_once('db.class.php');
require_once('add_member.php');
//establish db connection
$db = new db('db name','localhost','name','password');
//set form to variables
$name=$_POST['Username'];
$password=$_POST['Password1'];
$email=$_POST['Email Address'];
$bday = $_POST['Birthday'];
$home=$_POST['Most Frequently In'];
//passowrds didn't match
if($password!=$_POST['Password2'])
header('Location: cpw.php');
//email accounts didn't match
if($email!=$_POST['Confirm Email Address'])
header('Location: cemail.php');
//query to see if username exists
$query = "SELECT * FROM members WHERE email='{$email}'";
$result = $db->query($query);
$row=$db->numRows($result);
// email exists
if($row!=0)
header('Location: email.php');
else
{
addmember($db,$name,$password);
require_once('_Header.php');
$output .= "Congrats on registering!<br />";
//include('confirmation_email.php');
//write function to send - test for email/sending failure
$output .= "An email has been sent to you.";
require_once('_Footer.php');
}
?>