Another problem I have after moving website to new host. When you goto http://ass.ammotroops.com/guestbook1.php?a=A It works, but suppose to be able to hit a letter at the top to change to different last name. Worked before I moved to new host. If I manual change in php code
$a= “a”; to say $a= “b”;
it will change to everyone with last name start with B
form does not work either when you click it.
[php]<?php
require(’./config.php’);
$fname = stripslashes($fname);
$lname = stripslashes($lname);
$rank = stripslashes($rank);
$email = stripslashes($email);
$current_base = stripslashes($current_base);
$deros = stripslashes($deros);
$shop = stripslashes($shop);
$autovon = stripslashes($autovon);
$previous_ass = stripslashes($previous_ass);
$comments = stripslashes($comments);
if($action == “form”){
printContent(showForm("",$fname,$lname,$rank,$email,$current_base,$deros,$shop,$autovon,$previous_ass,$comments),$guestbookTitle);
}
else if($action == “submit”){
if($fname=="" || $lname=="" || $rank=="" || $email =="" || $current_base == “” || $deros == “” || $shop == “” || $autovon == “” || $previous_ass=="" || $comments == “”){
printContent(showForm(“Please Fill in all Fields”, $fname,$lname,$rank, $email,$current_base,$deros,$shop,$autovon,$previous_ass,$comments),$guestbookTitle);
}
else if(!isValidEmail($email)){
printContent(showForm("You Have Entered An Invalid Email Address", $fname,$lname,$rank,$email,$current_base,$deros,$shop,$autovon,$previous_ass,$comments),$guestbookTitle);
}
else if(isDuplicatedName($fname,$lname,$dbhost,$dbname,$dbuser,$dbpass)){
//printContent("duplicated",$guestbookTitle);
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$fname = addslashes($fname);
$lname = addslashes($lname);
$rank = addslashes($rank);
$email = addslashes($email);
$current_base = addslashes($current_base);
$deros = addslashes($deros);
$shop = addslashes($shop);
$autovon = addslashes($autovon);
$previous_ass = addslashes($previous_ass);
$comments = addslashes($comments);
$sqlInsert = "INSERT INTO ammoupdate VALUES ('', '$fname', '$lname', '$rank', '$email', '$current_base', '$deros', '$shop', '$autovon', '$previous_ass', '$comments', '');";
mysql_query($sqlInsert);
$id = mysql_insert_id();
mysql_close ($conn);
$to = "AMMOTROOP <$e_mail>";
$subject = "GUESTBOOK - USER UPDATED INFO - AMMOTROOPS";
$message = <<<ENDH
<html>
<head><title>USER UPDATED THEIR INFO</title></head>
<body>
<p><u><b>USER <font color=green>"$fname $lname"</font> HAS UPDATED THEIR INFO<br>
<br>
</b></u>Go to address below to view and validated this users info.<br>
----------------------------------------------------------
<br><br>
<a href="$home/guestbookupdate1.php?action=view&item=$id">$home/guestbookupdate1.php?action=view&item=$id</a>
</p>
</body></html>
ENDH;
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: AMMOTROOPS WEBSITE <[email protected]>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
$msg = <<<ENDH
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="373" height="30">
<tr>
<td width="373" height="11" bgcolor="#0000FF">
<p align="center"><b><font color="#FFFFFF">Updating Information</font></b></td>
</tr>
<tr>
<td width="373" height="15" bgcolor="#FFFFFF">
<p align="center"> Thankyou for registrering. Your information has been sent for confirmation.</p></td>
</tr>
</table>
<br><p align="center">Click <a href=http://www.ammotroops.com/>here</a> to return to main page.</p>
</center>
</div>
ENDH;
printContent($msg, $guestbookTitle);
}
else{
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$fname = addslashes($fname);
$lname = addslashes($lname);
$rank = addslashes($rank);
$email = addslashes($email);
$current_base = addslashes($current_base);
$deros = addslashes($deros);
$shop = addslashes($shop);
$autovon = addslashes($autovon);
$previous_ass = addslashes($previous_ass);
$comments = addslashes($comments);
$sqlInsert = "INSERT INTO ammoupdate VALUES ('', '$fname', '$lname', '$rank', '$email', '$current_base', '$deros', '$shop', '$autovon', '$previous_ass', '$comments', '');";
mysql_query($sqlInsert);
$id = mysql_insert_id();
mysql_close ($conn);
$to = "AMMOTROOP <$e_mail>";
$subject = "GUESTBOOK - NEW USER - AMMOTROOPS";
$message = <<<ENDH
<html>
<head><title>USER ADDED THEIR INFO</title></head>
<body>
<p><u><b>USER <font color=green>"$fname $lname"</font> HAS ADDED THEIR INFO<br>
<br>
</b></u>Go to address below to view and validated this users info.<br>
----------------------------------------------------------
<br><br>
<a href="$home/guestbookupdate1.php?action=view&item=$id&type=new">$home/guestbookupdate1.php?action=view&item=$id&type=new</a>
</p>
</body></html>
ENDH;
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "From: AMMOTROOPS WEBSITE <[email protected]>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
$msg = <<<ENDH
<div align="center">
<center>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="373" height="30">
<tr>
<td width="373" height="11" bgcolor="#0000FF">
<p align="center"><b><font color="#FFFFFF">Registration Successfull</font></b></td>
</tr>
<tr>
<td width="373" height="15" bgcolor="#FFFFFF">
<p align="center"> Thankyou for registrering. Your name has been
added to the $guestbookTitle.</td>
</tr>
</table>
<br><p align="center">Click <a href=http://www.ammotroops.com/>here</a> to return to main page.</p>
</center>
</div>
ENDH;
printContent($msg, $guestbookTitle);
}
}
else {
if($a=="" || ord($a) >90 || ord($a) < 65 )
$a= “a”;
$a = strtolower($a);
?>
<!doctype html public “-//w3c//dtd html 4.0 transitional//en”>
HOME
<?php
for ($i=0; $i<26; $i++){
$ch = chr(65+$i);
echo " $ch";
}
?>
Welcome to the Locator
<?=strtoupper($a)?>
NAME: <?=$theRow[2]?>, <?=$theRow[1]?>
RANK: <?=$theRow[3]?>
EMAIL: <?=$theRow[4]?>
CURRENT BASE: <?=$theRow[5]?>
DEROS: <?=$theRow[6]?>
SHOP: <?=$theRow[7]?>
AUTOVON#: <?=$theRow[8]?>
PREVIOUS ASSIGNMENTS: <?=preg_replace("[\n\r\f]","
\n",$theRow[9])?>
COMMENTS: <?=preg_replace("[\n\r\f]","
\n",$theRow[10])?>
<?php } mysql_close ($conn); } ///////////////////////////////////////////////////////////////////// ////////////// check duplicated name //////////////////////////////// ///////////////////////////////////////////////////////////////////// function isDuplicatedName($fname,$lname,$dbhost,$dbname,$dbuser,$dbpass){ $conn = mysql_connect( $dbhost, $dbuser, $dbpass ); mysql_select_db($dbname,$conn); $sql = "select * from ammoguest where fname='$fname' and lname='$lname'"; $num_rows = mysql_num_rows(mysql_query($sql)); //echo $sql; if($num_rows > 0) return true; else return false; mysql_close ($conn); } ///////////////////////////////////////////////////////////////////// ////////////// Validate Email Address /////////////////////////////// ///////////////////////////////////////////////////////////////////// function isValidEmail($email){ if( strstr($email,'@') ) { return true; } else{ return false; } } ///////////////////////////////////////////////////////////////////// // SHOW FORM WITH MSG//////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////// function showForm($msg, $fname,$lname,$rank, $email,$current_base,$deros,$shop,$autovon,$previous_ass,$comments){ $html = <<<ENDH
www.AmmoTroops.com
Thanks for visiting my site!
Guess Book!
Just complete this form. Click on Submit when ready to send.
$msg
First Name: | |
Last Name: | |
Rank: | |
E-Mail Address: | |
Current Base: | |
DEROS: | |
SHOP: | |
AUTOVON: |
PREVIOUS ASSIGNMENTS: $previous_ass COMMENTS: $commentsENDH; return($html); } ///////////////////////////////////////////////////////////////////// ////////// print content surrounded by background//////////////////// ///////////////////////////////////////////////////////////////////// function printContent($content,$guestbookTitle){ $html = <<<ENDH $guestbookTitle $content ENDH; echo $html; } ?>
[/php]