deanb61 Posted August 5, 2007 Share Posted August 5, 2007 I jsut inherited an application. Works fine on the machine it came from. On my pc is just hangs. I've traced it to the statement: $password=encrypt($_REQUEST['password']); Which calls: //encryption function function encrypt($encrypt) { global $key; $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND); $passcrypt = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $encrypt, MCRYPT_MODE_ECB, $iv); $encode = base64_encode($passcrypt); return $encode; } php 5 and apache 2 on windows. Any ideas? Thanks, Dean Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/ Share on other sites More sharing options...
teng84 Posted August 5, 2007 Share Posted August 5, 2007 are u suing some loop in the function or any thing within that page????? Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316290 Share on other sites More sharing options...
btherl Posted August 6, 2007 Share Posted August 6, 2007 How did you trace it to that function, and exactly which line of the function does it hang on? Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316484 Share on other sites More sharing options...
neel_basu Posted August 6, 2007 Share Posted August 6, 2007 Please explain more your Problem I dont think its due to this function. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316508 Share on other sites More sharing options...
deanb61 Posted August 6, 2007 Author Share Posted August 6, 2007 How did you trace it to that function, and exactly which line of the function does it hang on? It's the login page of the application. Enter user name and password, hit the login button, and all that shows is a blank white page. I traced it to this function like so: function process_customer(){ global $sessionid, $today, $database_name; echo"<p>doing process customer</p>"; $email=strtolower($_REQUEST['email']); $pass=$_REQUEST['password']; echo" <p>password: $pass</p> "; $password=encrypt($_REQUEST['password']); echo" encrypted password "; $company=$_REQUEST['company']; $screen_width= $_REQUEST['screen_width']; $screen_height= $_REQUEST['screen_height']; echo" <p>Variables set</p> "; This first echo now appears on the blank white page, it says 'Password: fred', but nothing else, so I'm assuming the encrypt function isn't working. Although an experience programmer, I'm not a PHP expert. This is working on one machine and I just copied the files over to my machine. I had one problem where the latest version of PHP doesn't seem to work with the latest version of Apache, so I installed a previous version of appache (v2) and stayed with PHP 5, I'm not sure if the original machine is running PHP5 however. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316591 Share on other sites More sharing options...
neel_basu Posted August 6, 2007 Share Posted August 6, 2007 ECB mode doesnt need IV. But it should just ignore your $iv. I think its a strange problem if its due to that function. you can use this http://www.phpfreaks.com/forums/index.php/topic,153142.0.html . Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316594 Share on other sites More sharing options...
deanb61 Posted August 6, 2007 Author Share Posted August 6, 2007 Thanks, effectively I think that solves the problem. I don't think I have mcrypt. I thought it was just a PHP statement, not a third party tool. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316602 Share on other sites More sharing options...
neel_basu Posted August 6, 2007 Share Posted August 6, 2007 But if you dont have mcrypt it would fire Error call to undefined function mcrypt_encrypt Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316605 Share on other sites More sharing options...
deanb61 Posted August 6, 2007 Author Share Posted August 6, 2007 But if you dont have mcrypt it would fire Error call to undefined function mcrypt_encrypt Ok, I'll do a bit more digging then. I certainly haven't knowingly installed it. Just php 5 and apache. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316608 Share on other sites More sharing options...
neel_basu Posted August 6, 2007 Share Posted August 6, 2007 Have you tried taht encryption class I've just posted ?? Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316610 Share on other sites More sharing options...
deanb61 Posted August 6, 2007 Author Share Posted August 6, 2007 Have you tried taht encryption class I've just posted ?? Not yet sorry, I've been doing some more digging. On the PC where this came from, there is a file libmcrypt.dll, this does not exist on my PC. I have a database which already has passwords encrypted using mcrypt. Will it be ok to use your encryption class in this case? I'll give it a go and see. First I might just try copying the libmcrypt.dll and see if that solves the problem. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316615 Share on other sites More sharing options...
neel_basu Posted August 6, 2007 Share Posted August 6, 2007 I have a database which already has passwords encrypted using mcrypt. Will it be ok to use your encryption class in this case?No it wouldnt work with mcrypt. you need to install it correctly. First check your phpinfo() output. then uncomment your php.ini's mcrypt loader line. then restart. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316618 Share on other sites More sharing options...
deanb61 Posted August 6, 2007 Author Share Posted August 6, 2007 Thanks, yes definately the problem. I don't know why it wasn't reporting it, but mcrypt is not installed on this PC. As you probably know copying the dll didn't work, so I guess I'll have to install it properly. I'll have a look at phpinfo(), and at the php.ini. I know it's there, but I haven't looked at it at all. As I said, although I'm an experienced programmer, I don't know php. Quote Link to comment https://forums.phpfreaks.com/topic/63469-solved-encrypt-function-hangs/#findComment-316619 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.