/**
  * encrypts a string
  *
  * @param $string \b string to encrypt
  */
 static function string_encrypt($string)
 {
     require_once 'encryption.class.php';
     include 'other/pw_key.php';
     $crypt = new encryption_class();
     return $crypt->encrypt($_PSU_KEY['key'], $string);
 }
Beispiel #2
0
 function encrypt($plain_text, $key = '')
 {
     $this->key = $key !== '' ? $key : mosCreateGUID();
     $mainframe =& mosMainframe::getInstance();
     $enc_text = parent::encrypt($this->key, $plain_text, strlen($plain_text));
     return $enc_text;
 }
function do_email_change()
{
    global $db, $ir, $c, $userid, $h;
    require 'encryptor.php';
    $crypt = new encryption_class();
    $encpass = $crypt->encrypt($ir['email'], $_POST['pass']);
    $encpass = addslashes($encpass);
    if ($encpass != $ir['userpass']) {
        print "The password you entered was wrong.<br />\n<a href='preferences.php?action=emailchange'>&gt; Back</a>";
    } else {
        if (!$_POST['email'] || !$_POST['pass']) {
            print "Must fill in all fields!<br />\n<a href='preferences.php?action=emailchange'>&gt; Back</a>";
        } else {
            if (!valid_email($_POST['email'])) {
                die("Sorry, the email is invalid.<br />\n&gt;<a href='preferences.php'>Back</a>");
            } else {
                $_POST['email'] = mysql_escape($_POST['email']);
                $newp = $crypt->encrypt($_POST['email'], $_POST['pass']);
                $newp = addslashes($newp);
                $db->query("UPDATE users SET email='{$_POST['email']}',userpass='******' WHERE userid={$userid}");
                print "Email changed!";
            }
        }
    }
}
require "class/class_db_mysql.php";
$db = new database();
$db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
$db->connect();
$c = $db->connection_id;
$set = array();
$settq = $db->query("SELECT * FROM settings");
$IP = mysql_real_escape_string($_SERVER['REMOTE_ADDR']);
while ($r = $db->fetch_row($settq)) {
    $set[$r['conf_name']] = $r['conf_value'];
}
if ($_POST['email'] == "" || $_POST['password'] == "") {
    die("<h3>{$set['game_name']} Error</h3>\nYou did not fill in the login form!<br>\n<a href=login.php>&gt; Back</a>");
}
$_POST['email'] = mysql_real_escape_string($_POST['email']);
$encpass = $crypt->encrypt($_POST['email'], $_POST['password']);
$encpass = addslashes($encpass);
$uq = $db->query("SELECT userid FROM users WHERE email='{$_POST['email']}' AND `userpass`='{$encpass}'");
$la = $db->fetch_row($db->query("SELECT * FROM loginattempts WHERE ip='{$IP}'"));
if ($db->num_rows($uq) == 0 && $la['times'] < 10) {
    $lat = $db->num_rows($db->query("SELECT * FROM loginattempts WHERE ip='{$IP}'"));
    if (!$lat) {
        $db->query("INSERT INTO loginattempts VALUES('','{$IP}',1)");
    } else {
        $db->query("UPDATE loginattempts SET times=times+1 WHERE ip='{$IP}'");
    }
    die("<h3>{$set['game_name']} Error</h3>\nInvalid email or password!<br>\n<a href=login.php>&gt; Back</a>");
} else {
    if ($la['times'] > 9) {
        die("<h3>{$set['game_name']} Error</h3>\nYou have tried to login the maximum number of times for this hour. Please wait 1 hour and try again.<br>\n<a href=login.php>&gt; Back</a>");
    } else {
Beispiel #5
0
    try {
        $id3data = $getid3->analyze($_FILES['upfile']['tmp_name']);
        getid3_lib::CopyTagsToComments($id3data);
        $title = htmlspecialchars(utf8_encode($id3data['comments_html']['title'][0]), ENT_QUOTES);
        $artist = htmlspecialchars(utf8_encode($id3data['comments_html']['artist'][0]), ENT_QUOTES);
        $playtime = $id3data['playtime_seconds'];
        $sample_rate = $id3data['audio']['sample_rate'];
        $filesize = $id3data['filesize'];
        $fileformat = $id3data['fileformat'];
    } catch (Exception $e) {
        echo 'ID3tag ERROR: ' . $e->message;
    }
    include 'include/class.encryption.php';
    $encryption = new encryption_class();
    $md5 = md5_file($_FILES['upfile']['tmp_name']);
    $secure_file_name = $encryption->encrypt(sha1($user), $md5);
    $secure_temporary_location = '' . $config['server']['internal_url'] . 'temp/' . $secure_file_name . '.' . strtolower(substr($_FILES['upfile']['name'], strrpos($_FILES['upfile']['name'], '.') + 1)) . '';
    rename($_FILES['upfile']['tmp_name'], $secure_temporary_location);
    $db->Raw("INSERT INTO `userdb_temporary` (`user`,`title`,`artist`,`md5`,`filesize`,`fileformat`,`sample_rate`,`location`,`playtime`) VALUES ('{$user}','{$title}','{$artist}','{$md5}','{$filesize}','{$fileformat}','{$sample_rate}','{$secure_temporary_location}','{$playtime}')");
    ?>
	
	<div style="border: 1px solid #e2c822; background-color: #fff9d7; padding: 5px;">
	<b><a href="<?php 
    echo "" . $config['fb']['fburl'] . "?tab=index&display=add&method=upload&step=3" . pages($_GET['fb_page_id']) . "";
    ?>
">Please click here if you are not automatically redirected within five seconds...</a></b>
	</div>
	<?php 
    if (isset($_GET['fb_page_id'])) {
        $facebook->redirect("" . $config['fb']['fburl'] . "?tab=index&display=add&method=upload&step=3&fb_page_id=" . $_GET['fb_page_id'] . "");
    } else {
Beispiel #6
0
function encrypt($value)
{
    $crypt = new encryption_class();
    return $crypt->encrypt("mysolrserver", $value, strlen($value));
}