summaryrefslogtreecommitdiff
path: root/www-ssl/nonpublic/auth.php
blob: 52c8b6f51ee05ca8412677ab814d45c5bba5f539 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?PHP
header('Content-Type: application/json');

include ("../../../27c3/includes/config.php");
include ("../../../27c3/includes/config_db.php");

$User = $_POST['user'];
$Pass = $_POST['pw'];
$SourceOuth = $_POST['so'];

/*
$User = $_GET['user'];
$Pass = $_GET['pw'];
$SourceOuth = $_GET['so'];
*/

/*
$User = "admin";
$Pass = "21232f297a57a5a743894a0e4a801fc3"; // "admin";
$SourceOuth = 23;
*/

if ( 	isset($CurrentExternAuthPass) &&  
	($SourceOuth == $CurrentExternAuthPass) )
{ // User ist noch nicht angemeldet 
	$sql = "SELECT * FROM `User` WHERE `Nick`='". $User. "'";
	$Erg = mysql_query( $sql, $con);

	if ( mysql_num_rows( $Erg)  == 1) 
	{ // Check, ob User angemeldet wird...
		if (mysql_result( $Erg, 0, "Passwort") == $Pass)
		{ // Passwort ok...
			// Session wird eingeleitet und Session-Variablen gesetzt..
			$UID = mysql_result( $Erg, 0, "UID");

			// get CVS import Data
			$SQL = "SELECT * FROM `UserCVS` WHERE `UID`='". $UID. "'";
			$Erg_CVS =  mysql_query($SQL, $con);
			$CVS = mysql_fetch_array($Erg_CVS);
			
			$msg = array( 
					'status' => 'success',
					'rights' => $CVS
					);
			echo json_encode($msg);
			
		} 
		else 
		{
			echo json_encode(array('status' => 'failed'));
		}
	} 
	else 
	{
		echo json_encode(array('status' => 'failed'));
	}
} 
else 
{
	echo json_encode(array('status' => 'failed'));
}


?>