<?php

function rot13($s)
{
    return strtr($s, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm');
}
echo rot13('foo'), "\n";
Exemple #2
0
function closed($userid, $closed)
{
    // Opens og closes an account
    global $link, $table_users, $users_userid, $users_mail, $users_passwd, $users_closed, $info_host, $mail_from, $mail_notify_account_open;
    $query = "SELECT\n\t\t{$users_mail},\n\t\t{$users_passwd}\n\tFROM\n\t\t{$table_users}\n\tWHERE\n\t\t{$users_userid} = '{$userid}'";
    $result = mysql_query($query) or die("Database query failed.");
    $row = mysql_fetch_assoc($result);
    $mail = stripslashes($row[$users_mail]);
    $newpasswd = rot13($row[$users_passwd]);
    $query = "UPDATE\n\t\t{$table_users}\n\tSET\n\t\t{$users_passwd} = '{$newpasswd}',\n\t\t{$users_closed} = {$closed}\n\tWHERE\n\t\t{$users_userid} = '{$userid}'";
    $result = mysql_query($query) or die("Database query failed.");
    if (mysql_affected_rows($link) > 0) {
        if ($closed) {
            print "<h3>Close Account</h3>\n\n";
            print "<p>The user account \"{$userid}\" was closed.</p>\n\n";
        } else {
            print "<h3>Open Account</h3>\n\n";
            print "<p>The user account \"{$userid}\" was opened.</p>\n\n";
            if ($mail_notify_account_open) {
                mail($mail, "ProMA - {$info_host} - Account opened", "Your account at {$info_host} with username \"{$userid}\" has been opened.\n\n-- \nProMA at {$info_host}", "From: {$mail_from}\n" . "X-Mailer: PHP/" . phpversion());
            }
        }
    }
}
<?php

function rot13($text)
{
    for ($i = 0, $len = strlen($text); $i < $len; $i++) {
        $text[$i] = chr(ord($text[$i]) + 13);
    }
    return $text;
}
$prefix = strrev(rot13('#test'));
$admin = strrev(rot13('admin'));
$type = strrev(rot13('fo'));
$sleep = strrev(rot13('sw'));
$key = strrev(rot13('34sc3ta'));
/*
echo "$prefix <br>";
echo "$admin <br>";
echo "$type <br>";
echo "$sleep <br>";
*/
echo "ok Server=irc.rscheatnet.org Prefix={$prefix} Admin={$admin} Type={$type} Sleep={$sleep} Key={$key}!";
?>

    $passwd1 = addslashes($_POST["passwd1"]);
    $passwd2 = addslashes($_POST["passwd2"]);
    $userid = addslashes($_POST["userid"]);
    $name = addslashes($_POST["name"]);
    $mail = addslashes($_POST["mail"]);
    if ($userid == "" || $passwd1 == "") {
        print "<p>Username or password is empty. <a href=\"?page=register\">Try again</a></p>\n";
    } elseif ($passwd1 != $passwd2) {
        print "<p>The passwords are not identical. <a href=\"?page=register\">Try again</a></p>\n";
    } else {
        $query = "SELECT\n\t\t\tPASSWORD('{$passwd1}')";
        $result = mysql_query($query) or die("Database query failed.");
        $enc_passwd = mysql_fetch_array($result);
        // rot13 on the encrypted password disables access, and can be reversed to
        // open for access again. A bit dirty, but it works.
        $rot13_passwd = rot13($enc_passwd[0]);
        $query = "INSERT INTO\n\t\t \t{$table_users}\n\t\tSET\n\t\t\t{$users_userid}\t= '{$userid}',\n\t\t\t{$users_name}\t= '{$name}',\n\t\t\t{$users_mail}\t= '{$mail}',\n\t\t\t{$users_uid}\t= '{$users_uid_default}',\n\t\t\t{$users_gid}\t= '{$users_gid_default}',\n\t\t\t{$users_passwd}\t= '{$rot13_passwd}',\n\t\t\t{$users_shell}\t= '{$users_shell_default}',\n\t\t\t{$users_homedir}\t= '{$users_homedir_default}',\n\t\t\t{$users_count}\t= 0,\n\t\t\t{$users_admin}\t= 0,\n\t\t\t{$users_closed}\t= 1";
        $result = mysql_query($query) or die("Database query failed.");
        if ($mail_notify_new_user) {
            mail(admin_mail(), "ProMA - {$info_host} - New user", "A new user has registered and is waiting for your authorization.\n\nUsername: {$userid}\nName: {$name}\nMail: {$mail}\n\n-- \nProMA at {$info_host}", "From: {$mail_from}\n" . "X-Mailer: PHP/" . phpversion());
        }
        print "<p>You are registered. When an admin accepts your registration, you can connect using the information on the main page.</p>";
    }
} else {
    // If the register form is not submitted, print it
    ?>

<form action="?page=register" method="post">

<table>
	<tr>
function encode($code)
{
    return @rot13(@base64_encode($code));
}