Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. Since I don't look at code that is not posted here, I will offer this solution. Why not build a query of what you need for your output and only select the records that meet your needs? That way you will not have any record for a state that does not have associated cities/stores.
  2. As I originally said I'm getting emails re: posts that I have NOT subscribed to, aka, have not made replies to yet. Just received two more un-solicited posts. Please make it stop!
  3. Ok - so my post was in the wrong forum. NOw that a moderator-type has seen this, does that mean that it is being looked into? (Just received a third un-solicited post btw.)
  4. Suddenly I just received two posts in my email concerning two new forum posts that I have not subscribed to. This is a definite change in how the forum has operated for me. Has somebody changed something here? I know I didn't.
  5. It's hard to help without seeing your code attempts. That's how it works here. Oh - and if your reference to 'mysql' means that you are using the MySQL extension to access your database, stop now and go read up on the mysqlI or PDO extensions and use one of them for your database accessing. See the manual for why this is if you don't know.
  6. Despite all that horrible looking logic to supposedly sanitize your input, I'll offer you this: You didn't do the insert.
  7. Your code suggests you are trying to do this: Replace "john, smith" with some values such as 'replaced, replaced'. Is that really what you are expecting to find in your file?
  8. Personally I would never give someone that kind of open access. If your task is to allow a user to bro(wse 'some' files that you have, I would put them in a set of folder(s) and use my own code to search them for whatever extension the user provides. That way he/she cannot browse anywhere else. You could also provide a dropdown list of folders to be checked, but let your script verify that the folder they select is one of the ones you expect by comparing the one chosen to a list that you store in your script or in a db.
  9. Perhaps it doesn't like your from address. Drop the <>
  10. Where is the image name? You have a field named 'image_path' in your img tag, but where is the name? Look at the source html code that this produces. What does it look like?
  11. It apparently is an add-on to standard php. You'll have to find someone who uses this add-on for help.
  12. The function 'file_get_html' doesn't exist in my version (?) of the PHP manual. How are we supposed to help you when we don't know what your code looks like?
  13. So now you should be showing us the code that is pointed to by these error messages. Maybe some lines prior to them as well so we have some context
  14. ALL YOU HAVE TO DO IS TAKE OUT THAT ECHO LIKE I'VE SAID 3 TIMES!
  15. The error shows on the client screen. Take out the echo and you will remove your problem
  16. monkaur - you're missing the problem. I already told him about the error checking being missing and my code provided that for him already. His reall problem is why does his script NOT give him an error on his header call?
  17. Your code is not what you sent me. Try this: <?php session_start(); // ALWAYS TURN ON ERROR CHECKING DURING DEVELOPMENT!!! error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); //*********************** $fnameErr = $lnameErr = $emailErr = $unameErr = $pwd1Err = $pwd2Err = ""; $fname = $lname = $email = $uname = $pwd1 = $pwd2 = ""; // turn off error indicator $errors = false; //***************************** // check if we have a POST or not. if ($_SERVER["REQUEST_METHOD"] <> "POST") { displaypage(); exit(); } else { // handle the inputs now. if (empty($_POST["fname"])) { // turn on error flag $errors = true; $fnameErr = "* First name is required"; } else { $fname = test_input($_POST["fname"]); if (!preg_match("/^[a-zA-Z]*$/",$fname)) { $errors = true; $fnameErr = "* Only letters are allowed"; } } if (empty($_POST["lname"])) { $lnameErr = "* Last name is required"; $errors = true; } else { $lname = test_input($_POST["lname"]); if (!preg_match("/^[a-zA-Z]*$/",$lname)) { $lnameErr = "* Only letters are allowed"; $errors = true; } } if (empty($_POST["email"])) { $emailErr = "* Email is required"; $errors = true; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "* Invalid email format"; $errors = true; } } if (empty($_POST["uname"])) { $unameErr = "* Username is required"; $errors = true; } else { $uname = test_input($_POST["uname"]); if (!preg_match("/^[a-zA-Z0-9]*$/",$uname)) { $unameErr = "* Only letters and numerals are allowed"; $errors = true; } } if (empty($_POST["pwd1"])) { $pwd1Err = "* Password is required"; $errors = true; } else { $pwd1 = test_input($_POST["pwd1"]); } if (empty($_POST["pwd2"])) { $pwd2Err = "* Password confirmation is required"; $errors = true; } else { $pwd2 = test_input($_POST["pwd2"]); if($pwd1 != $pwd2) { $pwd2Err = "* Passwords do not match"; $errors = true; } } // are there any errors? if ($errors == false) { $to = $_POST['email']; // this is your Email address $from = "verify@dfwit.co"; // this is the sender's Email address $fname = $_POST['fname']; $lname = $_POST['lname']; $subject = "Form submission"; $message = $fname . ":\n\n" . "Thank you for subscribing to DFW Information Technologies database services.\n\nYour login credentials are:\n\nUsername: ".$uname."\nPassword: ".$pwd1."\n\nPlease click the link below to proceed to Login screen:\n\nhttp:www.dfwit.co/index.html\n\n\n\nTech Support: techsupport@dfwit.co\nSales: sales@dfwit.co"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent. Thank you " . $fname . ", we will contact you shortly."; header("Location: www.dfwit.co/index.html"); // I put this in but it won't redirect until the mail // sends...and that's sorta slow. } else { displaypage(); exit(); } } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } function displaypage() { global $fname,$fnameErr,$lname,$lnameErr,$email,$emailErr,$uname,$unameErr,$pwd1,$pwd1Err,$pwd2,$pwd2Err; $action = htmlentities($_SERVER['PHP_SELF']); $code=<<<heredocs <form method="post" action="$action"> <input type="text" name="fname" placeholder="First Name" value="$fname"> <span class="error">$fnameErr</span><br><br> <input type="text" name="lname" placeholder="Last Name" value="$lname"> <span class="error">$lnameErr</span><br><br> <input type="text" name="email" placeholder="E-mail Address" value="$email"> <span class="error">$emailErr</span><br><br> <input type="text" name="uname" placeholder="Username" value="$uname"> <span class="error">$unameErr</span><br><br> <input type="password" name="pwd1" placeholder="Password" value="$pwd1"> <span class="error">$pwd1Err</span><br><br> <input type="password" name="pwd2" placeholder="Confirm Password" value="$pwd2"> <span class="error">$pwd2Err</span><br><br> <input type="submit" value="Submit"> </button> </form> </body> </html> heredocs; echo $code; } Please run this - it gives me the error message every time. Of course you should have fixed that by now.
  18. Ok - form looks ok. So - getting back to the error message you should be getting. With error checking turned on, I ran your 3 lines of code and I get the expected message. Why don't you? Either you are not getting to them, or the code you are posting is not what is running. Add some echos to the code and let's see what gets output before we get to the header line.
  19. Having now extracted your code and re-formatted it to read it and deciphered it, could we see the actual input form code? Q1 - why does you email use the unsanitized input values in the email instead of the ones you bothered to clean? Q2 - Do you ever receive the email? PS - I've got 12+ years on you!
  20. It does have try catch blocks. But you have written the kind of checks you neeed. You just forgot to check if you set any of them. Trick: Use an array and set a different index for each message if you have an error. Then if the array is not empty you have messages to echo. Then do a foreach loop on the array and echo out each message. Back to the previous question - what's wrong with those three lines? Not the header! Again: You can't output anything prior to a header call. You send the mail. You output your message. You (attempt to) send a header. WRONG!
  21. Hmmm - seme to have lost my response. Trying again. Tip - Why not add those tests for empty to your test function and save a whole lot of coding? Plus - why do you bother to do all the testing and not handle any errors that you find? Kind of a waste of energy, no?
  22. Programming is a very exact science. Therefore you need to be able to clearly read your own code in order to debug it. As I said above - you can't output anything prior to the header call. So - what's wrong with your code here: mail($to,$subject,$message,$headers); echo "Mail Sent. Thank you " . $fname . ", we will contact you shortly."; header("Location: www.dfwit.co/index.html");
×
×
  • 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.