Esempio n. 1
0
while ($row = mysql_fetch_array($gameLogin)) {
    if ($row['key'] == $_GET['key']) {
        $good = true;
        $gameid = $row['id'];
    }
}
// Load user info
$userLogin = mysql_query("SELECT * FROM user WHERE (username = '******'username']) . "') and (application_password = '******'password']) . "')");
// Check game and user info
if ($good) {
    if (mysql_num_rows($userLogin) == 1) {
        // Get data
        $row = mysql_fetch_array($userLogin);
        $userid = $row['id'];
        // Print info
        $key = createRandomKey(10);
        echo "true\n";
        echo $key;
        echo "\n";
        // Revoke previous sessions
        mysql_query("DELETE FROM sessions WHERE userid = '" . $userid . "'");
        // Save session
        mysql_query("INSERT INTO sessions (userid, gameid, apikey) VALUES ('{$userid}','{$gameid}','{$key}')");
        echo mysql_error();
    } else {
        echo "false";
        echo "<br>";
        echo "Invalid user\n";
    }
} else {
    echo "false";
Esempio n. 2
0
<?php

/**
 * @author Oleg Stepura <oleg.stepura [at] gmail.com>
 * @copyright Oleg Stepura <oleg.stepura [at] gmail.com>
 * @version $Id: random.php,v 343cbf4c5fe4 2011/04/14 15:35:59 C0BA $
 */
echo createRandomKey(64);
/**
 * Creates random passwords.
 * @author Oleg Stepura <oleg.stepura [at] gmail.com>
 * @version 1.0
 */
function createRandomKey($length)
{
    $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    $key = "";
    for ($i = 0; $i < $length; $i++) {
        $key .= $chars[rand(0, strlen($chars) - 1)];
    }
    return $key;
}
<?php

$absolute_path = __FILE__;
$path_to_file = explode('wp-content', $absolute_path);
$path_to_wp = $path_to_file[0];
//Access WordPress
require_once $path_to_wp . '/wp-load.php';
// JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $ext = end(explode('.', $_FILES['Filedata']['name']));
    $newName = createRandomKey(16) . '.' . $ext;
    $targetFile = $galleryimages . '/' . $newName;
    $targetURL = $galleryimagesUrl . '/' . $newName;
    if (@move_uploaded_file($tempFile, $targetFile)) {
        $updateResult = $wpdb->update($wpdb->prefix . 'backgrounds', array('THUMB' => $targetURL), array('IMAGEID' => $_REQUEST['IMAGEID']), array('%s'), array('%d'));
        if (sizeof($updateResult) > 0) {
            echo '{"status":"OK", "IMAGEID":"' . $_REQUEST['IMAGEID'] . '", "path":"' . $targetURL . '"}';
        } else {
            echo '{"status":"NOK", "ERR":"Have gots an error while inserting to database."}';
        }
    } else {
        echo '{"status":"NOK", "ERR":"File doesn\'t move to upload folder."}';
    }
}
Esempio n. 4
0
function getSource($sourceData, $imageW, $imageH)
{
    if (!empty($sourceData)) {
        $embedCode = '';
        $sourceType = getMediaType(trim($sourceData));
        $mediaParams = getParamsFromUrl(trim($sourceData));
        if (empty($sourceType)) {
            return '';
        }
        if ($sourceType == 'vimeo') {
            $embedCode = '<iframe src="http://player.vimeo.com/video/' . $mediaParams['v'] . '?title=0&amp;byline=0&amp;portrait=0" width="' . $imageW . '" height="' . $imageH . '" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>';
        } elseif ($sourceType == 'youtube') {
            $embedCode = '<iframe width="' . $imageW . '" height="' . $imageH . '" src="http://www.youtube.com/embed/' . $mediaParams['v'] . '?wmode=transparent&rel=0" frameborder="0" allowfullscreen></iframe>';
        } elseif ($sourceType == 'jwplayer') {
            $rand = createRandomKey(5);
            $embedCode = '<div id="jwEP' . $rand . '" style="width:' . $imageW . 'px; height:' . $imageH . 'px;"></div>
							<script>
							jwplayer("jwEP' . $rand . '").setup({
								flashplayer: "' . get_template_directory_uri() . '/jwplayer/player.swf",
								autostart: false,
								skin: "' . get_template_directory_uri() . '/jwplayer/glow/glow.xml",
								file: "' . $mediaParams['vurl'] . '",
								height: ' . $imageH . ',
								width: ' . $imageW . '
								});
							</script>';
        } elseif ($sourceType == 'flash') {
            $rand = createRandomKey(5);
            $embedCode = '<div id="flashContent' . $rand . '">
								<p>You need to <a href="http://www.adobe.com/products/flashplayer/" target="_blank">upgrade your Flash Player</a> to version 10 or newer.</p>  
							</div>
							<script type="text/javascript">  
									var flashvars = {};  
									var attributes = {};  
									attributes.wmode = "transparent";
									attributes.play = "true";
									attributes.menu = "false";
									attributes.scale = "showall";
									attributes.wmode = "transparent";
									attributes.allowfullscreen = "true";
									attributes.allowscriptaccess = "always";
									attributes.allownetworking = "all";					
									swfobject.embedSWF("' . $mediaParams['vurl'] . '", "flashContent' . $rand . '", "' . $imageW . '", "' . $imageH . '", "10", "' . get_template_directory_uri() . '/js/expressInstall.swf", flashvars, attributes);  
							</script>';
        }
        return $embedCode;
    }
}
Esempio n. 5
0
function sh_map($attr, $content = null)
{
    $content = trim($content);
    //defaults
    $width = '500px';
    $height = '500px;';
    $zoom = 11;
    // 0,7 to 18
    $sensor = 'true';
    $controls = 'false';
    $type = 'HYBRID ';
    // ROADMAP | SATELLITE | TERRAIN
    $marker = '';
    $marker_icon = '';
    if (!empty($attr['zoom'])) {
        $zoom = $attr['zoom'];
    }
    if (!empty($attr['sensor'])) {
        $sensor = $attr['sensor'];
    }
    if (!empty($attr['nocontrols'])) {
        $controls = $attr['nocontrols'];
    }
    if (!empty($attr['type'])) {
        $type = $attr['type'];
    }
    if (!empty($attr['width'])) {
        $width = $attr['width'];
    }
    if (!empty($attr['height'])) {
        $height = $attr['height'];
    }
    $mapID = createRandomKey(5);
    if (!empty($attr['marker']) || !empty($content)) {
        if (!empty($attr['marker_icon'])) {
            $marker_icon = ', icon:\'' . $attr['marker_icon'] . '\'';
        }
        $marker = 'var marker' . $mapID . ' = new google.maps.Marker({map: mapObj' . $mapID . ', 
		position: mapObj' . $mapID . '.getCenter()
		' . $marker_icon . '
		});';
        if (!empty($content)) {
            $marker .= '
		var infowindow' . $mapID . ' = new google.maps.InfoWindow();
		infowindow' . $mapID . '.setContent(\'' . $content . '\');
		google.maps.event.addListener(marker' . $mapID . ', \'click\', function() {
				infowindow' . $mapID . '.open(mapObj' . $mapID . ',  marker' . $mapID . ');
		});';
        }
    }
    $re = ' 
<script type="text/javascript">
$(document).bind(\'contentPageReady\', function(){
	var latlng = new google.maps.LatLng(' . $attr['lat'] . ', ' . $attr['lng'] . ');
	var myOptions = {
	  zoom: ' . $zoom . ',
	  disableDefaultUI: ' . $controls . ',
	  center: latlng,
	  mapTypeId: google.maps.MapTypeId.' . $type . '
	};
	var mapObj' . $mapID . ' = new google.maps.Map(document.getElementById("map' . $mapID . '"), myOptions);
	' . $marker . '
});
</script>
<div id="map' . $mapID . '" class="mapContact" style="width:' . $width . '; height:' . $height . '"></div>
';
    return $re;
}