Could it be because different verison of php? New site has php 5 not sure what other site has its down now and so is webhost which is why I had to move site. Have other post with my config.php. When i moved to new site created same folder name and put all file in folder. Only thing I should have had to change was config.php with new db name, db user, db password which i did. What else could be causing not to work? I have use same script for 10 yrs on 3 different webhost. only thing i can think of is old php.
http://ass.ammotroops.com/view.php?action=view&form=1
last part can be 0-3 but none works.
[php]<?php
require(’./config.php’);
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
if($action=="post"){
if ($assname=="" || $asslocation=="" || $asscontent=="" || $name=="" || $email=="" || !isValidEmail($email)){
$msg1 = <<<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">Invalid Info</font></b></td>
</tr>
<tr>
<td width="373" height="15" bgcolor="#FFFFFF">
<p align="center"><Font color=red>You have entered invalid information</font></td>
</tr>
</table>
<br><p align="center">Press the back button to correct your information</p>
</center>
</div>
ENDH;
printContent($msg1);
}
else {
$table_db = $ASS[$form];
$d = getdate (time());
$myDate= $d[“year”]."-".$d[“mon”]."-".$d[“mday”];
$sql_query = “INSERT INTO $table_db (name, email, assname, asslocation, asscontent, publish, id, date) VALUES (’$name’, ‘$email’, ‘$assname’, ‘$asslocation’, ‘$asscontent’, ‘N’, ‘’, ‘$myDate’)”;
$gholi= mysql_query( $sql_query , $conn );
$msg1 = <<<ENDH
Submission Information |
Thankyou For your submission |
Click here Ammotroops to go to main page
</center>
</div>
ENDH;
printContent($msg1);
}
}
else if($action==“view”){
if($start=="" || $start < 0){
$start=0;
}
$max=$default_max;
if(($start % $max) != 0){
header("Location:$home/$view?action=view&start=0&form=$form");
}
if($pg==""){
$pg=1;
}
$num_cat = count($ASS);
if($form >= $num_cat || $form < 0 || $form=="" ){
header ("Location: $home");
exit;
}
$table_db = $ASS[$form];
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM $table_db where publish=\"Y\""));
$remainder = ($num_rows % $max);
if(($start+$max) > ($num_rows + ($max - $remainder))){
$start=0;
$max = $default_max;
}
head($form,$Title,$formpg);
$sql_select_query = "SELECT * FROM $table_db WHERE publish=\"Y\" ORDER BY date DESC LIMIT $start,$max";
//echo $sql_select_query;
$select_info = mysql_query( $sql_select_query , $conn );
while( $theRow = mysql_fetch_row( $select_info )){
echo "<tr><td align=center width=\"200\" height=\"1\">$theRow[7]</td><td width=\"371\" height=\"24\" rowspan=\"4\">$theRow[4]</td></tr>";
echo "<tr><td align=center width=\"200\" height=\"1\">$theRow[2]</td></tr>";
echo "<tr><td align=center width=\"200\" height=\"1\">$theRow[3]</td></tr><tr><td height=100%> </td></tr>";
echo "</tr><tr><td width=\"555\" height=\"1\" colspan=\"2\" bgcolor=\"#E2E1D1\"> </td></tr>";
}
echo "</table></div>";
$num_rows = mysql_num_rows(mysql_query("SELECT * FROM $table_db where publish=\"Y\""));
echo "Page: ";
$remainder = ($num_rows % $max);
$num_pg = (int)($num_rows / $max);
if($remainder > 0) $num_pg = $num_pg+1;
for ($i=0; $i< $num_pg; $i++) {
$startVal = $i * $max;
$page = $i+1;
echo "\n<a href=$view?action=view&start=$startVal&max=$max&form=$form>$page</a> ";
}
mysql_close ($conn);
foot();
}
function isValidEmail($email){
if( strstr($email,’@’) ) {
return true;
}
else{
return false;
}
}
function foot(){
$foot = <<<ENDH
ENDH;
echo $foot;
}
function head($form,$Title,$formpg){
$head = <<<ENDH
Ammo Ass www.AmmoTroops.com
<body background="http://ass.ammotroops.com/froncoin4.jpg">
<center><a href="http://www.ammotroops.com">www.AmmoTroops.com</a>
<div width="600">
<table align=center><tr><td align=center><b><font color="#FF0000"><font size="+3">$Title[$form] AWARD</font></font></b></td></tr>
<tr><td align=center><a href=$formpg?form=$form>$Title[$form] Form</a></td></tr><tr><td> <br><br></td></tr></table>
<table BORDER="1" COLS="2" WIDTH="577">
<tr>
<td width="131" height="19" bgcolor="#E2E1D1"><center>
<p><b>Date</b></p>
</center></td>
<td width="424" height="31" bgcolor="#E2E1D1" rowspan="3" valign="middle">
<p align="center"><b>Why</b></td>
</tr>
<tr>
<td width="134" height="12" bgcolor="#E2E1D1">
<p align="center"><b>Name</b></td>
</tr>
<tr>
<td width="134" height="1" bgcolor="#E2E1D1">
<p align="center"><b>Location</b></td>
</tr>
ENDH;
echo $head;
}
function printContent($content){
$html = <<<ENDH
Ammo TRoops
$content
ENDH;
echo $html;
}
?>[/php]