Example #1
0
 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)) {
         echo "bad country";
         exit;
     }
     $postal_code = '';
     $user = make_user($new_email_addr, $new_name, $passwd_hash, $country, $postal_code, $project_prefs = "", $teamid = 0);
     if (!$user) {
         show_error("Couldn't create account");
     }
     if (defined('INVITE_CODES')) {
         error_log("Account '{$new_email_addr}' created using invitation code '{$invite_code}'");
     }
 }
 // Log-in user in the web
 // In success case, redirect to a fixed page so that user can
 // return to it without getting "Repost form data" stuff
 $next_url = post_str('next_url', true);
 $next_url = sanitize_local_url($next_url);
 if ($next_url) {
     Header("Location: " . URL_BASE . "{$next_url}");
 } else {
Example #2
0
function insert_case($t, $user)
{
    global $master_url;
    global $dry_run;
    if ($dry_run) {
        if (!$user) {
            echo "   making user {$t->user_email}\n";
        }
        echo "   making team {$t->name}\n";
        return;
    }
    if (!$user) {
        echo "   making user {$t->user_email}\n";
        $user = make_user(mysql_real_escape_string($t->user_email), mysql_real_escape_string($t->user_name), random_string());
        if (!$user) {
            echo "   Can't make user {$t->user_email}\n";
            echo mysql_error();
            exit;
        }
    }
    echo "   making team {$t->name}\n";
    $team = make_team($user->id, $t->name, $t->url, $t->type, $t->name_html, $t->description, $t->country);
    if (!$team) {
        echo "   Can't make team {$t->id}\n";
        echo mysql_error();
        echo "\n";
        exit;
    }
    mysql_query("update team set seti_id={$t->id} where id={$team->id}");
    mysql_query("update user set teamid={$team->id} where id={$user->id}");
    send_email($user, "Team created on " . PROJECT, "An instance of the BOINC-wide team '{$t->name}'\nhas been created on the project:\nname: " . PROJECT . "\nURL: {$master_url}\n");
}
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
// Script to create a BOINC-wide team and corresponding account.
// Probably useful only to me.
// usage: create_boinc_wide_team.php username emailaddr teamname
require_once "../inc/user.inc";
require_once "../inc/team.inc";
if ($argc != 4) {
    die("usage: create_boinc_wide_team username email teamname\n");
}
$user_name = $argv[1];
$email_addr = $argv[2];
$team_name = $argv[3];
$passwd_hash = md5("foobar" . $email_addr);
$user = make_user($email_addr, $user_name, $passwd_hash);
if (!$user) {
    die("can't create user\n");
}
echo "created user {$user->id}\n";
$team = make_team($user->id, $team_name, "", "", "", "", "");
if (!$team) {
    die("can't create team\n");
}
echo "created team {$team->id}\n";
$retval = $user->update("email_validated=1, teamid={$team->id}");
if (!$retval) {
    die("can't update user\n");
}
echo "done\n";
Example #4
0
[quote]
And a quote!
[/quote]
';
// The script expects the ID's in the tables to sequential (1,2,3,4,5),
// so no holes please (1,4,5,8)...
$nr_of_users = nrof(USERS_TABLE);
$nr_of_cats = nrof(CATEGORIES_TABLE);
$nr_of_forums = nrof(FORUMS_TABLE);
$nr_of_posts = nrof(POSTS_TABLE);
$u = $users;
$starttime = microtime();
$usercreationcount = 0;
while ($users > 0) {
    $name = "testuser_" . substr(md5(uniqid(rand())), 0, 10);
    if (make_user($name)) {
        $usercreationcount++;
        $users--;
    }
    if ($usercreationcount % 500 == 0) {
        echo "status: {$usercreationcount} <br>\n";
        flush();
    }
}
if ($posts > 0) {
    filldb($posts);
}
$endtime = microtime();
if ($submit = "" || !isset($submit)) {
    ?>
Hello, welcome to this little phpBB Benchmarking script :)<p>
Example #5
0
}
if (is_banned_email_addr($email_addr)) {
    xml_error(ERR_BAD_EMAIL_ADDR);
}
if (strlen($passwd_hash) != 32) {
    xml_error(-1, "password hash length not 32");
}
$user = BoincUser::lookup_email_addr($email_addr);
if ($user) {
    if ($user->passwd_hash != $passwd_hash) {
        xml_error(ERR_DB_NOT_UNIQUE);
    } else {
        $authenticator = $user->authenticator;
    }
} else {
    $user = make_user($email_addr, $user_name, $passwd_hash, 'International');
    if (!$user) {
        xml_error(ERR_DB_NOT_UNIQUE);
    }
    if (defined('INVITE_CODES')) {
        error_log("Account for '{$email_addr}' created using invitation code '{$invite_code}'");
    }
}
if ($team_name) {
    $team_name = BoincDb::escape_string($team_name);
    $team = BoincTeam::lookup("name='{$team_name}'");
    if ($team && $team->joinable) {
        user_join_team($team, $user);
    }
}
echo " <account_out>\n";
Example #6
0
    $run_on_batteries = parse_boolint($prefs, "run_on_batteries");
    $run_if_user_active = parse_boolint($prefs, "run_if_user_active");
    $start_hour = parse_num($prefs, "<start_hour>");
    $end_hour = parse_num($prefs, "<end_hour>");
    $net_start_hour = parse_num($prefs, "<net_start_hour>");
    $net_end_hour = parse_num($prefs, "<net_end_hour>");
    $leave_apps_in_memory = parse_boolint($prefs, "leave_apps_in_memory");
    $confirm_before_connecting = parse_boolint($prefs, "confirm_before_connecting");
    $hangup_if_dialed = parse_boolint($prefs, "hangup_if_dialed");
    $work_buf_min_days = parse_num($prefs, "<work_buf_min_days>");
    $max_cpus = parse_num($prefs, "<max_cpus>");
    $cpu_scheduling_period_minutes = parse_num($prefs, "<cpu_scheduling_period_minutes>");
    $disk_interval = parse_num($prefs, "<disk_interval>");
    $disk_max_used_gb = parse_num($prefs, "<disk_max_used_gb>");
    $disk_max_used_pct = parse_num($prefs, "<disk_max_used_pct>");
    $disk_min_free_gb = parse_num($prefs, "<disk_min_free_gb>");
    $vm_max_used_pct = parse_num($prefs, "<vm_max_used_pct>");
    $idle_time_to_run = parse_num($prefs, "<idle_time_to_run>");
    $max_bytes_sec_up = parse_num($prefs, "<max_bytes_sec_up>");
    $max_bytes_sec_down = parse_num($prefs, "<max_bytes_sec_down>");
    $query = "insert into puser values\r\n\t\t({$user->id},\r\n\t\t{$user->create_time},\r\n\t\t'{$user->email_addr}',\r\n\t\t'{$user->country}',\r\n\t\t{$user->total_credit},\r\n\t\t'{$user->venue}',\r\n\t\t{$run_on_batteries},\r\n\t\t{$run_if_user_active},\r\n\t\t{$start_hour},\r\n\t\t{$end_hour},\r\n\t\t{$net_start_hour},\r\n\t\t{$net_end_hour},\r\n\t\t{$leave_apps_in_memory},\r\n\t\t{$confirm_before_connecting},\r\n\t\t{$hangup_if_dialed},\r\n\t\t{$work_buf_min_days},\r\n\t\t{$max_cpus},\r\n\t\t{$cpu_scheduling_period_minutes},\r\n\t\t{$disk_interval},\r\n\t\t{$disk_max_used_gb},\r\n\t\t{$disk_max_used_pct},\r\n\t\t{$disk_min_free_gb},\r\n\t\t{$vm_max_used_pct},\r\n\t\t{$idle_time_to_run},\r\n\t\t{$max_bytes_sec_up},\r\n\t\t{$max_bytes_sec_down})\r\n\t";
    $retval = mysql_query($query);
    if (!$retval) {
        echo mysql_error();
    }
}
set_time_limit(0);
$result = mysql_query("select * from user where total_credit > 0");
while ($user = mysql_fetch_object($result)) {
    make_user($user);
}
                            echo $CONF["db"];
                            ?>
" is created.
			<?php 
                        } else {
                            ?>
				Database "<?php 
                            echo $CONF["db"];
                            ?>
" already exists. Database has not been created.
			<?php 
                        }
                        ##################
                        # if create user
                        if ($FDAT["create_user"]) {
                            $user_created = make_user();
                            if ($user_created) {
                                ?>
					<br />
					User "<?php 
                                echo $CONF["user"];
                                ?>
" for database "<?php 
                                echo $CONF["db"];
                                ?>
" is created.
				<?php 
                            } else {
                                ?>
					<br />
					User "<?php 
Example #8
0
<?php

// configuration
require "../includes/config.php";
// if form was submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["username"])) {
        apologize("You must provide a username.");
    }
    if (empty($_POST["password"])) {
        apologize("You must provide a password.");
    }
    if (empty($_POST["confirmation"])) {
        apologize("You need to confirm your password by re-typing it.");
    }
    if ($_POST["password"] != $_POST["confirmation"]) {
        apologize("Password and confirmation do not match.");
    }
    // create new user account
    if (make_user($_POST["username"], $_POST["password"]) === false) {
        apologize("Username already exists.");
    }
    redirect("login.php");
} else {
    // else render form
    render("register_form.php", ["title" => "Register"]);
}