lucas_robb Posted November 19, 2013 Share Posted November 19, 2013 Hey All, I'm having difficulty as I would like to create a simple HTML page that will create for me new RADIUS users. Can someone help me pass text from the HTML page into the PHP script. I'm trying to setup new users for radius, I can figure out the server side but what I want is to have PHP input a username and a password (masked) and a button that activates the script which will then append to the bottom of a file '$username NT-Password=: "$NTLMHash". Can anyone provide any suggestions? I'm already running a php script and html page found here: upload.lucasrobb.com so I know PHP server works Thank you, Quote Link to comment https://forums.phpfreaks.com/topic/284077-html-and-php-page-for-radius-user-creation/ Share on other sites More sharing options...
lucas_robb Posted November 20, 2013 Author Share Posted November 20, 2013 Hello all I hunted around and I thought... if I were to use this code to hash my password the way I need, would it work? <?php function MD4Hash($_POST["password"]) { // Convert the password from UTF8 to UTF16 (little endian) $_POST["password"]=iconv('UTF-8','UTF-16LE',$_POST["password"]); // Encrypt it with the MD4 hash $MD4Hash=bin2hex(mhash(MHASH_MD4,$_POST["password"])); // Return the result return($MD4Hash); } ?> Also, how would I then move on to use the $MD4Hash as a variable inside of my edited file later on? Quote Link to comment https://forums.phpfreaks.com/topic/284077-html-and-php-page-for-radius-user-creation/#findComment-1459097 Share on other sites More sharing options...
QuickOldCar Posted November 21, 2013 Share Posted November 21, 2013 Try the following code. <?php function MD4Hash($post_password) { // Convert the password from UTF8 to UTF16 (little endian) $post_password=iconv('UTF-8','UTF-16LE',$post_password); // Encrypt it with the MD4 hash $MD4Hash=bin2hex(hash(md4, $post_password)); // Return the result return($MD4Hash); } //you may want to do additional checking on the post values $post_password = trim($_POST["password"]); echo MD4Hash($post_password); ?> Quote Link to comment https://forums.phpfreaks.com/topic/284077-html-and-php-page-for-radius-user-creation/#findComment-1459313 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.