本文整理匯總了PHP中api::sign_up方法的典型用法代碼示例。如果您正苦於以下問題:PHP api::sign_up方法的具體用法?PHP api::sign_up怎麽用?PHP api::sign_up使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類api
的用法示例。
在下文中一共展示了api::sign_up方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: mysqli
}
$table = DB_NAME;
echo "Connecting ... <br>";
$mysql = new mysqli(DB_HOST, DB_USER, DB_PASSWORD, '', DB_PORT);
echo "Connected .. <br>";
if ($mysql->connect_error) {
die($mysql->connect_error);
}
echo "Creating datatbase ... <br>";
$mysql->query("CREATE DATABASE IF NOT EXISTS " . DB_NAME);
echo "Database created <br>";
echo "Filling with Tables <br>";
$mysql->select_db($table);
$mysql->query("CREATE TABLE IF NOT EXISTS users(id INT NOT NULL AUTO_INCREMENT, username VARCHAR(16) NOT NULL, password VARCHAR(64) NOT NULL, token VARCHAR(23), time DATETIME, PRIMARY KEY(id))");
echo "Finished ... <br>";
echo 'Inserting User and getting up ... <br>';
echo "\n";
try {
print_r($api->sign_up("Hallo", hash("sha256", "Hallo"), hash("sha256", "Hallo")));
$pass = hash("sha256", "Hallo");
$api->query("INSERT INTO users(username, password) VALUES ('Hallo', {$pass}");
} catch (Exception $e) {
echo $e->getTraceAsString();
echo "\n at :" . $e->getLine();
}
echo "\n";
echo 'User Hallo with Password Hallo inserted ...<br>';
echo 'Created the SQL and made Tables ...<br> ';
echo '<iframe src="../login"></iframe>';
echo "\n";
echo '<a href="../index.php">Go Back</a>';
示例2: api
<?php
@E_DEPRECATED;
//TODO: Rework
require_once 'api.php';
$api = new api();
$user = $_POST["username"];
$pass = hash("sha256", $_POST["password"]);
$pass2 = hash("sha256", $_POST["password2"]);
$api->sign_up($user, $pass, $pass2);
?>
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Signup - Reloading</title>
</head>
<body>
<!-- TODO: Use ajax -->
<script src="/api/libs/jquery-2.1.4.js"></script>
<script type="text/javascript">
/* $.ajax({
url:"login.php",
method: "post",
}"login.php", {username: <?php
echo $user;
?>
, password: <?php
echo $_POST["password"];
?>