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.
SWF image using php?
Hello once again.My latest en devour requires me to produce an image of a static .swf that is embedded on a page.Unfortunately, it has a selection of variables passed to it.EgCode: <object
Extending Exception to contain method name
I was wondering, if there's a way to extend Exception in such a way, that it would contain name of a method where it has been thrown.Right now I have this:class myException extends Exception {
How do I replace any number of character occurences with one occurrence?
How do I replace any number of character occurences with one occurrence?Let's say I have:aaaaaaaaaaaaaaaaaaaaaaAll of the above should be replaces with a single 'z' character say for exampleI can do
help understanding hidden input w/ php
hello i'm doing a tutorial where there are multiple forms for an edit page for a user to update their info... there's a section of the code i dont really understand how it works...here's code:php:if
Accessing Infotype data in dialog program
Hi All
Inserting into MySQL Newbie
Hi ive got a slight problem where ive made a simple web form where the customer inserts the ammount of tickets and then enters their personal details... then this form does the post method and it then
unoconv doc convert to pdf code prob
PHP/5.3.1 Hi. I am trying to use this code to convert docs to .pdf utilizing unoconv. However the page just freezes blank, with no php errors reported. All permissions to folders are set 777. Can
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html "select form" and set value to "Between x and x" I get a resource error when
Batch Session SM35 stuck in status 'in Background
Hi Experts,
Memory Allocation
Hi folks,see this ex:int v=5;v=v+10;then what will do the compiler before the output come as 15.Please explain me technically.