n0isy Posted April 23, 2011 Share Posted April 23, 2011 I am making script that will include 2 files , 1. with the cracked hashes and 2. with the usernames and hashes 1. file is like : hash:salt:password , and 2. file is like is username:hash:salt I want that the script loop through the 1.. file with hash:salt:password and replace every hash:salt with the password in 2. file I have written something but it isnt working for me <?php $usernames=file_get_contents('users.txt'); $cracked=file('cracked.txt'); foreach($cracked as $cracked_line){ $hashes_explode=explode(":",$cracked_line); $hash_salt="$hashes_explode[0]:$hashes_explode[1]"; $plain_password=str_replace($hash_salt,$hashes_explode[2],$usernames); print $plain_password; } print $plain_password; ?> Link to comment https://forums.phpfreaks.com/topic/234518-str_replace-problem/ Share on other sites More sharing options...
fugix Posted April 23, 2011 Share Posted April 23, 2011 the foreach loop will only work to iterate arrays.. Link to comment https://forums.phpfreaks.com/topic/234518-str_replace-problem/#findComment-1205236 Share on other sites More sharing options...
Pikachu2000 Posted April 23, 2011 Share Posted April 23, 2011 This doesn't exactly sound legitimate. Link to comment https://forums.phpfreaks.com/topic/234518-str_replace-problem/#findComment-1205241 Share on other sites More sharing options...
n0isy Posted April 24, 2011 Author Share Posted April 24, 2011 so , can you help me or ... Link to comment https://forums.phpfreaks.com/topic/234518-str_replace-problem/#findComment-1205394 Share on other sites More sharing options...
Pikachu2000 Posted April 24, 2011 Share Posted April 24, 2011 No. Link to comment https://forums.phpfreaks.com/topic/234518-str_replace-problem/#findComment-1205407 Share on other sites More sharing options...
Recommended Posts