Example #1
0
function generateID()
{
    $id = sha1(mt_rand());
    $mysqli = connectDB();
    $result = $mysqli->query("SELECT users.user_id, blogs.blog_id, posts.post_id FROM users,blogs,posts \n\t\t\t\t\t\t\t  WHERE users.user_id='" . $id . "' OR blogs.blog_id='" . $id . "' OR posts.post_id='" . $id . "';");
    if ($result->num_rows == 0) {
        return $id;
    } else {
        generateID();
    }
}
function generateID()
{
    $id = mt_rand(100000, 999999);
    $config = get_option('os_ticket_config');
    extract($config);
    $ost_wpdb = new wpdb($username, $password, $database, $host);
    $count_no = $ost_wpdb->get_var("SELECT count(*) as count from " . $keyost_prefix . "ticket WHERE number = '{$id}'");
    if ($count_no > 0) {
        return generateID();
    }
    return $id;
}
Example #3
0
function createRental($data)
{
    //Data: movieID & customerID
    $id = generateID(6);
    $data['rentalID'] = $id;
    $data['loanDate'] = date("Y-m-d");
    $data['dueDate'] = date("Y-m-d", strtotime("+1 month"));
    $data['amount'] = 3.0;
    if (insertRental($data) != false) {
        return $id;
    } else {
        return false;
    }
}
Example #4
0
 /**
  * @return string|false ID of the created album.
  */
 public function add($title = 'Untitled')
 {
     // Call plugins
     Plugins::get()->activate(__METHOD__, 0, func_get_args());
     // Properties
     $id = generateID();
     $sysstamp = time();
     $public = 0;
     $visible = 1;
     // Database
     $query = Database::prepare(Database::get(), "INSERT INTO ? (id, title, sysstamp, public, visible) VALUES ('?', '?', '?', '?', '?')", array(LYCHEE_TABLE_ALBUMS, $id, $title, $sysstamp, $public, $visible));
     $result = Database::execute(Database::get(), $query, __METHOD__, __LINE__);
     // Call plugins
     Plugins::get()->activate(__METHOD__, 1, func_get_args());
     if ($result === false) {
         return false;
     }
     return $id;
 }
Example #5
0
function create_room()
{
    // Generate a randoom string for use as a table name
    // $roomID = date('ymd') . generateID();
    global $link;
    $roomID = generateID();
    $roomDB = "room_" . $roomID;
    $rollDB = "rolls_" . $roomID;
    $mapsDB = "maps_" . $roomID;
    // Construct the SQL to create table
    $query = "CREATE TABLE IF NOT EXISTS `" . $rollDB . "` (`timestamp` INT UNSIGNED, `username` VARCHAR(60), `num` TINYINT UNSIGNED, `die` TINYINT UNSIGNED, `outcome` SMALLINT UNSIGNED, INDEX (username)) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
    $query2 = "CREATE TABLE IF NOT EXISTS `" . $mapsDB . "` (`username` VARCHAR(60), `xvar` SMALLINT UNSIGNED, `yvar` SMALLINT UNSIGNED, `role` TINYINT UNSIGNED, PRIMARY KEY (username), INDEX (username)) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
    $query3 = "CREATE TABLE IF NOT EXISTS `" . $roomDB . "` (`map` VARCHAR(60), PRIMARY KEY (map), INDEX (map)) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
    // Execute the query
    $result = mysql_query($query, $link) or die("A MySQL error has occurred.<br />Query: " . $query . "<br />Error: (" . mysql_errno() . ") " . mysql_error());
    $result2 = mysql_query($query2, $link) or die("A MySQL error has occurred.<br />Query: " . $query2 . "<br />Error: (" . mysql_errno() . ") " . mysql_error());
    $result3 = mysql_query($query3, $link) or die("A MySQL error has occurred.<br />Query: " . $query3 . "<br />Error: (" . mysql_errno() . ") " . mysql_error());
    // Save the roomID to the session
    $_SESSION['roomID'] = $roomID;
    return $roomID;
}
Example #6
0
//モードを取得
$mode = '';
if(!empty($_GET['mode'])){
	$mode = h($_GET['mode']);
}
//ページャーセット
$pager = pagerOut(file($file_path),$pagelengthAdmin,$pagerDispLength);

//----------------------------------------------------------------------
//  書き込み・編集処理 (START)
//----------------------------------------------------------------------

if ( (isset($_POST['submit']) || isset($_POST['edit_submit']) ) && !isset($_POST['del'])){
	  
	//各記事にユニークなIDを付与 uniqid(PHP3以下)が無ければ年月日時分秒
	$id = generateID();
		
	//----------------------------------------------------------------------
	//  画像縮小保存処理 GD必須 (START)
	//----------------------------------------------------------------------
	
		if(is_uploaded_file($_FILES["upfile"]["tmp_name"])){
			if ($_FILES["upfile"]["size"] < $maxImgSize) {
				$imgType = $_FILES['upfile']['type'];
				if ($imgType == 'image/gif') {
					$extension = 'gif';
					$image = ImageCreateFromGIF($_FILES['upfile']['tmp_name']); //GIFファイルを読み込む
				} else if ($imgType == 'image/png' || $imgType == 'image/x-png') {
					$extension = 'png';
					$image = ImageCreateFromPNG($_FILES['upfile']['tmp_name']); //PNGファイルを読み込む
				} else if ($imgType == 'image/jpeg' || $imgType == 'image/pjpeg') {
Example #7
0
    return $min + $rnd;
}
function generateID($length)
{
    $id = "";
    $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    $codeAlphabet .= "abcdefghijklmnopqrstuvwxyz";
    $codeAlphabet .= "0123456789";
    $max = strlen($codeAlphabet) - 1;
    for ($i = 0; $i < $length; $i++) {
        $id .= $codeAlphabet[crypto_rand_secure(0, $max)];
    }
    return $id;
}
$target_dir = "movie/img/";
$id = generateID(6);
$target_file = $target_dir . $id . "." . pathinfo($target_dir . basename($_FILES["fileToUpload"]["name"]), PATHINFO_EXTENSION);
$uploadOk = 1;
$imageFileType = pathinfo($target_dir . basename($_FILES["fileToUpload"]["name"]), PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
if (isset($_POST["submit"])) {
    $check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
    if ($check !== false) {
        $uploadOk = 1;
    } else {
        createResponse(array('error' => 'File is not a valid image.'));
        $uploadOk = 0;
    }
}
// Check if file already exists
if (file_exists($target_file)) {
Example #8
0
    if (file_exists('uploads/' . $GINKGO_USER_ID . '/' . $query[2] . '.done')) {
        echo '<img src="./uploads/' . $GINKGO_USER_ID . '/' . $query[2] . '.jpeg?uniq=' . rand(1000000.0, 2000000.0) . '">';
    } else {
        echo 'Generating figure...<meta http-equiv="refresh" content="1">';
    }
    exit;
}
// =============================================================================
// == Prepare file for UCSC custom track =======================================
// =============================================================================
if (isset($_POST['ucsc'])) {
    // Job settings
    $cell = $_POST['cell'];
    $range = $_POST['range'];
    //
    $analysisID = generateID(10);
    // Save job settings
    $configTxt = "browser position {$range}\n";
    $CMD = <<<CM
awk -v CELL='"{$cell}"' 'BEGIN{ print "track name=Amplifications description="CELL" color=0,0,255,"; }{  if(NR==1){ for(i=1;i<=NF;i++){if(\$i==CELL)cellID=i;} }else{ if(\$cellID>2)print \$1"\t"\$2"\t"\$3;  }  }' ./uploads/{$GINKGO_USER_ID}/SegCopy;
awk -v CELL='"{$cell}"' 'BEGIN{ print "track name=Deletions description="CELL" color=255,0,0,"; }{  if(NR==1){ for(i=1;i<=NF;i++){if(\$i==CELL)cellID=i;} }else{ if(\$cellID<2)print \$1"\t"\$2"\t"\$3;  }  }' ./uploads/{$GINKGO_USER_ID}/SegCopy;
CM;
    file_put_contents($userDir . '/' . $analysisID . '.ucsc', "browser position {$range}\n" . shell_exec($CMD));
    echo $analysisID;
    exit;
}
// =============================================================================
// == If analysis under way, redirect to status page ===========================
// =============================================================================
// Load status.xml if exists and check if analysis under way
if ($GINKGO_PAGE == "" || $GINKGO_PAGE == "home" || $GINKGO_PAGE == "dashboard") {
Example #9
0
<?php

header('Content-type: text/html; charset=ISO-8859-1');
// Allow access from anywhere. Can be domains or * (any)
header('Access-Control-Allow-Origin: *');
// Allow these methods of data retrieval
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
// Allow these header types
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
include "fhost.php";
$codhost = $_GET["codhost"];
$tracking = $_GET["tracking"];
$preview = $_GET["preview"];
if (is_null($codhost)) {
    debugl("<h1>Informe um codigo de hostname</h1>");
    exit;
} else {
    /**
     * Cria o objeto de host com todos os valores possiveis.
     **/
    $identificador = generateID();
    $host = createHost($codhost);
    debugl("Grafico ID -> {$identificador}");
    debugl("Inseridos -> " . registraGeracaoHTML($identificador, $host));
    if (strcmp($preview, "true") == 0) {
        echo processaRelatorioHost($identificador, $host);
    }
    echo "<h2>Id Gerado: {$identificador}<h2>";
}
Example #10
0
<?php

require_once '/home/nulled/www/planetxmail.com/mle/mlpsecure/config/config.inc';
require_once '/home/nulled/www/planetxmail.com/mle/mlpsecure/validationfunctions.php';
require_once '/home/nulled/www/planetxmail.com/mle/mlpsecure/mailfunctions.php';
if (!@mysqli_ping($db->link)) {
    $db = new MySQL_Access('mle');
} else {
    $db->SelectDB('mle');
}
if (!$resending) {
    $i = 0;
    while (true) {
        $i++;
        if ($i > 3000) {
            mail_debug_backtrace_exit();
        }
        $uID = generateID(10);
        if ($db->Query("SELECT userID FROM users WHERE userID='{$uID}' LIMIT 1")) {
            continue;
        } else {
            break;
        }
    }
    $email = $email1 = strtolower(trim($email1));
}
$referercookie = $referer ? $_COOKIE["{$listhash}"] : 0;
$notValid = send_signup_mail($list, $id, $resending, $pass1, $email, $username, $uID, $fname, $lname, $email1, $status, 'sendvalidationmail.php', $referercookie);
 foreach ($ficheros as $nombre => $fichero) {
     // Convert file
     if (strpos($fichero, '.txt') !== false) {
         $path_orig = $fichero;
         $path_dest = preg_replace('/(\\.txt)/', '_convert$1', $path_orig);
         $fich_orig = fopen($path_orig, "r");
         $fich_dest = fopen($path_dest, "w");
         $fich_htaccess = fopen($temp_dir . ".htaccess", "w");
         if ($fich_orig && $fich_dest && $fich_htaccess) {
             // Print header
             fwrite($fich_dest, Ubicacion::printHeader() . "\n");
             // Skip first line
             fgets($fich_orig);
             while (($line = fgets($fich_orig)) !== false) {
                 // Process the line read
                 $id_elem = generateID();
                 $datos = explode(",", $line);
                 $lat = $datos[2];
                 $long = $datos[3];
                 $ubic = new Ubicacion($id_elem, $lat, $long);
                 $file_name = str_replace(".txt", "", $nombre);
                 fwrite($fich_dest, $ubic->__toString() . "\"" . PHP_EOL);
             }
             fclose($fich_orig);
             unlink($path_orig);
             fclose($fich_dest);
             fwrite($fich_htaccess, "Options +Indexes");
             fclose($fich_htaccess);
         }
     }
 }
Example #12
0
 /**
  * Duplicates a photo.
  * @return boolean Returns true when successful.
  */
 public function duplicate()
 {
     // Check dependencies
     Validator::required(isset($this->photoIDs), __METHOD__);
     // Call plugins
     Plugins::get()->activate(__METHOD__, 0, func_get_args());
     // Init vars
     $error = false;
     // Get photos
     $query = Database::prepare(Database::get(), "SELECT id, checksum FROM ? WHERE id IN (?)", array(LYCHEE_TABLE_PHOTOS, $this->photoIDs));
     $photos = Database::execute(Database::get(), $query, __METHOD__, __LINE__);
     if ($photos === false) {
         return false;
     }
     // For each photo
     while ($photo = $photos->fetch_object()) {
         // Generate id
         $id = generateID();
         // Duplicate entry
         $values = array(LYCHEE_TABLE_PHOTOS, $id, LYCHEE_TABLE_PHOTOS, $photo->id);
         $query = Database::prepare(Database::get(), "INSERT INTO ? (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum) SELECT '?' AS id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star, checksum FROM ? WHERE id = '?'", $values);
         $result = Database::execute(Database::get(), $query, __METHOD__, __LINE__);
         if ($result === false) {
             $error = true;
         }
     }
     if ($error === true) {
         return false;
     }
     return true;
 }