Tuck Posted October 9, 2009 Share Posted October 9, 2009 $id1 = str_replace("STEAM_", "", $id); $id2 = explode(":", ${id1}); if (!id2[0]>=0 && !id2[0]<=5) { return false; } if (!id2[1]>=0 && !id2[1]<=9) { return false; } suppose to split STEAM_ from the id and then split whats left via ":" and then check the integers Quote Link to comment https://forums.phpfreaks.com/topic/177111-checking-string-bug/ Share on other sites More sharing options...
mikesta707 Posted October 9, 2009 Share Posted October 9, 2009 can you give a sample of what $id is supposed to look like? Quote Link to comment https://forums.phpfreaks.com/topic/177111-checking-string-bug/#findComment-933857 Share on other sites More sharing options...
Tuck Posted October 9, 2009 Author Share Posted October 9, 2009 can you give a sample of what $id is supposed to look like? http://developer.valvesoftware.com/wiki/SteamID if u cba to look STEAM_0:0:1234 Quote Link to comment https://forums.phpfreaks.com/topic/177111-checking-string-bug/#findComment-933859 Share on other sites More sharing options...
lemmin Posted October 9, 2009 Share Posted October 9, 2009 Try this: $sid = "STEAM_0:1:4321"; preg_match("/STEAM_(\d+)\d+)\d+)/", $sid, $matches); print_r($matches); $server1 = $matches[1]; $server2 = $matches[2]; $id = $matches[3]; Quote Link to comment https://forums.phpfreaks.com/topic/177111-checking-string-bug/#findComment-933860 Share on other sites More sharing options...
Tuck Posted October 9, 2009 Author Share Posted October 9, 2009 $id1 = str_replace("STEAM_", "", $id); $id2 = explode(":", ${id1}); if (!id2[0]>=0 && !id2[0]<=5) { return false; } if (!id2[1]>=0 && !id2[1]<=9) { return false; } suppose to split STEAM_ from the id and then split whats left via ":" and then check the integers found the bug forgot $ in front of arrays ;( Quote Link to comment https://forums.phpfreaks.com/topic/177111-checking-string-bug/#findComment-933862 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.