Location: PHPKode > projects > Wiki-Map > htdocs/login.php
<?
/******************************************************************************
#   Copyright notice                                                                
#   
#   This file is part of Wiki-Map project [http://wiki-map.sourceforge.net/] 
#   Wiki-Map is free software; you can redistribute it and/or 
#   modify it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or (at your 
#   option) any later version.                                    
#
#   The GNU General Public License can be found at                        
#   http://www.gnu.org/copyleft/gpl.html.                                 
#   A copy is found in the textfile GPL and important notices to the      
#   license from the team is found in the textfile LICENSE distributed    
#   with these scripts.                                                    
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
#   This copyright notice MUST APPEAR in all copies and derivatives of the script!
#*********************************************************************************
# $Source: /cvsroot/wiki-map/htdocs/login.php,v $
# $Header: /cvsroot/wiki-map/htdocs/login.php,v 1.1 2005/11/19 09:43:25 soumya42 Exp $
# $Author: soumya42 $

# All PHP scripts requires

dss.php          # DSS has global variables setup, and some common scripts
codepage.php     # Includes all user prompts declared as variable string for internatiolization
authorize.php    # Check authorization for running the program

All these scripts are referenced from /htdocs/ directory

# Global database variables (Defined in dss.php)
#
# 	$host      	- Database host
# 	$db_base    	- Database name
# 	$db_owner  	- Database user
# 	$db_passwd	- Database password
#
# ------------------- Your program should come below this --------------------------- -->
*/

require_once('openDB.php');

if (isset($_POST['login'])){
	$dt = date('Y-m-d h:m');
	$pass = md5($_POST[pass]);
	$logname = $_POST['login'];

	$sql = "SELECT logname,password,f_name,l_name FROM user ";
	$sql .= "WHERE logname='$logname';";
//echo $sql."<br>";
	$result = mysql_query($sql);
	$row = mysql_fetch_array($result, MYSQL_ASSOC);
	$user = $row['f_name']." ".$row['l_name'];

//echo $row['logname'].'='.$logname."<BR>";
//echo $row['password'].'='.$pass."<BR>";

	if (($row['logname']==$logname) && ($row['password']==$pass)){
		setcookie("login","$logname");
		setcookie("name","$user");
		header("Cache-Control:no-cache");
		$go = "Location:".$_POST[next];
		header($go);
		exit();
	} else {
		echo "<P>** Wrong login **</P>";
	}
	mysql_close($db);
} else {

	$nlink = "index.php";
?>
<HTML>
<HEAD>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
   <title>Wiki-Map: Login</title>
   <link rel="stylesheet" type="text/css" href="wikimap.css">    
</HEAD>
<BODY>
<div id="docs">
	
<? if ($_GET[st]=="require"){ 
	echo "<P><H3>You require to login for this feature...</H3></P>";
	$nlink = $_GET[rt];
} ?>
<FORM method=POST action="">
<INPUT type=hidden name=next value=<? echo $nlink; ?> >
<TABLE>
<TR><TD>Login:</TD><TD> <INPUT TYPE=text size=25 name=login></TD></TR>
<TR><TD>Password:</TD><TD> <INPUT TYPE=password size=20 name=pass></TD></TR>
<TR><TD><A HREF='register.php'><u>Register</u></A></TD><TD><INPUT type=submit value='LOGIN'></TD></TR>
</TABLE>

</FORM>
<P>
Note:<br><br>
New user, please <A HREF='register.php'><u>register</u></A> yourself in this site before you try to login. <br><br><br><br>
If you have forgotten your password, you may <A href='http://www.wikimap.biz/resetpass.php' title='Reset and mail password'><u>reset</u></A> it.
</P>
</div>
<?
include "wikifoot.php";
}
?>

<!--
#---------------------------- End of program --------------------------------------------
# $Log: login.php,v $
# Revision 1.1  2005/11/19 09:43:25  soumya42
# New addition
#
# 
-->
Return current item: Wiki-Map