Here are my php codes for my webpages there are a few. I will start with the registration page, then the RegistrationTemplate that it refers to. Then the Mangage Listings page, then the ManageTemplate it refers to. Then the Add offer page. Then the Search page, and the SearchTemplate page.
register page
<?
require_once("conn.php");
require_once("includes.php");
if(isset($_POST[s1]))
{
$MyExp = mktime(0,0,0,date(m) + 1, date(d), date(Y));
$q1 = "insert into re2_agents set
username = '$_POST[NewUsername]',
AccountType = '$_POST[AccountType]',
password = '$_POST[p1]',
FirstName = '$_POST[FirstName]',
LastName = '$_POST[LastName]',
resume = '$_POST[resume]',
phone = '$_POST[phone]',
cellular = '$_POST[cellular]',
pager = '$_POST[pager]',
ResumeImages = '$ImageStr',
email = '$_POST[email]',
RegDate = '$t',
ExpDate = '$MyExp',
AccountStatus = 'active',
offers = '1' ";
mysql_query($q1);
if(ereg("key 2", mysql_error()))
{
$error = "<font face=verdana size=2 color=red><b>The username <font color=black>$_POST[NewUsername]</font> is already in use!<br>Select another one, please!</b></font>";
unset($_POST[NewUsername]);
}
elseif(ereg("key 3", mysql_error()))
{
$error = "<font face=verdana size=2 color=red><b>You are already registered!<br>Update your account, please!</b></font>";
unset($_POST);
}
else
{
$last = mysql_insert_id();
$_SESSION[NewAgent] = $last;
//send an email
$to = $_POST[email];
$subject = "Your registration at $_SERVER[HTTP_HOST]";
$message = "Hello $_POST[FirstName] $_POST[LastName],\nhere is your login information for $_SERVER[HTTP_HOST]\n\nUsername: $_POST[NewUsername]\nPassword: $_POST[p1]\n\nYou are able to post a free listing. To login, follow this link:\n$site_url/login.php\n\nThank you for your registration!";
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
$headers .= "From: $_SERVER[HTTP_POST] <$aset[ContactEmail]>\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: PHP/" . phpversion()."\n";
mail($to, $subject, $message, $headers);
header("location:login.php");
exit();
}
}
if(!empty($_GET[AccountType]))
{
$AccountType = $_GET[AccountType];
}
else
{
$AccountType = $_POST[AccountType];
}
//get the templates
require_once("templates/HeaderTemplate.php");
require_once("templates/RegistrationTemplate.php");
require_once("templates/FooterTemplate.php");
?>