Example #1
0
<?php

function mySQLconnect()
{
    //load and check the form variables
    $hostname = "mysql.jennvargas.com";
    $username = "******";
    $password = "******";
    $database = "commonsground";
    $link = mysql_connect($hostname, $username, $password);
    mysql_select_db($database) or die("Unable to select database");
}
mySQLconnect();
$apiKey = "48792291a85b6bb9c45c7ba86372e720";
$apiSecret = "e519a126d6de492a";
// Create new phpFlickr object
$f = new phpFlickr($apiKey, $apiSecret);
//*** GET EXISTING TAGS FOR THAT PHOTO ***//
function displayExistingTags($photoID)
{
    $query = 'SELECT * FROM photos NATURAL LEFT JOIN connect WHERE flickrID = "' . $photoID . '"';
    $result = mysql_query($query) or die('Query failed: ' . mysql_error());
    while ($row = mysql_fetch_assoc($result)) {
        $tagID = $row['tagID'];
        $query = 'SELECT * FROM tags WHERE tagID = "' . $tagID . '"';
        $result2 = mysql_query($query) or die('Query failed: ' . mysql_error());
        while ($row2 = mysql_fetch_assoc($result2)) {
            //echo print_r($row2);
            $isMachine = $row2['tagType'];
            if ($isMachine != "machine") {
                $rawTag = $row2['rawTag'];
Example #2
0
File: sql.php Project: GGF/oldbaza
	//header('Location: http://'.$_SERVER['HTTP_HOST'].'');
	echo "<script>window.location='http://".$_SERVER['HTTP_HOST']."'</script>";
}

function is_utf($t) { if (@preg_match ('/.+/u', $t)) return true; else return false; }

function utf8_to_cp1251($t) { return iconv("UTF-8", "CP1251", $t);}
function cp1251_to_utf8($t) { return iconv( "CP1251","UTF-8", $t);}

// запускается - не функция
if(!headers_sent()  && !isset($print)) {
	header('Content-type: text/html; charset=windows-1251');
}

foreach ($_GET as $key => $val) {
	if (is_utf($val)) 
		${$key}=utf8_to_cp1251($val);
}
foreach ($_POST as $key => $val) {
	if (is_utf($val)) 
		${$key}=utf8_to_cp1251($val);
}

importmodules();

if (!isset($dbname)) $dbname='zaompp';
if (!mySQLconnect()) {
	my_error('Not connect to base!');
}

?>