-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Your example's above didn't show that, however try this <?php $text = '<?php $Hello="moo"; $BLAH_Hi="cookies"; echo "TEST"; $Query = "SELECT HIGH_PRIORITY * FROM users WHERE u_userid=\'$vp_userid\' limit 1" ?>'; $text = preg_replace_callback('/(\$.*?)[=\'"}{]/s',"toLower",$text); echo $text; function toLower($matches) { return strtolower($matches[1]); } ?> EDIT: Add }{ EDIT: #2 Read it this time! Why should limit be LIMIT ? that has nothing to do with the first post! in addition I'm not writing an whole clean up parse!
-
\w matche digets as well So [\W\D] would match be the same as [\W] 8 & 9 should have the - at the end of the set 8. [^\w@\.-]+ 9. [^\w\.@-]+
-
Topic Solved ? (bottom left button)
-
kinda need more info ~or~ Remove the page is one option, Why do you need the page if its not being viewed!
-
CV, can you help us here, of course not being psychic myself, i have no useful information to work with
-
Yes, we know that CV, but for anyone else they would need to see the code to have a clue.. shame we're not all psychic ~Sighs~.
-
Heres how i would write the line <?php echo "<a href=\"{$row['imgpath']}\" onClick=\"window.open('{$row['imgpath']}', width=350, height=350); return false\"><img src=\"'{$row['imgpath']}\" width=\"150\" alt=\"\" border=\"0\"></a>"; ?>
-
Ah Very true, I should of read it again, I thought he wanted the values lower!
-
Your welcome, but please double check my findings Again why that script exactly ? (just wondering thats all)
-
try this <?php echo '<a href="' . $row['imgpath'] . '" onClick="window.open(\'".$row['imgpath']."\', width=350, height=350); return false"> <img src="' . $row['imgpath'] . '" width="150" alt="" border="0"></a>'; ?>
-
Something like this should work, <?php $text = '<?php $Hello="moo"; $BLAH_Hi="cookies"; echo "TEST"; ?>'; $text = preg_replace_callback('/(\$.*?;)/s',"toLower",$text); echo $text; function toLower($matches) { return strtolower($matches[1]); } ?>
-
Why does it have to be that code ? In anycase i just did a little reseach and found the company is http://www.maxanet.com/ I hope that helps
-
Look at this http://php-login-script.com/ as a note i have NOT looked at the source so it could be quite bad, but should atleast should get you started
-
Topic Solved ?
-
Without seeing the API its hard to say how to implement it!
-
[SOLVED] Uhh... I'm new to PHP an I need help with sessions...
MadTechie replied to gergy008's topic in PHP Coding Help
Heres a basic example When i user logs in, you can set a session like this <?php session_start(); //connect to database and check login details //get UserID eg $row['UserName'] //set to session $_SESSION['UserName'] = $row['UserName']; ?> Now on other pages if that session is set you can check it like this <?php session_start(); if(!empty($_SESSION['UserName'])) { echo "Welcome Guest <a href=\"login.php\">Login</a>"; }else{ echo "Welcome ".$_SESSION['UserName']; } ?> -
To stop users using a page reload, i set a session to a random code, and add that value to the form in a hidden field, once thats been processed the sessions is removed, so if the form is refreshed the session and the hidden field no longer match. I assume thats what your doing.
-
Humm, i think using IN is quicker than using lots of ANDs in anycase, heres a basic conversion <?php #option 1 $string = "12 34 565 32 123"; #$result = preg_split('/\s+/', $string); $result = explode(' ', $string); $result = "id=".implode(" AND id=",$result)." AND approve=1"; echo $result; echo "<br>\n"; #option 2 $string = "12 34 565 32 123"; $string = str_replace(" ",",",$string); $result = "id IN ($string) AND approve=1"; echo $result; ?>
-
] <?php session_start(); //Must be used before accessing sessions unset($_SESSION['variable']); //remove it ?> <?php session_start(); $_SESSION = array(); if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } session_destroy(); ?> But remember i just oh Hows your encryption algorithm coming alone ?
-
try this $result = explode(' ', $string); if you have a few spaces then this maybe better $result = preg_split('/\s+/', $string);
-
What part you stuck on ? if your using sessions, you could do something like this:~ <?php session_start(); function countUsersOnline() { $count = 0; $handle = opendir(session_save_path()); if ($handle == false) return -1; while (($file = readdir($handle)) != false) { if (preg_match("/^sess/i", $file)) { if(file_exists($file)) $count++; } } closedir($handle); return $count; } ?> To display <?php $usercount = countUsersOnline(); echo $usercount; ?>
-
Add encryption would help against collisions but would weaken the whole point, its like saying keep the plain text version as well! Encrypted data can be cracked (reverted back to the original state) One way encrypted data can not be converted back for example if i used DES256 and encrypted a 400 page word document and have you the password you could get that document original contents, but it i used MD5 your have 32 character string.. you could brute force but lets be practical that's going to take years (i'm not even going to take a guess how long), its like trying to clone a human from a fingerprint.. However if you want to highly reduce the collision factor theirs a simple route, store 2 hash's each with a different salt, But with that said, i must stress that MD5 is not the only part of a log-in process allowed chartors and password length are also major parts, to breaks someones password is one thing, but to break it from a hash is another, its more likely they will try to bruteforce from the log-in screen, as they shouldn't be able to get he hash, The hash only really takes affect once your system is already compromised.
-
I have no idea what you mean!
-
SELECT SUBSTRING(`UserName`,1,1) as letter FROM `users` GROUP BY letter $result = mysql_query($query) or die (mysql_error()); $letters = array(); while( $row = mysql_fetch_array($result)) { $letters[] = $row['letter'] } Edit: never mind lol
-
#1 use code tags #2 are you doing another query before the next loop ? if not then you can move internal result pointer like this <?php mysql_data_seek($result, 0);//go back to first records while ($row = mysql_fetch_assoc($result)) { \\... ?>