public static function fetchOne($sql) { $con = new connection(); $con->execute($sql); $con->fetch(); return $con->rows; }
function dateExists() { $date = date('Y-m-d', strtotime($_GET['date'])); $sql = "SELECT COUNT(*) AS count FROM ipodate WHERE ipodate = '" . mysql_escape_string($date) . "'"; $con = new connection(); $con->execute($sql); die($con->fetch()); }
function useralive($userid) { $con= new connection(); $con->execute("select time from users where iduser='******'"); $con->fetch(); $time1= $con->rows['time']; if ($time1<(time()-13)) return false; else return true; }
function getSymbols() { // get a list of IPOs from database that are missing the ipoprice $sql = "SELECT DISTINCT symbol FROM ipo WHERE ipoprice IS NULL"; $con = new connection(); $con->execute($sql); $symbols = array(); while ($con->fetch()) { $symbols[] = $con->rows["symbol"]; } return $symbols; }
function getSymbols() { // get a list of all IPOs that don't have first day open/close price set $sql = "SELECT DISTINCT symbol, ipodate FROM ipo WHERE closeprice = 0 OR openprice = 0"; $con = new connection(); $con->execute($sql); $symbols = array(); while ($con->fetch()) { $symbols[] = array("symbol" => $con->rows["symbol"], "ipodate" => $con->rows["ipodate"]); } return $symbols; }
function getSymbols() { // get the full list of IPOs in the database $sql = "SELECT DISTINCT symbol FROM ipo"; $con = new connection(); $con->execute($sql); $symbols = array(); while ($con->fetch()) { $symbols[] = $con->rows["symbol"]; } return $symbols; }
function symbolsNoScore() { // get a list of IPOs and their dates from the database that are missing tweets/hype or are in the future $sql = "SELECT DISTINCT symbol, ipodate FROM ipo WHERE hype IS NULL OR ipodate >= CURDATE()"; $con = new connection(); $con->execute($sql); $symbols = array(); while ($con->fetch()) { $symbol = array(); $symbol["symbol"] = $con->rows["symbol"]; $symbol["ipodate"] = strtotime($con->rows["ipodate"]); $symbols[] = $symbol; } return $symbols; }
<?php include "../database/connection.php"; $conn = new connection(); $conn->connectdb('wisma', 'wisma'); $str = "INSERT INTO FASILITAS VALUES('" . $_POST["id_fasilitas"] . "','" . $_POST["nama_fasilitas"] . "')"; echo $str; $conn->execute($str); header("location: ../tambah_fasilitas.php");
<? include("connection.php"); include("classes/users.class.php"); include("classes/chat.class.php"); $user= new users(); if (!$user->isuser($_REQUEST['device'])) { header("location: newuser.php?device=".$_REQUEST['device']); exit(); } $con= new connection(); $con->execute("update users set time='" . time() . "' where iduser='******'"); $chat= new chat(); $chat->closedeadrooms(); if(!$chatid=$_GET['idchat']) { if ($chatid=$chat->findchat($user->id)) { //echo "found chat"; $chat->joinchat($chatid,$user->id); }else{ $chatid=$chat->createchat($user->id); //echo "created chat";
function closedeadrooms() { $con= new connection(); $con->execute("select idchat, user1, user2, full from chat where closed<>'Y'"); while($con->fetch()) { $user= new users(); if ($user->useralive($con->rows['user1'])==false) $this->closeroom($con->rows['idchat']); if ($user->useralive($con->rows['user2'])==false && $con->rows['full']=='Y') $this->closeroom($con->rows['idchat']); } }
<?php include "../database/connection.php"; $conn = new connection(); $conn->connectdb('wisma', 'wisma'); $conn->execute("DELETE FROM KAMAR WHERE NO='" . $_GET['id_kamar'] . "'"); //echo "DELETE FROM KAMAR WHERE NO=".$_GET['id_kamar']; header("Location: ../tambah_kamar.php");
<?php include './database/connection.php'; $my_connection = new connection(); $my_connection->connectdb('wisma', 'wisma'); $str = "INSERT INTO KAMAR VALUES('" . $_POST['no_kamar'] . "','" . $_POST['kelas'] . "'," . $_POST['harga'] . "," . $_POST['kapasitas'] . ",'" . $_POST['wisma'] . "')"; echo $str; $my_connection->execute($str); header("Location: tambah_kamar.php"); ?>
$user=new users(); $chat=new chat(); $count=$user->getusercount(); if (!$chat->chatclosed($_REQUEST['idchat'])) { if ($partner=$chat->getchatpartner($_REQUEST['idchat'], $_REQUEST['iduser'])) echo "<b>Chatting with $partner</b>"; else echo "<b>Waiting for chat partner</b>"; } else echo "<b>Partner has left the chat</b>"; echo " - $count Users Online!"; $con=new connection(); $con->execute("select * from text where idchat='" . $_REQUEST['idchat'] . "' "); $count=$con->numRows(); /* if ($count > 12) $start=$count - 12; else $start=0; */ $con->execute("select * from text where idchat='" . $_REQUEST['idchat'] . "'"); while ($con->fetch()) { $name = $user->getname($con->rows['iduser']); $txt=stripslashes($con->rows['text']); echo "<div style='margin:2px; padding:5px; width:290px; color:#333333; font-size:11px; font-family:\"lucida grande\",tahoma,verdana,arial,sans-serif; background-color:#ECEFF5; '><span style='font-weight:bold;color:#3B5998; text-transform:capitalize; margin-right:3px;'>$name</span> {$txt}</div>"; }
<?php include "../database/connection.php"; $conn = new connection(); $conn->connectdb('wisma', 'wisma'); $conn->execute("DELETE FROM FASILITAS WHERE ID_FASILITAS='" . $_GET['id_fasilitas'] . "'"); //echo "DELETE FROM KAMAR WHERE NO=".$_GET['id_kamar']; header("Location: ../tambah_fasilitas.php");