Example #1
0
 //    $teamid = 0;
 //    $project_prefs = "";
 //}
 //if(defined('INVITE_CODES')) {
 //    $invite_code = post_str("invite_code");
 //    if (strlen($invite_code)==0) {
 //        show_error(tra("You must supply an invitation code to create an account."));
 //    }
 //    if (!preg_match(INVITE_CODES, $invite_code)) {
 //        show_error(tra("The invitation code you gave is not valid."));
 //    }
 //}
 print_r($data);
 exit;
 $new_name = $data['namePerson/friendly'];
 if (!is_valid_user_name($new_name, $reason)) {
     show_error($reason);
 }
 $new_email_addr = $data['contact/email'];
 $new_email_addr = strtolower($new_email_addr);
 if (!is_valid_email_addr($new_email_addr)) {
     show_error("Invalid email address:\n                you must enter a valid address of the form\n                name@domain");
 }
 $user = lookup_user_email_addr($new_email_addr);
 if (!$user) {
     $passwd_hash = random_string();
     $country = $data['contact/country/home'];
     if ($country == "") {
         $country = "International";
     }
     if (!is_valid_country($country)) {
Example #2
0
<?php

require "admin-header.php";
if (!isset($_SESSION['administrator'])) {
    echo "<a href='../loginpage.php'>Please Login First!</a>";
    exit(1);
}
if (isset($_POST['prefix'])) {
    require_once "../include/check_post_key.php";
    $prefix = $_POST['prefix'];
    require_once "../include/my_func.inc.php";
    if (!is_valid_user_name($prefix)) {
        echo "Prefix is not valid.";
        exit(0);
    }
    $teamnumber = intval($_POST['teamnumber']);
    $pieces = explode("\n", trim($_POST['ulist']));
    if ($teamnumber > 0) {
        echo "<table border=1>";
        echo "<tr><td colspan=3>Copy these accounts to distribute</td></tr>";
        echo "<tr><td>team_name<td>login_id</td><td>password</td></tr>";
        for ($i = 1; $i <= $teamnumber; $i++) {
            $user_id = $prefix . ($i < 10 ? '0' . $i : $i);
            $password = strtoupper(substr(MD5($user_id . rand(0, 9999999)), 0, 10));
            if (isset($pieces[$i - 1])) {
                $nick = $pieces[$i - 1];
            } else {
                $nick = "your_own_nick";
            }
            echo "<tr><td>{$nick}<td>{$user_id}</td><td>{$password}</td></tr>";
            $password = pwGen($password);
Example #3
0
<?php

$cache_time = 10;
$OJ_CACHE_SHARE = false;
require_once './include/cache_start.php';
require_once './include/db_info.inc.php';
require_once './include/setlang.php';
require_once "./include/const.inc.php";
require_once "./include/my_func.inc.php";
// check user
$user = $_GET['user'];
if (!is_valid_user_name($user)) {
    echo "No such User!";
    exit(0);
}
$view_title = $user . "@" . $OJ_NAME;
$user_mysql = mysql_real_escape_string($user);
$sql = "SELECT `school`,`email`,`nick` FROM `users` WHERE `user_id`='{$user_mysql}'";
$result = mysql_query($sql);
$row_cnt = mysql_num_rows($result);
if ($row_cnt == 0) {
    $view_errors = "No such User!";
    require "template/" . $OJ_TEMPLATE . "/error.php";
    exit(0);
}
$row = mysql_fetch_object($result);
$school = $row->school;
$email = $row->email;
$nick = $row->nick;
mysql_free_result($result);
// count solved
Example #4
0
        $str2 = $str2 . "&problem_id=" . $problem_id;
    } else {
        $problem_id = strval(intval($_GET['problem_id']));
        if ($problem_id != '0') {
            $sql = $sql . "AND `problem_id`='" . $problem_id . "' ";
            $str2 = $str2 . "&problem_id=" . $problem_id;
        } else {
            $problem_id = "";
        }
    }
}
// check the user_id arg
$user_id = "";
if (isset($_GET['user_id'])) {
    $user_id = trim($_GET['user_id']);
    if (is_valid_user_name($user_id) && $user_id != "") {
        $sql = $sql . "AND `user_id`='" . $user_id . "' ";
        if ($str2 != "") {
            $str2 = $str2 . "&";
        }
        $str2 = $str2 . "user_id=" . $user_id;
    } else {
        $user_id = "";
    }
}
if (isset($_GET['language'])) {
    $language = intval($_GET['language']);
} else {
    $language = -1;
}
if ($language > 9 || $language < 0) {
Example #5
0
<?php

require_once "./include/db_info.inc.php";
require_once "./include/my_func.inc.php";
$newlang = strval($_GET['lang']);
if (is_valid_user_name($newlang) && strlen($newlang) < 3) {
    $_SESSION['OJ_LANG'] = $newlang;
}
echo "<script language='javascript'>\n";
echo "history.go(-1);\n";
echo "</script>";
Example #6
0
<?php

session_start();
require_once "include/db_info.inc.php";
require_once "include/my_func.inc.php";
$sql = "select * from users where `user_id`='{$_POST['id']}'";
$tmp = @mysql_query($sql);
$cnt = @mysql_num_rows($tmp);
if ($cnt >= 1 || !is_valid_user_name($_POST['id'])) {
    echo "false";
} else {
    echo "true";
}