Blame view
php/change_passwd.php
886 Bytes
cf76164e6
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?php //include('../cfg/file_name.php'); $open_passwd = '../default/login_config.php'; $open_passwd_admin = '../default/admin_config.php'; if($_POST['passwd'] == $_POST['cpass']){ $hash=hash("md5",$_POST['passwd']); if($_POST['user'] == 'admin'){ $content = "<?php define('AD_ACCOUNT','admin'); define('AD_PASSWORD','".$hash."'); ?>"; $fp = @fopen($open_passwd_admin,'w') or die("Unable to open file!"); fwrite($fp, $content); fclose($fp); echo '1'; //echo "<script>location.href='index.php'</script>"; }elseif($_POST['user'] == 'pi'){ $content = "<?php define('ACCOUNT','pi'); define('PASSWORD','".$hash."'); ?>"; $fp = @fopen($open_passwd,'w') or die("Unable to open file!"); fwrite($fp, $content); fclose($fp); echo '1'; //echo "<script>location.href='index.php'</script>"; } }else{ echo '0'; } ?> |