Making a login script for my website help!

July 3, 2009 at 08:52:18
Specs: Windows XP Pro
Alright, so I am currently in the process of developing my website, and am trying to create a login script.

I don't have full understanding of php yet, so forgive me if I made a really stupid mistake.

<?php	
	if( file_exists("webusers/".$_GET['username']) )
	{
		$content = file("webusers/".$_GET['username'],"r");
		if($content[0]==$_GET['password'])
		{
			setcookie("randomhomepage.com",$_GET['username'],time()+(60*60*60));
			$loggedin=true;
		}
	}
?>

<!-- apply div settings for login result window -->
<style type="text/css">
	.loginresult
	{
		position:absolute;
		left:0%;
		top:0%;
		width:100%;
		height:100%;
		background-color: #ffffff;
	}
</style>

<html>
	<div class="loginresult">
		

		<?php
		if( $loggedin )
		{
			echo "<center>You have successfully logged in</center>";
		}
		else
		{
			echo "<center>Login attempt unsuccessful</center>";
		}
		?>
		<center><u><a href="randomhomepage.com" ?>Click here to return to the home page</a></u></center>
		

	</div>
</html>

I get a parse error on line 3. Could someone please tell me what is the cause of this?


See More: Making a login script for my website help!

Report •


#1
July 4, 2009 at 02:43:19
Go read the manual about file() :D

http://php.net/manual/en/function.f...

... removing ,"r" should do the trick.

---
Fubar


Report •

#2
November 24, 2009 at 07:11:04
Hi that all looks pretty complicated. Why don't you use a paid script like this: http://www.prophpscripts.com/tutori...

Report •

Related Solutions


Ask Question