View Full Version : login in php
ff123
04-16-2009, 08:03 AM
Hi.. im thinking to built a login page in php for my website like each user should have their own pages in it after logging in where they can post thread which will only be viewable to admin and admin can comment it only and a page which shows user project demo.
sysout
04-16-2009, 09:40 AM
use session for that palz.
Steps :
1. Make a login form (which form actions target to : your process_login page)
2. Make a process_login.php (in this page, validate the user who want to login)
3. Divide each user authentication (if admin, go to admin page, if user, go to user page, others, must not login)
try this, so much fun ^^
ff123
04-16-2009, 10:09 AM
use session for that palz.
Steps :
1. Make a login form (which form actions target to : your process_login page)
2. Make a process_login.php (in this page, validate the user who want to login)
3. Divide each user authentication (if admin, go to admin page, if user, go to user page, others, must not login)
try this, so much fun ^^
thanx is there any kind of script for this work in php.. anyone tried this before?
ff123
04-17-2009, 10:40 AM
bump...
CrazyChop
04-17-2009, 10:54 AM
This is basically the kind of projects that is good for beginners to try. Either you try it yourself or learn PHP or...
http://www.tutorialized.com/tutorials/PHP/User-Authentication/1
or you find a pre-package class that does it for you:
http://www.phpclasses.org/browse/class/21.html
It's also a topic covered by many PHP books.
ff123
04-17-2009, 04:14 PM
This is basically the kind of projects that is good for beginners to try. Either you try it yourself or learn PHP or...
http://www.tutorialized.com/tutorials/PHP/User-Authentication/1
or you find a pre-package class that does it for you:
http://www.phpclasses.org/browse/class/21.html
It's also a topic covered by many PHP books.
thanks i have already done it but there is one more question, how can i encrypt an HTML page into php likh if someone open that www.domain.com/domain.html directly it does not open and ask to login thru www.domain.com/clientlogin, and after logging in domain.html can be opened
ff123
04-17-2009, 07:16 PM
i hope anyone could help me this time i have three pages
1. Login in HTML
2. Process-login.php // get user input and re directed to user dersire page
3. Result page ( now the problem is that this result page is not able variables values from page 1 or even page 2... what could be the solution
borikenMedia
04-19-2009, 02:51 PM
a quick one mysql based.
<?php
function login(){
print('<form method="post">
<input type="hidden" name="id" value="null">
<input type="text" name="uname" value="UserName"><br/>
<input type="password" name="urpass" value="oooo"><br?>
<input type="submit" name="login" value="Login"><br/>
<input type="reset" value="Retry"></form>');
}
if(!isset($_POST['login'])){
print login();
}else{
$urname = $_POST['uname'];
$urpass = $_POST['urpass'];
mysql_connect("localhost","dbuser","dbpass") or die(mysql_error());
mysql_select_db("dbname") or die(mysql_error());
$query = mysql_query("select user,password from $tablename");
$result = mysql_fetch_row($query);
$cqm = ($urname.$urpass && $result[1].$result[2]);
if($cqm == true){
setcookie("stat", $_SERVER['REMOTE_ADDR']);
print("Succesfully loged!");
header("refresh: 4; url= http://targeted_addres.com/?tab=logued");
die();
}
}
?>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.