Login Issue's


Posted on 16th Feb 2014 07:03 pm by admin

Code: <?php
$file = fopen('user.txt', 'r');

/* Set login to false initially */
$login = false

/* Break out of loop if login becomes true OR EOF is encountered */
while(($login == false) && (!eof($file)))
{
$data = explode(":", fgets($file));

/* assume field 0 is username, field 1 is password */
if( ($data['0'] == $username) && ($data['1'] == $password)
{
/* login is true, so will break out of loop after this iteration */
$login = true;
}
}
if $login = true
{
echo 'hi there user';
} else {echo 'nope';}
fclose($file);

?>
<html>
<body>
<form action="login4.php" method="post">
<ul>
<li><label for="username">
USERNAME: </label><input type="text"
name="username" id="username"/></li>
<li><label for="password">
PASSWORD: </label><input type="password"
name="password" id="password"/></li>
</ul>
<input name="login" type="submit" value="Login"/
</form>
</body>
</html>
Parse error: syntax error, unexpected T_WHILE in C:xampplitehtdocslogin testslogin4.php on line 8

having trouble writing a login script that uses .txt files.

No comments posted yet

Your Answer:

Login to answer
313 Like 30 Dislike
Previous forums Next forums
Other forums

paginate search result
Hi, I have a paginations script to display data from my database but i would like to paginate someon

Christian Louboutin Boots: ChristianLouboutin-Sale.com
Christian louboutin gull glitter slingbacks
Christian louboutin dame clou slingbacks
[b][url

Copy Watches Patek Philippe Watch Classic Automatic White Dial Post1446 [9980] - $216.00 : Professional replica watches stores, silverwatches.cn
swiss replica watches aaa+
swiss replica watches
[b][url=http://www.silverwatches.cn/]high

MSSQL/PHP
I am tryint to setup a webapplication developed in PHP, Apache2.0 and SQLServer2000 as backend which

Топ Дизайн Пандора Ожерелье Outlet Store : Предложение лучший Pandora украшения по отличным ценам .
[b][url=http://ru.wsopandora.com/]Пандора ювелирныÐ

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Google+ Indyaspeak @ Pinterest RSS