Jump to content

zer0day

Members
  • Posts

    30
  • Joined

  • Last visited

    Never

About zer0day

  • Birthday 06/04/1989

Contact Methods

  • AIM
    xaceacex

Profile Information

  • Gender
    Male
  • Location
    Georgia

zer0day's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $i = 0; $ip = $_SERVER['REMOTE_ADDR']; $file = fopen('InternetProtocol.txt', 'r'); while(!feof($file)) { if(fgets($file) == $ip) { $i = 1; } } if($i == 1) { echo "You may view this page."; } else { echo "You may not view this page..."; } fclose($file);
  2. I took your code and added/subtracted a few things, although I didn't fix much -- I just got it to the point where it should work, so if there were errors in your initial code, they're still there. Here ya go: <?php /* Subject and Email variables */ $emailSubject = "Your Car Report Info."; $webMaster = "me@rustyeckford.com"; $webMaster2 ="me1@rustyeckford.com"; $webMaster3 ="me2@rustyeckford.com"; /* Gathering Data Variables */ $f_nameField = $_POST['f_name']; $l_nameField = $_POST['l_name']; $addField = $_POST['Address']; $stateField = $_POST['state']; $phoneField = $_POST['phone']; $emailField = $_POST['email']; $vinField = $_POST['vin']; $body = "<br><hr><br>"."First Name: ".$f_name."<br />"; $body .= "Last Name: ".$l_name."<br />"; $body .= "Address: ".$address."<br />"; $body .= "State: ".$state."<br />"; $body .= "Phone: ".$phone."<br />"; $body .= "Email: ".$email."<br />"; $body .= "VIN: ".$vin."<br />"; switch($state) { case 'Kansas': case 'Oklahoma': $wm = $webMaster2; break; case 'Missouri': break; case 'Iowa': $wm = $webMaster3; break; case 'Nebraska': $wm = $webMaster; break; default: $wm = $webMaster; } $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($wm, $emailSubject, $body, $headers); $theResults = "<html><head><title>Your Car Report - Results</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\"><style type=\"text/css\">"; $theResults .= " body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } "; $theResults .= "</style></head><div><div align=\"center\">Thank you for your submission. Your vehicle report will be provided to you very soon!</div></div></body></html>"; echo $theResults; ?>
  3. Change the value of "name" in the <input> tag to "clentFname" and see if that fixes your problem.
  4. As Gristoi said, you're not setting a value to all of the variable that you're trying to insert into the database. Replace: $date = date("Y-m-d"); $name = $_POST['name']; $comments = $_POST['comments']; With: $date = date("Y-m-d"); $name = $_POST['name']; $email = $_POST['email']; $song = $_POST['song']; $part = $_POST['part']; $comments = $_POST['comments'];
  5. Can you post the code that you're trying to insert?
  6. Try this: $array = array("Apple", "apple", "Apple", "ID1", "ID2", "ID3", "ID1"); print_r($array); echo "<br /><br />"; $array = array_values(array_unique($array)); print_r($array);
  7. You were setting the sessions to a blank array every time the form was processed here: $_SESSION['songlist'] = array(); $_SESSION['songrating'] = array(); This should work: <?php session_start(); ?> <html> <head> <title>Song List</title> </head> <body> <form action="song.php" method="POST"> Song: <input type="text" name="song" /> Rating: <select name="rating"> <?php foreach (range(5, 1) as $number) { echo "<option value=\"$number\">$number</option>"; } echo "</select>"; ?> <input type="submit" value="Submit!" /> </form> <?php if (isset($_POST['song']) && isset($_POST['rating'])) { $song = $_POST['song']; $rating = $_POST['rating']; if(!is_array($_SESSION['songlist'])) $_SESSION['songlist'] = array(); if(!is_array($_SESSION['songrating'])) $_SESSION['songrating'] = array(); $_SESSION['songlist'][] = $song; $_SESSION['songrating'][] = $song; echo "Your song " . $song . " is rated " . $rating . " stars!"; } print_r($_SESSION['songlist']); echo "<br /><br />"; print_r($_SESSION['songrating']); ?> </body> </html>
  8. Do you have a field that auto increments in the database? If you do, you can put the name of that field where I have "id" below, and it should work. If you want to pull the last image that was uploaded, replace "ASC" with "DESC". $query = "SELECT image FROM image_ads ORDER BY id ASC";
  9. <?php echo '<META HTTP-EQUIV="Refresh" Content="0; URL=index.php">'; ?>
  10. This should get them all working: <?php if(isset($_POST['reset'])) { header('Location: index2.php'); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> </head> <body> <?php $host = 'localhost'; $usr = "vinny"; $password = 'thepassword'; $db_name = 'logbook'; $date = $_POST['date']; $type = $_POST['type']; $reg_01 = $_POST['reg_01']; $reg_02 = $_POST['reg_02']; $captain = $_POST['captain']; $passenger = $_POST['passenger']; $where_01 = $_POST['where_01']; $where_02 = $_POST['where_02']; $takeoff_hr = $_POST['takeoff_hr']; $takeoff_min = $_POST['takeoff_min']; $landing_hr = $_POST['landing_hr']; $landing_min = $_POST['landing_min']; $ws_captain_hrs = $_POST['ws_captain_hrs']; $ws_captain_min = $_POST['ws_captain_min']; $ws_student_hrs = $_POST['ws_student_hrs']; $ws_student_min = $_POST['ws_student_min']; $three_captain_hrs = $_POST['three_captain_hrs']; $three_captain_min = $_POST['three_captain_min']; $three_student_hrs = $_POST['three_student_hrs']; $three_student_min = $_POST['three_student_min']; $passenger_hrs = $_POST['passenger_hrs']; $passenger_min = $_POST['passenger_min']; $remarks = $_POST['remarks']; if(isset($_POST['takeoff_hr']) && isset($_POST['takeoff_min']) && isset($_POST['landing_hr']) && isset($_POST['landing_min'])) { if(isset($_POST['autofill_ws_captain'])) $formId = "ws_captain"; if(isset($_POST['autofill_ws_student'])) $formId = "ws_student"; if(isset($_POST['autofill_3_captain'])) $formId = "three_captain"; if(isset($_POST['autofill_3_student'])) $formId = "three_student"; if(isset($_POST['passenger_button'])) $formId = "passenger"; if(strlen($formId) > 1) { $hrs = $formId."_hrs"; $min = $formId."_min"; $$hrs = $takeoff_hr - $landing_hr; $$hrs = str_replace("-", "", $$hrs); if(strlen($$hrs) == "1") { $$hrs = "0".$$hrs; } $$min = $takeoff_min - $landing_min; $$min = str_replace("-", "", $$min); if(strlen($$min) == "1") { $$min = "0".$$min; } } } if(isset($_POST['today'])) { $date = date("Y-m-d"); } $errorstring = ""; // default value of errorstring if(isset($_POST['save_flight'])) { // Validate all the code inputs that are required fields if ($date =="") $errorstring = $errorstring. "Date<br>"; if ($type =="") $errorstring = $errorstring. "Aircraft Type<br>"; if ($reg_01 =="") $errorstring = $errorstring. "Reg Prefix<br>"; if ($reg_02 =="") $errorstring = $errorstring. "Registration Mark<br>"; if ($captain =="") $errorstring = $errorstring. "Captain<br>"; if ($where_01 =="") $errorstring = $errorstring. "Flight From<br>"; if ($where_02 =="") $errorstring = $errorstring. "Flight To<br>"; if ($takeoff_hr =="") $errorstring = $errorstring. "Takeoff Hours<br>"; if ($takeoff_min =="") $errorstring = $errorstring. "Takeoff Minutes<br>"; if ($landing_hr =="") $errorstring = $errorstring. "Landing Hours<br>"; if ($landing_min =="") $errorstring = $errorstring. "Landing Minutes<br>"; // does the errorstring = "nothing"? if ($errorstring !="") echo "You have not put anything in the following fields: <br><br> $errorstring"; //echo "If you have nothing to put in the box please type the word \"None\" or \"N\/A\""; //die ("Please try again, ensuring that you fill out all the fields!"); elseif(isset($_POST['save_flight'])) { //echo "Your data has been saved"; //connect to database mysql_connect ("$host","$usr","$password") or die ('Error During Connect:<br>'.mysql_error()); mysql_select_db ("$db_name") or die ('Error Selecting DB:<br>'.mysql_error()); $insert_query = "INSERT INTO pilots_logbook (date, type, reg_01, reg_02, captain, passenger, where_01, where_02, takeoff_hr, takeoff_min, landing_hr, landing_min, ws_captain_hrs, ws_captain_min, ws_student_hrs, ws_student_min, three_captain_hrs, three_captain_min, three_student_hrs, three_student_min, passenger_hrs, passenger_min, remarks) VALUES ('$date', '$type', '$reg_01', '$reg_02', '$captain', '$passenger', '$where_01', '$where_02', '$takeoff_hr', '$takeoff_min', '$landing_hr', '$landing_min', '$ws_captain_hrs', '$ws_captain_min', '$ws_student_hrs', '$ws_student_min', '$three_captain_hrs', '$three_captain_min', '$three_student_hrs', '$three_student_min','$passenger_hrs', '$passenger_min', '$remarks')"; $insert_action = mysql_query($insert_query) or die ('Error During Insert :<br>'.mysql_error().'<br><br>Error occured running the following code :<br>'.$insert_query); $id = mysql_insert_id(); echo "Thank you, Your logbook entry has been saved."; } } ?> <p>Use this form to add an entry to your logbook.</p> <form name="form1" method="post" action="index2.php"> <table width="650" border="1" cellspacing="0" cellpadding="5"> <tr> <td>Required *</td> <td> </td> <td>This Format Only</td> </tr> <tr> <td width="180">Date *</td> <td width="300"> <input type="text" name="date" id="date" size="25"/ value="<?php echo $date; ?>" /> <input type="submit" name="today" id="today" value="Add Today" /> </td> <td width="170">YYYY-MM-DD</td> </tr> <tr> <td>Aircraft Type *</td> <td><input type="text" name="type" id="type" size="40" / value="<?php echo $type; ?>" /></td> <td>E.G. Quantum</td> </tr> <tr> <td>Reg Number *</td> <td><input type="text" name="reg_01" id="reg_01" size="5" value="<?php echo $reg_01; ?>" /> - <input type="text" name="reg_02" id="reg_02" size="15" value="<?php echo $reg_02; ?>" /></td> <td>G - ABCD</td> </tr> <tr> <td>Captain *</td> <td><input type="text" name="captain" id="captain" size="40" value="<?php echo $captain; ?>" /></td> <td>Name of Captain</td> </tr> <tr> <td>Passenger or Student</td> <td><input type="text" name="passenger" id="passenger" size="40" value="<?php echo $passenger; ?>" /></td> <td>Were you? P or S</td> </tr> <tr> <td>Flight From *</td> <td><input type="text" name="where_01" id="where_01" size="40" value="<?php echo $where_01; ?>" /></td> <td>Take off Airfield</td> </tr> <tr> <td>Flight To *</td> <td><input type="text" name="where_02" id="where_02" size="40" value="<?php echo $where_02; ?>" /></td> <td>Landing Airfield</td> </tr> <tr> <td>Takeoff GMT *</td> <td> <label> Hr <input type="text" name="takeoff_hr" id="takeoff_hr" size="10" value="<?php echo $takeoff_hr; ?>" /> Min <input type="text" name="takeoff_min" id="takeoff_min" size="10" value="<?php echo $takeoff_min; ?>" /> </label> </td> <td>24 Hr Format Only</td> </tr> <tr> <td>Landing GMT *</td> <td> <label> Hr <input type="text" name="landing_hr" id="landing_hr" size="10" value="<?php echo $landing_hr; ?>" /> Min <input type="text" name="landing_min" id="landing_min" size="10" value="<?php echo $landing_min; ?>" /> </label> </td> <td>24 Hr Format Only</td> </tr> <tr> <td>Captain Weighshift</td> <td> <label>Hrs <input type="text" name="ws_captain_hrs" id="ws_captain_hrs" size="10" value="<?php echo $ws_captain_hrs; ?>" /></label> <label> Min <input type="text" name="ws_captain_min" id="ws_captain_min" size="10" value="<?php echo $ws_captain_min; ?>" /> <input type="submit" name="autofill_ws_captain" id="autofill_ws_captain" value="Auto Insert" /> </label> </td> <td>Button works it out and inserts it here</td> </tr> <tr> <td>Student Weightshift</td> <td> <label>Hrs <input type="text" name="ws_student_hrs" id="ws_student_hrs" size="10" value="<?php echo $ws_student_hrs; ?>" /></label> <label> Min <input type="text" name="ws_student_min" id="ws_student_min" size="10" value="<?php echo $ws_student_min; ?>" /> <input type="submit" name="autofill_ws_student" id="autofill_ws_student" value="Auto Insert" /> </label> </td> <td>Button works it out and inserts it here</td> </tr> <tr> <td>Captain 3 Axis</td> <td> <label>Hrs <input type="text" name="three_captain_hrs" id="three_captain_hrs" size="10" value="<?php echo $three_captain_hrs; ?>" /></label> <label> Min <input type="text" name="three_captain_min" id="three_captain_min" size="10" value="<?php echo $three_captain_min; ?>" /> <input type="submit" name="autofill_3_captain" id="autofill_3_captain" value="Auto Insert" /> </label> </td> <td>Button works it out and inserts it here</td> </tr> <tr> <td>Student 3 Axis</td> <td> <label>Hrs <input type="text" name="three_student_hrs" id="three_student_hrs" size="10" value="<?php echo $three_student_hrs; ?>" /></label> <label> Min <input type="text" name="three_student_min" id="three_student_min" size="10" value="<?php echo $three_student_min; ?>" /> <input type="submit" name="autofill_3_student" id="autofill_3_student" value="Auto Insert" /> </label> </td> <td>Button works it out and inserts it here</td> </tr> <tr> <td>Passenger Interest Only</td> <td> Hrs <input type="text" name="passenger_hrs" id="passenger_hrs" size="10" value="<?php echo $passenger_hrs; ?>" /> Min <input type="text" name="passenger_min" id="passenger_min" size="10" value="<?php echo $passenger_min; ?>" /> <input type="submit" name="passenger_button" id="passenger_button" value="Auto Insert" /> </td> <td>Button works it out and inserts it here</td> </tr> <tr> <td>Remarks</td> <td><textarea name="remarks" id="remarks" cols="45" rows="5"><?php echo $remarks; ?></textarea></td> <td>Went to get microlight forum cup from XYZ airfield. Maximum 500 characters</td> </tr> <tr> <td><input type="submit" name="save_flight" id="save_flight" value="Save Flight" /></td> <td><input type="submit" name="reset" id="reset" value="Reset Form" /></td> <td> </td> </tr> </table> <p> </p> <p> </p> </body> </html>
  11. If you will let me know how to get the values for Student Weightshift, Captain 3 Axis, Student 3 Axis, and Passenger Interest Only, I'll get everything working.
  12. I don't know for sure that I understand exactly what you're asking, but maybe this will help: <?php $string = "<table>"; $result = mysql_query($sql); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_object($result)) { $string .= "<tr>"; $string .= "<td>".$row->last_name."</td>"; $string .= "<td>".$row->first_name."</td>"; $string .= "<td>".$row->employee_id."</td>"; $string .= "<td>".$row->title."</td>"; $string .= "<td>".$row->territory."</td>"; $string .= "<td>".$row->district."</td>"; $string .= "<td>".$row->Phase1A_Score."</td>"; $string .= "<td>".$row->Phase1B_Score."</td>"; $string .= "<td>".$row->Phase1_Average."</td>"; $string .= "<td>".$row->Phase1A_HS_Exam."</td>"; $string .= "<td>".$row->Phase1A_HS_Exam_RT."</td>"; $string .= "<td>".$row->Phase1B_HS_Exam."</td>"; $string .= "<td>".$row->Phase1B_HS_Exam_RT."</td>"; $string .= "<td>".$row->Class_Date."</td>"; $string .= "<td>".$row->Awards."</td>"; $string .= "</tr>"; } $string .= "</table>"; } else { $string = "No matches found!"; } echo $string; ?>
  13. Who are you using for hosting? You may have to create the users via cPanel (or whichever "Panel") your hosting provider offers.
  14. Try this. I haven't executed it, but it should work... I think. <?php elseif(isset($_GET['search'])) { $search = $_POST['search']; $search = str_replace(" ", "+", $search); header("Location: ./index.php?q=".$search); } elseif(isset($_GET['q'])) { $search = $_GET['q']; $keywords = explode("+", $search); $sql10000 = "SELECT product_id FROM $tbl_name2 WHERE "; } foreach($keywords as $query10000) { $sql10000 .= "keyword LIKE '%".$query10000."%' OR "; } $sql10000 = substr($sql10000,0,(strLen($sql10000)-3)); $content = $sql10000; ?>
  15. That's odd, it's working for me on multiple servers. Did you name the file, "index.php"? Let me know if that doesn't fix it and I'll look through the code again.
×
×
  • 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.