View Single Post
Old 10-24-2006, 02:14 AM   · #8
maximum
MyDomains.net
 
maximum's Avatar
 
Name: -Unknown-
Location: Inside your head...
Trader Rating: (15)
Join Date: Oct 2005
Posts: 804
NP$: 42.70 (Donate)
maximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud ofmaximum has much to be proud of
Child Abuse Special Olympics Save a Life Baby Health Autism
The both cleaned-up and corrected version of that code, rewritten by NamePro's resident PHP guru SecondVersion. Hope this solves that issue for you.

Thank You, SecondVersion

PHP Code:
<?php

$file
= '/home/nonpubl/public_html/np/HTaccess-Sample/mylogins.txt';

if (!
is_file($file))
{
    die(
"$file does not exist.");
}

$contents = htmlentities(file_get_contents($file));

if (isset(
$_POST['submit_edit']) AND trim($_POST['edit']) != '')
{
    
$edit = trim(html_entity_decode($_POST['edit']));
    
$fp = fopen($file, 'w+');
    
fputs($fp, $edit);
    
fclose($fp);  
}

?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<textarea name="edit" cols="45" rows="20"><?php echo $contents; ?></textarea><br>
<input type="submit" name="submit_edit" value="Edit List">&nbsp;&nbsp;&nbsp;
<input type="button" value="Refresh List" onclick="javascript:window.location.replace('<?php echo $_SERVER['PHP_SELF']; ?>')">
</form><br><br>

<?php

$didadd
= '';

if (isset(
$_POST['submit_add']))
{
    
$username = trim($_POST['user']);
    
$clearpassword = trim($_POST['pass']);

    if (
$username != '' AND $clearpassword != '')
    {
        
$encryptedpassword = crypt($clearpassword, base64_encode($clearpassword));
        
$login = "$username:$encryptedpassword\n";

        
$handle = fopen($file, 'a');
        
fwrite($handle, $login);
        
fclose($handle);

        
$didadd = "<b>Login added to<br><font color=\"red\">$file</font></b><br><br>UserName: <font color=\"red\">$username</font><br>Password: <font color=\"red\">$clearpassword</font><br>Encrypted As: <font color=\"red\">$encryptedpassword</font><br><br>";
    }
}

?>

<table>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<table>
<tr>
  <td>UserName: </td><td><input type="text" name="user"></td>
</tr>
<tr>
  <td>Password: </td><td><input type="text" name="pass"></td>
</tr>
<tr>
  <td colspan="2" align="center"><input type="submit" name="submit_add" value="Add User"></td>
</tr>
</form>
</table><br><br>
<?php

echo $didadd;

?>


Please register or log-in into NamePros to hide ads
__________________
In loving memory of my mother - Valettajho - Sept. 23, 2008
A devoted mother, sister, grandmother, great-granddaughter, and a true friend to anyone blessed enough to have met you. You taught me well, and made me who I am today. I can only hope to live the remainder of my life in a fashion that you would be proud of. Your life may have been taken by the hands of a man, but in doing so he delivered you into the hands of God. You will forever be missed.
maximum is online now  
  Reply With Quote
Site Sponsors
http://www.mobisitetrader.com/ Exdon Buy Flash Arcade Game Script
Advertise your business at NamePros
All times are GMT -7. The time now is 12:33 AM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.