示例#1
0
 /**
  * Obtain a URL where we can redirect to securely post a form with the given data to a specific destination.
  *
  * @param string $destination The destination URL.
  * @param array  $data An associative array containing the data to be posted to $destination.
  *
  * @return string  A URL which allows to securely post a form to $destination.
  *
  * @author Jaime Perez, UNINETT AS <*****@*****.**>
  */
 private static function getSecurePOSTRedirectURL($destination, $data)
 {
     $session = \SimpleSAML_Session::getSessionFromRequest();
     $id = self::savePOSTData($session, $destination, $data);
     // encrypt the session ID and the random ID
     $info = base64_encode(Crypto::aesEncrypt($session->getSessionId() . ':' . $id));
     $url = \SimpleSAML_Module::getModuleURL('core/postredirect.php', array('RedirInfo' => $info));
     return preg_replace('#^https:#', 'http:', $url);
 }
示例#2
0
    $uname = $_POST["dbuname"];
    $pass = $_POST["dbpass"];
    $goto = $_GET["goto"];
    $link = mysql_connect(DBHOST, $uname, $pass);
    if (!$link) {
        echo "<script type='text/javascript'>alert('Wrong Credentials!!');window.location='auth.php?goto={$goto}'</script>";
    } else {
        if (!mysql_select_db(DBNAME)) {
            echo "<script type='text/javascript'>alert('Cant Connect to Database!!');window.location='auth.php?goto={$goto}'</script>";
        }
    }
    require_once 'classes.php';
    $pbkdf2 = new PBKDF2();
    $key = $pbkdf2->deriveKey($goto);
    $crypto = new Crypto($key);
    $c = $crypto->aesEncrypt($goto);
    setcookie("auth", $c);
    $red = $_GET["goto"] . ".php";
    echo "<script type='text/javascript'>window.location='{$red}';</script>";
}
function table_exists($tablename)
{
    $x = mysql_query("show tables like '{$tablename}'");
    if (mysql_num_rows($x) > 0) {
        return TRUE;
    } else {
        return FALSE;
    }
}
?>
<div id="additional">