you can save a list of users and passwords like //name@name@name@name and
//pass@pass@pass@pass
and save the files as pass.php and name.php and people will just get blank pages when they try to go to those pages since it is all commented out. but the system can read the files in line and match them up. then you either manually enter new names and passes to the end of the list, or better... you have a little admin thing at the top of the page to add them...
<?
session_start();
if ((!$_POST[NewUsername]) || (!$_POST[NewPassword])) {
} else {
if (!("" == $_POST[NewUsername])) {
if (!("" == $_POST[NewPassword])) {
$Title = "name.php";
$thestuff = fopen($Title, "r");
$thelist = fread($thestuff, 65000);
fclose($thestuff);
$thelist = str_replace('?>', '', $thelist);
$thelist .= "@$_POST[NewUsername]?>";
$thestuff = fopen($Title, "w");
fputs($thestuff, $thelist);
fclose($thestuff);
$Title = "pass.php";
$thestuff = fopen($Title, "r");
$thelist = fread($thestuff, 65000);
fclose($thestuff);
$thelist = str_replace('?>', '', $thelist);
$thelist .= "@$_POST[NewPassword]?>";
$thestuff = fopen($Title, "w");
fputs($thestuff, $thelist);
fclose($thestuff);
}
}
}
if ((!$_POST[username]) || (!$_POST[password])) {
} else {
if ($_POST[username] == " the guy's username ") {
if ($_POST[password] == " the guy's password ") {
$_SESSION[logged] = "yes";
$_SESSION[admin] = "yes";
}
}
$Title = "name.php";
$thestuff = fopen($Title, "r");
$thelist = fread($thestuff, 65000);
fclose($thestuff);
$thelist = str_replace('<?//', '', $thelist);
$thelist = str_replace('?>', '', $thelist);
$namelist = split ("@",$thelist);
$Title = "pass.php";
$thestuff = fopen($Title, "r");
$thelist = fread($thestuff, 65000);
fclose($thestuff);
$thelist = str_replace('<?//', '', $thelist);
$thelist = str_replace('?>', '', $thelist);
$passlist = split ("@",$thelist);
$sizeoflist = count($passlist);
for ($counter = 0; $counter <= $sizeoflist; $counter++) {
if ($_POST[username] == $namelist[$counter]) {
if ($_POST[password] == $passlist[$counter]) {
if (!("" == $passlist[$counter])) {
if (!("" == $namelist[$counter])) {
$_SESSION[logged] = "yes";
}
}
}
}
}
}
if (!($_SESSION[logged] == "yes")) {
echo " --- HTML form with 2 text boxes to accept user info in POST form that links to this very file---";
die();
}
?>
<html>
<head>
<title></title>
</head>
<body>
<?
if ($_SESSION[admin] == "yes") {
echo "<form to gather new users and passes in POST form NewUsername and NewPassword and submit button>";
}
?>
</body>
</html>
pass.php looks like
<?//password_1@password_2@password_3@password_4?>
name.php looks like
<?//username_1@username_2@username_3@username_4?>
Both pass and name .php should START OUT with just a <?//?> on the top line.
Once again... you have to add the form things yourself... the should be in POST and should link back to the same file... You will need to manually enter the name of the file in the code... but hey... you only have to do it once... also.. all the php files need to be in the same folder... otherwise it won't be able to find pass.php and name.php ... however, you could directly link to them by sticking the whole file path (not url) starting with C:/ or E:/ or whatever...
When you use echo you need to escape out "s so ....
echo "<table width = "95%" height = "25">";
echo "<tr>";
echo "<td>";
echo "<form method = "POST" action = "index.php">";
echo "New Username: <input type = "text" name = "NewUsername">";
echo "New Password: <input type = "text" name = "NewPassword">";
echo "<input type = "submit" value = "Change!">";
echo "</form>";
echo "</td>";
echo "</tr>";
echo "</table>";
Will create the admin member adder for the top of the guy's own page only... I didn't want to stick it in the code, cause it might not look like what you want.
Keep in mind... I haven't tested any of this... and it may not work as planned cause I might have left out a ; or something dumb... test it out on a dummy page.. tell me if it works.