コード例 #1
0
ファイル: register.php プロジェクト: Dayron1234/RubyCMS
<?php

include_once 'functions.php';
$user = new Users();
if ($user->session()) {
    header('Location: homepage.php');
}
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $reg = $user->register($_POST['username'], $_POST['password'], $_POST['email']);
    if ($reg) {
        echo 'You have successfully registered <a href="login.php">Login here</a>';
    } else {
        echo 'Username or email is already taken, try again';
    }
}
?>
<html>
<form method="POST" action="register.php" name="register">
    Username: <input type="text" name="username"/><br>
    Password: <input type="password" name="password"/><br>
    E-mail: <input type="text" name="email"/><br>
    <input type="submit" value="Register"/>
</form>
</html>
コード例 #2
0
ファイル: homepage.php プロジェクト: Dayron1234/RubyCMS
<?php

session_start();
include_once 'functions.php';
$user = new Users();
$id = $_SESSION['id'];
if (!$user->session()) {
    header('Location: index.php');
}
if ($_GET['q'] == "logout") {
    $user->logout();
    header('Location: index.php');
}
?>
<h1>Welcome to RubyCMS!</h1>
<p>Although RubyCMS is in pre-alpha development will continue till the developer feels like the CMS is fully complete.
So expect a lot of bugs and please report any bugs to the developer. If you want to logout just click the link below.
Thanks for using RubyCMS, come back any time you want!</p>
<a href="?q=logout">Logout</a>