Jump to content

Philip

Staff Alumni
  • Posts

    4,665
  • Joined

  • Last visited

  • Days Won

    20

Everything posted by Philip

  1. Umm... that would just return true/false and wouldn't grab the letter the user wants.
  2. That is the one thing I hate the most - the little tweaks and hacks to make it look/act the exact same in all the browsers (especially when I used to work with IE6 too.) But, I think jcombs hit it, front end is that instant satisfaction that you can go to sleep at night with a smile on, where as the backend you can brag about it saying "hey look, this site has 100k users using and MY code keeps them happy" Plus I like the logic side of coding.... at my full time job I don't require that much thinking, so I enjoy challenging myself to a good in-depth project from time to time.
  3. You did it write, but seeing it in color always helps: $query = 'SELECT something FROM table WHERE var = '.$var.' AND another = 1'; Have you tried echo'ing $query to see if it's what you're looking for?
  4. Is it solved or was that a mistake?
  5. "Not working" isn't very descriptive. Are you sure the page with the validation is "contact_sucess.php"? Also, make sure to use full php tags (<?php) instead of short tags (<? ) as they are turned off by default
  6. my thoughts.
  7. That means $result isn't a valid mysql result resource, or in other words mysql_query(" SELECT games.Name2 FROM games WHERE Name2 = \"$search\" ORDER BY occurrences DESC "); failed. Place a echo mysql_error(); just after you run that query and it will you give the reason why its failing.
  8. Try running this and see what you get: mysql_select_db("comics", $con); //Delete all existing entries $delete = "DELETE FROM lookup_comics WHERE UID = '$session->username'"; mysql_query($delete); if (!mysql_query($delete,$con)) { die('Error: ' . mysql_error()); } //Insert all new entries into table $sql = "INSERT INTO lookup_comics (UID, CID) VALUES "; $comics = $_POST["comics"]; $count = 0; // for debugging foreach ($comics as $cid) { $count++; // for debugging $sql .= "('$session->username', '$cid'),"; echo "Record Added: ".$session->username.", ".$cid."<br>"; } $sql = substr($sql, 0, -1); echo $sql."<br>"; mysql_query($sql); echo 'Rows we should have: ',$count,' actual rows inserted: ',mysql_affected_rows(),' and any errors: ',mysql_error(),'<br>';
  9. Something like: <?php $error_message = array(); if(($_FILES['userfile']['size'] > $_POST['MAX_UPLOAD_SIZE']) || ($_FILES['userfile']['size'] > $max_size)) { $error_message['size'] = "Upload file size too large: (<b>{$_FILES['userfile']['size']}</b>). Must not exceed {$max_size}kb."; } $array = explode(".", $_FILES['userfile']['name']); $nr = count($array); $ext = $array[$nr-1]; // I condensed all 3 of the next if's into one... since they were checking for the same thing pretty much. if(($ext !="jpg") && ($ext !="jpeg") && ($ext !="png") && ($ext !="pjpeg") && ($_FILES['userfile']['type'] != "image/jpeg") && ($_FILES['userfile']['type'] != "image/pjpeg") && ($_FILES['userfile']['type'] != "image/png") && ($info['mime'] != "image/jpeg") && ($info['mime'] != "image/pjpeg") && ($info['mime'] != "image/png")) { $error_message['format'] = "Upload file type un-recognized. Only .JPG or .PNG images allowed."; } if(count($error_message)>0) { // we had errors: foreach($error_message as $message) { echo '<strong>ERROR:</strong> '.$message.'<br>'; } // die, exit, or show form again. whatever you want here. } else { // we didn't have errors, continue with uploading // ... } ?>
  10. So, this query: INSERT INTO lookup_comics (UID, CID) VALUES ('admin', '1'),('admin', '4'),('admin', '8'),('admin', '9'),('admin', '10') Is inserting something like this in the database? : 'admin' '1' 'admin' '1' 'admin' '1' 'admin' '4' 'admin' '4' 'admin' '4' 'admin' '8' 'admin' '8' 'admin' '8' 'admin' '9' 'admin' '9' 'admin' '9' 'admin' '10' 'admin' '10' 'admin' '10'
  11. Ahhh, yes, I remember seeing this on the local news a few months ago. Lives about 30 minutes away. Sucks when it rains and your car is outside though
  12. Probably because the script is told to die right after you set $error_message
  13. No matter where you go you're going to have fees. If you choose to process through the credit card companies, they make everyone pay a small fee per transaction anyways. You also would have to worry more about security - as if something happened on your end with a breach in security you would be held liable, not paypal, google checkout or the like. I'd strongly suggest staying with one of the well known processors.
  14. Yes you could, but it wouldn't really make sense to - why reinvent the wheel?
  15. I'm sorry, that should be $i, not $int.
  16. Then change the initilization of $i to 1 instead of 0.
  17. Use a for loop. <?php // define a max define('MAX_TRIES', 99); // loop until we find one or we hit the max for($i=0, $found=false;$i<MAX_TRIES;$i++) { // format the file path $filepath = sprintf('img/%s/%s/%s-%02d.jpg', $_POST['anim_name'],$_POST['anim_name'],$_POST['date'],$int); // Check to see if it exists if(file_exists($filepath)) { // tell us it did, and set the flag to true echo 'File exists!'; $found = true; break; } } // check the glad to see if nothing was found if(!$found) { echo 'nothing was found'; } ?>
  18. Haha, gotta love Google's easter eggs.
  19. By doing that, you're showing the user you didn't want them to see that something 'valuable' is at the location they just tried to visit, but hey... it's your site
  20. Make sure this is at the top: error_reporting(E_ALL); ini_set('display_errors', TRUE); I have a sneaky suspicion it has to do with the column name in your database. First, you used 'id' now 'ID' - what is it in the db?
  21. Firefox will show the response headers a 404, but you need to show a 404 page otherwise it will be blank. I should have mentioned that earlier, sorry. As for the other part of the question, read the above quote from earlier.
  22. I like the top one, whatever that is... even if it is bigger. I like seeing the blah blah fall apart
  23. You got nothing at all? You should have at least gotten Array ( )
  24. <?php if (!isset($_POST['password']) || $_POST['password'] != "TEST") { header("HTTP/1.0 404 Not Found"); exit; } else { $name = $_POST["name"]; echo "&name=" . $name; } ?> Works just fine for me. What exactly is it doing on your end?
×
×
  • 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.