Jump to content

Application Script wont work becuase I am recceving an Undefined Variable


topflight

Recommended Posts

Hello I am creating my registreation page and if the member select a certain group that will get an ID number plus 1 (i.e Group A = 1000 if a new member were to join it their ID would be 1001 and if another member join their id would be 1002.) Each group has their own A= 1000 B= 2000 C= 3000 4= 4000. But for some reason they are not going up. And I think the reason it is not working because I keep getting an undefined variable login on line 64,71,82 Here is my code:

 

 

64:

            $update = mysql_query("INSERT INTO `pilots` (login,pwd,fname,lname,email,hub,thours,thoursc,rating,vatsimid,date,ip,status,hm,ed,bm,active

 

71:

pending ID of ($login)

 

82:

Is an email with the login information

 

This is my code:

 

 

<?php
include 'db.php';
$error = '';
session_start();
if(isset($_SESSION['LOGGEDIN'])==TRUE){
echo'You are already a member ';}

if(isset($_POST['apply']))
{
   if (!$_POST['fname']){ $error .='No First name<br>'; }
   if (!$_POST['lname']){ $error .='No Last  name<br>'; }
   if (!$_POST['email']){ $error .='No Email Address<br>'; }
   if (!$_POST['vatsimid']){ $error .='No VATSIM ID<br>'; }
   if (!$_POST['hub']){ $error .='No Hub<br>'; }
   if (!$_POST['pwd']){ $error .='No Password<br>'; }
   if (!$_POST['pwdc']){ $error .='No Password Conformation<br>'; }
   if (!$_POST['emailc']){ $error .='No Conformation Email Address<br>'; }
   if ($_POST['thours']){ if (!$_POST['thoursc']){ $error .='No comments<br>'; }}
   if ($_POST['email'] != $_POST['emailc']){ $error .='Email mismatch'; }
   if ($_POST['pwd'] != $_POST['pwdc']){ $error .='Password mismatch'; }

   if (!empty($error))
   { 
      echo $error;?> <FORM><INPUT TYPE="BUTTON" VALUE="Fix Errors" ONCLICK="history.go(-1)"></FORM> <?php 
   } 
   else 
   {
      $fpwd= $_POST['pwd'];
      $pwd = md5($fpwd);
      $fname = $_POST['fname'];
      $lname = $_POST['lname'];
      $email = $_POST['email'];
      $pilotl= mysql_query("SELECT * FROM `pilots` WHERE hub='$_POST[hub]' ORDER BY login DESC LIMIT 1") or die(mysql_error());

      $plrows = mysql_num_rows($pilotl);
      if ($plrows=="0")
      { 
         if ($_POST['hub']=="KPDX")
         { 
            $login = "1000"; 
         }
         if ($_POST['hub']=="KLAX")
         { 
            $login = "2000"; 
         }
         if ($_POST['hub']=="PANC")
         { 
            $login = "3000"; 
         }
         if ($_POST['hub']=="KSEA")
         { 
            $login = "4000"; 
         }
      } 
      else 
      {
         if(empty($error))
         {

            while($plr = mysql_fetch_array($pilotl))
            { 
               $login = $plr[login]; 
            } 
            
            $login = $login + 1;  

            $update = mysql_query("INSERT INTO `pilots` (login,pwd,fname,lname,email,hub,thours,thoursc,rating,vatsimid,date,ip,status,hm,ed,bm,active) VALUES ('$login','$pwd','$_POST[fname]','$_POST[lname]','$_POST[email]','$_POST[hub]','$_POST[thours]','$_POST[thoursc]','First Officer','$_POST[vatsimid]','$now','$ip','0','0','0',0,0)") or die(mysql_error());

            $jto = "``````````";
            $jsubject = "A new pilot has signed up";
            $jjmessae = "
            A new pilot ($fname $laname) with the pending ID of ($login) has submitted an Applications with Simulated Alaska. Please activate their test. ";
            $from = "[email protected]";
            $jheaders = "From: $from";

            mail($jto, $jsubject, $jmessage, $jheaders);

            $jto = "email";
            $jsubject = "A new pilot has signed up";
            $jjmessae = "
            A new pilot ($fname $laname) with the pending ID of ($login) has submitted an Applications with --------. Please activate their test. ";
            $from = "email";
            $jheaders = "From: $from";

            mail($jto, $jsubject, $jmessage, $jheaders);

            $to = "$email";
            $subject = "RE:------ Application ($fname $lname)";
            $messae = "
      Dear ($fname $lname),

      We have reccevied your application for membership with -----. You will reccevie another email within 24-48 hours regarding your entry exam. It is really importaint that you complete this exam ASAP. In order to have a membership account with Simulated Alaska you MUST pass this exam with an 80%. So in the meantime please look at the SOP's, explore the site, and study basic aircraft Maneuvers. The exam will cover(Simulated Alaska Operations, Basic Aircraft Maneuvers, and Basic Flying Skills. Once you have pass this test you will then recceive another email saying you have been accepted.




      Sincerly,
      --------
      ";

            $from = "email";
            $headers = "From: $from";
            mail($to, $subject, $message, $headers);
            echo'<b>Application Sent ------- Staff</b>';
         } 
      } 
   } 
}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.