📄 register.php
字号:
<?php
$registration = new registration;
class registration {
function registration() {
global $DB, $output;
global $HTTP_POST_VARS, $HTTP_GET_VARS;
$output .= "The registation has simply been replaced by an add user function for this version since the functionality of registering, logging-in, and session handling have not been completeled.<BR><BR>";
$action = $HTTP_GET_VARS['code'];
if ($action == 0) //show the form
$this->displayForm();
if ($action == 1)
$this->addUser();
}
function displayForm()
{
global $output;
$output .= "<form action = \"index.php?action=register&code=1\" method = \"post\">\n";
$output .= "Username : <input type = \"text\" name = \"username\"<BR>\n";
$output .= "<input type = \"submit\" name = \"submit\" value = \"submit\"<BR>\n";
}
function addUser()
{
global $output, $DB;
global $HTTP_POST_VARS;
$user['name'] = $HTTP_POST_VARS['username'];
$DB->query("select rung from users order by rung DESC;");
$row = $DB->getRow();
$highestRung = $row['rung'];
$highestRung = $highestRung + 1;
$user['rung'] = $highestRung;
$dbString = $DB->generateInsertString($user);
$DB->query("insert into users (" . $db_string['dataNames']. ") values (". $dbString['dataValues'] .");");
$output .= $HTTP_POST_VARS['username'].= " has been added at rung $highestRung!";
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -