Commit 925cd5afa41cabaaf637866566b8debbcef2d699
1 parent
e9bec98f
Session is now correctly defined
Showing
1 changed file
with
8 additions
and
1 deletions
Show diff stats
checkCreds.php
1 | <?php | 1 | <?php |
2 | +session_start(); | ||
2 | require_once("creds.php"); | 3 | require_once("creds.php"); |
3 | 4 | ||
4 | if(!(isset($_GET["user"])&&isset($_GET["pass"]))) | 5 | if(!(isset($_GET["user"])&&isset($_GET["pass"]))) |
@@ -10,14 +11,20 @@ $link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__ | @@ -10,14 +11,20 @@ $link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__ | ||
10 | if(!mysql_select_db('crep', $link)) | 11 | if(!mysql_select_db('crep', $link)) |
11 | die('Nop'); | 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 | $resultat = mysql_query($requete); | 15 | $resultat = mysql_query($requete); |
15 | 16 | ||
16 | if (!$resultat) | 17 | if (!$resultat) |
17 | die("Nop"); | 18 | die("Nop"); |
18 | 19 | ||
19 | if($row = mysql_fetch_assoc($resultat)) | 20 | if($row = mysql_fetch_assoc($resultat)) |
21 | +{ | ||
20 | echo 'Yep'; | 22 | echo 'Yep'; |
23 | + $_SESSION["connected"]=true; | ||
24 | + $_SESSION["pk"]=$row[0]; | ||
25 | + $_SESSION["admin"]=$row[1]; | ||
26 | + $_SESSION["realname"]=$row[2]; | ||
27 | +} | ||
21 | else | 28 | else |
22 | echo 'Nop'; | 29 | echo 'Nop'; |
23 | 30 |