Jump to content

tomjung09

Members
  • Posts

    27
  • Joined

  • Last visited

    Never

Everything posted by tomjung09

  1. You make a good point PFMaBiSmAd. It looks like it isn't the require once file but the function that is being called that is failing. This is the code I ran on it, the error!!! is never printed. Does that mean that the function get_distance is erroring out? <?php echo "test"; try{ $distance = zipcode_class::get_distance($zip1, $temp); } catch(Exception $e){ echo "error!!!"; } ?>
  2. Thanks for the reply. It's actually the zipcodefunctions that I am having issues with. I tried include("zipcodefunctions.php"); and include 'zipcodefunctions.php'; No luck with either one.
  3. Hi. I am trying to use the require_once function in php to include a file. It is working in Chrome, and Firefox but not in IE8 and I cannot figure out why. Main file (home.php) <?php require_once 'salvagedrides.php'; require_once 'zipcodefunctions.php'; ?> the two files are in the same directory, it has no problem with salvagedrides.php but fails when I try to include the zipcodefunctions.php Any ideas why? The website is http://www.salvagedrides.com/usa/home.php
  4. Man I am good, apparently having multiple ini_set('sendmail_from', 'postmaster@salvagedrides.com'); statements causes a problem. Peace, love, and good times!
  5. Okay, I can't figure this one out... I am sending 3 different emails from one page. I am trying to get the first two to work. This is the code for the first email sent: //send email to user that was outbid $to = $outbid_user; $from_header = "SalvagedRides.com"; $subject = "You have been outbid!"; $contents = "You have been outbid on the " . $title . "motorcyle. To bid on this bike again you can follow this link: http://www.salvagedrides.com/usa/home.php?innerframe=bike.php?id=" . $id . " \n\n Thank you for choosing SalvagedRides \n\n -The SalvagedRides Team"; ini_set('sendmail_from', 'postmaster@salvagedrides.com'); if(mail($to, $subject, $contents, $from_header)){echo "Mail sent to outbid user";} This email will send, the second one however, no dice: //send email to current high bidder $to_high = $userArray['email']; $from_header_high = "SalvagedRides.com"; $subject_high = "You have been outbid!"; $contents_high = "You are the current high bidder on the " . $title . "motorcyle. We will notify you if you are outbid. Meanwhile, to check on the status of this bike, you can follow this link: http://www.salvagedrides.com/usa/home.php?innerframe=bike.php?id=" . $id . " \n\n Thank you for choosing SalvagedRides \n\n -The SalvagedRides Team"; ini_set('sendmail_from', 'postmaster@salvagedrides.com'); if(mail($to_high, $subject_high, $contents_high, $from_header_high)){echo "Mail sent to highbid user";} It hangs up, since this code is before the header, nothing loads and the second email never sends. Any idea why? I have checked the $to_high it is filled correctly.
  6. Okay, $_file is not empty but ["tmp_name"] is empty. Still can't figure out why...
  7. Ok, this isn't making sense, I changed upload_tmp_dir to "/tmp" and it worked. I made a small edit in my code (the part that does the upload not the one that posts the information) and it did not work again. I rolled back to the previous version that worked and it still does not work. This is frustrating. >.<
  8. My $_File array is empty and therefore I cannot upload images. It just stopped working, I have no Idea what I did. This is the form tag: <form id="pleasework" name="pleasework" method="post" action="uploadbikesubmit.php" enctype="multipart/form-data"> <input type="file" name="txtimage1"/> And the code I am using to upload it is this: <?php require_once 'salvagedrides.php'; mysql_select_db($database_sr, $sr); session_start(); //$username = $_SESSION['$user_ID']; ?> <!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=iso-8859-1" /> <title>Untitled Document</title> <style type="text/css"> <!-- body { background-color: #D7DFEC; } .style1 {color: #00757E} .style2 {font-size: 12px} .style3 {font-size: 18px} --> </style></head> <body> <table width="699" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="210" height="107"> </td> <td width="454"> </td> <td width="35"> </td> </tr> <tr> <td height="267"> </td> <td valign="top" bgcolor="#CC3300"><?php $model = $_POST['txtmodel']; $year = $_POST['txtyear']; $make = $_POST['txtmake']; $bid = $_POST['txtbid']; $location = $_POST['txtlocation']; $zipcode = $_POST['txtzipcode']; $enddate = $_POST['txtenddate']; $actualenddate = $_POST['txtactualenddate']; $comments = $_POST['txtcomments']; $vin = $_POST['txtvin']; $engine = $_POST['txtengine']; $title = $_POST['txttitle']; $milage = $_POST['txtmilage']; $status = $_POST['txtstatus']; $location = $_POST['txtlocation']; $category = $_POST['txtcategory']; $keys = $_POST['txtkeys']; $featured = $_POST['txtfeatured']; //make sure all required fields are filled if($model == ""){header("Location: uploadbike.php?msg=model" . $back);} /* elseif($year == ""){header("Location: uploadbike.php?msg=year" . $back);} elseif($make == ""){header("Location: uploadbike.php?msg=make" . $back);} elseif($bid == ""){header("Location: uploadbike.php?msg=bid" . $back);} elseif($location == ""){header("Location: uploadbike.php?msg=location" . $back);} elseif($zipcode == ""){header("Location: uploadbike.php?msg=zipcode" . $back);} elseif($enddate == ""){header("Location: uploadbike.php?msg=enddate" . $back);} elseif($actualenddate == ""){header("Location: uploadbike.php?msg=actual" . $back);} elseif($_FILES['txtimage1']['name'] == ""){header("Location: uploadbike.php?msg=image1" . $back);} elseif($_FILES['txtimage2']['name'] == ""){header("Location: uploadbike.php?msg=image2" . $back);} elseif($_FILES['txtimage3']['name'] == ""){header("Location: uploadbike.php?msg=image3" . $back);} elseif($_FILES['txtimage4']['name'] == ""){header("Location: uploadbike.php?msg=image4" . $back);} elseif($_FILES['txtimage5']['name'] == ""){header("Location: uploadbike.php?msg=image6" . $back);} elseif($_FILES['txtimage6']['name'] == ""){header("Location: uploadbike.php?msg=image7" . $back);} elseif($_FILES['txtimage7']['name'] == ""){header("Location: uploadbike.php?msg=image8" . $back);} elseif($_FILES['txtimage8']['name'] == ""){header("Location: uploadbike.php?msg=image9" . $back);}*/ else{ //check dates $enddate = substr($enddate, 0, 4) . substr($enddate, 5, 2) . substr($enddate, 8, 2) . substr($enddate, 11, 2) . substr($enddate, 14, 2); $actualenddate = substr($actualenddate, 0, 4) . substr($actualenddate, 5, 2) . substr($actualenddate, 8, 2) . substr($actualenddate, 11, 2) . substr($actualenddate, 14, 2); $date = date("YmdHis"); $str[0] = strtolower($_FILES['txtimage1']['name']); $str[1] = strtolower($_FILES['txtimage2']['name']); $str[2] = strtolower($_FILES['txtimage3']['name']); $str[3] = strtolower($_FILES['txtimage4']['name']); $str[4] = strtolower($_FILES['txtimage5']['name']); $str[5] = strtolower($_FILES['txtimage6']['name']); $str[6] = strtolower($_FILES['txtimage7']['name']); $str[7] = strtolower($_FILES['txtimage8']['name']); $str[8] = strtolower($_FILES['txtimage0']['name']); for($x = 0; $x < 9; $x += 1){ //not closed yet $i = strrpos($str[$x],"."); $l = strlen($str[$x]) - $i; $ext = substr($str[$x],$i+1,$l); echo "loop"; $path[$x] = "bike_images/" . $date . $x .".". $ext; } //end for loop $image_thumb = $path[8]; if ($_FILES["txtimage1"]["error"] > 0) { echo "Error: " . $_FILES["txtimage1"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["txtimage1"]["name"] . "<br />"; echo "Type: " . $_FILES["txtimage1"]["type"] . "<br />"; echo "Size: " . ($_FILES["txtimage1"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["txtimage1"]["tmp_name"]; } move_uploaded_file($_FILES["txtimage1"]["tmp_name"], $path[0]); move_uploaded_file($_FILES['txtimage2']['tmp_name'], $path[1]); move_uploaded_file($_FILES['txtimage3']['tmp_name'], $path[2]); move_uploaded_file($_FILES['txtimage4']['tmp_name'], $path[3]); move_uploaded_file($_FILES['txtimage5']['tmp_name'], $path[4]); move_uploaded_file($_FILES['txtimage6']['tmp_name'], $path[5]); move_uploaded_file($_FILES['txtimage7']['tmp_name'], $path[6]); move_uploaded_file($_FILES['txtimage8']['tmp_name'], $path[7]); move_uploaded_file($_FILES['txtimage0']['tmp_name'], $path[8]); } ?> </td> <td> </td> </tr> <tr> <td height="126"> </td> <td> </td> <td> </td> </tr> </table> </body> </html> I am getting an Error: 7 from the part that checks for errors for txtimage1 - I'm pretty sure that means that the $_file array is empty. I have checked my folder settings, its 777. And the only thing I'm not sure about is my upload_tmp_dir in my ini file. Its set to /tmp/ and I have a folder under my root site folder named tmp. Any ideas?
  9. So...I had the wrong name for the copy($_FILES['uploadedfile']['tmp_name'], $path) it should have been copy($_FILES['txtimage1']['tmp_name'], $path) I'm a little perplexed as to why copy() works but move_uploaded_file() does not. At any rate, I suppose I spent 5 hours looking for something right in front of me.... I've been at this too long.
  10. I'm trying to do a simple upload from client computer to a directory on my server. I have checked the folder settings and it is chmod 777. This is my code: $path = $date . $x .".". "jpg"; $image2[$x] = $path; if ($_FILES["txtimage1"]["error"] > 0) { echo "Error: " . $_FILES["txtimage1"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["txtimage1"]["name"] . "<br />"; echo "Type: " . $_FILES["txtimage1"]["type"] . "<br />"; echo "Size: " . ($_FILES["txtimage1"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["txtimage1"]["tmp_name"]; } if(copy($_FILES['uploadedfile']['tmp_name'], $path)){echo "uploaded \n";} It outputs: Upload: 13332118_1X.JPG Type: image/jpeg Size: 88.9501953125 Kb Stored in: c:\winnt\temp\php4\php1190.tmp success I have tried setting the path to <filename> .jpg and .jpeg neither works, I am to the point where I am just trying to get it to upload to the directory that the php file resides in. The file txtimage1 is being called from contains the form and file form: <form id="form1" name="form1" method="post" action="uploadbikesubmit.php" enctype="multipart/form-data"> <input type="file" name="txtimage1"/> Any ideas on what might be causing the problem or things I might try? I have also tried the move_uploaded_file() function, no luck there either.
  11. Wow this was a headache. I figured it out, you have to have: <form id="form1" name="form1" method="post" enctype="multipart/form-data" action="uploadbikesubmit.php"> enctype="multipart/form-data" in the form settings.
  12. I am using the form: <form id="form1" name="form1" method="post" action="uploadbikesubmit.php"> to submit
  13. It seems like nothing is going right for me here lol. I am trying to upload a file from the clients computer to the server. I have been testing my code for about 2 hours and I cannot figure out why this does not work: original file: <input type="file" name="txtimage1"/> Upload file: $test = $_POST['txtimage1']; echo "test " . $test . " \n"; if ($_FILES["txtimage1"]["error"] > 0) { echo "Error: " . $_FILES["txtimage1"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["txtimage1"]["name"] . "<br />"; echo "Type: " . $_FILES["txtimage1"]["type"] . "<br />"; echo "Size: " . ($_FILES["txtimage1"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["txtimage1"]["tmp_name"]; } test prints out the path that was inputed to txtimage1, but everything else outputs nothing. Could this be a server side issue or am I missing something?
  14. Thanks for the help, I decided just to put the function inside the original file and it works fine that way.
  15. well, I tried that and it didn't work and I tried parent.window.location = 'page.php'; that didn't work either I used some javascript to get the job done but I would rather use php in the case someone doesn't have java installed. Here is the code I used: <script type="text/javascript"> <!-- parent.window.location = "http://salvagedrides.com/usa/home.php?innerframe=account" //--> </script> Now here is another one, I need to change what is inside another iframe from a different iframe, both childs of the same parent. Any ideas on that one?
  16. Is it possible to change the page of the parent of an iframe? For example if I have a main webpage: main.php and inside I have an iframe who's current page is intheframe.php, is it possible to click a button in intheframe.php and have the parent (main.php) page change?
  17. Right right, got ya, thank you for your help!
  18. I cannot get the following code to work $query_r0 = "SELECT zipcode FROM sr_users WHERE username = '$id'"; $result0 = mysql_query($query_r0) or die('Could not connect to mysql server.' ); $num = mysql_num_rows($result0); $zip = mysql_result($result0,0,'zipcode'); I am calling it from another file, the $id variable is correct, the database selection is correct, the $num = 0 and therefore $zip = Null. When I run this code on the main page, it runs just fine and it finds the zip. Why does it not work when I include it in the require_once() function?
  19. Ah, 2 things, first of all, I am an idiot. I thought I was looking at a webpage that was explaining php functions. I didn't realize they had a function that went with it. I changed that to the header() function and it worked just fine. Second, if the cookie is already set, I am just updating its value. If it isn't set, I am using the setcookie() function. Am I doing that part right?
  20. Yes, I tested it without the if/then statements, the redirect does not work for sure. Any idea why?
  21. Ah, sorry, the redirect is not working as far as I can tell, I'm not sure the if/then statements are working. But it definitely does not get to the pages it's supposed to redirect to. And $_COOKIE['user_ID'] = $un; is supposed to set a cookie with the user's username txtusername is the name of the input box on the login page.
  22. Hi, I am trying to write a login script. Unfortunately it is not working and I am not getting any errors returned. I have been looking at the code forever and can't seem to figure it out and I was hoping maybe someone could see what I am not. Also, I am really rusty on cookies, so if I am setting my cookies wrong, please let me know. <?php require_once 'salvagedrides.php'; //connects to the database I haver verified that it works. session_start(); $un = $_POST['txtusername']; $pw = $_POST['txtpassword']; mysql_select_db($database_sr, $sr); $query2 = "SELECT password FROM sr_users WHERE username = '$un'"; $result2 = mysql_query($query2, $sr) or die(mysql_error()); $row2 = mysql_fetch_assoc($result2); if($row2['password'] == $pw){ //login successfull set cookie and session if(isset($_COOKIE['user_ID'])){ $_COOKIE['user_ID'] = $un;} else{ $twomonths = 5184000 + time(); setcookie('user_ID', $un, $twomonths); } $_SESSION['user_ID'] = $un; //Redirect to their account page //301 Moved Permanently - Forget the old page existed //302 Found - Use the same method (GET/POST) to request the specified page. //303 See Other - Use GET to request the specified page. Use this to redirct after a POST. //307 Temporary Redirect - Good for response to POST. redirect("account.php",301); } else{//Return to login page redirect("login.php?msg=invalid",301); } ?>
  23. I'm an idiot, I moved servers and didn't change the localhost to the server IP. Thanks for everyones help!
  24. updatetest.php isn't working either.... I could have sworn it was earlier but it gets the same error.
  25. Ah, okay, I found the problem but I don't know how to fix it lol. This line here: <?php require_once('../Connections/emotos.php')or die(mysql_error()); ?> Throws the error: Warning: main(1) [function.main]: failed to open stream: No such file or directory in /home/emotosn/public_html/html2/updatetest.php on line 1 Fatal error: main() [function.require]: Failed opening required '1' (include_path='.:/usr/php4/lib/php:/usr/local/php4/lib/php') in /home/emotosn/public_html/html2/updatetest.php on line 1 The file does exist in Connections.... so .... any ideas?
×
×
  • 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.