<?php
################################################################################
#
# PABS Login
#
#
################################################################################
include "class_ooauth.php";
#
# Init
# Get IP Address and init Class
#
$ooauth_remote_addr=& $_SERVER['REMOTE_ADDR'];
$ooauth=& new ooauth("pabs2+");
if($_REQUEST[logout]) #Logout Request
$ooauth->kill_session(1);
#
# Get last Error, if one....
# will be needed on login screen
$error=$ooauth->get_error_msg();
if($_POST[login] and $_POST[pass])
{
/* Example:
$sql = "select passwort, ID, realname, access
from user where username='{$_POST[login]}' ";
$result = mysql_query($sql, $conn);
$error.= mysql_error($conn);
...
*/
#We simulate getting a password from database :-)
$password="demo";
#Öffne Session, wenn Passwörter stimmen
if($password==$_POST[pass])
{
#Create new Session
$ooauth->new_session(60, "ooauth_remote_addr");
#and redirect to index-page
header("Location: index.php\n\n");
exit;
}
else
$ooauth->set_error(-2); #Set to password error
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="author" content="Heiko Dillemuth">
<meta name="description" content="ooauth Demo Login">
<title>Login</title>
</head>
<body bgcolor="white">
<h1>Login</h1>
<SCRIPT language=Javascript>
<!--
if (parent.frames.length!=0)
{
parent.location.href="";
}
// -->
</SCRIPT>
<FORM ACTION="class_ooauth_login.php" METHOD="POST" name="login">
<TABLE>
<TR>
<TD>Username </TD>
<TD>Password </TD>
<TD></TD>
</TR>
<TR>
<TD><INPUT TYPE="TEXT" NAME="login" SIZE="10" MAXLENGTH="15"></TD>
<TD><INPUT TYPE="PASSWORD" NAME="pass" VALUE="" SIZE="10" MAXLENGTH="15"></TD>
<TD><INPUT TYPE="SUBMIT" VALUE="Login">
</TD>
</TR>
</TABLE>
<FONT COLOR="red" SIZE="2"><?php print $error; ?></FONT>
</FORM>
<br>
<br>
<hr>
Username: admin<br>
Password: demo<br>
</body>
</html>
|