Jump to content

DarkWater

Members
  • Posts

    6,173
  • Joined

  • Last visited

    Never

Everything posted by DarkWater

  1. Well, since the value of a text input can be set with the value="" parameter, this works: <?php //assume you took care of sanitizing POST and all sorts of stuff up here printf('<input type="text" name="address" value="%s" />', (isset($_POST['address']) ? $_POST['address'] : ''));
  2. That's because your badwords() function doesn't actually do anything in its current state. Plus you're missing a ;.
  3. mod_rewrite You're basically making it appear that a user has his own page, when in reality, you're routing it back to a PHP script that accepts a GET parameter and processes it accordingly.
  4. I'm pretty sure those two things are one in the same... Therefore you have confused me. I'm reading up on all this crap, to make sure I use the best method. I meant if you planned to circumvent the built-in handlers, you would need to store your own session ID in a cookie without using the session_* functions. And that session_set_save_handler being disabled non-sense is very paranoid. Also, Wordpress and phpBB do use the standard PHP sessions. They may have some wrapper functions, but on the lowest level, it's what they're using.
  5. This is basic PHP form handling. Are you familiar with PHP at all, or are you just curious as to how they did this? ??? Basically, when the data get passed along to enquiry.php, they are put into the $_POST array. They can then use this array to populate the form fields.
  6. Nice, PFM. I forgot ! will just convert turn it to a bool value. xD
  7. <?php function int_equal_check($one, $two) { return (bool) !($one - $two); } Win.
  8. Stop putting variables in single quotes (' '). They don't interpolate in single quotes, so they're not expanded into their stored value.
  9. Why were you exploding by " " in your code, by the way? Just curious.
  10. That's a stupid interview question. <?php function int_equal_check($one, $two) { if (!($one + -$two)) { return false; } return true; }
  11. You have $File wrapped in single quotes. Remove the quotation marks.
  12. Put your sessionID in a cookie? Or use PHP's built in session handler. It's pretty simple to get working.
  13. <?php function images($link) { $info = @getimagesize($link); $types = array("image/gif", "image/jpeg", "image/png", "image/wbmp"); if (in_array($info['mime'], $types)) { return $link; } return false; }
  14. You're echoing something else out in the code somewhere after that last $count_all that is equal to 1. Since there's no newline or anything, it appears right next to it. <?php $count_all = 10; echo "$count_all $count_all $count_all"; //arbitrary code here, as long as it doesn't echo anything echo true; ?>
  15. That code that you posted in the original post should work. Which "errors" do you get?
  16. That DreamHost comment made my day. =P I remember when you had that whole conversation with one of the tech reps from DreamHost and posted it.
  17. You're storing session information in the database? And I don't see the issue here. If you're setting a cookie that expires when the browser closes, the user is no longer associated with that session data when they return. What's the problem?
  18. Kay, great. Do you know what the problem was, btw? =P Just curious.
  19. That's odd. At what point in the script are you doing that replacement? Before or after my code?
  20. Glad I could help. Do you understand what's going on in the script, or do you need anything explained?
  21. Not going to lie, that was annoying to write. xD Here, see if this works. Uncomment the first two lines and delete the example string I used. <?php //$points = "points.html"; //$getPoints = file_get_contents($points); $getPoints = "<TR> <TD>text</TD> <TD>text</TD> <TD>text</TD> <TD>text</TD> <TD>text</TD> <TD>text</TD> <TD>text</TD> <TD>text</TD> </TR>"; function odd_replace($matches) { static $count = 0; if ($count % 2 == 0) { //even $matches[1] = '<tr class="row1">'; } else { $matches[1] = '<tr class="row2">'; } $count++; $i = 1; $matches[2] = preg_replace('/<td>(.+?)<\/td>/ise', "'<td class=\"c' . \$i++ . '\">' . '\\1' . '</td>'", $matches[2]); return $matches[1] . $matches[2] . $matches[3]; } $getPoints = preg_replace_callback("/(<tr>)(.+?)(<\/tr>)/is", "odd_replace", $getPoints); echo $getPoints; >_<
  22. Does every <tr> have those 8 <td>'s in it? If every single one does, it'll make it wayyyy easier.
  23. Or: <?php $points = "points.html"; $getPoints = file_get_contents($points); function odd_replace($matches) { static $count = 0; if ($count % 2 == 0) { //even $count++; return '<tr class="row1">'; } else { $count++; return '<tr class="row2">'; } } $getPoints = preg_replace_callback("/<tr>/i", "odd_replace", $getPoints); echo $getPoints;
×
×
  • 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.