Jump to content

ginerjm

Members
  • Posts

    6,906
  • Joined

  • Last visited

  • Days Won

    99

Everything posted by ginerjm

  1. 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.
  2. Perhaps it doesn't like your from address. Drop the <>
  3. 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?
  4. It apparently is an add-on to standard php. You'll have to find someone who uses this add-on for help.
  5. 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?
  6. 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
  7. ALL YOU HAVE TO DO IS TAKE OUT THAT ECHO LIKE I'VE SAID 3 TIMES!
  8. The error shows on the client screen. Take out the echo and you will remove your problem
  9. 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?
  10. 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.
  11. 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.
  12. 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!
  13. 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!
  14. 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?
  15. 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");
  16. And you aren't seeing an error message? The error is you cannot execute a header command once you have output something. Which you are doing right after your mail() call.
  17. sign? sign=signature. Did you add those lines to the beginning of your php code? Could we see it?
  18. If you would turn on php error checking (see my sign.) you would see the reason that you don't see anything. It's not the email holding you up. It is the error you are generating.
  19. Your script should send the email and then continue on with its responsibilities, namely providing the user with some sort of response. What are you doing in your script now?
  20. From the manual: domain The domain that the cookie is available to. Setting the domain to 'www.example.com' will make the cookie available in the www subdomain and higher subdomains. Cookies available to a lower domain, such as 'example.com' will be available to higher subdomains, such as 'www.example.com'. Older browsers still implementing the deprecated ยป RFC 2109 may require a leading . to match all subdomains. Not sure what this means 'higher subdomains'. I always think of a sub as 'lower'. IIRead this correctly it says that a cookie in www.xyz.com will be available in xyz.com as well.
  21. I'm not sure but I think that www.xyz.com is the same as xyz.com. Somehow. The 'true' subdomains tho are different. Either way if you begin in a specific domain name and set some cookies in the root folder they will be there for any users of said domain. What else could you want? In what world would you need cross-referencing of them between apps running in different domains?
  22. Yes I am. And I see now how confusing my answer was to you. IF I had bothered to check first I would have said that the \ in the 4th argument would ensure that your cookies would be in the correct place regardless of what domain name was in $site. The cookies will be in the domain root because of the \ although the absolute path of that location will be different depending upon the current $site/domain value.
  23. Why don't you read the manual re: cookies? You do read the manual when you have questions first, don't you?
  24. I think that a simple \ should work. It will represent the root folder of whatever the domain is pointing to, no?
  25. It doesn't look like anything to me. Ancient deprecated html code too. Probably copied from somewhere. Oh, well....
×
×
  • 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.