Blame view

checkCreds.php 671 Bytes
bb6a08e5   Jean Wasilewski   Added full creds ...
1
  <?php
925cd5af   Jean Wasilewski   Session is now co...
2
  session_start();
14540574   Jean Wasilewski   Fixed inclusion d...
3
  require_once("creds.php");
bb6a08e5   Jean Wasilewski   Added full creds ...
4
  
bb6a08e5   Jean Wasilewski   Added full creds ...
5
6
7
8
9
10
11
  if(!(isset($_GET["user"])&&isset($_GET["pass"])))
  	die("Nop");
  
  $link = mysql_connect(__MYSQL_HOSTNAME__, __MYSQL_USERNAME__, __MYSQL_PASSWORD__)
  	or die("Nop");
  
  if(!mysql_select_db('crep', $link))
f42e5a0f   Jean Wasilewski   Fixed issue with die
12
  	die('Nop');
925cd5af   Jean Wasilewski   Session is now co...
13
  $requete = 'SELECT pk, admin, realname FROM users WHERE username=\''.$_GET["user"].'\' AND password=\''.$_GET["pass"].'\'';
bb6a08e5   Jean Wasilewski   Added full creds ...
14
15
16
17
18
  $resultat = mysql_query($requete);
  	
  if (!$resultat)
  	die("Nop");
  	
fe74dec7   Jean Wasilewski   No need to use assoc
19
  if($row = mysql_fetch_row($resultat))
925cd5af   Jean Wasilewski   Session is now co...
20
  {
bb6a08e5   Jean Wasilewski   Added full creds ...
21
  	echo 'Yep';
925cd5af   Jean Wasilewski   Session is now co...
22
23
24
25
26
  	$_SESSION["connected"]=true;
  	$_SESSION["pk"]=$row[0];
  	$_SESSION["admin"]=$row[1];
  	$_SESSION["realname"]=$row[2];
  }
bb6a08e5   Jean Wasilewski   Added full creds ...
27
28
29
30
31
32
  else
  	echo 'Nop';
  
  	
  mysql_close($link);
  ?>