コード例 #1
0
ファイル: login_code.php プロジェクト: nomad-mystic/CIS195PHP
function register($username, $password, $confirm)
{
    if (empty($username)) {
        return error_message(E_REGISTER, E_NO_USERNAME);
    }
    if (empty($password)) {
        return error_message(E_REGISTER, E_NO_PASSWORD);
    }
    if (empty($confirm)) {
        return error_message(E_REGISTER, E_NO_CONFIRM);
    }
    if ($password !== $confirm) {
        return error_message(E_REGISTER, 'Mismatch');
    }
    //     $user = look_up_key_value($username, USER_ACCOUNT_FILE);
    $user = lookup_user($username);
    if (!empty($user)) {
        return error_message(E_REGISTER, E_ACCOUNT_EXISTS);
    }
    //     add_key_value($username, [$username, password_hash($password, PASSWORD_DEFAULT)], USER_ACCOUNT_FILE);
    add_user($username, password_hash($password, PASSWORD_DEFAULT));
    set_user($username);
    return '';
}
コード例 #2
0
}
if (isset($_POST['to'])) {
    if ($_POST['to'] == "") {
        $error = "You must enter a username or id";
    }
} else {
    $error = "";
}
if (!$error) {
    # Check to see if username was supplied, if it was convert to id
    $amount = intval($_POST['amount']);
    $from = $_SESSION['id'];
    $comment = $_POST['comment'];
    $users_total = get_total($conn, $from);
    $error = False;
    $to_user = lookup_user($conn, $_POST['to']);
    if (isset($to_user['error'])) {
        $error = $to_user['error'];
    } else {
        $to = $to_user['id'];
    }
    if (!((is_int($amount) || ctype_digit($amount)) && (int) $amount > 0)) {
        $error = "You can't transfer negative Kitten Coins";
    }
    if ($users_total) {
        if ($users_total['total'] < $amount) {
            $error = "You can't transfer more than is in your account";
        }
    } else {
        $error = "Something is wrong with your amount";
    }
コード例 #3
0
ファイル: share.php プロジェクト: RITSPARSA/ISTS14_CTF
\t\t\t\t<div class="file-link"><a style="margin: 0px;" class="done" href="javascript: submitform({$num})">Share</a></div>
\t\t\t</div>
\t\t\t<div class="clearfix"></div>
\t\t\t</li>

BOTTOM;
    }
    return $element;
}
require_once "functions.php";
$conn = connect_to_db();
$error = "";
$success = "";
$results = "";
if (isset($_GET['user']) && $_GET['user'] != "") {
    $result = lookup_user($conn, $_GET['user']);
    $results = <<<TOP
\t\t<br /><br />
\t\t<div id="search-results">
\t\t<h3 class="bars">Results</h3>
\t\t<ul class="list-group" style="text-align: left;">

TOP;
    if ($result[1] != "") {
        $error = "Error finding the user specified.";
        $results .= getElement("", "", 0, $error);
        $error = "";
    } else {
        if ($result[0]->num_rows < 1) {
            $results .= getElement("", "", 0, "No users found.");
        } else {
コード例 #4
0
ファイル: index.php プロジェクト: RITSPARSA/ISTS14_CTF
</div>
<div class="row">
    <div class="small-2 columns"><p></p></div>
    <?php 
$transfers = get_transfers($conn, $user['id']);
if ($transfers != []) {
    ?>
    <div class="small-8 columns panel">
        <div class="row">
            <div class="twelve columns text-center"><h3><strong>Your transaction history</strong></h3></div>
        </div>
        <?php 
    foreach ($transfers as $transfer) {
        echo "<div class='small-12 columns panel'>";
        $to = lookup_user($conn, $transfer['transfer_to']);
        $from = lookup_user($conn, $transfer['transfer_from']);
        echo "<div class='small-4 columns'><strong>Transfer To: </strong>" . ucfirst($to['name']) . "</div>";
        echo "<div class='small-4 columns'><strong>Transfer From: </strong>" . ucfirst($from['name']) . "</div>";
        echo "<div class='small-4 columns'><strong>Amount: </strong>" . $transfer['amount'] . "</div>";
        if ($transfer['comment'] != "") {
            echo "<div class='small-12 columns text-center'><strong>Comment: </strong>" . $transfer['comment'] . "</div>";
        }
        echo "</div>";
    }
}
?>
    </div>
    <div class="small-2 columns"><p></p></div>
</div>
<?php 
require_once 'src/footer.html';
コード例 #5
0
$gentimecount = 0;
$order = "acctid";
if ($sort != "") {
    $order = "{$sort}";
}
$display = 0;
$query = httppost('q');
if ($query === false) {
    $query = httpget('q');
    if ($query === false) {
        $query = $session['user']['login'];
    }
}
if ($op == "search" || $op == "") {
    require_once "lib/lookup_user.php";
    list($searchresult, $err) = lookup_user($query, $order);
    $op = "";
    if ($err) {
        output($err);
    } else {
        $display = 1;
    }
}
$m = httpget("module");
if ($m) {
    $m = "&module={$m}&subop=module";
}
rawoutput("<form action='user.php?op=search{$m}' method='POST'>");
output("Search by any field below: ");
rawoutput("<input name='q' id='q'>");
$se = translate_inline("Search");
コード例 #6
0
ファイル: lookup_user.php プロジェクト: RITSPARSA/ISTS14_CTF
if (!isset($_GET['id'])) {
    $error = "You must enter an ID";
    header('Location: /lookup.php?error=' . urlencode($error));
    die;
}
$conn = connect_to_db();
$title = "Lookup User";
$css = "";
$subtitle = "";
require_once 'src/title.php';
check_errors();
?>

<div class="twelve columns text-center">
    <?php 
$lookup = lookup_user($conn, $_GET['id']);
if (isset($lookup['error'])) {
    echo "<div class='error_msg welcome'>" . $lookup['error'] . "</div>";
} else {
    foreach ($lookup as $row) {
        foreach ($row as $user => $value) {
            echo "<strong>{$user}</strong>: {$value}<br>";
        }
        echo "<br>";
    }
    echo "<br>";
}
?>
</div>
<div class="row">
        <div class="small-6 columns">
コード例 #7
0
include_once '../bitvote.php';
function lookup_user($usr_id, $cur_time)
{
    // check if user exists (if not, create user)
    // check if url exists (if not, create url)
    // add vote
    if ($con = connect_db('../auth.txt')) {
        $result = pg_prepare($con, "check_user", 'SELECT * FROM users where id = $1');
        $result = pg_execute($con, "check_user", array($usr_id));
        $usr_entry = pg_fetch_array($result);
        pg_free_result($result);
        if (!$usr_entry) {
            $result = pg_prepare($con, "reg_user", 'INSERT INTO users VALUES ($1, $2, $3)');
            $result = pg_execute($con, "reg_user", array($usr_id, 0, (int) $cur_time));
            pg_free_result($result);
            $id = $usr_id;
            $spent = 0;
            $reg = $cur_time;
        } else {
            $id = $usr_entry[0];
            $spent = $usr_entry[1];
            $reg = $usr_entry[2];
        }
        echo json_encode(array("usr" => $id, "spent" => $spent, "reg" => $reg));
    } else {
        echo json_encode(array("f**k" => "nuts"));
    }
}
lookup_user($_POST['usr_id'], $_POST['cur_time']);
コード例 #8
0
ファイル: find.php プロジェクト: RITSPARSA/ISTS14_CTF
$tail = <<<TAIL
\t\t</table>
\t</div>
TAIL;
require_once "functions.php";
$conn = connect_to_db(1);
$error = "";
$result = "";
$users = "";
if (isset($_POST['username'])) {
    $username = $_POST['username'];
    if ($username == "") {
        $error = "Username must not be blank.";
    }
    if (!$error) {
        $result = lookup_user($conn, $username);
        $users = $result[0];
        $error = $result[1];
    }
}
$conn->close();
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Find Friends - Top Secret</title>
<link href="css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery-1.11.0.min.js"></script>
<!-- Custom Theme files -->
<link href="css/style.css" rel="stylesheet" type="text/css" media="all"/>