jsnewbie Posted August 23, 2013 Share Posted August 23, 2013 Page 460 - step 11, last paragraph: ...after running it through sanitizing functions to make it safe... ..after confirming that it's a syntactically valid email address. I think I can do the latter, with the help of Regular Expressions, but I need a hand (no, I don't need the code written for me, I prefer to write it myself) with how to sanitize comments. I know I would need to remove HTML tags but what else is there? I've been looking at W3Schools (yes, I'm that desparate! I don't have a book that contains cogent information on how to code/program in PHP) as well as other website tutorials. They're all incomplete in some form or other but they at least give me some idea how to format a PHP script/program. Side Note: I'm extremely dismayed at the _lack_ of information on how to connect a PHP script/program to a Microsoft SQL Server Express database. Yes Yes, PHP and MySQL are ".join()"ed at the hip but with the ample availability of SQL Server Express, you'd think someone would've picked up on this and wrote some sample PHP code for Microsoft's platform...regardless of how they feel about the company and leader(s). My intention is not to start a "m$ war" so if you intend on responding, please do so with proof/links to back up your defense. Link to comment Share on other sites More sharing options...
Larry Posted August 23, 2013 Share Posted August 23, 2013 I would use the filter_var() function to make sure the email address is syntactically valid. Use strip_tags() to make the comments safe to use. Link to comment Share on other sites More sharing options...
jsnewbie Posted August 24, 2013 Author Share Posted August 24, 2013 Thank you. Much appreciated. Link to comment Share on other sites More sharing options...
jack-the-lad Posted January 24, 2014 Share Posted January 24, 2014 Hi Larry After running the example provided on page 460 section 11 I get the following error: Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\html\xperiment\raw-js\modern-js\ch-11\resources\contact.php on line 2 Here is my Code: <?php # Script 13.3 - login.phpmail('jack.ui.maynard@gmail.com', 'Contact form Submission', $body, $from);?>The message has been sent. And here is my php.ini file : smtp section [mail function]; For Win32 only.; http://php.net/smtpSMTP = localhost http://php.net/smtp-portsmtp_port = 25; For Win32 only.; http://php.net/sendmail-fromsendmail_from = you@yourdomain; For Unix only. You may supply arguments as well (default: "sendmail -t -i").; http://php.net/sendmail-path;sendmail_path =; Force the addition of the specified parameters to be passed as extra parameters; to the sendmail binary. These parameters will always replace the value of; the 5th parameter to mail(), even in safe mode.;mail.force_extra_parameters =; Add X-PHP-Originating-Script: that will include uid of the script followed by the filenamemail.add_x_header = On; Log all mail() calls including the full path of the script, line #, to address and headers;mail.log = CAn you please advise what I have to do. Thank you. Link to comment Share on other sites More sharing options...
HartleySan Posted January 24, 2014 Share Posted January 24, 2014 Are you trying to send mail from XAMPP or some other virtual server program? Link to comment Share on other sites More sharing options...
Recommended Posts