Ejemplo n.º 1
0
 public function isLoggedIn($cookie)
 {
     if ($cookie) {
         $username = filter_input(INPUT_COOKIE, "username");
         $password = filter_input(INPUT_COOKIE, "password");
         if ($username && $password && ctype_alnum($username) && ctype_alnum($password)) {
             $rows = Queries::getRowWithValue(Database::$table_users, "username", $username);
             if ($rows) {
                 if ($rows['password'] == $password) {
                     $this->username = $username;
                     $this->password = $password;
                     $this->email = $rows['email'];
                     return true;
                 }
             }
         }
         return false;
     }
 }
Ejemplo n.º 2
0
 public static function isBanned($ip)
 {
     return Queries::getRowWithValue(Database::$table_bans, "ip", $ip);
 }
Ejemplo n.º 3
0
<?php

include '../includes.php';
Tracking::track(basename(filter_input(INPUT_SERVER, 'PHP_SELF')));
$passkey = filter_input(INPUT_GET, 'passkey');
if (!$passkey) {
    echo "Error receiving passkey";
} else {
    if (!ctype_digit($passkey)) {
        echo "Invalid passkey";
    } else {
        if (Queries::valueOccurances(Database::$table_temp, "code", $passkey) == 1) {
            $rows = Queries::getRowWithValue(Database::$table_temp, "code", $passkey);
            if (Queries::instertValuesIntoTable(Database::$table_users, array($rows['username'], $rows['password'], $rows['email']))) {
                echo "Email confirmation successful!";
                if (Queries::deleteValueFromTable(Database::$table_temp, "code", $passkey)) {
                    echo "<br>User info moved from temporary to permanent database";
                }
            }
        }
    }
}
Ejemplo n.º 4
0
<html>
    <body>
        <ul>
            <?php 
include 'includes.php';
Tracking::track(basename(filter_input(INPUT_SERVER, 'PHP_SELF')));
$account = new User();
$get_title = filter_input(INPUT_GET, 'title');
if (!$get_title) {
    echo "Error getting title";
}
if ($account->isLoggedIn()) {
    if (ctype_alnum($get_title)) {
        $row = Queries::getRowWithValue(Database::$table_pages, 'title', $get_title);
        if ($row) {
            $owner = $row['owner'];
            $title = $row['title'];
            $description = $row['description'];
            $goal = $row['goal'];
            $amount = $row['amount'];
            $pageinfo = array($owner, $title, $description, $goal, $amount);
            for ($i = 0; $i < count($pageinfo); $i++) {
                echo "<li>{$pageinfo[$i]}</li>";
            }
        } else {
            echo "Error getting a page with that title";
        }
    } else {
        echo "Title must be alphanumeric";
    }
} else {
Ejemplo n.º 5
0
 public static function viewmembers($username, $password, $guildname)
 {
     if (User::isValidUser($username, $password)) {
         if (User::isValidGuildname($guildname)) {
             $userIsInGuild = false;
             $retVal = "";
             $row = Queries::getRowWithValue(Database::$table_guilds, "guildname", $guildname);
             if ($row['guildmaster'] == $username) {
                 $userIsInGuild = true;
             }
             $retVal = $retVal . "guildmaster: " . $row['guildmaster'];
             $retVal = $retVal . "<br>";
             $rows = Queries::getRowsWithValue(Database::$table_members, "guildname", $guildname);
             for ($i = 0; $i < sizeof($rows); $i++) {
                 if ($rows[$i]['username'] == $username) {
                     $userIsInGuild = true;
                 }
                 $retVal = $retVal . "member: " . $rows[$i]['username'];
                 $retVal = $retVal . " rank: " . $rows[$i]['rank'];
                 $retVal = $retVal . "<br>";
             }
             if ($userIsInGuild) {
                 return $retVal;
             } else {
                 return "user not in specified guild, access denied";
             }
         }
         return "invalid guildname";
     }
     return "invalid user";
 }