Page 1 of 1

help with this script

Posted: Tue Aug 12, 2003 3:49 pm
by hhut387
Can any one help with this script if you want to see this go to:

http://hhut387.t35.com:8000/users/main-page.htm


Their are 2 php files hear is the source code

if you need any thing else let me know thanks.

-----<LOG.PHP>-----<"LOG IN FILE">----
<?php

$id = $_POST['id'];
$pass = $_POST['pass'];

$lines = file("pass.txt");
$data = explode("||", $lines[$id]);

if ($data[0] == $pass) {
echo "cool!";
}

else {
print "go back and try againg";
}

?>

-----<REG.PHP>-----<"SIGN-UP FILE">----
<html>

<head>
</head>

<body>
<?php
$password = $_POST['password'];
$writeline;
$incrid;

//opens password file and writes password
$fp = fopen("pass.txt", "a");

if(!$fp)
{
echo "ERROR : FILE CAN NOT BE OPNED!";
exit;
}

$writeline=$password."\n";

fwrite($fp, $writeline);

fclose($fp);


//opens id.txt and increments the id number
$lines = file("id.txt");
$data = explode("||", $lines[0]);

$incrid = $data[0]+1;

$fp2 = fopen("id.txt","w");
if (!$fp2)
{
echo "An error has occured and the file could not be open!";
exit;
}

fwrite($fp2, $incrid);

fclose($fp2);

?>
<div align="center">
<center>
<table border="0" width="986" height="1" cellspacing="1" cellpadding="0" bgcolor="#008000">
<tr>
<td width="986" height="1" colspan="2" bgcolor="#FFFFFF"><?php
print "RECORD THIS INFORMATION IN A SAFE PLACE. YOU WILL NEED TO OPEN A NEW ACCOUNT IF YOU FORGET THIS INFORMATION!\n";
?></td>
</tr>
<tr>
<td width="172" height="1" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp; <?php
print "<b>your id# is:</b> <i>$data[0]</i>";
?>
</td>
<td width="798" height="1" bgcolor="#FFFFFF">&nbsp;&nbsp;&nbsp;&nbsp; <?php
print "<b>your password is:</b> <i>$password</i>";
?>
</td>
</tr>
</table>
</center>
</div>
<p><a href="signin.htm">L</a><a href="signin.htm">ogin</a></p>
</body>

</html>

Posted: Tue Aug 12, 2003 9:25 pm
by like_duh44
what is your question/problem?

Posted: Tue Aug 12, 2003 9:34 pm
by JAM
Contents of pass.txt youre using.

Code: Select all

silver79 1 foo
You cant explode with || if you dont provide it before writing a new password to the file...