Jump to content

emediastudios

Members
  • Posts

    418
  • Joined

  • Last visited

Posts posted by emediastudios

  1. Thanks so much.

    I have spent hours on this, but hey, i quess thats how you learn.

    I altered the code to this

    	//verify user...
    $get_user = mysql_query("SELECT * FROM `salon` WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'");
    $q = mysql_fetch_object($get_user);
        if(!$q) { 
    $errors_login[] = 'Wrong username or password.'; 
    }

     

    and it all works just dandy now.

    I will improve on my script by studying your script and altering mine at a later date.

    One again, thanks everyone for the help.

    ;D

  2. ok, please someone.

    This is what i need.

     

    This script

    //verify user...
    $get_user = mysql_query("SELECT * FROM `salon` WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'");
    $q = mysql_fetch_object($get_user);
        if(!$q) die("Login Failure: An error occured, please verify your username and password are correct.");
    

     

    But i dont want this section,

    if(!$q) die("Login Failure: An error occured, please verify your username and password are correct.");
    

     

    I want something like this

    if (!$q)  $errors_login[] = 'Wrong username or password.'; else $clean['password'] = htmlspecialchars($_POST['password']);

     

    I have tried but cant get it to work

    ???

  3. also, these 2 statements

     

    if(empty($_POST['username'])) $errors_login[] = 'Please put in your username.'; else $clean['username'] = htmlspecialchars($_POST['username']);

    if(empty($_POST['password'])) $errors_login[] = 'Please put in your password.'; else $clean['password'] = htmlspecialchars($_POST['password']);

     

     

    dont have any {} in them, I also am new to php, but I dont think they are optional

    I got this script off the net, it works so i will leave it, thanks anyway. ;)

  4. ok, i made some changes and got it to work.

     

    Added this code

    //verify user...
    $get_user = mysql_query("SELECT * FROM `salon` WHERE username = '".$_POST['username']."' AND password = '".$_POST['password']."'");
    $q = mysql_fetch_object($get_user);
       if(!$q) die("Login Failure: An error occured, please verify your username and password are correct.");

     

    But i dont want the error to echo on a blank page.

    I want it to echo like the other validation script.

     

    Any ideas?

     

     

  5. I gave it a go but i get errors.

    Still leatning php, but am getting better with the help from this site.

     

    Dont mean to be a pain but how would i implement that code in my code below.

    I want the error to be displayed like the other validation, the blank fields validation.

    I have a script on my page that displays the errors wher i want them to be displayed.

     

    This is my code

    <?php
    
    include('includes/include.php');
    include('form_email_config.php');
    
    #Form has been submitted?
    if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){
    ob_start();
    $host="localhost"; // Host name 
    $username="root"; // Mysql username 
    $password="5050888202"; // Mysql password 
    $db_name="sde"; // Database name 
    $tbl_name="salon"; // Table name 
    
    $errors_login = array(); #Initiate error variable
    #Check for blanks and clean data
    if(empty($_POST['username'])) $errors_login[] = 'Please put in your username.'; else $clean['username'] = htmlspecialchars($_POST['username']);
    if(empty($_POST['password'])) $errors_login[] = 'Please put in your password.'; else $clean['password'] = htmlspecialchars($_POST['password']);
    
    
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Define $username and $password 
    $username=$_POST['username']; 
    $password=$_POST['password']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $username = stripslashes($username);
    $password = stripslashes($password);
    $username = mysql_real_escape_string($username);
    $password = mysql_real_escape_string($password);
    
    $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $username and $password, table row must be 1 row
    
    if($count==1){
    // Register $username, $password and redirect to file "templates.php"
    session_register("username");
    session_register("password"); 
    header("location:templates.php");
    }
    else {
    
    ob_end_flush();
    }
    }
    ?>
    

     

    This my error reporting script.

     

    <?php
    	if(!empty($errors_login)){
    		echo "<p><span class='red'>";
    		foreach($errors_login as $error_login){
    			echo $error_login."<br />";
    		}
    		echo "</span></p>";
    	}
    	?>

  6. I got this code that checks for empty fields.

    #Check for blanks and clean data
    if(empty($_POST['username'])) $errors_login[] = 'Please put in your username.'; else $clean['username'] = htmlspecialchars($_POST['username']);
    if(empty($_POST['password'])) $errors_login[] = 'Please put in your password.'; else $clean['password'] = htmlspecialchars($_POST['password']);

     

    What i want is to add an error if the username or password is incorrect

    Anyone, please, its the last bit of code i need.

  7. OK i got it to work. ;D

    I just need one thing to perfect it.

     

    I have an error message display if the fields are left blank.

    But how do i add an error message if the username or password is not the right one.

    Here is the amended code.

    \

    <?php
    
    include('includes/include.php');
    include('form_email_config.php');
    
    #Form has been submitted?
    if((isset($_POST['login'])) AND ($_POST['login'] == 'Login')){
    ob_start();
    $host="localhost"; // Host name 
    $username="root"; // Mysql username 
    $password="5050888202"; // Mysql password 
    $db_name="sde"; // Database name 
    $tbl_name="salon"; // Table name 
    
    $errors_login = array(); #Initiate error variable
    #Check for blanks and clean data
    if(empty($_POST['username'])) $errors_login[] = 'Please put in your username.'; else $clean['username'] = htmlspecialchars($_POST['username']);
    if(empty($_POST['password'])) $errors_login[] = 'Please put in your password.'; else $clean['password'] = htmlspecialchars($_POST['password']);
    
    // Connect to server and select databse.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    // Define $username and $password 
    $username=$_POST['username']; 
    $password=$_POST['password']; 
    
    // To protect MySQL injection (more detail about MySQL injection)
    $username = stripslashes($username);
    $password = stripslashes($password);
    $username = mysql_real_escape_string($username);
    $password = mysql_real_escape_string($password);
    
    $sql="SELECT * FROM $tbl_name WHERE username='$username' and password='$password'";
    $result=mysql_query($sql);
    
    // Mysql_num_row is counting table row
    $count=mysql_num_rows($result);
    // If result matched $username and $password, table row must be 1 row
    
    if($count==1){
    // Register $username, $password and redirect to file "login_success.php"
    session_register("username");
    session_register("password"); 
    header("location:templates.php");
    }
    else {
    
    ob_end_flush();
    }
    }

  8. Notice: Undefined index: status in C:\Program Files\Apache Group\Apache2\htdocs\salondigitalentertainment\login_salon.php on line 15

     

    This line

      if($loginrow['status'] == 1) {

     

    do i need this email stuff?

     

     session_register("SESS_EMAIL");

  9. Thanks heaps

    But i still can get it to work.

    I  Changed my form to read

     

    <form id="login2" name="login2" method="post" action="login_salon.php">
          <table width="950" border="0" align="center" cellpadding="4">
            <tr>
              <td colspan="2" class="silver">Registered Salon Login</td>
              <td width="678" colspan="2" rowspan="5"> </td>
            </tr>
            <tr>
              <td width="123" class="contactdetails">Username:</td>
              <td width="117"><div align="left">
                <input name="username" type="text" class="smalltext" id="username" />
              </div></td>
            </tr>
            <tr>
              <td class="contactdetails">Password:</td>
              <td><div align="left">
                <input name="password" type="text" class="smalltext" id="password" />
              </div></td>
            </tr>
            <tr>
              <td colspan="2" class="login1"><input name="login2" type="submit" class="smalltext" id="login2" value="Login" /></td>
            </tr>
            <tr>
              <td colspan="2"> </td>
            </tr>
          </table>
          <span class="smalltext">Not a registered Salon?<br /> 
        Simply fill out the form below to register, and we will send you your login details.</span>      <br />
          <br />
        </form>

     

    and my process file code

     

    <?PHP 
    
    $config_basedir = 'salons.php';
    include('includes/include.php');
    if($_POST['login2'])
    {
    	$loginsql = "SELECT * FROM salon WHERE username= '" . $_POST['username'] . "' AND password = '" . $_POST['password'] . "'";
    	$loginres = mysql_query($loginsql);
    	$numrows = mysql_num_rows($loginres);
    
    	if($numrows == 1){				
    			$loginrow = mysql_fetch_assoc($loginres);
    
    			if($loginrow['status'] == 1) {
    
    				session_register("SESS_LOGGEDIN");
    				session_register("SESS_EMAIL");
    				session_register("SESS_USERID");
    				session_register("SESS_USERNAME");
    
    				$_SESSION['SESS_LOGGEDIN'] = 1;
    				$_SESSION['SESS_EMAIL'] = $loginrow['email'];
    				$_SESSION['SESS_USERID'] = $loginrow['id'];
    				$_SESSION['SESS_USERNAME'] = $loginrow['username'];
    
    				header("Location: " . $templates.php);
    			}				
    
    			else {				
    			header("Location: " . $config_basedir ."?error=verified");
    			}				
    		}
    		else {
    			header("Location: " . $config_basedir ."?error=incorrect");
    		}
    	}
    	?>

     

  10. Im just learning php and alot goes to the help i get here.

    I have tried and keep gettin errors when tryin to do the code myself.

    I can make it work with dreamweaver but i want to learn the proper way.

    I have this form below.

     

        <form id="login" name="login" method="post" action="">
          <table width="950" border="0" align="center" cellpadding="4">
            <tr>
              <td colspan="2" class="silver">Registered Salon Login</td>
              <td width="678" colspan="2" rowspan="5"> </td>
            </tr>
            <tr>
              <td width="123" class="contactdetails">Username:</td>
              <td width="117"><div align="left">
                <input name="user" type="text" class="smalltext" id="user" />
              </div></td>
            </tr>
            <tr>
              <td class="contactdetails">Password:</td>
              <td><div align="left">
                <input name="password" type="text" class="smalltext" id="password" />
              </div></td>
            </tr>
            <tr>
              <td colspan="2" class="login1"><input name="login2" type="submit" class="smalltext" id="login2" value="Login" />

     

    I know its alot to ask but if some one could write me the code that makes this work, i'd be stoked.

    I promise to study it and learn to do it myself.

     

    I created a table called salon, in my database. and i connect to the database through a include file. I have a username and password field in that table.

    How do i check the entries against each other.?

     

    Once they enter the right details i want them to be sent to a file called templates.php

  11. I have 3 forms that need to be finished.

    2 of them are simple forms that send the form data by email.

    The other is a form that needs the data injected into a database.

     

    I have created the forms and can be viewed here:\

     

    These are the email forms

     

    http://emediastudios.com.au/salondigitalentertainment/global_opportunities.php

    http://emediastudios.com.au/salondigitalentertainment/contact.php

     

    This is the database form

     

    http://emediastudios.com.au/salondigitalentertainment/salons.php

     

    Quotes are welcomed.

     

    My programmer that does work for me has some personal issues to deal with and i am needing someone to replace him for a few jobs.

    This may lead to a constant supply of work to the right person.

     

    Please contact me via these forums asap for more details.

  12. My script work fine on localhost but get this error on my server online.

     

    Fatal error: Cannot redeclare htmlspecialchars_decode() in /home/emediast/public_html/salondigitalentertainment/includes/include.php on line 88

     

    Code

    <?php
    
    /*
    ** Database functions
    */
    function dbConnect()
    {
      $dbhost = "localhost";  //ex: LocalHost
      $dbuser = "emediast"; //ex: User
      $dbpass = "7833pjer"; //ex: iamapassword
      $db = "emediast_sde"; //ex: Resume
      $dbcnx = @mysql_connect($dbhost, $dbuser, $dbpass) 
          or die("The site database appears to be down."); 
    
      if ($db!="" and !@mysql_select_db($db)) 
          die("The site database is unavailable."); 
        
      return $dbcnx; 
    }
    /*
    **  Universal Cleaning and Checking Functions
    */
    
    function clean($var)
    {
    /*
      * Use preg_replace to replace things such as javascript: and any other nasties you can think of. This is the bloated bit.
      * Done because things like javascript: aren't caught by strip_tags. I also remove certain javascript functions for good measure
      */
    //Now add in our own slashes
    $var = mysql_real_escape_string($var);
    //Strip any html tags
    $var = strip_tags($var);
    //Convert any special chars
    $var = htmlspecialchars($var);
    //turn it into html
    $var = htmlentities($var);
    
    $var = str_replace('\r\n','<br>',$var);
    //Take out any slashes, in case php is set to add them
    $var = stripslashes($var);
    
    return $var;
    }
    
    
    function EmailChk($email){
    $regex = '&^(?:
    ("\s*(?:[^"\f\n\r\t\v\b\s]+\s*)+")|
    ([-\w!\#\$%\&\'*+~/^`|{}]+(?:\.[-\w!\#\$%\&\'*+~/^`|{}]+)*))
    @(((\[)?
    (??:(??:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))\.){3}
    (??:25[0-5])|(?:2[0-4][0-9])|(?:[0-1]?[0-9]?[0-9]))))(?(5)\])|
    ((?:[a-z0-9](?:[-a-z0-9]*[a-z0-9])?\.)*[a-z0-9](?:[-a-z0-9]*[a-z0-9])?)
    \.((?[^- ])[-a-z]*[-a-z])))
    $&xi';
    if( 0 < preg_match($regex, $email)) return true;
    else return false;
    }
    
    
    
    function EmailCheck($email){
    $r = mysql_query("SELECT * FROM resume WHERE email='".$email."'") or die(mysql_error());
    $num =  mysql_num_rows($r);
    if(!$num) return true;
    else return false;
    }
    
    function cleanInputs(){
    foreach($_GET as $key => $stuff){
      $_GET[$key] = clean($stuff);
    }
    
    foreach($_POST as $key => $stuff){
      if($key != "message" || $key != "choices") $_POST[$key] = clean($stuff);
    }
    }
    
    /*
    ** Call On-Run Functions
    */
    session_start();
    dbConnect();
    //cleanInputs();
    if (!function_exists("htmlspecialc
    hars_decode")) {
        function htmlspecialchars_decode($string, $quote_style = ENT_COMPAT) {
            return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
        }
    }
    
    
    
    
    ?>
    

  13. Im a bit of a NOOBIE when it comes to php, but i have managed to alter this form to do as i wish,

    Just one problem.

    I wanted to move all the fields over to the left as they are sitting in the middle of the table.

    How would i go about this.

    This is the code

    <?php 
    include_once('includes/include.php');
    $pageTitle = "Join Our Team";
    $upload_dir = "upload/";
    
    //Experinced Users only Beyond this point except for formatting which will be commented
    
    
    $form = '<form enctype="multipart/form-data" action="upload_resume.php?submit=2" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="10240000" />
    <input type="hidden" name="email" value="'.$_POST[email].'" />
    Files must be of PDF format.<br>Max file size, one meg.<br><br>Attach Resume: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>';
    
    
    
    //FORMAT HERE
    
    
    //VERY IMPORTANT:  make sure that you use " if the entire string is surrounded by ' and vice versa
    //otherwise you'll fuck yourself over
    
    
        //the table goes here
        $content3 .= '<table width="950" border="1" class="contact">';
        $content3 .= '<form method="post" action="upload_resume.php?submit=1">';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Name:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="name" value="'.$_POST[name].'" /></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Email Address:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="email" value="'.$_POST[email].'" /></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Contact Number:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="contact"  value="'.$_POST[contact].'"/></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Mobile Number:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="mobile"  value="'.$_POST[mobile].'"/></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Address Line 1:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="ad1"  value="'.$_POST[ad1].'"/></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">Address Line 2:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="ad2"  value="'.$_POST[ad2].'"/></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">City:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="city"  value="'.$_POST[city].'"/></td></tr>';
        $content3 .= '<tr><td width="150"><span class="contactdetails">State:</span> </td><td width="150" class="smalltext">';
        $content3 .= '<select name="state" style="width:120px" class="smalltext">
      <option value="">Please Select</option>
    <option value="NSW"';
           if($_POST[state] == "NSW") $content3 .= " selected='selected'"; 
          $content3 .= '>New South Wales</option>
    <option value="NT"';
           if($_POST[state] == "NT") $content3 .= " selected='selected'"; 
          $content3 .= '>Northern Territory</option>
    <option value="QLD';
           if($_POST[state] == "QLD") $content3 .= " selected='selected'"; 
          $content3 .= '">Queensland</option>
    <option value="SA"';
           if($_POST[state] == "SA") $content3 .= " selected='selected'"; 
          $content3 .= '>South Australia</option>
    <option value="TAS"';
           if($_POST[state] == "TAS") $content3 .= " selected='selected'"; 
          $content3 .= '>Tasmania</option>
    <option value="VIC"';
           if($_POST[state] == "VIC") $content3 .= " selected='selected'"; 
          $content3 .= '>Victoria</option>
    <option value="WA"';
           if($_POST[state] == "WA") $content3 .= " selected='selected'"; 
          $content3 .= '>Western Australia</option>
    
    </select></td></tr>
    ';
    $content3 .= '<tr><td width="150"><span class="contactdetails">Zip Code:</span> </td><td width="150"><input type="text" style="width:120px" class="smalltext" name="post"  value="'.$_POST[post].'" /></td></tr>';
    
    $content3 .= '<tr><td colspan="2" align="left"><input type="submit" class="smalltext" value="Next"/></td></tr></form></table>';
      if($_GET['submit'] == ""){
       $content .= $content3;
      }
      else if($_GET[submit] == '1'){
       //the mysql goes here
        if(!EmailChk($_POST[email])){$kill=1; $content2 .= "Invalid Email Address<br>";}
        if(!EmailCheck($_POST[email])){$kill=1; $content2 .= "Duplicate Email Address<br>";}
        if($_POST[contact] == ""){$kill=1; $content2 .= "Enter a Phone Number (Normal)<br>";}
        if($_POST[mobile] == ""){$kill=1; $content2 .= "Enter a Phone Number (Mobile)<br>";}
        if($_POST[state] == ""){$kill=1; $content2 .= "Enter a State<br>";}
        if($_POST[name] == ""){$kill=1; $content2 .= "Enter a Name<br>";}
        if($_POST[city] == ""){$kill=1; $content2 .= "Enter a City<br>";}
        if($_POST[ad1] == ""){$kill=1; $content2 .= "Enter an Address<br>";}
        if($_POST[post] == ""){$kill=1; $content2 .= "Enter a Postal Code<br>";}
        if($kill != 1){
         $_POST[address] = $_POST[ad1] . "\n" . $_POST[ad2];
         $_POST[ad1] = "";
         $_POST[ad2] = "";
         $q = "INSERT INTO resume(name,address,city,state,post,contact,mobile,email,file) VALUES ('".$_POST[name]."','".$_POST[address]."','".$_POST[city]."','".$_POST[state]."','".$_POST[post]."','".$_POST[contact]."','".$_POST[mobile]."','".$_POST[email]."','')";
         if(!mysql_query($q)) $content .= "failed to insert user data";
         else{
          $content .= $form;
         }
        }
        else $content.= $content2 . "<br><br><br>" . $content3;
    
    
      }
      else if($_GET[submit] == '2'){
         $target_path = $upload_dir;
         while(file_exists($target_path)){
          $random3 = (rand()%999999);
          $target_path = $target_path . $random3 . basename( $_FILES['uploadedfile']['name']);
         }
         if(strtolower($_FILES['uploadedfile']['name']) != str_replace(".pdf", "", strtolower($_FILES['uploadedfile']['name']))){
          if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
            $content .= "The file ".  basename( $_FILES['uploadedfile']['name']).
             " has been uploaded for email address:<br> ". $_POST[email];
             mysql_query("UPDATE resume SET file = '".$target_path."' WHERE email='".$_POST[email]."'");
    mail("design@sdemail.com.au","New Employment Application at your website", "Please go to your website to see the application", "From: webmaster@emediastudios.com.au");
             
          } else{
            $content .= 'There was an error uploading the file, please try again!<br>';
            $content .= $form;
          }
         }
         else{
         $content .= 'Must Be A .pdf File<br>';
         $content .= $form;
         }
    
      }
    $pageTitle = "Join Our Team";
    include('employment.php');
    
    ?>
    

  14. I have this code i had built and i want to use it in another site with a couple of alterations.

    I just want to take out "history" and "position applying for"

    The code works fine, but when i take out the pieces of code i think that should go, i get the returned error "failed to insert user data"

     

    This is the complete code

    <?php 
    include_once('includes/include.php');
    $pageTitle = "Join Our Team";
    $upload_dir = "upload/";
    
    //Experinced Users only Beyond this point except for formatting which will be commented
    
    
    $form = '<form enctype="multipart/form-data" action="upload_resume.php?submit=2" method="POST">
    <input type="hidden" name="MAX_FILE_SIZE" value="10240000" />
    <input type="hidden" name="email" value="'.$_POST[email].'" />
    Files must be of PDF format.<br>Max file size, one meg.<br><br>Attach Resume: <input name="uploadedfile" type="file" /><br />
    <input type="submit" value="Upload File" />
    </form>';
    
    
    
    //FORMAT HERE
    
    
    //VERY IMPORTANT:  make sure that you use " if the entire string is surrounded by ' and vice versa
    //otherwise you'll fuck yourself over
    
    
        //the table goes here
        $content3 .= '<table width="650">';
        $content3 .= '<form method="post" action="upload_resume.php?submit=1">';
        $content3 .= '<tr><td width="150">Name: </td><td width="150"><input type="text" style="width:175px" class="fields" name="name" value="'.$_POST[name].'" /></td></tr>';
        $content3 .= '<tr><td width="150">Email Address: </td><td width="150"><input type="text" style="width:175px" class="fields" name="email" value="'.$_POST[email].'" /></td></tr>';
        $content3 .= '<tr><td width="150">Contact Number: </td><td width="150"><input type="text" style="width:175px" class="fields" name="contact"  value="'.$_POST[contact].'"/></td></tr>';
        $content3 .= '<tr><td width="150">Mobile Number: </td><td width="150"><input type="text" style="width:175px" class="fields" name="mobile"  value="'.$_POST[mobile].'"/></td></tr>';
        $content3 .= '<tr><td width="150">Address Line 1: </td><td width="150"><input type="text" style="width:175px" class="fields" name="ad1"  value="'.$_POST[ad1].'"/></td></tr>';
        $content3 .= '<tr><td width="150">Address Line 2: </td><td width="150"><input type="text" style="width:175px" class="fields" name="ad2"  value="'.$_POST[ad2].'"/></td></tr>';
        $content3 .= '<tr><td width="150">City: </td><td width="150"><input type="text" style="width:175px" class="fields" name="city"  value="'.$_POST[city].'"/></td></tr>';
        $content3 .= '<tr><td width="150">State: </td><td width="150" class="fields1">';
        $content3 .= '<select name="state" style="width:179px" class="fields">
      <option value="">Please Select</option>
    <option value="NSW"';
           if($_POST[state] == "NSW") $content3 .= " selected='selected'"; 
          $content3 .= '>New South Wales</option>
    <option value="NT"';
           if($_POST[state] == "NT") $content3 .= " selected='selected'"; 
          $content3 .= '>Northern Territory</option>
    <option value="QLD';
           if($_POST[state] == "QLD") $content3 .= " selected='selected'"; 
          $content3 .= '">Queensland</option>
    <option value="SA"';
           if($_POST[state] == "SA") $content3 .= " selected='selected'"; 
          $content3 .= '>South Australia</option>
    <option value="TAS"';
           if($_POST[state] == "TAS") $content3 .= " selected='selected'"; 
          $content3 .= '>Tasmania</option>
    <option value="VIC"';
           if($_POST[state] == "VIC") $content3 .= " selected='selected'"; 
          $content3 .= '>Victoria</option>
    <option value="WA"';
           if($_POST[state] == "WA") $content3 .= " selected='selected'"; 
          $content3 .= '>Western Australia</option>
    
    </select></td></tr>
    ';
    $content3 .= '<tr><td width="150">Zip Code: </td><td width="150"><input type="text" style="width:175px" class="fields" name="post"  value="'.$_POST[post].'" /></td></tr>';
    $content3 .='<tr><td width="150">Date Of Birth: </td><td width="150">';
    $content3 .='
    <select name="dateofbirthday">
    <option value="">DD</option>';
    
    for($i = 1; $i <= 31; $i++)
    {
      if(strlen($i) < 1) $i = '0' . $i;
      if($_POST[dateofbirthday] == $i) $selection = " selected='selected'"; 
      $content3 .= '<option value="'. $i .'" '.$selection.'>'. $i .'</option>';
    }
    
    $content3 .='</select>
    <select name="dateofmonth">
    <option value="">MM</option>';
    
    for($i = 1; $i <= 12; $i++)
    {
      if(strlen($i) < 1) $i = '0' . $i;
      if($_POST[dateofmonth] == $i) $selection = " selected='selected'"; 
      $content3 .= '<option value="'. $i .'" '.$selection.'>'. $i .'</option>';
    }
    
    $content3 .='</select>
    <select name="dateofbirthyear">
    <option value="">YYYY</option>';
    
    for($i = date('Y') - 100; $i <= date('Y') - 16; $i++)
    {
      if($_POST[dateofbirthyear] == $i) $selection = " selected='selected'"; 
      $content3 .= '<option value="'. $i .'" '.$selection.'>'. $i .'</option>';
    }
    
    $content3 .='</select></td></tr>';
    $content3 .= '<tr><td width="150">Position Applying For: </td><td width="150"><input type="text" style="width:175px" class="fields" name="position"  value="'.$_POST[position].'"/></td></tr>';
    $content3 .= '<tr><td colspan="2">History: </td></tr><tr><td colspan="2"><textarea name="history" cols=35 rows=8>'.$_POST[history].'</textarea></td></tr>';
    $content3 .= '<tr><td colspan="2" align="left"><input type="submit" value="Next"/></td></tr></form></table>';
      if($_GET['submit'] == ""){
       $content .= $content3;
      }
      else if($_GET[submit] == '1'){
       //the mysql goes here
        if(!EmailChk($_POST[email])){$kill=1; $content2 .= "Invalid Email Address<br>";}
        if(!EmailCheck($_POST[email])){$kill=1; $content2 .= "Duplicate Email Address<br>";}
        if($_POST[contact] == ""){$kill=1; $content2 .= "Enter a Phone Number (Normal)<br>";}
        if($_POST[mobile] == ""){$kill=1; $content2 .= "Enter a Phone Number (Mobile)<br>";}
        if($_POST[dateofmonth] == ""){$kill=1; $content2 .= "Enter a Birth Month<br>";}
        if($_POST[dateofbirthday] == ""){$kill=1; $content2 .= "Enter a Birth Day<br>";}
        if($_POST[dateofbirthyear] == ""){$kill=1; $content2 .= "Enter a Birth Year<br>";}
        if($_POST[state] == ""){$kill=1; $content2 .= "Enter a State<br>";}
        if($_POST[name] == ""){$kill=1; $content2 .= "Enter a Name<br>";}
        if($_POST[city] == ""){$kill=1; $content2 .= "Enter a City<br>";}
        if($_POST[ad1] == ""){$kill=1; $content2 .= "Enter an Address<br>";}
        if($_POST[post] == ""){$kill=1; $content2 .= "Enter a Postal Code<br>";}
        if($_POST[history] == ""){$kill=1; $content2 .= "Enter work History<br>";}
        if($kill != 1){
         $_POST[address] = $_POST[ad1] . "\n" . $_POST[ad2];
         $_POST[ad1] = "";
         $_POST[ad2] = "";
         $_POST[dob] = $_POST[dateofmonth] . "/" . $_POST[dateofbirthday] . "/" . $_POST[dateofbirthyear];
         $_POST[dateofmonth] = "";
         $_POST[dateofbirthyear] = "";
         $_POST[dateofbirthday] = "";
         $q = "INSERT INTO resume(name,dob,address,city,state,post,contact,mobile,position,history,email,file) VALUES ('".$_POST[name]."','".$_POST[dob]."','".$_POST[address]."','".$_POST[city]."','".$_POST[state]."','".$_POST[post]."','".$_POST[contact]."','".$_POST[mobile]."','".$_POST[position]."','".$_POST[history]."','".$_POST[email]."','')";
         if(!mysql_query($q)) $content .= "failed to insert user data";
         else{
          $content .= $form;
         }
        }
        else $content.= $content2 . "<br><br><br>" . $content3;
    
    
      }
      else if($_GET[submit] == '2'){
         $target_path = $upload_dir;
         while(file_exists($target_path)){
          $random3 = (rand()%999999);
          $target_path = $target_path . $random3 . basename( $_FILES['uploadedfile']['name']);
         }
         if(strtolower($_FILES['uploadedfile']['name']) != str_replace(".pdf", "", strtolower($_FILES['uploadedfile']['name']))){
          if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
            $content .= "The file ".  basename( $_FILES['uploadedfile']['name']).
             " has been uploaded for email address:<br> ". $_POST[email];
             mysql_query("UPDATE resume SET file = '".$target_path."' WHERE email='".$_POST[email]."'");
    mail("design@sdemail.com.au","New Employment Application at your website", "Please go to your website to see the application", "From: webmaster@emediastudios.com.au");
             
          } else{
            $content .= 'There was an error uploading the file, please try again!<br>';
            $content .= $form;
          }
         }
         else{
         $content .= 'Must Be A .pdf File<br>';
         $content .= $form;
         }
    
      }
    $pageTitle = "Join Our Team";
    include('employment.php');
    
    ?>
    

     

    I thought i could take out these sections of code, but errors for me  ???

     

    $content3 .='</select></td></tr>';
    $content3 .= '<tr><td width="150">Position Applying For: </td><td width="150"><input type="text" style="width:175px" class="fields" name="position"  value="'.$_POST[position].'"/></td></tr>';
    $content3 .= '<tr><td colspan="2">History: </td></tr><tr><td colspan="2"><textarea name="history" cols=35 rows=8>'.$_POST[history].'</textarea></td></tr>';
    
        if($_POST[post] == ""){$kill=1; $content2 .= "Enter a Postal Code<br>";}
        if($_POST[history] == ""){$kill=1; $content2 .= "Enter work History<br>";}
    
    
    
    position,history,
    
    '".$_POST[position]."','".$_POST[history]."'
    
    
    
    

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