Blame view

checkCreds.php 674 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');
bb6a08e5   Jean Wasilewski   Added full creds ...
13
  
925cd5af   Jean Wasilewski   Session is now co...
14
  $requete = 'SELECT pk, admin, realname FROM users WHERE username=\''.$_GET["user"].'\' AND password=\''.$_GET["pass"].'\'';
bb6a08e5   Jean Wasilewski   Added full creds ...
15
16
17
18
19
  $resultat = mysql_query($requete);
  	
  if (!$resultat)
  	die("Nop");
  	
b3d7ea05   Jean Wasilewski   Minor fix
20
  if($row = mysql_fetch_assoc($resultat))
925cd5af   Jean Wasilewski   Session is now co...
21
  {
bb6a08e5   Jean Wasilewski   Added full creds ...
22
  	echo 'Yep';
925cd5af   Jean Wasilewski   Session is now co...
23
24
25
26
27
  	$_SESSION["connected"]=true;
  	$_SESSION["pk"]=$row[0];
  	$_SESSION["admin"]=$row[1];
  	$_SESSION["realname"]=$row[2];
  }
bb6a08e5   Jean Wasilewski   Added full creds ...
28
29
30
31
32
33
  else
  	echo 'Nop';
  
  	
  mysql_close($link);
  ?>