Hello;
i am modifying an open source user management script that i found on the web.
Here is the login page of it :
<?php
session_start();
include("config.php");
$msg = "";
if (isset($_POST['Submit']))
{
$username = $_POST['username'];
$password = md5($_POST[password]);
$result = mysql_query("Select * From login_table where user_name='$username'",$con);
if(mysql_num_rows($result)>0)
{
$row = mysql_fetch_array($result, MYSQL_BOTH);
if($password == $row["user_pass"])
{
$_SESSION['loginok'] = "ok";
$_SESSION['username'] = "username";
$_SESSION['password'] = "password";
$_SESSION['level'] = $row["user_level"];
header("Location: index.php");
}
else
{
$msg = "Password incorrect";
}
}
else
{
$msg = "Username incorrect";
}
}
?>
<html>
<head>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<p align="center"><strong>Soldier Arena Login</strong></p>
<form name="form1" method="post" action="">
<p align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Please
enter your username and password to login</font></p>
<p align="center"><?php echo "<font color='red'>$msg</font>" ?></p>
<table class="table" width="35%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#000000">
<tr bgcolor="#000000">
<td colspan="2"><div align="center"><font color="#FC9801" size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>LOGIN</strong></font></div></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Username: </font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="username" type="text" id="username" width="200" size="20">
</font></td>
</tr>
<tr>
<td><div align="right"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Password: </font></div></td>
<td><font size="2" face="Verdana, Arial, Helvetica, sans-serif">
<input name="password" type="password" id="password" width="200" size="20">
</font></td>
</tr>
<tr>
<td><a href="" target="blank"><font color="#ffffff"></font></a></td>
<td><div align="center">
<input type="submit" name="Submit" value="Submit">
</div></td>
</tr>
</table>
<p align="center" class="smallErrorText"><a href="forgot.php">Forgot Password ? </a></p>
</form>
<p align="center"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong></a>
<a href="http://www.tarakji.net/adduser.php">New User ? Register here</a></strong><br>
</font><strong></strong><a href="" target="blank"></a></p>
<p> </p>
</body>
</html>
And here is my index page :
<?php include "level1_check.php";?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Soldier Arena is still under construction</title>
</head>
<body bgcolor="#404040" text="#FFFFFF">
<p align="center">
<img border="0" src="Logo%20-%20%20Logo_05.jpg" width="560" height="420"></p>
<p align="center">Soldier Arena is still under construction, Please check back
another time.</p>
<p align="center">Thank you for your support</p>
<p align="center"><a href="http://www.tarakji.net/logout.php">Logout</a></p>
</body>
</html>
I would like to put in my index page "hello $username", but it won't work ... i have to use sessions, does anyone know how i can do that with a session ?
Please help me 🙂
Thank you in advance;
PHPFREEK