Jump to content

Not working


topflight

Recommended Posts

I have edited this part of my script:

$cerror = count($error);

  if ($cerror > 1 )

  {

      echo $error;?> <FORM><INPUT TYPE="BUTTON" VALUE="Fix Errors" ONCLICK="history.go(-1)"></FORM> <?php

  }

  else

  {

     

and now I am not receiving no errors I click submit with no input field and it just gives me a white page.

 

That is because $cerror is the result of count($error), and count returns 1 if the variable it is passed is not an array and has been set. As it has been assigned "" it has been set, so $cerror will ALWAYS be 1, whether there is an error or not, hence you will never deal with the errors.

 

Try this

 

<?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 = "jobs@simulatedasa.org";
            $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 = "jobs@simulatedasa.org";
            $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>';
         } 
      } 
   } 
}

?>

 

All the best

 

Keith

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.