help with this script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hhut387
Forum Newbie
Posts: 5
Joined: Mon Jul 21, 2003 1:41 pm

help with this script

Post 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>
like_duh44
Forum Commoner
Posts: 63
Joined: Sat Jul 26, 2003 6:57 pm

Post by like_duh44 »

what is your question/problem?
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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...
Post Reply