12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
-
- session_start();
- require_once('config.php');
-
- $username = formulaires($_POST['username']);
- $passwd = formulaires($_POST['passwd']);
-
-
- $passwd=md5($passwd);
-
- if(!$username)
- {
- header('Location:'.$root_path.'index.php?error=username');
- }
- if(!$passwd)
- {
- header('Location:'.$root_path.'index.php?error=pass');
- }
- $reponse_cores=mysql_query("SELECT * FROM user WHERE pass='$passwd' AND username='$username'") or die ('error : '.mysql_error());
- $count_cores=mysql_num_rows($reponse_cores);
- if($count_cores == 0 )
- {
- header('Location:'.$root_path.'index.php?error=connection');
- }
-
- else
- {
- for ($ligne=0;$ligne<30;$ligne++) //Création d'un identifiant aléatoire
- {
- @$session.=substr('0123456789AZERTYUIOPMLKJHGFDSQWXCVBN',(rand()%(strlen('0123456789AZERTYUIOPMLKJHGFDSQWXCVBN'))),1);
- }
-
- mysql_query("UPDATE user SET session='$session' WHERE username='$username'") or die ('error : '.mysql_error());
- $_SESSION['session'] = "$session"; //création de la session
- header('Location:'.$root_path.'user/index.php'); //redirection vers l'index
- }
- include_once('bottom.php');
- ?>
|