summaryrefslogtreecommitdiff
path: root/www-ssl/nonpublic/auth.php
diff options
context:
space:
mode:
authorAngelo Cuccato <cuccato@web.de>2010-12-29 14:06:07 +0100
committerAngelo Cuccato <cuccato@web.de>2010-12-29 14:06:07 +0100
commit4836a82eb9614bd9aefccbc45d6d074c5e8174e6 (patch)
tree0cdb21d6c46c3e324b60222cccd55f64cfdf2c4a /www-ssl/nonpublic/auth.php
parent4ebc072511a144eb11c5c86651a3753c774a448c (diff)
add external auth
Diffstat (limited to 'www-ssl/nonpublic/auth.php')
-rwxr-xr-xwww-ssl/nonpublic/auth.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/www-ssl/nonpublic/auth.php b/www-ssl/nonpublic/auth.php
new file mode 100755
index 00000000..99b153e5
--- /dev/null
+++ b/www-ssl/nonpublic/auth.php
@@ -0,0 +1,66 @@
+<?PHP
+header('Content-Type: application/json');
+
+include ("../../includes/config.php");
+include ("../../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'));
+}
+
+
+?>
+
+