function exportData($WHERE) { $SQL = 'SELECT ' . TBL_DATA . '.*, ' . TBL_USERS . '.name AS owner, ' . TBL_MEDIATYPES . '.name AS mediatype, ' . TBL_LENT . '.who AS lentto, CASE WHEN ' . TBL_USERSEEN . '.video_id IS NULL THEN 0 ELSE 1 END AS seen FROM ' . TBL_DATA . ' LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_USERS . '.id LEFT JOIN ' . TBL_USERSEEN . ' ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . ' LEFT JOIN ' . TBL_LENT . ' ON ' . TBL_DATA . '.diskid = ' . TBL_LENT . '.diskid LEFT JOIN ' . TBL_MEDIATYPES . ' ON mediatype = ' . TBL_MEDIATYPES . '.id ' . $WHERE; $result = runSQL($SQL); // do adultcheck if (is_array($result)) { $result = array_filter($result, create_function('$video', 'return adultcheck($video["id"]);')); } // genres for ($i = 0; $i < count($result); $i++) { $result[$i]['genres'] = getItemGenres($result[$i]['id'], true); } //2015-10-6 Alex ADD start // studios for ($i = 0; $i < count($result); $i++) { $result[$i]['studios'] = getItemStudios($result[$i]['id'], true); } //2015-10-6 Alex ADD end return $result; }
function countRec($fname, $where) { //$sql = "SELECT count($fname) FROM $tname "; $sql = "SELECT count({$fname})\n FROM ticket_delivery a LEFT JOIN agent b ON a.agent_id = b.id\n LEFT JOIN ticket_delivery_user c on a.user_id = c.id {$where}"; $result = runSQL($sql); return $result[0][0]; }
function countRec($fname, $tname) { $sql = "SELECT count({$fname}) FROM {$tname} "; $result = runSQL($sql); while ($row = mysql_fetch_array($result)) { return $row[0]; } }
public function __construct($user_id) { $result = runSQL("select * from users where id = '{$user_id}'"); $user = mysql_fetch_array($result); $this->id = $user['id']; $this->name = $user['first_name'] . ' ' . $user['last_name']; $this->email = $user['email']; $this->username = $user['username']; }
/** * Create user * * @param string $user Username * @param string $pass Password * @param string $perm permission as integer * @return boolean true on success */ function create_user($user, $pass, $perm, $email) { global $config; // acquire next free "real" user-id $SQL = "SELECT (MAX(id)+1) AS id FROM " . TBL_USERS . " WHERE id != " . $config['guestid'] . ";"; $res = runSQL($SQL); $nextid = $res[0]['id']; $SQL = "INSERT INTO " . TBL_USERS . "\n SET id = " . $nextid . ",\n \t name = '" . addslashes($user) . "',\n passwd = '" . md5($pass) . "',\n permissions = {$perm},\n email = '" . addslashes($email) . "'"; $res = runSQL($SQL, false); // set default read/write permissions for own data if ($res !== false) { $SQL = 'REPLACE INTO ' . TBL_PERMISSIONS . " \n SET from_uid=" . $nextid . ", to_uid=" . $nextid . ", permissions=" . PERM_READ . "|" . PERM_WRITE; $res = runSQL($SQL, false); } return $res; }
function printItems($UID, $hours) { // date_default_timezone_set("America/New_York"); // $sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl, // UNIX_TIMESTAMP(A.dt) as unix_time // $sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl, // DATE_FORMAT(A.dt, '%H:%i') as time, // DATE_FORMAT(A.dt, '%W %D %M %Y') as date $sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl,\n\t\t\t UNIX_TIMESTAMP(A.dt) as timestamp\n FROM lylina_items A, lylina_feeds B, lylina_userfeeds C\n WHERE B.id = A.feed_id\n AND B.id = C.feed_id\n AND C.user_id = {$UID}\n AND UNIX_TIMESTAMP(A.dt) > UNIX_TIMESTAMP()-({$hours}*60*60)\n ORDER BY A.dt DESC, A.title"; $items = runSQL($sql); // foreach($items as $item){ // formatItem($item); // } for ($n = 0; $n < count($items); $n++) { // $items[$n]['time'] = date("H:i", $items[$n]['unix_time'] + date('Z')); // $items[$n]['date'] = date("l F j, Y", $items[$n]['unix_time'] + date('Z')); formatItem($items[$n], $n); } }
function channelFavicon($location) { $empty_ico_data = base64_decode('AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAD//wAA//8AAP//' . 'AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAA='); // $ico_url = getFaviconURL($location) ; // if(!$ico_url) { // return false ; // } $sql = "SELECT favicon_url FROM lylina_feeds WHERE url = '" . $location . "'"; $result = runSQL($sql); // $cached_ico = './favicons/' . md5($ico_url) . ".ico" ; $cached_ico = './favicons/' . md5($result[0]['favicon_url']) . ".ico"; $cachetime = 7 * 24 * 60 * 60; // 7 days // echo "<br> $ico_url , $cached_ico " ; // Serve from the cache if it is younger than $cachetime clearstatcache(); // Clear the file stat cache in case we already recached the ico if (file_exists($cached_ico) && time() - filemtime($cached_ico) < $cachetime) { return $cached_ico; } else { $ico_url = getFaviconURL($location); if (!$ico_url) { return false; } if ($ico_url != $result['favicon_url']) { $sql = "UPDATE lylina_feeds SET favicon_url = '" . $ico_url . "' WHERE url ='" . $location . "'"; runSQL($sql); } $cached_ico = './favicons/' . md5($ico_url) . ".ico"; if (!($data = @file_get_contents($ico_url))) { $data = $empty_ico_data; } if (stristr($data, 'html')) { $data = $empty_ico_data; } $fp = fopen($cached_ico, 'w'); fputs($fp, $data); fclose($fp); return $cached_ico; } }
function getRevenue($date_to, $gameID) { if ($gameID == "CARO") { $database_name = "gametrans_MPCARO"; } elseif ($gameID == "10HA7") { $database_name = "gametrans_VC"; } else { $database_name = "gametrans_{$gameID}"; } $param = $date_to; $table = date("Ymd", strtotime($param)); $table_sms = $gameID . "_sms_" . $table; $table_sms_user = "******" . $table; $table_mcard = "card123_verify_" . $table; $table_mcard_user = "******" . $table; $table_zcard = "cardzing_verify_" . $table; $table_zcard_user = "******" . $table; $table_atm = "atm_queryorder_" . $table; $table_atm_user = "******" . $table; //////////////////////// ATM /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// $list = array(); $sql_atm = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.totalAmount) as revenue_gross,SUM(t1.opAmount) as revenue_net FROM {$table_atm} t1, {$table_atm_user} t2 WHERE t1.mTransactionID = t2.mTransactionID \nAND t1.transactionStatus = '1' AND t2.gameID = '{$gameID}' "; $row_atm = runSQL($sql_atm); $sql_zcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.cardvalue) as revenue_gross,SUM(t1.cardvalue) as revenue_net FROM {$table_zcard} t1 WHERE t1.verify = '1' AND t1.gameID = '{$gameID}' "; $row_zcard = runSQL($sql_zcard); $sql_mcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.grossAmount) as revenue_gross,SUM(t1.netAmount) as revenue_net FROM {$table_mcard} t1 WHERE t1.groupResponseCode = '1' AND t1.gameID = '{$gameID}' "; $row_mcard = runSQL($sql_mcard); $sql_sms = "SELECT COUNT(t1.requestid) as qty,SUM(t1.money) as revenue_gross,SUM(t1.net_money) as revenue_net FROM {$table_sms} t1 \n "; $row_sms = runSQL_sms($sql_sms, $database_name); $list['atm'] = $row_atm; $list['zcard'] = $row_zcard; $list['mcard'] = $row_mcard; $list['sms'] = $row_sms; // $result = json_encode($list); // savefile($result, $name_file_log); return $list; }
function runUpdate($name, $version) { global $UPDATES_PATH; log_update("Running update {$name}.{$version}"); $fileSQL = "{$name}.{$version}.sql"; $fileSH = "{$UPDATES_PATH}/{$name}.{$version}.sh"; log_update("Checking SQL..."); if (file_exists("{$UPDATES_PATH}/{$fileSQL}")) { log_update("... SQL file found: {$fileSQL}"); runSQL($fileSQL); } else { log_update("... This update doesn't contain any SQL"); } log_update("Checking shell script..."); if (file_exists($fileSH)) { log_update("... Shell script found: {$fileSH}"); $output = shell_exec($fileSH); if ($output) { log_update($output); } } else { log_update("... This update doesn't contain any shell script"); } }
function countRec($fname, $tname) { $sql = "SELECT count({$fname}) FROM {$tname} "; $result = runSQL($sql); return $result[0][0]; }
$str .= '<tr><td style="padding-left:10px;height:15px;">Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>'; // Caso 2: possui inst/campus } else { $sql2 = "SELECT ca.nome as nomeCampus, i.nome as nomeInst, i.sigla\r\n\t\t\t\t\t\tFROM campus ca\r\n\t\t\t\t\t\tINNER JOIN instituicao i on (i.id_instituicao = '" . $arr["fk_instituicao"] . "')\r\n\t\t\t\t\t\tWHERE ca.id_campus = " . $arr["fk_campus"]; $result2 = runSQL($sql2); $arr2 = mysql_fetch_array($result2); $nomeCampus = stripslashes($arr2["nomeCampus"]); $nomeInst = stripslashes($arr2["nomeInst"]); $sigla = stripslashes($arr2["sigla"]); $str .= '<tr><td style="padding-left:10px;height:15px;"> Campus: </td><td style="padding-left:10px;"> ' . $nomeCampus . '</td></tr>'; $str .= '<tr><td style="padding-left:10px;height:15px;"> Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>'; } // Caso 3: possui inst } else { $sql2 = "SELECT nome as nomeInst, sigla\r\n\t\t\t\t\tFROM instituicao\r\n\t\t\t\t\tWHERE id_instituicao = " . $arr["fk_instituicao"]; $result2 = runSQL($sql2); $arr2 = mysql_fetch_array($result2); $nomeInst = stripslashes($arr2["nomeInst"]); $sigla = stripslashes($arr2["sigla"]); $str .= '<tr><td style="padding-left:10px;height:15px;"> Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>'; } } echo $str; exit; } else { if (isset($_POST["opcao"]) && $_POST["opcao"] == "logout") { session_destroy(); echo 1; } } }
function countRec($_field, $_table, $_where = false) { try { $_query = runSQL("SELECT count(" . $_field . ") AS count FROM " . $_table . " " . $_where, "mysql"); $_response = mysql_fetch_assoc($_query); return $_response["count"]; } catch (Exception $e) { echo "#" . $e->getMessage() . ": Algum erro ocorreu."; echo "<br />"; print_r($e->getTrace()); exit; } }
function editar_cad_usuario($id, $nome, $email, $senha, $cpf) { if ($senha != "") { $senha2 = MD5($senha); } else { $mantemSenha = "SELECT senha\r\n\t\t\t\t\t\tFROM usuario\r\n\t\t\t\t\t\tWHERE id_usuario=" . $id; $resultSenha = runSQL($mantemSenha); $linha_senha = mysql_fetch_array($resultSenha); $senha2 = $linha_senha["senha"]; } $sql = "UPDATE usuario\r\n SET\r\n nome = '" . $nome . "',\r\n email = '" . $email . "',\r\n senha = '" . $senha2 . "'\r\n WHERE id_usuario = " . $id; $result = runSQL($sql); if ($result != false) { $nome = stripslashes($nome); $email = stripslashes($email); $senha = stripslashes($senha); // envio do email /* $sHeader = "From: mostratec@poa.ifrs.edu.br\n"; $sBody = $nome."\n"; $sBody = "Registro de Alteração de Dados:\n\n"; $sBody .= "Nome: ".$nome."\n"; $sBody .= "Email: ".$email."\n"; $sBody .= "Para entrar no sistema:\n"; $sBody .= "CPF: ".$cpf."\n"; $sBody .= "Senha: ".$senha."\n"; $sBody .= "Link: http://mostratec.poa.ifrs.edu.br/2012 \n"; $sTo = $email; $sSubject = " Alteração de Dados - Mostratec (".$nome.") "; $Envio = mail ($sTo, $sSubject, $sBody, $sHeader) ; */ $_SESSION['nome_usuario'] = $nome; $ans = 1; } else { $ans = 0; } return $ans; }
/** * Genres */ function setup_getGenres() { $SELECT = 'SELECT id, name FROM ' . TBL_GENRES . ' ORDER BY name'; $result = runSQL($SELECT); return array_associate($result, 'id', 'name'); }
<?php $id = $_GET["id"]; $task = runSQLfetchAll("SELECT * FROM task WHERE id = :id", array(":id" => $id)); $task = $task[0]; $current_date = time() * 1000; if ($task["start_date"] * 1 > 0) { // если задача уже была запущена, то перещитаем ей время в пауз $pause_summ = +$task["pause_summ"]; $pause_date = +$task["pause_date"]; if ($pause_date * 1 > 0) { $diff = $current_date - $pause_date; } else { $diff = 0; } $pause_summ += $diff; runSQL("UPDATE task SET pause_date = 0, pause_summ = :pause_summ WHERE id = :id", array(":id" => $id, ":pause_summ" => $pause_summ)); $task["pause_date"] = 0; $task["pause_summ"] = +$pause_summ; } else { // если задача ни разу не была запущена, то сетим ей дату начала runSQL("UPDATE task SET pause_date = 0, start_date = :start_date WHERE id = :id", array(":id" => $id, ":start_date" => $current_date)); $task["start_date"] = +$current_date; $task["pause_date"] = 0; } echo json_encode(array("task" => $task));
function FetchSaveMovie($id, $lookup) { $debug = 0; $video = runSQL('SELECT * FROM ' . TBL_DATA . ' WHERE id = ' . $id); // get fields (according to list) from db to be saved later if ($debug) { echo "\n=================== Video DB Data ============================\n"; print_r($video[0]); echo "\n=================== Video DB Data ============================\n"; } $imdbID = $video[0]['imdbID']; echo "Movie/imdb -- " . $video[0]['title'] . "/" . $video[0]['imdbID'] . "\n"; if (empty($imdbID)) { echo "No imdbID\n"; return; } if (empty($engine)) { $engine = engineGetEngine($imdbID); } if ($debug) { echo "IMDBID = {$imdbID}, engine = {$engine}\n"; } $imdbdata = engineGetData($imdbID, $engine); # removed due to performance issues of is_utf8 // fix erroneous IMDB encoding issues if (!is_utf8($imdbdata)) { echo "Applying encoding fix\n"; $imdbdata = fix_utf8($imdbdata); } if (empty($imdbdata[title])) { echo "Fetch failed , try again...\n"; $imdbdata = engineGetData($imdbID, $engine); } if (empty($imdbdata[title])) { echo "Fetch failed again , next movie"; return; } if ($debug) { echo "\n=================== IMDB Data ============================\n"; print_r($imdbdata); echo "\n=================== IMDB Data ============================\n"; } if (!empty($imdbdata[title])) { // // NOTE: comment out any of the following lines if you do not want them updated // $video[0][title] = $imdbdata[title]; $video[0][subtitle] = $imdbdata[subtitle]; $video[0][year] = $imdbdata[year]; $video[0][imgurl] = $imdbdata[coverurl]; $video[0][runtime] = $imdbdata[runtime]; $video[0][director] = $imdbdata[director]; $video[0][rating] = $imdbdata[rating]; $video[0][country] = $imdbdata[country]; $video[0][language] = $imdbdata[language]; $video[0][actors] = $imdbdata[cast]; $video[0][plot] = $imdbdata[plot]; } if (count($genres) == 0 || $lookup > 1) { $genres = array(); $gnames = $imdbdata['genres']; if (isset($gnames)) { foreach ($gnames as $gname) { // check if genre is found- otherwise fail silently if (is_numeric($genre = getGenreId($gname))) { $genres[] = $genre; } else { echo "MISSING GENRE {$gname}\n"; } } } } // custom filds , not working for now for ($i = 1; $i <= 4; $i++) { $custom = 'custom' . $i; $type = $config[$custom . 'type']; if (!empty($type)) { // copy imdb data into corresponding custom field $video[0][$custom] = $imdbdata[$type]; echo "CUSTOM {$custom} {$type} = {$imdbdata[$type]}\n"; } } // -------- SAVE $SETS = prepareSQL($video[0]); if ($debug) { echo "\n=================== Final Data ============================\n"; echo "SETS = {$SETS} \n"; echo "\n=================== Final Data ============================\n"; } $id = updateDB($SETS, $id); // save genres setItemGenres($id, $genres); // set seen for currently logged in user set_userseen($id, $seen); }
// check for localnet localnet_or_die(); // multiuser permission check permission_or_die(PERM_WRITE, get_owner_id($id)); /* // remove old cover image from cache $SQL = 'SELECT imgurl FROM '.TBL_DATA.' WHERE id = '.$id; $res = runSQL($SQL); if (count($res)) { removeCacheFile($res[0]['imgurl']); } */ // remove actual data runSQL('DELETE FROM ' . TBL_DATA . ' WHERE id = ' . $id); runSQL('DELETE FROM ' . TBL_VIDEOGENRE . ' WHERE video_id = ' . $id); //2015-10-6 Alex ADD start runSQL('DELETE FROM ' . TBL_VIDEOSTUDIO . ' WHERE video_id = ' . $id); //2015-10-6 Alex ADD end // clear smarty cache for this item #!! this does not work- at least not with Smarty3 #$smarty->cache->clear($id); // goto index instead of delete template if ($redirect) { header("Location: index.php?deleteid={$id}"); exit; } // prepare templates tpl_page(); // display templates tpl_display('delete.tpl');
if ($id) { // select all fields according to list, plus id foreach ($imdb_set_fields as $name) { if ($SELECT) { $SELECT .= ', '; } $SELECT .= $name; } $SELECT = 'SELECT ' . TBL_DATA . '.id, ' . TBL_DATA . '.owner_id, ' . TBL_USERS . '.name AS owner, !ISNULL(' . TBL_USERSEEN . '.video_id) AS seen, ' . $SELECT . ' FROM ' . TBL_DATA . ' LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_USERS . '.id LEFT JOIN ' . TBL_USERSEEN . ' ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . ' WHERE ' . TBL_DATA . '.id = ' . $id; $video = runSQL($SELECT); // diskid to global scope: $diskid = $video[0]['diskid']; } else { $video[0]['language'] = $config['langdefault']; } // assign automatic disk id if ($config['autoid'] && (empty($diskid) || $add_flag) && $mediatype != MEDIA_WISHLIST) { $video[0]['diskid'] = getDiskId(); // Fix for Bugreport [1122052] Automatic DiskID generation problem $smarty->assign('autoid', $result[0]['max']); } if (empty($video[0]['owner_id']) && !empty($owner_id)) { $video[0]['owner_id'] = $owner_id; } // prepare templates
// Get imgurl for the actor if ($name) { require_once './engines/engines.php'; // name given $name = html_entity_decode($name); $result = engineActor($name, $actorid, engineGetActorEngine($actorid)); if (!empty($result)) { $url = $result[0][1]; } if (preg_match('/nohs(-[f|m])?.gif$/', $url)) { // imdb no-image picture $url = ''; } // write only if HTTP lookup physically successful $SQL = 'REPLACE ' . TBL_ACTORS . " (name, imgurl, actorid, checked)\n VALUES ('" . addslashes($name) . "', '" . addslashes($url) . "', '" . addslashes($actorid) . "', NOW())"; runSQL($SQL); } // Get cached image for the given url if (preg_match('/\\.(jpe?g|gif|png)$/i', $url, $matches)) { // calculate cache filename if we're not looking into the cache again- otherwise this is done by cache_file_exists // $file is further needed for downloading the file // This is only effective if function is enabled in getThumbnail function # if ($cache_ignore) $file = cache_get_filename($url, CACHE_IMG, $matches[1])); // does the cache file exist? if (cache_file_exists($url, $targetfile, CACHE_IMG, $matches[1])) { // amazon workaround for 1 pixel transparent images checkAmazonSmallImage($url, $matches[1], $targetfile); } else { download($url, $targetfile); } // double-check this is really an image
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="description" content="VideoDB" /> </head> <body> <?php if ($submit) { // validate form data $maxcount = is_numeric($maxcount) ? (int) $maxcount : 0; // Build query - ignore duplicate imdbID fields $query = 'SELECT DISTINCT `imdbID`, `director`, `actors` FROM ' . TBL_DATA; if (empty($wishlist)) { $query .= ' WHERE mediatype != ' . MEDIA_WISHLIST; } $result = runSQL($query); $includeDirectors = !empty($director); $actors = array(); // Actor array // If we are counting the directors separately than the actors, create the array if (empty($notseparate) && $includeDirectors) { $directors = array(); $displayDirectorCount = true; } else { // Otherwise, use the actor array for directors as well. $directors =& $actors; $displayDirectorCount = false; } foreach ($result as $row) { $cast = split("\r?\n", $row['actors']); // Counting actors
$rating = $match[1]; // matching at least required rating? if (!empty($required_rating) && (double) $rating < $required_rating) { continue; } } $year = ''; if (preg_match("#\\((\\d{4})\\)#i", $title, $match)) { $year = $match[1]; // matching at least required year? if (!empty($required_year) && (int) $year < $required_year) { continue; } } if (empty($rating) || $rating >= $required_rating) { $available = count(runSQL("SELECT * FROM " . TBL_DATA . " WHERE imdbID = '{$id}'")) > 0; if ($available) { $add_movie = $title; } else { $add_movie = '<a class="green" href="../edit.php?save=1&mediatype=' . MEDIA_WISHLIST . '&lookup=1&imdbID=' . $id . '&title=' . urlencode($title) . '" target="_blank">' . $title . ' <img src="../images/add.gif" border="0"/></a>'; } $add_movie = 'Recommended: ' . $add_movie . " (IMDB Id {$id}) {$rating}<br/>\n"; echo $add_movie; if ($download && !$available) { engineGetData($id); } } } } echo "<br/>\n\n"; }
$query = "SELECT * FROM EXISTINGNEEDS WHERE NEED_ID={$t_id}"; if ($result = runSQL($query)) { $row = $result->fetch_assoc(); $user_id = $row['USER_ID']; $title_ = $row['TITLE']; $location_ = $row['LOCATION']; $content_ = $row['DESCRIPTION']; $need_date_ = $row['NEEDDATE']; $userid = $row['USER_ID']; echo "<h4>Title:</h4>{$title_}"; echo "<h4>Location:</h4>{$location_}"; echo "<h4>Date:</h4>{$need_date_}"; echo "<h4>What do they need?</h4>{$content_}"; // echo "{$userid}"; $query2 = "SELECT * FROM USERS WHERE USER_ID={$userid}"; if ($result2 = runSQL($query2)) { $row2 = $result2->fetch_assoc(); $name_ = $row2['FIRST_NAME'] . " " . $row2['LAST_NAME']; $email_ = $row2['EMAIL']; } echo "<h4>Contact:</h4><b>Name:</b>\t{$name_}"; echo "<br><b>Email:</b>\t{$email_}"; //echo "<p>Contact {$name_} at {email_} </p> " } } ?> </div> </div> <div class="col-md-2"></div>
<?php $id = $_GET["id"]; $name = $_GET["name"]; runSQL("UPDATE task SET name = :name WHERE id = :id", array(":name" => $name, ":id" => $id)); echo json_encode(array("status" => "success"));
/** * Function combines multiple actor thumbnail queries into single SQL query */ function get_actor_thumbnails_batched(&$actors) { if (!count($actors)) { return; } $ids = "'" . join("','", array_map('addslashes', array_extract($actors, 'id'))) . "'"; $SQL = 'SELECT actorid, name, imgurl, UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(checked) AS cacheage FROM ' . TBL_ACTORS . ' WHERE actorid IN (' . $ids . ')'; $result = runSQL($SQL); $result = array_associate($result, 'actorid'); // loop over actors from full-text field foreach ($actors as $idx => $actor) { // check for actor thumbnail $batch_result = $result[$actor['id']]; if ($batch_result) { $actors[$idx]['imgurl'] = get_actor_image_from_cache($batch_result, $actor['name'], $actor['id']); } else { $actors[$idx]['imgurl'] = getActorThumbnail($actor['name'], $actor['id'], false); } } }
INNER JOIN avaliador av ON av.fk_usuario = avs.fk_avaliador INNER JOIN usuario u ON av.fk_usuario = u.id_usuario WHERE s.id_sessao =".$id_sessao." AND ". "u.id_usuario =".$id_avaliador." AND ". "t.id_trabalho =".$id_trabalho. "order by s.id_sessao, avs.seq, t.id_trabalho"; */ $sql_trab = "SELECT t.id_trabalho, t.titulo_ordenar, t.fk_area, t.fk_categoria, t.fk_modalidade, c.nivel, u.nome AS nome_autor\r\nFROM trabalho t, trabalho_autor_curso tac, usuario u, curso c\r\nWHERE (t.id_trabalho = " . $id_trabalho . " AND t.status = 4) AND (tac.fk_trabalho = t.id_trabalho AND tac.seq = 1) AND u.id_usuario = tac.fk_autor AND (c.id_curso = tac.fk_curso)\r\nORDER BY t.id_trabalho"; $result_trab = runSQL($sql_trab); if ($result_trab == false) { echo mysql_error(); } $linha_trab = mysql_fetch_array($result_trab); $sql_avaliador = "SELECT u.nome as nome_avaliador\r\nFROM usuario u, avaliador_sessao avs, trabalho t\r\nWHERE t.id_trabalho = " . $id_trabalho . " AND avs.fk_sessao=t.fk_sessao AND u.id_usuario=avs.fk_avaliador \r\nAND u.id_usuario =" . $id_avaliador . " ORDER BY avs.fk_avaliador"; $result_avaliador = runSQL($sql_avaliador); if ($result_avaliador == false) { echo mysql_error(); } //$result = mysql_query($sql,$conexao) or die(mysql_error()); //$num_reg = mysql_num_rows($result); //Fazer um laço de repeticao enquanto tiver avaliador dessa sessao desse trabalho. while ($linha_avaliador = mysql_fetch_array($result_avaliador)) { $titulo = $linha_trab['titulo_ordenar']; $tematica = $linha_trab['fk_area']; $categoria = $linha_trab['fk_categoria']; $modalidade = $linha_trab['fk_modalidade']; $nivel = $linha_trab['nivel']; $nome_apresentador = $linha_trab['nome_autor']; $nome_avaliador = $linha_avaliador['nome_avaliador']; # array : área temática :
<?php $id = $_GET["id"]; $stop_date = time() * 1000; runSQL("UPDATE task SET stop_date = :stop_date WHERE id = :id", array(":id" => $id, ":stop_date" => $stop_date)); echo json_encode(array("stop_date" => $stop_date));
echo $str; exit; } else { if (isset($_POST["opcao"]) && $_POST["opcao"] == "removerTrabalho") { $id_user = (int) $_SESSION["id_usuario"]; if (isset($id_user)) { if (ETAPA_INSCRICAO_TRABALHO == 1 || ETAPA_CORRECAO_TRABALHO == 1) { $id_trab = (int) $_POST["id_trabalho"]; $valida = validaAutor($id_user, $id_trab, $conexao); if ($valida == 1) { $sqlRemove1 = "DELETE FROM trabalho_orientador_campus WHERE fk_trabalho = " . $id_trab; $sqlRemove2 = "DELETE FROM trabalho_autor_curso WHERE fk_trabalho = " . $id_trab; $sqlRemove3 = "DELETE FROM trabalho WHERE id_trabalho = " . $id_trab; $result1 = runSQL($sqlRemove1); $result2 = runSQL($sqlRemove2); $result3 = runSQL($sqlRemove3); $str = 1; } else { $str = -1; // erro: não é autor principal } } else { $str = -1; // erro: etapa não permite remover trabalho } } else { $str = -1; // erro: sessão expirou ou não existe ! } echo $str; exit;
unset($_SESSION['customer']); unset($_SESSION['admin']); unset($_REQUEST['logout']); unset($_SESSION['is_admin']); include 'login.htm'; exit(0); } if (!(isset($_REQUEST['login']) && isset($_REQUEST['password']))) { echo "Ошибка при вводе имени или пароля! login={$_REQUEST['login']} password={$_REQUEST['password']}"; exit(0); } require_once 'config_db.php'; // $conn->debug = true; $login = $conn->Qmagic($_REQUEST['login']); $password = $conn->Qmagic($_REQUEST['password']); $recordSet = runSQL($_SESSION['sql_text'] = "select * from users where login={$login} and password = {$password}"); //.$conn->Qmagic( hash("sha256", $password) ) ); if ($recordSet->EOF) { throw new Exception("Ошибка при вводе имени и пароля! {$login} {$password} Либо запись не активизирована."); } // общие параметры try { $_SESSION['customer'] = $recordSet->fields['key_users']; $_SESSION['login'] = $recordSet->fields['login']; $_SESSION['name_user'] = $recordSet->fields['descriptor']; if ($recordSet->fields['is_admin']) { $_SESSION['admin'] = '12345'; $_SESSION['is_admin'] = 'true'; } else { unset($_SESSION['is_admin']); }
<div class="jumbotron"> <div class="container"> <div class="row"> <div class="col-md-2"></div> <div class="col-md-8 forms" id="form"> <form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> " method="post"> <div class="form-group"> <label for="category">Category</label> <select class="form-control" name="category" id="category"> <?php echo "<option value=\"\">Please Select</option>"; $sql = "SELECT * FROM CATEGORIES"; $result = runSQL($sql); while ($row = $result->fetch_assoc()) { $cat_id = $row['CATEGORY_ID']; $cat_name = $row['CATEGORY_NAME']; echo "<option value={$cat_id}>{$cat_name}</option>"; } ?> </select> </div> <div class="form-group"> <label for="title">Title: Briefly describe what you need help with</label> <input type="text" class="form-control" name="title" id="title"> </div> <div class="form-group"> <label for="date">On which date do you need help?</label> <input type="date" class="form-control" name="date" id="date">
md5, comment, disklabel, imdbID, actors, runtime, country, filename, filesize, filedate, audio_codec, video_codec, video_width, video_height, istv, lastupdate, mediatype, created, location, download1, download2, download3, download4, custom1, custom2, custom3, custom4, !ISNULL(' . TBL_USERSEEN . '.video_id) AS seen, ' . TBL_LENT . '.who, ' . TBL_USERS . '.name AS owner, ' . TBL_MEDIATYPES . '.name AS mediatypename FROM ' . TBL_DATA . ' LEFT JOIN ' . TBL_USERS . ' ON owner_id = ' . TBL_USERS . '.id LEFT JOIN ' . TBL_USERSEEN . ' ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . ' LEFT JOIN ' . TBL_LENT . ' ON ' . TBL_DATA . '.diskid = ' . TBL_LENT . '.diskid LEFT JOIN ' . TBL_MEDIATYPES . ' ON ' . TBL_DATA . '.mediatype = ' . TBL_MEDIATYPES . '.id' . $JOINS . ' WHERE ' . $WHERES . ' ORDER BY title, subtitle'; $result = runSQL($select); /* // prepare actors table if searching for them if (in_array('actors', $fields)) { $actors = ''; foreach ($result as $row) { $actors .= $row['actors']."\n"; } # dump($actors); $qa = preg_replace('/"/', '', $q); # dump($qa); if (preg_match_all("#^.*$qa.*#im", $actors, $m, PREG_PATTERN_ORDER)) $actors = join("\n", $m);