Jump to content

Move to new Web host now script dont work


doogie63

Recommended Posts

I move my website to new webhost and now script does not work. Thinking maybe newer version of php. This script is old been using for 10 yrs and has worked on 3 different webhost. It has config.php which the only thing I should have to change is db name, db user, and db password which I did but still does not work.

dont work

 

http://ass.ammotroops.com/view.php?action=view&form=0

http://ass.ammotroops.com/view.php?action=view&form=1

http://ass.ammotroops.com/view.php?action=view&form=2

http://ass.ammotroops.com/view.php?action=view&form=3

http://ass.ammotroops.com/admin.php

 

Somewhat works;

http://ass.ammotroops.com/guestbook1.php?a=A

It suppose to be able to click letter at top to switch users but stays with A's and form does not work. But at least I know config.php is working because it get info from mysql. If I change inside guestbook1.php

$a= "a";  If I change "a" to "b" it will display b's

 

 

config.php:

<?php   
   //enter user info in here
   $dbhost="localhost";
        $dbuser="user";
        $dbpass="password";
        $dbname="database";
   

   //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 = "[url]http://www.ammotroops.com/ass[/url]";
   

   $formpg = "forms.php";
   $view = "view.php";
   $admin = "admin.php";

   $guestbookTitle = "Guest Book";
   $e_mail="[email]ammo@mail.com[/email]";
?>

 

admin.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
<html><head>
<meta http-equiv="expires" content="Thu, 01-Jan-1970 00:00:01 GMT">
<title>AMMO TROOPS ADMIN</title></head><body>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="55%" id="AutoNumber1" height="140">
  <tr>
    <td width="1%" height="19" bgcolor="#3366CC"> </td>
    <td width="55%" height="19" bgcolor="#3366CC"> <font face="Verdana" size="2" color="#FFFFFF"><b>Ammo 
    Troops Admin Area</b></font></td>
    <td width="1%" height="19" bgcolor="#3366CC"> </td>
  </tr>
  <tr>
    <td width="1%" height="104"> </td>
    <td width="55%" height="104"><form method="POST" action="$home/$admin">
ENDH;
echo $pageCode;
if($flag == 1)
   echo "<font color=red size=2>Invalid Login, Please Try again</font>";
$pageCode = <<<ENDH
  <p>Please Login in: <br>
  <input type="password" name="password" size="20">
<input type="hidden" name="login" value="1">   
<input type="submit" value="Login" name="B1">
   
</p>
  </p>
</form></td>
    <td width="1%" height="104"> </td>
  </tr>
  <tr>
    <td width="57%" height="19" colspan="3" bgcolor="#3366CC">
    <p align="center"><font size="2" face="Verdana" color="#FFFFFF">Made for 
    Ammo (<a href="[url]http://www.ammotroops.com/[/url]"><font color=white>www.AmmoTroops.com</font></a>)</font></td>
</tr></table></body></html>
ENDH;
echo $pageCode;

}
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
</td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td width="57%" height="19" colspan="3" bgcolor="#3366CC">
    <p align="center"><font size="2" face="Verdana" color="#FFFFFF">Made for
    Ammo ([url=http://www.AmmoTroops.com]www.AmmoTroops.com[/url])</font></td>
</tr></table></body></html>
ENDH;
   echo $foot;
}

function head($admin){
   $head = <<<ENDH
<html><head>
<title>AMMO TROOPS ADMIN</title></head><body>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="600" id="AutoNumber1" height="140">
  <tr>
    <td width="1%" height="19" bgcolor="#3366CC"> </td>
    <td width="57%" height="19" bgcolor="#3366CC"> <font face="Verdana" size="2" color="#FFFFFF"><b>Ammo 
    Troops Admin Area</b></font></td>
  </tr>
  <tr>
    <td width="58%" height="104" colspan="2">
    <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber2" height="109">
      <tr>
        <td width="22%" height="109" valign=top>
        <table border="1" style="border-collapse: collapse" bordercolor="#111111" width="170" id="AutoNumber3" height="151" cellpadding="0" cellspacing="0">
          <tr>
            <td width="100%" height="19">
            <p dir="ltr"> </td>
          </tr>
          <tr>
            <td width="100%" height="15" bgcolor="#3366CC">
            <p dir="ltr"><b>
            <font face="Times New Roman" size="2" color="#FFFFFF">> VIEW</font></b></td>
          </tr>
          <tr>
            <td width="100%" height="79" bgcolor="#0099FF">
            <ul>
              <li>
              <p dir="ltr"><b><font face="Times New Roman" size="2"><a href="$admin?action=view&form=0">AMMO ASS</a></font></b></li>
              <li>
              <p dir="ltr"><b><font face="Times New Roman" size="2"><a href="$admin?action=view&form=1">AMMO DUMB ASS</a></font></b></li>
              <li>
              <p dir="ltr"><b><font face="Times New Roman" size="2"><a href="$admin?action=view&form=2">AMMO ACE</a></font></b></li>
              <li>
              <p dir="ltr"><b><font face="Times New Roman" size="2"><a href="$admin?action=view&form=3">AMMO BASE</a></font></b></li>
            </ul>
            </td>
          </tr>
          <tr>
            <td width="100%" height="19" bgcolor="#3366CC">
            <p dir="ltr"><b>
            <a href=$admin?action=logout><font face="Times New Roman" size="2" color="#FFFFFF">> LOGOUT</font></a></b></td>
          </tr>
          <tr>
            <td width="100%" height="11" bgcolor="#3366CC">
            <p dir="ltr"><b><a href=$admin?action=chgpass>
            <font face="Times New Roman" size="2" color="#FFFFFF">> CHANGE 
            PASSWORD</font></a></b></td>
          </tr>
          <tr>
            <td width="100%" height="19"> </td>
          </tr>
        </table>
        </td>
        <td width="78%" height="109">
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber4">
          <tr>
            <td>   </td><td width="100%">
ENDH;
   echo $head;
}
?>

 

 

view.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
         <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">Submission Information</font></b></td>
             </tr>
             <tr>
               <td width="373" height="15" bgcolor="#FFFFFF">
               <p align="center"><Font color=green>Thankyou For your submission</font></td>
             </tr>
           </table>
                   <br><p align="center">Click here <a href="[url]http://www.ammotroops.com/[/url]">Ammotroops</a> to go to main page</p>

           </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
   </center>
   </body>
   </html>
ENDH;
   echo $foot;
}

function head($form,$Title,$formpg){
   $head = <<<ENDH
   <html>
   <head>
   <meta http-equiv="Content-Language" content="en-us">
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="Author" content="doogie">
   <meta name="keywords" content="ammo, newgroups, binnews, ammo bowl, iyaayas, doogie, air force, ammo ass award,
   ammo dumb ass, ammo ace, ammo base">
   <title>Ammo Ass [url=http://www.AmmoTroops.com]www.AmmoTroops.com[/url]</title>
   </head>
   
   <body background="[url]http://ass.ammotroops.com/froncoin4.jpg[/url]">
   <center><a href="[url]http://www.ammotroops.com[/url]">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
   <html>
   <head>
   <title>Ammo TRoops</title>
   </head>
   <body background="[url]http://ass.ammotroops.com/froncoin4.jpg[/url]">
      $content
   </body></html>
ENDH;
echo $html;
}

?>

 

guestbook1.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]ammotroops@somewhere.com[/email]>\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]ammotroops@somewhere.com[/email]>\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">
<html>
<head>
<title>Guestbook</title>
</head>
<body background="[url]http://ass.ammotroops.com/froncoin4.jpg[/url]">
<center>
<p style="margin-top: 0; margin-bottom: 0"><font size="+2">
<a href="[url]http://www.ammotroops.com/[/url]">HOME</a></font> <br>
<font size="+2">
<?php
for ($i=0; $i<26; $i++){
      $ch = chr(65+$i);
      echo " <a href=\"guestbook1.php?a=$ch\" target=\"_top\">$ch</a>";
}
?>
</font> </p>
<p style="margin-top: 0; margin-bottom: 0"><b><font size="+3" color="#FF0000">
Welcome to the Locator</font></b> <br>
<b><font size="+3" color="#FF0000"><?=strtoupper($a)?></font></b> </p>
<p style="margin-top: 0; margin-bottom: 0"><br>
<b><a href="guestbook1.php?action=form" target="_top">
<font size="6">Locator Form</font></a></b></p>
</center>
<?php
      $sqlstat = "SELECT * from ammoguest where alpha=\"$a\" order by lname";
      $conn = mysql_connect( $dbhost, $dbuser, $dbpass );
      mysql_select_db($dbname,$conn);   
                $select_info = mysql_query( $sqlstat , $conn );
      while( $theRow = mysql_fetch_row( $select_info )){
?>
         <img SRC="[url]http://ass.ammotroops.com/flagbar.gif[/url]" height="16" width="700"><br>
         NAME: <?=$theRow[2]?>, <?=$theRow[1]?><br>
         RANK: <?=$theRow[3]?><br>
         EMAIL: <a href="mailto:<?=$theRow[4]?>"><?=$theRow[4]?></a><br>
         CURRENT BASE: <?=$theRow[5]?><br>
         DEROS: <?=$theRow[6]?><br>
         SHOP: <?=$theRow[7]?><br>
         AUTOVON#: <?=$theRow[8]?><br>
         PREVIOUS ASSIGNMENTS: <?=preg_replace("[\n\r\f]","<br>\n",$theRow[9])?><br>
         COMMENTS: <?=preg_replace("[\n\r\f]","<br>\n",$theRow[10])?><br>

<?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
<form action=guestbook1.php?action=submit method=post>
<center>
<h1 style="margin-top: 0; margin-bottom: 0">
<a href="[url]http://www.ammotroops.com/[/url]">www.AmmoTroops.com</a></h1>
<h1 style="margin-top: 0; margin-bottom: 0"><font COLOR="#000000">Thanks for 
visiting my site!</font> </h1>
<p style="margin-top: 0; margin-bottom: 0"> </p>
<p style="margin-top: 0; margin-bottom: 0"><b>Guess Book!</b></p>
<p style="margin-top: 0; margin-bottom: 0"></p>
<p style="margin-top: 0; margin-bottom: 0">Just complete this form. Click on 
Submit when ready to send.</p>
<br><br>
<Font size=4 color=red>$msg</font>
</center>
<table id="AutoNumber2" style="BORDER-COLLAPSE: collapse" borderColor="#111111" height="34" cellSpacing="0" cellPadding="0" width="100%" border="0">
  <tr>
    <td width="26%" height="36"><b><font size="4">First Name:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="fname" value="$fname"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">Last Name:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="lname" value="$lname"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">Rank: </font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="rank" value="$rank"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">E-Mail Address:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="email" value="$email"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">Current Base:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="current_base" value="$current_base"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">DEROS:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="deros" value="$deros"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">SHOP:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="shop" value="$shop"></font></b></td>
  </tr>
  <tr>
    <td width="26%" height="36"><b><font size="4">AUTOVON:</font></b></td>
    <td width="74%" height="36"><b><font size="4">
    <input maxLength="50" size="36" name="autovon" value="$autovon"></font></b></td>
  </tr>
</table>
<pre><b><font size="4">PREVIOUS ASSIGNMENTS:</font></b>
<textarea name="previous_ass" rows="5" cols="50">$previous_ass</textarea>
<b><font size="4">COMMENTS:</font></b>
<textarea name="comments" rows="5" cols="50">$comments</textarea>
<input type="submit" value="Send Mail!"><input type="reset" value=" Clear-Form">
</pre>
</form>
ENDH;
return($html);
}


/////////////////////////////////////////////////////////////////////
////////// print content surrounded by background////////////////////
/////////////////////////////////////////////////////////////////////
function printContent($content,$guestbookTitle){
$html = <<<ENDH
   <html>
   <head>
   <title>$guestbookTitle</title>
   </head>
   <body background="[url]http://ammotroops.com/froncoin4.jpg[/url]">
      $content
   </body></html>
ENDH;
echo $html;
}

?>




 

MOD EDIT: PHP Manual [m] . . . [/m] tags changed to

 . . . 

tags.

Link to comment
Share on other sites

Now, on to the problem. The code appears to have been written to rely on a deprecated "feature" of php being on; register_globals. As a result of that directive being off by default now, none of the variables that come from form fields are being populated. You can do this the not-so-great way and turn on register_globals in the php.ini file, or you can assign the values from the post array to the proper variables. There could be other problems, but start with that.

 

It would also be helpful to look at your php error logs and see what errors have been thrown by these scripts.

Link to comment
Share on other sites

error log for admin.php

 

10:44:03] PHP Warning:  mysql_query(): supplied argument is not a valid MySQL-Link resource in /home2/ammotro1/public_html/ass/admin.php on line 220

[09-Feb-2012 10:44:03] PHP Warning:  mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home2/ammotro1/public_html/ass/admin.php on line 221

[09-Feb-2012 10:44:03] PHP Warning:  mysql_close(): supplied argument is not a valid MySQL-Link resource in /home2/ammotro1/public_html/ass/admin.php on line 223

 

Link to comment
Share on other sites

I think the error is talking about this part, What a good book I can start to read to learn more about php? For noob

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;

Link to comment
Share on other sites

In the config.php I have the new database name, user, and password.

Thats why http://ass.ammotroops.com/guestbook1.php?a=A works, its pulls info from config to open db to get info.

 

I think thats what you are talking about?

 

whatever $conn1 holds in your script you gave us doesn't hold a valid resource. Thus the error.

Link to comment
Share on other sites

$conn1 = mysql_connect( $dbhost, $dbuser, $dbpass );

 

which in config.php gives answers. I edit it to post not to give out real user or pass, that i have the right info in config.

 

//enter user info in here

$dbhost="localhost";

        $dbuser="user";

        $dbpass="pass";

        $dbname="doogie_ass";

Link to comment
Share on other sites

Whatever credentials you are using, they aren't correct. You can look in the servers php.ini file for the credentials (although they might not be there). But the user and pass will be what you set them to, if you can't remember them, contact your provider.

Link to comment
Share on other sites

Further to the above - the './config.php' value refers to the current folder of the main script that is running. The 'config.php' value causes php to search the include_path to find the file. Your include_path setting may or may not have a value that causes php to search (first, last, or at all) in the current folder.

 

You can check why the connection is failing by using some error checking logic -

 

 $conn1 = mysql_connect( $dbhost, $dbuser, $dbpass ) or die("Connection failed: " . mysql_error());

 

 

Link to comment
Share on other sites

This is what I got back from Help desk of web host. Now working.

http://ass.ammotroops.com/guestbook1.php?a=A

http://ass.ammotroops.com/view.php?action=view&form=0

 

It looks like your script heavily relies on register_globals being on but it is currently set off by default. I noticed you had a php.ini file in that folder to try and turn them on but you are also using the Single INI version of our php which will only use the public_html/php.ini for all php settings. You would need to make that change in a php.ini file located in the public_html or you would need to set a different PHP type in that folder so that it will check the php.ini in that folder. To change the php type you could add "AddHandler application/x-httpd-php5 .php" into your .htaccess in that folder.

 

I put my php.ini file in public_html and now it works, before I just had it in ass. I dont really understand what they want me to do to:

"AddHandler application/x-httpd-php5 .php" into your .htaccess

would I just add that line just as it reads into my .htaccess?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.