Jump to content

unkwntech

Members
  • Posts

    447
  • Joined

  • Last visited

Everything posted by unkwntech

  1. Personaly assuming you don't need any advanced query options then just do a preg_replace('/ /', '%', $searchPhrase); This will replace all the spaces with the MySQL wildcard character, this is not the best way (or even nesicarily a good one) but it works well enough for phrases.
  2. Same result, but not surprising as the only difference between yours and mine was the content-type header.
  3. You just need to add a default: to your switch switch($cmd) { case 1:$file="main.php"; break; case 2:$file="signup.php"; break; default: //not avail break; }
  4. I have the following code //There were no emails so we need to send the email to Jarrod and tell the user it was sucessful. $message = 'A quote was requested from your website today (' . date('D, JS') . 'of' . date('F Y') . ' at ' . date('g:i A') . ".\r\n"; $message .= 'Name: ' . $_POST['firstName'] . ' ' . $_POST['lastName'] . ".\r\n"; $message .= $_POST['firstName'] . ' can be contacted at ' . $_POST['phoneNumber'] . ".\r\n"; $message .= 'The best time to contact this person is between ' . $_POST['time1'] . ' and ' . $_POST['time2'] . ".\r\n"; $message .= "They said they need:\r\n" . $_POST['body'] . "\r\n\r\n"; $headers = 'From: EMAIL-REMOVED' . "\r\n" . 'Reply-To: EMAIL-REMOVED'; if(mail('EMAIL-REMOVED', 'Quote Requested', $message, $headers)) { echo 'Message sent'; } else { echo 'Message failed'; } I have already validated the post values at this point, and I am seeing message sent but the message has not arrived at either email address specified, did I miss something?
  5. There was an extra ) and the line numbers were wrong because of the PHP at the top of the file.
  6. The if in the above code will always return TRUE because you are adding the ? just do this: <?php if(preg_match('/\.php\?/', $_SERVER['REQUEST_URI'])) { die('oi oi oi oi no no no no no'); }
  7. I probably can but first I would have to understand your question, what is you the input you are expecting and what are you trying to do with it?
  8. This is my form validation function and the basic form, when I use this code I am getting the following error: I added a comment to line 41 to show where it is, what am I doing wrong. ...SNIP... <head> ...SNIP... <script src="jquery.js" type="text/javascript"></script> <script type="text/javascript"> function validateForm() { names = /[\w ]/i; if(!$('firstName').val().match(names)) { //First name does not match the required format $('firstNameError').html() = 'You must enter your first name and it must only contain letters and spcaes!'; } if(!$('lastName').val().match(names)) { //Last name does not match the required format $('lastNameError').html() = 'You must enter your last name and it must only contain letters and spcaes!'; } if(!$('phoneNumber').val().match('/\(?[\d]{3}\)?[ -]?[\d]{3}[ -]?[\d]{4}/')) { //LINE 41 //Phone number does not match any acceptable format $('phoneNumber').html() = 'You must enter you full 10 digit phone number!'; } if($('time1').val() > $('time2')).val()) { //Start time cannnot be before the end time $('timeError').html() = 'The start time must not be after the end time'; } } </script> ...SNIP... <p>If you'd like to get a quote fill out this simple form and we will get back to you as soon as posible.</p> <form name="quote" method="post" action="quoteProcessor.php"> <font color="red"><div id="firstNameError"></div></font> <p>First Name <input type="text" name="firstName" id="firstName"> </p> <font color="red"><div id="lastNameError"></div></font> <p>Last Name <input type="text" name="lastName" id="lastName"> </p> <font color="red"><div id="phoneNumberError"></div></font> <p>Phone Number <input type="text" name="phoneNumber" id="phoneNumber"> </p> <font color="red"><div id="timeError"></div></font> <p>Best Time to Call is between <select name="time1" id="time1"> <option value="7">7am</option> ...SNIP... <option value="21">9pm</option> </select> and <select name="time2" id="time2"> <option value="7">7am</option> ...SNIP... <option value="21">9pm</option> </select> </p> <font color="red"><div id="descriptionError"></div></font> <p>Short Description of your needs<br /> <textarea cols="45" rows="10" name="body" id="body"></textarea> </p> <font color="red"><div id="recaptchaError"></div></font> <p><?php echo recaptcha_get_html($publickey); ?></p> <p> <label> <input type="submit" value="Submit"> </label> </p> </form> ...SNIP...
  9. I'm hoping a few people would look over this script and tell me if I missed any potential security issues. I have left out only the client authentication script so authentication is required to access this API. http://pastebin.com/d748dc1cf
  10. That is true but still does not explain the error as it states argument 1, is this just a PHP bug?
  11. So i'm getting this error which seem entirly backwords, any ideas whats going on? Error: Catchable fatal error: Argument 1 passed to siteMS::logger() must be an instance of string, string given Offending line: $this->logger('Invalid page name requested', 0, 0, $pageName); Definition of logger: private function logger(string $message, int $line, string $file, string $extra=null) {...}
  12. $item = '1, 2, 3, 4, 5, 6, 7, 8, 9'; $items = explode(',', $item); $items will be an array with each number in it. edit: no regex needed
  13. <a href="yourlink" target="_blank" onmouseover"javascript:location.href='link';">link</a>
  14. True, but that's why I got out of the web-design business and stick to the back-end stuff.
  15. Screw the w3c standards, target="_blank" works that's all that matters.
  16. It meas that line 61 ($numresults=mysql_query($query) is does not contain a valid query. Did you connect to the DB server and select a BD Side Note: There is still a potentail security problem there. change LIKE \"%$trimmed%\" ORD to LIKE \"%" . mysql_real_escape_string($trimmed) . "%\" ORD
  17. <?php session_start(); if ($_SESSION['download']) { header('Content-Disposition: attachment; filename="file.ext"'); readfile('path/to/file.ext'); } ?>
  18. Those characters are unicode so you will need to handle that.
  19. what is the format of the file, can you give an example with any private data *** out.
  20. I have this script: http://pastebin.com/m73d014e3 (sry its to long to post here) It is mostly working fine except that it is not getting sub-directories even though I tried to work that out at line 31. All help is appreciated.
×
×
  • 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.