本文整理汇总了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"];
?>