I moved to new webhost and now my php script does not work. The only thing I should of had to change was config.php with new database name and user login info. Which is all i changed.
Config file:
[php]<?php
//enter user info in here
$dbhost=“localhost”;
$dbuser=“doogie63”;
$dbpass=“password”;
$dbname=“dbname”;
//enter the max per page default value
$default_max=20;
//here are your different categories.
//Please do _NOT_ add to this list
$ASS = array ( "ammoass", "ammodumbass", "ammoace", "ammobase" );
$Title = array ( "AMMO ASS", "AMMO DUMB ASS", "AMMO ACE", "AMMO BASE" );
//home URL (no trailing slash)
$home = "http://www.mywebsite.com/ass";
$formpg = "forms.php";
$view = "view.php";
$admin = "admin.php";
$guestbookTitle = "Guest Book";
$e_mail="[email protected]";
?>[/php]
My admin.php :[php]<?php
require(‘config.php’);
$status=0;
if(isset($passwd)) $status=1;
if($action==“logout”){
setcookie(“passwd”, “”, time()-3600);
header(“Location: $home/$admin?action=login”);
}
elseif($action==“login”){
loginPage($home,$admin,$login);
}
elseif(passwd($password,$passwd, $dbhost, $dbuser, $dbpass, $dbname,$status) == true ){
if($status==0){
setcookie(“passwd”, md5($password));
}
if($action=="view"){
$num_cat = count($ASS);
if($form >= $num_cat || $form < 0 || $form=="" ){
head($admin);
echo " There is No Such Section";
foot();
exit;
}
head($admin);
$table_db = $ASS[$form];
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$sql_select_query = "SELECT * FROM $table_db ORDER BY date DESC";
$select_info = mysql_query( $sql_select_query , $conn );
echo "<table BORDER=\"1\" COLS=\"2\" WIDTH=\"577\">";
$count=0;
while( $theRow = mysql_fetch_row( $select_info )){
echo "<tr><td align=center width=\"200\" height=\"1\">$theRow[7]</td>";
echo "<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>";
echo "<tr><td height=100%><center>";
if($theRow[8] == 0)
echo "<font color=red>NEW</font>";
echo " <a href=$admin?action=edit&form=$form&num=$theRow[6]>EDIT</a></center></td></tr>";
echo "</tr><tr><td width=\"555\" height=\"1\" colspan=\"3\" bgcolor=\"#E2E1D1\"> </td></tr>";
$count = $count+1;
}
echo "</table>";
mysql_close ($conn);
foot();
}
elseif($action=="edit"){
if($form=="" || $num==""){
header("LOCATION: $home/$admin");
exit;
}
head($admin);
$table_db = $ASS[$form];
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$sql_select_query = "SELECT * FROM $table_db WHERE id=$num";
$select_info = mysql_query( $sql_select_query , $conn );
$theRow = mysql_fetch_row( $select_info);
echo "<form method=\"POST\" action=\"$admin?action=finaledit\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"100%\" height=\"1\" id=\"AutoNumber1\">";
echo "<tr><td width=\"131\" height=\"1\" align=\"right\"><b><font size=\"2\">NAME:</font></b></td><td width=\"8\" height=\"1\" align=\"right\"></td><td width=\"667\" height=\"1\">";
echo "<input type=\"text\" name=\"name\" value=\"$theRow[0]\" size=\"20\">";
echo "</td></tr><tr><td width=\"131\" height=\"1\" align=\"right\"><b><font size=\"2\">EMAIL:</font></b></td><td width=\"8\" height=\"1\" align=\"right\"></td><td width=\"667\" height=\"1\">";
echo "<input type=\"text\" name=\"email\" value=\"$theRow[1]\"size=\"20\">";
echo "</td></tr><tr><td width=\"131\" height=\"26\" align=\"right\"><b><font size=\"2\">ASS NAME:</font></b></td><td width=\"8\" height=\"26\" align=\"right\"> </td><td width=\"667\" height=\"26\">";
echo "<input type=\"text\" name=\"assname\" value=\"$theRow[2]\" size=\"20\">";
echo "</td></tr><tr><td width=\"131\" height=\"1\" align=\"right\"><b><font size=\"2\">ASS LOCATION:</font></b></td><td width=\"8\" height=\"1\" align=\"right\"></td><td width=\"667\" height=\"1\">";
echo "<input type=\"text\" name=\"asslocation\" size=\"20\" value=\"$theRow[3]\">";
echo "</td></tr><tr><td width=\"131\" height=\"148\" valign=\"top\"><p align=\"right\"><br><b><font size=\"2\">WHY:</font></b></td><td width=\"8\" height=\"148\"><b><font size=\"2\"> </font></b></td><td width=\"667\" height=\"148\"><b><font size=\"2\">";
echo "<textarea rows=\"6\" name=\"asscontent\" cols=\"40\">$theRow[4]</textarea>";
echo "<br><BR><b>PUBLISH:</b> YES<input type=\"radio\" value=\"Y\" name=\"publish\"> NO<input type=\"radio\" value=\"N\" checked name=\"publish\">";
echo "<input type=hidden name=num value=$num><input type=hidden name=form value=$form><br><br><b>DATE: </b> <input type=text name=date value=\"$theRow[7]\" >";
echo "</font></b></td> </tr><tr><td width=\"131\" height=\"53\"> </td><td width=\"8\" height=\"53\"> </td><td width=\"667\" height=\"53\"><input type=\"submit\" value=\"Submit\" name=\"B1\"></td></tr></table></form><table><tr><td width=95> </td><td><form method=post action=$admin?action=delete><input type=hidden name=form value=$form><input type=hidden name=num value=$num><input type=submit value=Delete name=delete></form></td></tr></table>";
mysql_close ($conn);
foot();
}
elseif($action=="finaledit"){
head($admin);
$table_db = $ASS[$form];
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$sql_select_query = "UPDATE $table_db SET name='$name', email='$email', assname='$assname', asslocation='$asslocation', asscontent='$asscontent', publish='$publish', date='$date', num='1' WHERE id=$num";
$select_info = mysql_query( $sql_select_query , $conn );
mysql_close ($conn);
echo "UPDATED FIELD";
foot();
}
elseif($action=="chgpass"){
if($chng == 1 && $pass1 == $pass2 && $pass1 != ""){
ChangePass($pass1, $dbhost, $dbuser,$dbpass,$dbname);
head($admin);
echo "<center><font color=red size=2>Password Has been Set</font></center>";
foot();
exit;
}
head($admin);
if($chng == 1){
echo "<font color=red size=2> Make Sure Passwords in both fields are the same </font>";
}
echo "<div align=\"left\"><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"482\" height=\"166\">";
echo "<tr><td width=\"482\" height=\"25\"><u><b>Change Password</b></u></td></tr><tr><td width=\"482\" height=\"141\">";
echo "<form method=\"POST\" action=\"$admin?action=chgpass\">";
echo "New Password: <input type=\"password\" name=\"pass1\" size=\"20\"><br>";
echo "New Password again: <input type=\"password\" name=\"pass2\" size=\"20\"><br>";
echo "<input type=hidden name=chng value=1><input type=\"submit\" value=\"Submit\" name=\"B1\"></form></td></tr></table></div>";
foot();
}
elseif($action=="delete"){
if($form=="" || $num==""){
header("Location: $home/$admin");
}
head($admin);
$table_db = $ASS[$form];
$conn = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn);
$sql_select_query = "DELETE FROM $table_db where id=$num";
$select_info = mysql_query( $sql_select_query , $conn );
mysql_close ($conn);
echo "ENTRY DELETED";
foot();
}
else{
head($admin);
echo " You Are Logged In";
foot();
}
}
else{
header(“LOCATION: $home/$admin?action=login”);
}
function loginPage($home, $admin,$flag){
$pageCode = <<<ENDH
Ammo Troops Admin Area | ||
ENDH;
echo $pageCode;
if($flag == 1)
echo "Invalid Login, Please Try again";
$pageCode = <<<ENDH
Please Login in: |
||
Made for Ammo (www.mywebsite.com) |
}
function ChangePass($password, $dbhost, $dbuser, $dbpass, $dbname){
$conn1 = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn1);
$givenPass = md5($password);
$sql_select_query = "UPDATE ammopass SET password='$givenPass' WHERE id=1";
$select_info = mysql_query( $sql_select_query , $conn1 );
setcookie("passwd", md5($password));
mysql_close ($conn1);
}
function passwd($password, $passwd,$dbhost, $dbuser, $dbpass, $dbname, $status){
$conn1 = mysql_connect( $dbhost, $dbuser, $dbpass );
mysql_select_db($dbname,$conn1);
if($status == 0)
$givenPass = md5($password);
else
$givenPass = $passwd;
$sql_select_query = "SELECT * FROM ammopass";
$select_info = mysql_query( $sql_select_query , $conn1 );
$theRow = mysql_fetch_row( $select_info );
$currentPass = $theRow[0];
mysql_close($conn1);
if ($currentPass==$givenPass)
return true;
else
return false;
}
function isValidEmail($email){
if( strstr($email,’@’) ) {
return true;
}
else{
return false;
}
}
function foot(){
$foot = <<<ENDH
Made for Ammo (www.mywebsite.com)
function head($admin){
$head = <<<ENDH
Ammo Troops Admin Area | ||||||||||
|