Jump to content

scootstah

Staff Alumni
  • Posts

    3,858
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by scootstah

  1. This seems to work: http://jsfiddle.net/KkkA3/
  2. mysql_query("INSERT INTO table (col1, col2, col3) VALUES ('" . $col1 . "', '" . $col2 . "', '" . $col3 . "')");
  3. Real basic example: the function function load_template($template, $vars = array()) { if (is_readable($template)) { extract($vars); require $template; } } call it $vars = array( 'description' => $row['description'], 'name' => $row['name'], 'leechers' => $row['leechers'], 'owner' => $row['owner'], 'filename' => $row['filename'], 'nunx' => $row['nunx'], 'seeders' => $row['seeders'] ); load_template('test.php', $vars); use it in a template <div> <?php echo $description; ?> </div>
  4. Something like $required = array( 'firstname' => 'You must enter a first name', 'lastname' => 'You must enter a last name', 'username' => 'You must enter a username', 'password' => 'You must enter a password' ); $errors = array(); foreach($required as $field => $error) { if (empty($_POST[$field])) { $errors[$field] = $error } }
  5. This is not what eval is for, so don't use it that way. There are better ways to parse templates. Or better yet, just use PHP in the template as that stuff just adds unnecessary overhead.
  6. All it takes is running a few million miles of optical cable to tens of thousands of data centers around the world from your personal computer and you can have free internet. Or... Millions of people buy a fancy wireless antenna and connect to other wireless antennas creating a wireless network. Like I said, the government regulates that.
  7. You're doing more work for no reason. You can just do <?php if(condition): ?> <some html> <?php endif; ?>
  8. You could, but once you send it to the browser you can't take it away again when PHP is done processing. PHP doesn't have any way to tell you that it is done in the first place. Where are the images coming from to start with?
  9. A spinner gif is only going to work if you're running it through AJAX or something.
  10. You're going to have to split them at the comma first. Try this: $numbers = "32|22|22,32|22|21"; foreach(explode(',', $numbers) as $num_set) { $num_array = array_unique(explode('|', $num_set)); if (count(num_array) < 3) { $std->Error2("You cannot pick 2 numbers with the same ticket"); break; } }
  11. GD functions are just intense, they take a little while. It's best to make it in such a way that they need not be run often. For example don't resize pictures on every page load, resize them once and then save them in the resized state.
  12. But that would change the user's input and it may no longer match. If the jackpot was 3|1|2 and they entered 3|1|2, changing the numerical order would make it 1|2|3 and thus not a match.
  13. If you use jQuery, jwysiwyg is pretty good. If you need something with more features, try CKEditor.
  14. The problem here is that the government controls the means to do that.
  15. There may be times a website doesn't run on port 80, so that wouldn't be 100% accurate.
  16. I really wish lawmakers knew what the hell they were talking about for once. I think the year 2012 is going to drastically change the internet as we know it.
  17. What is it supposed to do?
  18. Interesting approach. But I'm glad I'll never have to debug that.
  19. If you separate each email with a comma you can send emails to multiple people. mail('[email protected], [email protected], [email protected]', 'subject', 'body');
  20. Try echo mysqli_error($conn);
  21. Doesn't the PHP engine essentially minify the script at run-time anyway?
  22. Why not just use mysqldump and make this 100x easier? exec("mysqldump -u root --all-databases > backup.sql");
  23. So let's say you have a form that saves user input to a database and then displays it somewhere else on the website. Let's say it's a comment form. So John comes along and types this as his comment: <script>alert("I'm John");</script> Now every user that views that comment will have an alert box pop up. One of the biggies here is being able to steal or alter cookies. John could potentially steal your login cookie and become you. He could also do all kinds of malicious things on the page to try to infect people with malware. As for protecting against it, you have two options. You can either convert HTML characters to entities so that the HTML is not parsed, which (should) protect against XSS. The other option, say if you want to actually display user-submitted HTML, is to filter out anything that can be used maliciously as XSS. Doing that is pretty complicated so if that's the route you want to take, I would recommend HTML Purifier.
  24. Change $user_offset = date('h:i a M/d', $time); To $user_offset = date('g:i a M/d', $time);
×
×
  • 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.