Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>xxxxxx</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<style TYPE="text/css">
font { font-family: Arial, Helvetica, sans-serif; font-size: 12px}
body { font-family: Arial, Helvetica, sans-serif }
table { font-family: Arial, Helvetica, sans-serif }
td { font-family: Arial, Helvetica, sans-serif; font-size: 12px}
p { font-family: Arial, Helvetica, sans-serif }
a:link {color:blue;}
a:visited {color:black;}
a:active {color:black;}
a:hover {color:black;background:#94d6e7;}
</style>
<body>
<?php
//$sql = "INSERT INTO players VALUES('$namefirst', '$namelast', '$work', '$home', '$cell', '$email' ,'$comments', '$datechg') ";
$sql = "INSERT INTO players ( namefirst, namelast, work, home, cell, email, jpg, comments, datechg ) values ('$namefirst', '$namelast', '$work', '$home', '$cell', '$email' , '$jpg', '$comments', '$datechg') ";
// $sql = "INSERT INTO players ( namefirst, namelast, work, home, cell, email, comments ) values ('$namefirst', '$namelast', '$work', '$home', '$cell', '$email' ,'$comments' ";
$username = "xxxxx";
$password = "xxxxxx";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
mysql_select_db ("biwrfcco_directory");
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
$me = $_SERVER['PHP_SELF'];
?>
<center>
<font face=arial>
<br><br><bR><br>
<table width="80%">
<tr><td><font face=arial size=2>
Purpose of this page is to allow you the internal Wolfhounds people to update or add your contact details to the 411 directory.
What you enter wont appear pretty at first as there is some backend admin to do, but it will get better.
<br><br> A new feature will be to add a small business card listing in the comments section.
<br>This is version 1, so if you have services you want to offer the rest of the club ie 'frog catcher' then make it known here.<br><br>
If you are not on the 411 list then use this tool to get there.<br><br>
</td></tr>
</table>
<form name="form1" method="post" action="<?=$me?>">
<center>
<table>
<tr>
<td><font face=arial size=2>First Name </td><td><input type="text" name="namefirst" size=20 maxlength=30> <font size=-1 color=red>* required</td></tr>
<tr>
<td><font face=arial size=2>Last Name </td><td><input type="text" name="namelast" size=20 maxlength=30><font size=-1 color=red>* required</td></tr>
<tr>
<td><font face=arial size=2>Work</td><td><input type="text" name="work" size=20 maxlength=15></td></tr>
<tr>
<td><font face=arial size=2>Home</td><td><input type="text" name="home" size=15></td></tr>
<tr>
<td><font face=arial size=2>Cell</td><td><input type="text" name="cell" size=15></td></tr>
<tr>
<td><font face=arial size=2>eMail </td><td><input type="text" name="email" size=20 maxlength=40> <font size=-1 color=red>* required</td></tr>
<tr>
<td><font face=arial size=2>Comments<br>
<font size=1> for example: building services offered </td><td><input type="text" name="comments" size=85 maxlength=85></td></tr>
<tr><td><br><br><br> <input type="SUBMIT" value="Add your details"></td><td></td></tr></table>
<?php
} else {
error_reporting(0);
// initialize a array to
//hold any errors we encounter
$errors = array();
//$datechg = curdate();
//$datechg = $_POST['date'];
$datechg = date("Y-m-d");
$jpg = "aaa.jpg";
// test to see if the form was actually
// posted from our form
// In testing, if you get an Inavlid referer error
// comment out or remove the next three lines
$page = $_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
if (!ereg($page, $_SERVER['HTTP_REFERER']))
$errors[] = "Invalid referer";
// check to see if a name and valid email was entered
if (!$_POST['namefirst'])
$errors[] = "Error-Msg(203) Your first name is required";
if (!$_POST['namelast'])
$errors[] = "Error-Msg(204) Your last name is required";
if (!$_POST['email'])
$errors[] = "Error-Msg(205) No Email Address detected - required";
// if there are any errors, display them
if (count($errors)>0) {
foreach($errors as $err)
echo "<center><br>$err<br>\n";
echo "<br>Please use your browser's Back button to fix.";
} else {
// no errors, so we build our message
// above is validation stuff
// following is code to update 411 file
//
// validate entries
$sql_result = mysql_query($sql, $dbh) or die ("zero-connection to Player info file");
if (!sql_result) {
echo "<p> Could not add record to file";
}
else
{
echo "
<p>Your Contact Details have been added.</p>
<p>Wolfhounds 411 is not visible to the public so your details are reasonably secure.</P>
<center>
$datechg
<table border=1 cellpadding=10 width=500>
<tr><td width=20%><font face=arial><b> Name</td><td width=80%> <font face=arial>$namefirst $namelast <hr size=1></td></tr>
<tr><td><font face=arial><b>Home #</td><td><font face=arial>$home</td></tr>
<tr><td><font face=arial><b>Work #</td><td><font face=arial>$work</td></tr>
<tr><td><font face=arial><b>Cell #</td><td><font face=arial>$cell</td></tr>
<tr><td><font face=arial><b>Email</td><td><font face=arial>$email</td></tr>
<tr><td><font face=arial><b>Comments</td><td><font face=arial>$comments</td></tr>
</table><br><br>
<a href='./test_update.php'>Back</a>";
}
}
}
?>
</body>
</html>