Commit 925cd5afa41cabaaf637866566b8debbcef2d699

Authored by Jean Wasilewski
1 parent e9bec98f

Session is now correctly defined

Showing 1 changed file with 8 additions and 1 deletions   Show diff stats
checkCreds.php
1 1 <?php
  2 +session_start();
2 3 require_once("creds.php");
3 4  
4 5 if(!(isset($_GET["user"])&&isset($_GET["pass"])))
... ... @@ -10,14 +11,20 @@ $link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__
10 11 if(!mysql_select_db('crep', $link))
11 12 die('Nop');
12 13  
13   -$requete = 'SELECT pk, admin FROM users WHERE username='.$_GET["user"].' AND password='.$_GET["pass"].'';
  14 +$requete = 'SELECT pk, admin, realname FROM users WHERE username='.$_GET["user"].' AND password='.$_GET["pass"].'';
14 15 $resultat = mysql_query($requete);
15 16  
16 17 if (!$resultat)
17 18 die("Nop");
18 19  
19 20 if($row = mysql_fetch_assoc($resultat))
  21 +{
20 22 echo 'Yep';
  23 + $_SESSION["connected"]=true;
  24 + $_SESSION["pk"]=$row[0];
  25 + $_SESSION["admin"]=$row[1];
  26 + $_SESSION["realname"]=$row[2];
  27 +}
21 28 else
22 29 echo 'Nop';
23 30  
... ...