Jump to content

Making a Login with PHP for a website... help?


newbie-ghozt

Recommended Posts

i need help, making a website login with PHP. Ok, and i need to know how to host a server with apache to test it.

I know nothing about php. :(

Any help appreciated.

 

Website is here

http://ghoztnetwork.x10hosting.com/index.html

(not finished yet, havent even made the main page :P )

simple one.

 

<?php
$username = "admin";
$password = "pass";
if ($_POST['txtusername'] != $username || $_POST['txtpassword'] != $password) {
?>

 

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

<table border="1" cellspacing="0" cellpadding="0" align="center">

<tr><td><label for="txtusername">Username:</label><br />

<input type="text" title="Enter your Username" name="txtusername" value="admin" /></td></tr>

<tr><td><label for="txtpassword">Password:</label><br />

<input type="password" title="Enter your password" name="txtpassword" /></td></tr>

<tr><td align="center"><input type="submit" name="Submit" value="Login" /></td></tr>

</table>

</form>

 

 

 

 

<?php
}
else {
?>

<?php
header( 'Location: http://www.website addy.com' ) ;
?>

<?php
}
?> 

 

bascailly. if user & admin = correct  go to <  header. >  good for a single admin login page :P

 

 

What have you done so far?

 

P.S. - Your link gives me an "Address Not Found" error.

 

nothing, just messed around by following a tutorial, failed miserably.

 

address not found ??? i get it fine. Idk, anyone else get address not found ?

Ok, if some one could walk me through making it please do. It would really be appreciated.

 

There are literally thousands of these tutorials on the net, were not here to write more of them.

 

If you have problems with code, post it, otherwise I suggest googling a tutorial.

I started learning here from these guys:

 

http://www.w3schools.com/

 

Look down the left menu until you see "Learn PHP" - I've not linked directly to that page so you can see what else they have on there.

 

Very informative with easy step-by-step guides.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.