Jump to content

sw0o0sh

Members
  • Posts

    151
  • Joined

  • Last visited

    Never

About sw0o0sh

  • Birthday 01/23/1991

Contact Methods

  • AIM
    timxwhite
  • Website URL
    http://projectrsc.com

Profile Information

  • Gender
    Male
  • Location
    Massachusetts

sw0o0sh's Achievements

Member

Member (2/5)

0

Reputation

  1. I'd like to say the issues been figured out. header('Content-type: text/html; charset=utf-8'); Seemed to fix the problem regarding POST data. Thank you for the tips ChristianF
  2. I had the same results on my server when statically placing the input string as you have, however for some reason in the context of input that's being received through $_POST, it still accepts these characters as valid input.
  3. I tried your regular expression as follows, /^[ -~\\t\\n]+\\z/ It validated abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+`-=[]\{}|;':",./<>?Ĝĝ But not abcdefghijklmnopqrstuvwxyzABCDEFGHIKLMNOPQRSTUVWXYZ0123456789~!@#$%^&*()_+`-=[]\{}|;':",./<>? I even attempted to change mine with your given tips, which resulted in: /^[\x20-\x7e\t\s]+$/u But produced the same false positives as yours did (also added the u modifier to your Regex as well). Still not sure what the proper solution may be.
  4. I'll check that out soon, thank you for some of the tips. I had setup a test page (using a textarea) to send data to the regular expression. The php... <?php $response = isset($_POST['post']) ? $_POST['post'] : null; $result = null; if ( $response !== null ) { $response = trim($response); if ( preg_match('/^[\x20-\x7e\t\s]+?$/', $response) ) { $result = 'string length: ' . strlen($response) . ' Validated input ' . $response; } else { $result = 'nope'; } } ?> <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="style/base.css" /> <link rel="stylesheet" type="text/css" href="style/xform.css" /> </head> <body> <?php echo $result; ?> <div class="xform"> <form method="post" action=""> <div class="inxform"> <fieldset> <legend>Message</legend> <div class="overlay"> <textarea name="post"><?php echo isset($_POST['post']) ? $_POST['post'] : null; ?></textarea> </div> <div class="overlay"> <input type="submit" name="submit_post" value="Post" /> </div> </fieldset> </div> </form> </div> </body> </html> For example, it'd validate īĬĭ and strange characters like that, but not , and so on and so forth with many random characters, that I had generated with the following code... <?php for( $i=0; $i < 1000; $i++) echo "&#" . $i . ";"; ?> So of course all the weird false positives had thrown me off that expression altogether when I was certain I was doing it right. I'm not sure if something else is causing it, as you say the initial expression should in theory work.
  5. Hi, I'm trying to make something that ensures that certain input is only between a specified range. Specially \x20 trough \x7e, as seen on chart: I came up with the expression, (using preg_match) /^[\x20-\x7e\t\s]+?$/ Which seemed to work at first, though leakage is occurring somewhere? I would only like to allow \x20-\x7e (\x20-\x7e), tab's, spaces and new lines (\t\s), and while it does seem to block out some characters that are not of that range, some still do slip through and I am unsure how. Can anyone see the problem here?
  6. post_max_size = 8M that's what mine says, I'm going to say yes and assume you need something there
  7. Does the uploads directory have the permissions to write files?
  8. Why do you have form tags nested within eachother?
  9. Store the options in an array and loop through them to output or implode
  10. Hi, I am working on a query for a highscores feature, that shows the amount of "kills" a certain player has made. Here is an example of the main table format: rsca2_players, which has the columns .user, .pass, .join_time, etc It stores their kills in a table called rsca2_kills, which has a common column .user, the person they killed: .killed, the .time it happened, etc. So naturally, if a user gets a lot of kills, they have a lot of rows in the rsca2_kills table. What I am trying to do is make it so I get a query that returns who has the most kills, (their .user id), and the COUNT of the kill rows. Is there any way to do this? I made a query but it never finishes loading, I'm assuming it is not efficient? Is there something else that can be done to make this work?
  11. nevermind, seems to have worked with: var pattern = /class\=\"(.*)\"/i; However it returns two matches, the second one being most appropriate(it returned class="sprite", and sprite). Perhaps knowing how to make it more specific would be useful but I'd say it's solved.
  12. I've used preg_match() in PHP but I can't seem to figure out how to accomplish what I need to do with JavaScript. I've checked out a lot of RegExp tutorials but don't understand still how to capture something between quotes and then make it act as a variable. For instance, <img src="image.gif" class="image_01" alt="sample image" /> I'm trying this but it's not working <script type="text/javascript"> function runCheck() { var data = document.getElementById("test").innerHTML; var pattern = /class\=\'(.*)\'/; var checkSprite = data.match(pattern); alert(checkSprite); } </script> I'm trying to grab what is inside of "class=''"
  13. function time_ago($timestamp) { //$months = array("Jan" => 31, "Feb" => 28, "Mar" => 31, "Apr" => 30, "May" => 31, "Jun" => 30, "Jul" => 31, "Aug" => 31, "Sept" => 30, "Oct" => 31, "Nov" => 30, "Dec" => 31); $curr_time = time(); $time_ago = $curr_time - $timestamp; if($time_ago < 60) // seconds { $ext = $time_ago . " seconds ago.."; } else { if($time_ago >= 60) // minutes { $time = floor($time_ago / 60); $seconds_remainder = $time_ago % 60; $ext = $time . " minutes " . $seconds_remainder . " seconds ago.."; if($time >= 60) // hours { $hours = floor($time / 60); $minutes = $time % 60; $ext = $hours . " hours " . $minutes . " minutes ago.."; if($hours >= 24) // days { $days = floor($hours / 24); $day_hours = $hours % 24; $ext = $days . " days " . $day_hours . " hours ago .."; } } } } return $ext; } Is there a cleaner approach to this?
×
×
  • 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.