Jump to content

Landslyde

Members
  • Posts

    93
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Landslyde

  1. A1: My bad. I have now changed that. A2: Yes You started programming in '72? Amazing. Languages have come a long way since COBOL Here is my entire page. If you find errors, do not shout at me. I loathe being shouted at. <!DOCTYPE html> <html> <head> <title>DFW Information Technologies</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="generator" content="Bluefish 2.2.5" > <meta name="author" content="Landslyde" > <meta name="date" content="2015-01-25T17:49:28-0600" > <meta name="copyright" content=""> <meta name="keywords" content=""> <meta name="description" content=""> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8"> <meta http-equiv="content-style-type" content="text/css"> <meta http-equiv="expires" content="0"> <link href="style/index.css" rel="stylesheet"> <!--[if lt IE 9]> <script scr="html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> </head> <body> <h1>DFW Information Technologies</h1> <img class="img1" src="images/blue_world.jpeg" width="225" height="225"> <div class="gradientbuttons"> <ul> <li><a href="index.html">Home</a></li> <li><a href="about.html">About Us</a></li> <li><a href="services.html">Services</a></li> <li><a href="register.php">Register</a></li> <li><a href="client.php">Client Area</a></li> <li><a href="contact.html">Contact Us</a></li> </ul> </div> <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); $fnameErr = $lnameErr = $emailErr = $unameErr = $pwd1Err = $pwd2Err = ""; $fname = $lname = $email = $uname = $pwd1 = $pwd2 = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["fname"])) { $fnameErr = "* First name is required"; } else { $fname = test_input($_POST["fname"]); if (!preg_match("/^[a-zA-Z]*$/",$fname)) { $fnameErr = "* Only letters are allowed"; } } if (empty($_POST["lname"])) { $lnameErr = "* Last name is required"; } else { $lname = test_input($_POST["lname"]); if (!preg_match("/^[a-zA-Z]*$/",$lname)) { $lnameErr = "* Only letters are allowed"; } } if (empty($_POST["email"])) { $emailErr = "* Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "* Invalid email format"; } } if (empty($_POST["uname"])) { $unameErr = "* Username is required"; } else { $uname = test_input($_POST["uname"]); if (!preg_match("/^[a-zA-Z0-9]*$/",$uname)) { $unameErr = "* Only letters and numerals are allowed"; } } if (empty($_POST["pwd1"])) { $pwd1Err = "* Password is required"; } else { $pwd1 = test_input($_POST["pwd1"]); } if (empty($_POST["pwd2"])) { $pwd2Err = "* Password confirmation is required"; } else { $pwd2 = test_input($_POST["pwd2"]); if($pwd1 != $pwd2) { $pwd2Err = "* Passwords do not match"; } } $to = $email; // this is your Email address $from = "verify@dfwit.co"; // this is the sender's Email address $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. } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>"> <input type="text" name="fname" placeholder="First Name" value="<?php if (isset($_POST['fname'])) { echo $fname; } ?>"> <span class="error"> <?php echo $fnameErr;?></span><br><br> <input type="text" name="lname" placeholder="Last Name" value="<?php if (isset($_POST['lname'])) { echo $lname; } ?>"> <span class="error"> <?php echo $lnameErr;?></span><br><br> <input type="text" name="email" placeholder="E-mail Address" value="<?php if (isset($_POST['email'])) { echo $email; } ?>"> <span class="error"> <?php echo $emailErr;?></span><br><br> <input type="text" name="uname" placeholder="Username" value="<?php if (isset($_POST['uname'])) { echo $uname; } ?>"> <span class="error"> <?php echo $unameErr;?></span><br><br> <input type="password" name="pwd1" placeholder="Password" value="<?php if (isset($_POST['pwd1'])) { echo $pwd1; } ?>"> <span class="error"> <?php echo $pwd1Err;?></span><br><br> <input type="password" name="pwd2" placeholder="Confirm Password" value="<?php if (isset($_POST['pwd2'])) { echo $pwd2; } ?>"> <span class="error"> <?php echo $pwd2Err;?></span><br><br> <input type="submit" value="Submit"></button> </form> </body> </html>
  2. Yeah. IMHO, php should have try-catch blocks. I have your error-catching code installed in my script and still see no errors thrown. And you're right about programming being an exact science. I've been doing it since '83, but am very new to php and am skinning my knees and banging my head as I go along
  3. I guess I need to do away with the header call, the redirect. Right?
  4. But I can't do the redirect before the mail call, right? I'm new to php, and that must be obvious to you by now. But I'm trying.
  5. Yes, of course "we" can see it... <?php error_reporting(E_ALL | E_NOTICE); ini_set('display_errors', '1'); $fnameErr = $lnameErr = $emailErr = $unameErr = $pwd1Err = $pwd2Err = ""; $fname = $lname = $email = $uname = $pwd1 = $pwd2 = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["fname"])) { $fnameErr = "* First name is required"; } else { $fname = test_input($_POST["fname"]); if (!preg_match("/^[a-zA-Z]*$/",$fname)) { $fnameErr = "* Only letters are allowed"; } } if (empty($_POST["lname"])) { $lnameErr = "* Last name is required"; } else { $lname = test_input($_POST["lname"]); if (!preg_match("/^[a-zA-Z]*$/",$lname)) { $lnameErr = "* Only letters are allowed"; } } if (empty($_POST["email"])) { $emailErr = "* Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "* Invalid email format"; } } if (empty($_POST["uname"])) { $unameErr = "* Username is required"; } else { $uname = test_input($_POST["uname"]); if (!preg_match("/^[a-zA-Z0-9]*$/",$uname)) { $unameErr = "* Only letters and numerals are allowed"; } } if (empty($_POST["pwd1"])) { $pwd1Err = "* Password is required"; } else { $pwd1 = test_input($_POST["pwd1"]); } if (empty($_POST["pwd2"])) { $pwd2Err = "* Password confirmation is required"; } else { $pwd2 = test_input($_POST["pwd2"]); if($pwd1 != $pwd2) { $pwd2Err = "* Passwords do not match"; } } $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. } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> Tired of whiting out my site.
  6. I'm on Linux and use Bluefish editor. When I run this php file, I have to send it to the localhost. I just added your "sign" information and ran the file again. I see no errors. Nothing advises me of an error. What error do you see? Landslyde
  7. I send my entire script because I may have something in the wrong place concerning the email and redirect. <?php $fnameErr = $lnameErr = $emailErr = $unameErr = $pwd1Err = $pwd2Err = ""; $fname = $lname = $email = $uname = $pwd1 = $pwd2 = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["fname"])) { $fnameErr = "* First name is required"; } else { $fname = test_input($_POST["fname"]); if (!preg_match("/^[a-zA-Z]*$/",$fname)) { $fnameErr = "* Only letters are allowed"; } } if (empty($_POST["lname"])) { $lnameErr = "* Last name is required"; } else { $lname = test_input($_POST["lname"]); if (!preg_match("/^[a-zA-Z]*$/",$lname)) { $lnameErr = "* Only letters are allowed"; } } if (empty($_POST["email"])) { $emailErr = "* Email is required"; } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $emailErr = "* Invalid email format"; } } if (empty($_POST["uname"])) { $unameErr = "* Username is required"; } else { $uname = test_input($_POST["uname"]); if (!preg_match("/^[a-zA-Z0-9]*$/",$uname)) { $unameErr = "* Only letters and numerals are allowed"; } } if (empty($_POST["pwd1"])) { $pwd1Err = "* Password is required"; } else { $pwd1 = test_input($_POST["pwd1"]); } if (empty($_POST["pwd2"])) { $pwd2Err = "* Password confirmation is required"; } else { $pwd2 = test_input($_POST["pwd2"]); if($pwd1 != $pwd2) { $pwd2Err = "* Passwords do not match"; } } $to = $_POST['email']; // this is your Email address $from = "verify@mysite.com"; // 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 my 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.mysite.com/login.php\n\n\n\nTech Support: techsupport@mysite.com\nSales: sales@mysite.com"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent. Thank you " . $first_name . ", we will contact you shortly."; header("Location: www.mysite.com/thankyou.html"); // I put this in but it won't redirect until the mail // sends...and that's sorta slow. } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?> Am I doing something wrong? Landslyde
  8. After 13 years of laboring over this, I finally got my form fixed today. Just two issues left: 1) Upon form submission, an email is sent out to the user. How do I redirect them to a Thank-You page so they don't have to stare at the Registration screen while the email is being sent out, as this seems to be a little slow. 2) In the body of these emails is a link to click to go to the Login screen. This works fine. However, I also provide them with two email addresses. How do I make them clickable (like the web link)? $message = $fname.":\n\n"."Thank you for subscribing to my services.\n\nYour login credentials are:\n\nUsername: ".$uname."\nPassword: ".$pwd1."\n\nPlease click the link below to proceed to Login screen:\n\nwww.mySite.com/login.php\n\n\n\nTech Support: techsupport@mysite.com\nSales: sales@mysite.com"; Thanks for your help, Landslyde PS: Just kidding abt the 13 years...only took 12
  9. Will someone, who doesn't mind helping an old man understand some things, explain how to use PHPMailer? You see, I downloaded a registration form that sends a verification e-mail. I'm testing all of this on my local machine (Linux). The mail, of course, fails to be delivered. So I surf around and see where phpmailer can help me with this. So I downloaded phpmailer-master. But I have absoultely no idea where to put what so I'll have e-mail capability from localhost. If you can tell me what goes where, I promise to name my next child after ya I just need some guidance on this one. It has me totally confused! Landslyde PS: Happy 2015 to all!
  10. Thanks LeJack and QuickOldCar. My PHP adventure begins now. See y'all around.
  11. QuickOldCar: LeJack: God bless both of you!! I now have PHP the way the rest of the world does! Everything works! You guys meet me at Joe's in an hour...the drinks are on me! I installed Lamp, although I removed MySQL and reinstalled MariaDB, watched a video shot to me by LeJack and...lol...the rest is history! I will be a contributor here for a long time to come. This is the most helpful forum I've ever been on. PHPFreaks ROCKS!! Thanks again I do have one more question though: Do I have to store all of my php files in var/www/html for testing? They can't be somewhere on my Desktop in a folder? I ask because I can access regular html files from a desktop folder and use them...but it seems php is a special case. Just wondering.
  12. I just installed LAMP through the use of tasksel as suggested by QuickOldCar. I get the same thing!! When I run the info.php file, which, again, consists of one line <?php phpinfo(); ?> that line is what I see on the webpage. Why won't this work? I mean I formatted my drive today and started from scratch! Then installed LAMP, the same things I already had installed, and it still refuses to cooperate!! This is crazy. And once again, I'm open to suggestions...up to and including blowing up my laptop!
  13. Yeah. I appreciate all of you guys helping me. But I'm going to throw in the towel on this and forget abt PHP altogether. You see, only a couple hours ago I updated and upgraded. Nothing brought me closer to being able to PHP like the rest of the world does. And my fight with this has been two very very long days. But while I have no love whatsoever for JSP, at least it works for me on NetBeans. So I guess that's the way I'll go. Thanks again for all your help...all of you. LOL! Just when I closed this I had a new msg from QuickOldCar (hope it's a Mustang!). So, out of respect, I'll install LAMP and see where it takes me. I'll post again on this.
  14. What's tasksel? I ask because this command isn't found on Linux Mint. Should I just use: sudo apt-get install lamp-server ? woogi@woogi-VPCEH1AFX ~ $ sudo tasksel install lamp-server [sudo] password for woogi: sudo: tasksel: command not found Also, will I need to purge and autoremove apache2 before installing it with LAMP?
  15. Debian doesn't use the httpd.conf file. I had read that it uses appache2.conf, but I checked for what you told me to look for and it isn't there. I checked not only that file but all files in all the folders in that dir. Now what?
  16. Yes, I get the default Apache page. But no, I haven't edited any files, Apache or otherwise. From your question, I think I was suppose to. But I wldn't know where to start
  17. Sorry. Linux Mint is Debian, so the install was sudo apt-get. After installing my OS, I installed apache2, php5 and a few others like MariaDB. All were installed separately from one another. In other words, I didn't use LAMP.
  18. First thing: I formatted my drive today and fresh installs of Apache2, PHP5 and MariaDB on Linux Mint 17.1. No files have been messed with. Not one. I created info.php and placed it in var/www dir. The file consists of one line: <?php phpinfo(); ?> When I run it our of my web editor (Bluefish), instead of showing me on my web browser the PHP info page that's suppose to show, I get: <?php phpinfo(); ?> I've been fighting this for two days! Done everything suggested by many others online...and that's why I had to scrub my drive; forgot all the files I augmented. Does anyone know why my PHP files behave this way? I'd love to start working with PHP, but I can't until whatever's broken is fixed. Any ideas? Any suggestions? I'm at my wit's end with this. Landslyde
×
×
  • 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.