serial Posted March 6, 2007 Share Posted March 6, 2007 hi all could someone answer my question please i have made a program that makes random number but i have made another program to read this file and just get the length of the random numbers but it doesn't just get the number that i was because sometime the number might be 5 chars long and sometime it could be 12 chars long could someone help me out please here is my code <?php $pass = file_get_contents("rnd.php"); $pass1 = substr($pass, 1272, 12); echo $pass1; ?> as you can see its only getting the 12 chars when the chars could be 5 chars long. i hope i explained it ok for everyone thanks Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/ Share on other sites More sharing options...
monk.e.boy Posted March 6, 2007 Share Posted March 6, 2007 I didn't understand what you want. Have you looked at strlen()? This will tell you how long $pass is, so maybe you could do strlen( $pass ) - 12; to get the last 12 character? Is this what you wanted? monk.e.boy Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-200805 Share on other sites More sharing options...
serial Posted March 9, 2007 Author Share Posted March 9, 2007 sorry no i didn't explain it properly hat i have is a page and i have to get a certain amount of letters out of that page it goes something like this: the solution is : 17637828374 but the numbers keep changing length so it could be 12 chars one time and 6 chars the next time i was wondering if there is a function to just get the length because i start getting a < at the end of the line and then other times i don't thank you for replying Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203523 Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 can we see the code that gets < this it wrong and you must set a number for the numbers like 34567 5 numbers or 56753 3 six numbers they all got to be correct lenth. Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203529 Share on other sites More sharing options...
serial Posted March 9, 2007 Author Share Posted March 9, 2007 <?php $pass = file_get_contents("http://www.chumley.biz/modules/programming7/programming7.php"); $pass1 = substr(trim($pass), 1272, 12); $decode = md5($pass1); $url = "http://www.chumley.biz/modules/programming7/programming7.php?solution=".$decode; $sol = header("location:$url"); echo $sol; ?> this is the code but the page where i have to get the numbers keeps changing the numbers to a different length so it isn't a fixed length Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203535 Share on other sites More sharing options...
serial Posted March 9, 2007 Author Share Posted March 9, 2007 *bump* Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203674 Share on other sites More sharing options...
redarrow Posted March 9, 2007 Share Posted March 9, 2007 Try this should get only the first 5 numbers all the time. <?php $pass = file_get_contents("http://www.chumley.biz/modules/programming7/programming7.php"); $pass1 = substr(trim($pass), 1272, 12); $x = md5($pass1); $decode = substr($x,5); $url = "http://www.chumley.biz/modules/programming7/programming7.php?solution=".$decode; $sol = header("location:$url"); echo $sol; ?> Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203682 Share on other sites More sharing options...
Orio Posted March 9, 2007 Share Posted March 9, 2007 You need that number? I tested this script and it gave me the right number: <?php $find = "The number you need is: "; $url = "http://www.chumley.biz/modules/programming7/programming7.php"; $page = file_get_contents($url); $solution = intval(substr(strstr($page, $find), strlen($find))); ?> Orio. Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203688 Share on other sites More sharing options...
serial Posted March 9, 2007 Author Share Posted March 9, 2007 that was fantasic cheer guys for that!!!! Link to comment https://forums.phpfreaks.com/topic/41434-end-of-line/#findComment-203720 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.