Hi guys i had a problem with my site.
in my site you must log-in with an account and password of course but when i login doesn't appear in local work perfectly i post you my source i hope you could help me thanks.
index.php
esegui_login.php
config.php
in my site you must log-in with an account and password of course but when i login doesn't appear in local work perfectly i post you my source i hope you could help me thanks.
index.php
<?phpsession_start();
$_SESSION['tipo']=1000;
$_SESSION['user']="";
?>
<html lang="it">
<head>
<meta charset="utf-8">
<meta name="viewport" content="user-scalable=no, width=device-width" />
<title> REGISTRO ELETTRONICO 5a Binfo ITIS MAJORANA</title>
<link rel="stylesheet" href="#" media="screen">
<style type="text/css">
<!--
.Stile1 {
font-size: xx-large;
font-weight: bold;
}
-->
</style>
</head>
<body>
<header>
<hgroup>
<h1> REGISTRO ELETTRONICO 5a Binf ITIS MAJORANA</h1>
<h2>BENVENUTI!</h2>
</hgroup>
</header>
<h1 align="center" class="Stile1">LOG IN</h1>
<form id="form_index" action="esegui_login.php" method="post">
<section align="right">
<div align="center">
<p><font size="4">USER:</font> </p>
<p>
<Input type = 'text' name = 'user' size=6>
</br>
<font size="4">PASSWORD:</font>
<input type='password' size = 6 name='pwd'>
<input name="login" type="submit"value="ACCEDI">
</p>
</div>
</section>
</form>
</body>
</html>
esegui_login.php
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Login</title>
</head>
<body>
<?php
include 'db_connection/config.php';
include 'db_connection/db_connection.php';;
$user=$_POST['user'];
$_SESSION['id']=$user;
$pwd=$_POST['pwd'];
$password=md5($pwd);
$query="SELECT user From login where user='".$user."'";
$ris=mysql_query($query);
$record=mysql_fetch_array($ris);
if(!$record)
{
echo "Nome utente non valido";
}
else
{
$query="SELECT Id_user FROM login WHERE user='".$user."' and password='".$password."'";
$risu=mysql_query($query);
$rec=mysql_fetch_array($risu);
if(!$rec[0])
{
echo "password errata";
}
else
{
$query_grant="SELECT tipo,cod_anag from login where user='".$user."'";
$ris_grant=mysql_query($query_grant);
$record_grant=mysql_fetch_array($ris_grant);
$_SESSION['tipo']=$record_grant[0];
$_SESSION['cod_anag']=$record_grant[1];
switch($record_grant[0]){
case 0:
break;
case 1:
header ("refresh:0;index_segre.php");
break;
case 2:
header ("refresh:0;index_prof.php");
break;
case 3:
header ("refresh:0;index_user.php");
break;
}
}
}
mysql_close($connect);
?>
</body>
</html>
config.php
<?php
$db_user="****_*****";
$db_pwd="*******";
$db_host="localhost";
$db_name="*****_registro_elettronico";
?>
Last edited by a moderator: