示例#1
0
 public function DigerSahane()
 {
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if (!$connection->connect_error) {
         $connection->set_charset("utf8");
         $results = $connection->query("SELECT * FROM threads ORDER BY threadPoint DESC LIMIT 8 OFFSET 10 ");
         while ($curres = $results->fetch_assoc()) {
             $threadID5 = $curres["threadID"];
             $threadDate5 = $curres["threadDate"];
             $threadWriter5 = $curres["threadWriter"];
             $threadCategory5 = $curres["threadCategory"];
             $threadPicture5 = $curres["threadPicture"];
             $stepCount5 = $curres["stepCount"];
             $threadName5 = $curres["threadName"];
             $threadPoint5 = $curres["threadPoint"];
             $myThread5 = new Thread(array($threadID5, $threadDate5, $threadWriter5, $threadCategory5, $threadPicture5, $stepCount5, $threadName5, $threadPoint5));
             $myThread5->ThreadToPetitHTML();
         }
         echo "<div id=\"moreBestDiv\"></div>";
         echo "<div style=\"margin:2%;\">";
         echo "<form id=\"loadMoreBestForm\" method=\"post\" action=\"loadMoreBest.php\">";
         echo "<input id=\"loadMoreBestOffset\" name=\"loadMoreBestOffset\" style=\"display:none;\" value=\"" . $results->num_rows . "\"/>";
         echo "<button id=\"loadMoreBestButton\" class=\"btn btn-block btn-success\">";
         echo "<i id=\"loadMoreBestSpinner\" style=\"display:none;\" class=\"fa fa-refresh fa-spin\"></i>";
         echo "<span id=\"loadMoreBestTXT\">";
         echo "Daha fazla göster";
         echo "</span>";
         echo "</button>";
         echo "</form>";
         echo "</div>";
     }
 }
 public function Find()
 {
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $myQuery = "SELECT MAX(usedID) FROM usedIDs";
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return -1;
     }
     /* database'e girdik */
     $result = $connection->query($myQuery);
     if ($result->num_rows != 0) {
         $curResult = $result->fetch_assoc();
         $newResult = $curResult["MAX(usedID)"];
         $newResult = (int) $newResult;
         $newResult = $newResult + 1;
     } else {
         $newResult = 1;
     }
     if ($connection->query("INSERT INTO usedIDs(usedID) VALUES (" . $newResult . ")") === TRUE) {
         $connection->close();
         return $newResult;
     }
     $connection->close();
     return -1;
 }
 public function Find2()
 {
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return false;
     } else {
         $connection->set_charset("utf8");
         $query1 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Alakasız\"";
         $query2 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Bilim/Kültür\" ";
         $query3 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Sosyal ilişkiler\"";
         $query4 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Sağlık/Spor\"";
         $query5 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Yemek/İçmek\"";
         $query6 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Bilgisayar/Elektronik\"";
         $query7 = "SELECT count(distinct threadWriter) FROM threads WHERE threadCategory = \"Sanat/Eğlence\"";
         $res1 = $connection->query($query1);
         $res2 = $connection->query($query2);
         $res3 = $connection->query($query3);
         $res4 = $connection->query($query4);
         $res5 = $connection->query($query5);
         $res6 = $connection->query($query6);
         $res7 = $connection->query($query7);
         $res1_assoc = $res1->fetch_assoc();
         $res2_assoc = $res2->fetch_assoc();
         $res3_assoc = $res3->fetch_assoc();
         $res4_assoc = $res4->fetch_assoc();
         $res5_assoc = $res5->fetch_assoc();
         $res6_assoc = $res6->fetch_assoc();
         $res7_assoc = $res7->fetch_assoc();
         $connection->close();
         return array($res1_assoc["count(distinct threadWriter)"], $res2_assoc["count(distinct threadWriter)"], $res3_assoc["count(distinct threadWriter)"], $res4_assoc["count(distinct threadWriter)"], $res5_assoc["count(distinct threadWriter)"], $res6_assoc["count(distinct threadWriter)"], $res7_assoc["count(distinct threadWriter)"]);
     }
 }
 public function Activate()
 {
     global $code;
     echo "<div  style=\"margin-top:10%;padding:3%;font-family:Verdana,Geneva,sans-serif;font-size:20px;background-color:#e6e6e6;border:1px solid #c7d0d5;border-radius:15px;width: 100%; max-width:100%;color:#6e6e6e;height:250px;\">";
     echo "<img src=\"images/headerfil2.jpg\" style=\"max-width:60px;\"/>";
     echo "<br/>";
     if (isset($_SESSION["user_name"])) {
         $usr = $_SESSION["user_name"];
         $myDBConnector = new DBConnector();
         $dbARY = $myDBConnector->infos();
         $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
         if ($connection->connect_error) {
             echo "Veritabanı bağlantı sorunu.";
         } else {
             $query = "UPDATE users SET activation=\"OK\" WHERE ( userName=\"" . $usr . "\" AND activationCode=\"" . $code . "\")";
             if ($connection->query($query) === TRUE) {
                 echo "Üyeliğiniz başarıyla aktive edildi.";
             } else {
                 echo "Veritabanı hatası.";
             }
         }
     } else {
         echo "Üyeliğinizi aktive etmeden önce giriş yapmalısınız.";
     }
     echo "<br/><br/>";
     echo "<button id=\"anasayfaya_don_buttonu\" class=\"btn btn-primary\">";
     echo "Anasayfaya git";
     echo "</button>";
     echo "<br/>";
     echo "</div>";
     echo "<script type=\"text/javascript\">";
     echo "\n\t\t\t\t\$(document).ready(function(){\n\t\t\t\t\t\$('#anasayfaya_don_buttonu').click(function(){\n\t\t\t\t\t\twindow.location.replace(\"http://www.serinhikaye.com\");\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t";
     echo "</script>";
 }
 public function ConversationsToHTML()
 {
     global $conversationsInfos;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         echo "Database bağlantı hatası";
     } else {
         $query = "SELECT * FROM conversations WHERE (user1=\"" . $conversationsInfos["Pour Qui"] . "\" OR user2=\"" . $conversationsInfos["Pour Qui"] . "\") ORDER BY lastDate DESC ";
         $results = $connection->query($query);
         if ($results->num_rows == 0) {
             echo "<div style=\"margin:2%;background-color:#e6e6e6;color:#6e6e6e;font-size:18px;font-family: Verdana,Geneva,sans-serif;\">";
             echo "Henüz mesajlaşmamışsınz.";
             echo "</div>";
         } else {
             while ($curResult = $results->fetch_assoc()) {
                 if ($curResult["user1"] == $conversationsInfos["Pour Qui"]) {
                     $other = $curResult["user2"];
                 } else {
                     $other = $curResult["user1"];
                 }
                 $ary = array($other, $conversationsInfos["Pour Qui"], $conversationsInfos["Pour Qui"]);
                 $myConversation = new Conversation($ary);
                 $myConversation->ConversationToHTML();
             }
         }
         $connection->close();
     }
 }
 public function GetTop3()
 {
     global $whichUser;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return false;
     } else {
         $connection->set_charset("utf8");
         $ress0 = $connection->query("SELECT * FROM users WHERE userName = '******'");
         if ($ress0->num_rows == 0) {
             echo "<script type=\"text/javascript\"> window.location='oops.php'; </script>";
         }
         $query = "SELECT * FROM `threads` WHERE threadWriter='{$whichUser}' ORDER BY `threadPoint` DESC LIMIT 3 ";
         $results = $connection->query($query);
         if ($results->num_rows < 3) {
             return false;
         } else {
             $returnAry = array();
             while ($curResult = $results->fetch_assoc()) {
                 $returnAry[] = $curResult["threadPicture"];
                 $returnAry[] = $curResult["threadName"];
                 $returnAry[] = $curResult["threadID"];
             }
             return $returnAry;
         }
     }
 }
 public function loadStep($stepNo)
 {
     global $threadInfos;
     $threadID = $threadInfos['Thread ID'];
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return "CONNECT_ERR";
     } else {
         /* database'e girdik */
         $sqlRequest = "SELECT * FROM steps WHERE (threadID='{$threadID}' AND stepNo='{$stepNo}')";
         if ($result = $connection->query($sqlRequest)) {
             $ary = array();
             $row = $result->fetch_assoc();
             $ary[0] = $row["stepNo"];
             $strx1 = str_replace('\\"', '"', $row["baslik"]);
             $strx2 = str_replace("\\'", "'", $strx1);
             $ary[1] = $strx2;
             $ary[2] = $row["resimLink"];
             $str1 = str_replace('\\"', '"', $row["icerik"]);
             $str2 = str_replace("\\'", "'", $str1);
             $ary[3] = $str2;
             $myStep = new Step($ary);
             return $myStep;
         } else {
             return "QUERY_ERR";
         }
         $connection->close();
     }
 }
 public function YazarBasliklariToHTML()
 {
     global $yazarAdi;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         echo "Database'e bağlantı sorunu";
     } else {
         $connection->set_charset("utf8");
         echo "<div style=\"overflow:auto;border:1px solid #c7d0d5;border-radius:15px;background-color:#e6e6e6;width:100%;margin-top:4%;font-size:19px;font-family: 'Josefin Sans', sans-serif;color:#cb7c7a;max-width:100%;\">";
         echo "<div style=\"margin-top:5%;text-align:left;margin-right:5%;margin-left:5%;font-size:19px;font-family: 'Josefin Sans', sans-serif;color:#cb7c7a;\">";
         echo "<p style=\"word-wrap:break-word;text-align:left;width:80%;max-width:80%;\">";
         echo "Aynı yazardan bazı süper başlıklar";
         echo "</p>";
         echo "<hr style=\"border:1px solid #c7d0d5;\"/>";
         echo "</div>";
         $res = $connection->query("SELECT * from threads where threadWriter='{$yazarAdi}' ORDER BY threadPoint LIMIT 10");
         while ($curres = $res->fetch_assoc()) {
             $threadID5 = $curres["threadID"];
             $threadDate5 = $curres["threadDate"];
             $threadWriter5 = $curres["threadWriter"];
             $threadCategory5 = $curres["threadCategory"];
             $threadPicture5 = $curres["threadPicture"];
             $stepCount5 = $curres["stepCount"];
             $threadName5 = $curres["threadName"];
             $threadPoint5 = $curres["threadPoint"];
             $myThread5 = new Thread(array($threadID5, $threadDate5, $threadWriter5, $threadCategory5, $threadPicture5, $stepCount5, $threadName5, $threadPoint5));
             $myThread5->ThreadToPetitHTML();
         }
         echo "</div>";
         $connection->close();
     }
 }
 public function LoadMessages()
 {
     global $conversationInfos;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         echo "Database bağlantı hatası";
     } else {
         mysqli_set_charset($connection, "utf8");
         $query = "SELECT * FROM messages WHERE ((From_msg='" . $conversationInfos["User1"] . "' AND To_msg='" . $conversationInfos["User2"] . "') OR (From_msg='" . $conversationInfos["User2"] . "' AND To_msg='" . $conversationInfos["User1"] . "'))";
         $results = $connection->query($query);
         $num = $results->num_rows;
         echo "<form style=\"display:none;\" id=\"offsetForm_" . $conversationInfos["other"] . "\" method=\"post\" action=\"instantmessage.php?usr1=" . $conversationInfos["User1"] . "&usr2=" . $conversationInfos["User2"] . "&monitor=" . $conversationInfos["WhoIsMonitoring"] . "\">";
         echo "<input name=\"offset\" id=\"offset_" . $conversationInfos["other"] . "\" style=\"display:none;\" type=\"text\" value=\"" . $num . "\"/>";
         echo "</form>";
         while ($curResult = $results->fetch_assoc()) {
             if ($conversationInfos["WhoIsMonitoring"] == $curResult["From_msg"]) {
                 $mode = "EvSahibi";
             } else {
                 $mode = "Deplasman";
             }
             $myMessage = new Message(array($curResult["MessageDate"], $curResult["From_msg"], $curResult["To_msg"], $curResult["Message"], $mode, $curResult["Read_msg"]));
             $myMessage->MessageToHTML();
         }
         $connection->close();
     }
 }
 public function BoardRightUpToHTML()
 {
     global $infos;
     $myIndexSocial = new IndexSocial();
     echo "<div id=\"catcher2\" style=\"border:1px solid #c7d0d5; border-radius:15px;\">";
     $myIndexSocial->IndexSocialToHTML();
     echo "</div>";
     echo "<div id=\"sticky2\" style=\"margin-top:2%;width:100%;\">";
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     $connection->set_charset("utf8");
     $query = "SELECT * FROM threads WHERE threadCategory=\"" . $infos['boardCategory'] . "\" ORDER BY rand() LIMIT 2";
     $results2 = $connection->query($query);
     while ($curResult2 = $results2->fetch_assoc()) {
         $threadID2 = $curResult2["threadID"];
         $threadDate2 = $curResult2["threadDate"];
         $threadWriter2 = $curResult2["threadWriter"];
         $threadCategory2 = $curResult2["threadCategory"];
         $threadPicture2 = $curResult2["threadPicture"];
         $stepCount2 = $curResult2["stepCount"];
         $threadName2 = $curResult2["threadName"];
         $threadPoint2 = $curResult2["threadPoint"];
         $myThread2 = new Thread(array($threadID2, $threadDate2, $threadWriter2, $threadCategory2, $threadPicture2, $stepCount2, $threadName2, $threadPoint2));
         $myThread2->ThreadToPetitHTML();
     }
     echo "</div>";
     echo "<script>";
     echo "\n\t\t\$(document).ready(function(){\n\t\t\tif (\$(window).width()<=1028)\n\t\t\t{\n\t\t\t\t\$('#catcher2').remove();\n\t\t\t\t\$('#sticky2').remove();\n\t\t\t\t\$('#random_for_mobile').show();\n\t\t\t}\n\t\t});\n\tvar wid = \$('#sticky2').width();\n\tfunction isScrolledTo(elem) {\n    var docViewTop = \$(window).scrollTop(); //num of pixels hidden above current screen\n    var docViewBottom = docViewTop + \$(window).height();\n \n    var elemTop = \$(elem).offset().top; //num of pixels above the elem\n    var elemBottom = elemTop + \$(elem).height();\n \n    return ((elemTop <= docViewTop));\n}\n\n\tvar catcher = \$('#catcher2');\nvar sticky = \$('#sticky2');\n\n\t\$(window).scroll(function() {\n\tif (\$(window).width()>1028){\n    if(isScrolledTo(sticky)) {\n        sticky.css('position','fixed');\n        sticky.css('top','100px');\n\tsticky.css('max-width',wid);\n\t\$('#sticky_footer_div').show(500);\n    }\n\t\n    var stopHeight = catcher.offset().top + catcher.height(); \n\t  if ( stopHeight > sticky.offset().top) {\n        sticky.css('position','absolute');\n        sticky.css('top',stopHeight-70);\n\t\$('#sticky_footer_div').hide(500);\n    }\n}\n});\n\t\t";
     echo "</script>";
 }
示例#11
0
 public function deletePhoto($userId)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = 'DELETE FROM photo WHERE fk_id_user=' . $userId;
     mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     mysql_close($connection);
 }
 function __construct(DBConnector $db)
 {
     Assert::isTrue(isset(self::$drivers[$db->getDriver()->getId()]), "unknown driver is specified: {$db->getDriver()}");
     $className = self::$drivers[$db->getDriver()->getId()];
     $driver = new ReflectionClass($className);
     Assert::isTrue($driver->isSubclassOf(new ReflectionClass('DBBackup')), "{$className} should implement DBBackup");
     $this->driver = $driver->newInstance($db);
 }
示例#13
0
 public function deleteQueryByID($queryID)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = "DELETE FROM queries WHERE id={$queryID}";
     mysql_query($query) or die("Error in query: {$query}. " . mysql_error());
     mysql_close($connection);
     return $queryID;
 }
 public function IndexGuncelToHTML()
 {
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     $connection->set_charset("utf8");
     echo "<div style=\"margin:2%;background-color:#e6e6e6;border-bottom:1px solid #c7d0d5;\">";
     echo "<p style=\"font-size:20px;word-wrap:break-word;color:#cb7c7a;font-family: 'Josefin Sans', sans-serif;\">";
     echo "Güncel panolar";
     echo "</p>";
     echo "</div>";
     echo "<div style=\"\">";
     $results = $connection->query("SELECT * FROM boards ORDER BY boardID DESC LIMIT 6 OFFSET 0");
     while ($boardInfos = $results->fetch_assoc()) {
         $myBoard = new Board(array($boardInfos['boardID'], $boardInfos['boardName'], $boardInfos['boardCategory'], $boardInfos['boardCreator'], $boardInfos['boardImage'], $boardInfos['boardDate']));
         $myBoard->BoardToPetitHTML();
     }
     echo "</div>";
     echo "<div id=\"x\" style=\"margin:2%;background-color:#e6e6e6;border-bottom:1px solid #c7d0d5;\">";
     echo "<p style=\"font-size:20px;word-wrap:break-word;color:#cb7c7a;font-family: 'Josefin Sans', sans-serif;\">";
     echo "Güncel içerikler";
     echo "</p>";
     echo "</div>";
     echo "<div style=\"\">";
     if (!$connection->connect_error) {
         $results = $connection->query("SELECT * FROM threads ORDER BY threadID DESC LIMIT 12 OFFSET 0 ");
         while ($curres = $results->fetch_assoc()) {
             $threadID5 = $curres["threadID"];
             $threadDate5 = $curres["threadDate"];
             $threadWriter5 = $curres["threadWriter"];
             $threadCategory5 = $curres["threadCategory"];
             $threadPicture5 = $curres["threadPicture"];
             $stepCount5 = $curres["stepCount"];
             $threadName5 = $curres["threadName"];
             $threadPoint5 = $curres["threadPoint"];
             $myThread5 = new Thread(array($threadID5, $threadDate5, $threadWriter5, $threadCategory5, $threadPicture5, $stepCount5, $threadName5, $threadPoint5));
             $myThread5->ThreadToPetitHTML();
         }
         echo "<div id=\"moreBestDiv\"></div>";
         echo "<div style=\"\">";
         echo "<form id=\"loadMoreBestForm\" method=\"post\" action=\"loadMoreRecentIndex.php\">";
         echo "<input id=\"loadMoreBestOffset\" name=\"loadMoreBestOffset\" style=\"display:none;\" value=\"" . $results->num_rows . "\"/>";
         echo "<button id=\"loadMoreBestButton\" class=\"btn btn-block btn-success\">";
         echo "<i id=\"loadMoreBestSpinner\" style=\"display:none;\" class=\"fa fa-refresh fa-spin\"></i>";
         echo "<span id=\"loadMoreBestTXT\">";
         echo "Daha fazla göster";
         echo "</span>";
         echo "</button>";
         echo "</form>";
         echo "</div>";
     }
     echo "</div>";
     echo "<script type=\"text/javascript\">";
     echo "\n\t\t\t\$(window).scroll(function(){\n\t\t\t\tvar p = \$('#x');\n\t\t\t\tvar pos = p.position();\n\t\t\t\tvar windowpos = \$(window).scrollTop();\n\t\t\t\tif (windowpos >= pos.top) {\n\t\t\t\t\t\$('#indexStickyFooter').fadeIn(500);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t\$('#indexStickyFooter').fadeOut(500);\n\t\t\t});\n\t\t\t\$('#loadMoreBestButton').click(function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\t\$('#loadMoreBestTXT').hide();\n\t\t\t\t\$('#loadMoreBestSpinner').show();\n\t\t\t\t\$('#loadMoreBestForm').ajaxForm({\n\t\t\t\t\tsuccess : function(msg){\n\t\t\t\t\t\t\$('#loadMoreBestTXT').show();\n\t\t\t\t\t\t\$('#loadMoreBestSpinner').hide();\n\t\t\t\t\t\tnewoffset = msg.charAt(0);\n\t\t\t\t\t\toldoffset = \$('#loadMoreBestOffset').val();\n\t\t\t\t\t\toldint = parseInt(oldoffset);\n\t\t\t\t\t\tnewint = parseInt(newoffset);\n\t\t\t\t\t\tif (newint==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$('#loadMoreBestTXT').html(\"Hepsi yüklendi\");\n\t\t\t\t\t\t\t\$('#loadMoreBestButton').attr(\"disabled\",true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\$('#loadMoreBestOffset').val(oldint+newint);\n\t\t\t\t\t\tmsg2 = msg.substring(1);\n\t\t\t\t\t\t\$('#moreBestDiv').append(msg2);\n\t\t\t\t\t},\n\t\t\t\t\terror : function(){\n\n\t\t\t\t\t}\n\t\t\t\t}).submit();\n\t\t\t});\t\n\t\t";
     echo "</script>";
 }
示例#15
0
 public function contributorCount()
 {
     global $boardInfos;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     $query = "SELECT distinct(contributor) FROM contributions WHERE boardID =\"" . $boardInfos['boardID'] . "\"";
     $results = $connection->query($query);
     return $results->num_rows;
 }
 public function SuggestionsBarToHTML()
 {
     $myIndexSocial = new IndexSocial();
     echo "<div style=\"border:1px solid #c7d0d5; border-radius:15px;\">";
     $myIndexSocial->IndexSocialToHTML();
     echo "</div>";
     global $sinf;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection2 = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection2->connect_error) {
         echo "Database'e bağlantı sorunu";
     } else {
         $connection2->set_charset("utf8");
         echo "<div style=\"border:1px solid #c7d0d5;border-radius:15px;margin-top:3%;overflow:auto;height:100%;width:100%;max-width:100%;background-color:#e6e6e6;\">";
         echo "<div style=\"margin-top:5%;text-align:left;margin-right:5%;margin-left:5%;font-size:19px;font-family: 'Josefin Sans', sans-serif;color:#cb7c7a\">";
         echo "<p style=\"word-wrap:break-word;text-align:left;width:80%;max-width:80%;\">";
         echo "İlginizi çekebilecek başlıklar";
         echo "</p>";
         echo "<hr style=\"border:1px solid #c7d0d5;\"/>";
         echo "</div>";
         $quelloThreddo = $connection2->real_escape_string($sinf['quelleThread']);
         $sugQuery = "SELECT * FROM threads WHERE threadCategory =\"" . $sinf['quelleCategorie'] . "\" AND threadName<>\"" . $quelloThreddo . "\" ORDER BY RAND() LIMIT 30";
         $results2 = $connection2->query($sugQuery);
         while ($curResult2 = $results2->fetch_assoc()) {
             $threadID2 = $curResult2["threadID"];
             $threadDate2 = $curResult2["threadDate"];
             $threadWriter2 = $curResult2["threadWriter"];
             $threadCategory2 = $curResult2["threadCategory"];
             $threadPicture2 = $curResult2["threadPicture"];
             $stepCount2 = $curResult2["stepCount"];
             $threadName2 = $curResult2["threadName"];
             $threadPoint2 = $curResult2["threadPoint"];
             $myThread2 = new Thread(array($threadID2, $threadDate2, $threadWriter2, $threadCategory2, $threadPicture2, $stepCount2, $threadName2, $threadPoint2));
             $myThread2->ThreadToPetitHTML();
         }
         $sugQuery = "SELECT * FROM threads WHERE threadCategory <>\"" . $sinf['quelleCategorie'] . "\" AND threadName<>\"" . $quelloThreddo . "\" ORDER BY RAND() LIMIT 10";
         $results2 = $connection2->query($sugQuery);
         while ($curResult2 = $results2->fetch_assoc()) {
             $threadID2 = $curResult2["threadID"];
             $threadDate2 = $curResult2["threadDate"];
             $threadWriter2 = $curResult2["threadWriter"];
             $threadCategory2 = $curResult2["threadCategory"];
             $threadPicture2 = $curResult2["threadPicture"];
             $stepCount2 = $curResult2["stepCount"];
             $threadName2 = $curResult2["threadName"];
             $threadPoint2 = $curResult2["threadPoint"];
             $myThread2 = new Thread(array($threadID2, $threadDate2, $threadWriter2, $threadCategory2, $threadPicture2, $stepCount2, $threadName2, $threadPoint2));
             $myThread2->ThreadToPetitHTML();
         }
         echo "</div>";
         $connection2->close();
     }
 }
示例#17
0
 public function getStatisticTitleById($sid)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $query = 'SELECT title FROM statistics WHERE id=' . $sid;
     $result = mysql_query($query) or die("Error in " . $query);
     $row = mysql_fetch_assoc($result);
     $title = $row['title'];
     mysql_free_result($result);
     mysql_close($connection);
     return $title;
 }
示例#18
0
文件: json.php 项目: nxnc/WPF_MW
 public function getJSONFromDB()
 {
     $db = new DBConnector();
     $sql = "SELECT s.spieltag, s.datum, sp.datum, sp.stadion, sp.heim, sp.gast, sp.tore_heim, sp.tore_gast FROM spieltag s, spiele sp WHERE s.spieltag = sp.spieltag_id";
     $mysql = $db->connect();
     $result = $mysql->query($sql);
     $json = array();
     while ($row = $result->fetch_assoc()) {
         $json[] = $row;
     }
     return $json;
 }
示例#19
0
 public function loadAllComments($qId)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $result = mysql_query("SELECT * FROM comment WHERE FK_queryId='{$qId}'") or die("Error");
     //TODO DATE
     $ans = array();
     while ($row = mysql_fetch_assoc($result)) {
         $ans[$row['id']] = $row['text'];
     }
     mysql_free_result($result);
     mysql_close($connection);
     return $ans;
 }
示例#20
0
 public function getMessage($mid)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $result = mysql_query("SELECT * FROM messages WHERE message_id = '{$mid}'");
     $message = mysql_fetch_array($result);
     $ans = array();
     $ans['title'] = $message['message_title'];
     $ans['from'] = $message['from_user'];
     $ans['content'] = $message['message_contents'];
     mysql_free_result($result);
     mysql_close($connection);
     return $ans;
 }
 public function UserThreadsToHTML()
 {
     global $whichUsr;
     echo "<div style=\"margin-top:2%;\">";
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         echo "Database'e bağlantı sorunu";
     } else {
         $connection->set_charset("utf8");
         $res0 = $connection->query("SELECT * from threads where threadWriter= '{$whichUsr}'");
         $totalCount = $res0->num_rows;
         $res = $connection->query("SELECT * from threads where threadWriter='{$whichUsr}' ORDER BY threadPoint DESC LIMIT 6");
         $curCount = $res->num_rows;
         while ($curres = $res->fetch_assoc()) {
             $threadID5 = $curres["threadID"];
             $threadDate5 = $curres["threadDate"];
             $threadWriter5 = $curres["threadWriter"];
             $threadCategory5 = $curres["threadCategory"];
             $threadPicture5 = $curres["threadPicture"];
             $stepCount5 = $curres["stepCount"];
             $threadName5 = $curres["threadName"];
             $threadPoint5 = $curres["threadPoint"];
             $myThread5 = new Thread(array($threadID5, $threadDate5, $threadWriter5, $threadCategory5, $threadPicture5, $stepCount5, $threadName5, $threadPoint5));
             $myThread5->ThreadToPetitHTML();
         }
         $connection->close();
     }
     echo "<div id=\"more_data_div\" style=\"\">";
     echo "</div>";
     echo "<div style=\"margin:2%;\">";
     if ($totalCount != 0) {
         echo "<form method =\"post\" id =\"userThreadsForm\" action=\"usrThreadsLoadMore.php?usr="******"\">";
         echo "<input name=\"offsetUsrThread\" id=\"offsetUsrThread\" value=\"" . $curCount . "\" style=\"display:none;\" />";
         echo "<input name=\"totalUsrThread\" id=\"totalUsrThread\" value=\"" . $totalCount . "\" style=\"display:none;\" />";
         echo "<button id=\"loadMoreDataButton\" class=\"btn btn-block btn-success\" style=\"\">";
         echo "<i id=\"loadMoreThreadSpinner\" style=\"display:none;\" class=\"fa fa-refresh fa-spin\"></i>";
         echo "<span id=\"loadMoreDataTXT\"> Daha fazla göster </span>";
         echo "</button>";
         echo "</form>";
     } else {
         echo "<span style=\"font-family: 'Josefin Sans', sans-serif;font-size:18px;color:#6e6e6e;\"> Bu yazar henüz başlık oluşturmamış. </span>";
     }
     echo "</div>";
     echo "</div>";
     echo "<script type=\"text/javascript\">";
     echo "\n\t\t\t\$('#loadMoreDataButton').click(function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\t\$('#loadMoreDataTXT').hide();\n\t\t\t\t\$('#loadMoreThreadSpinner').show();\n\t\t\t\t\$('#userThreadsForm').ajaxForm({\n\t\t\t\t\tsuccess : function(msg){\n\t\t\t\t\t\t\$('#loadMoreDataTXT').show();\n\t\t\t\t\t\t\$('#loadMoreThreadSpinner').hide();\n\t\t\t\t\t\toldoffset = \$('#offsetUsrThread').val();\n\t\t\t\t\t\tnewoffset = msg.charAt(0);\n\t\t\t\t\t\toldint = parseInt(oldoffset);\n\t\t\t\t\t\tnewint = parseInt(newoffset);\n\t\t\t\t\t\tif (newint==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$('#loadMoreDataTXT').html('Hepsi yüklendi');\n\t\t\t\t\t\t\t \$('#loadMoreDataButton').attr(\"disabled\", true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\$('#offsetUsrThread').val(oldint+newint);\n\t\t\t\t\t\tmsg2 = msg.substring(1);\n\t\t\t\t\t\t\$('#more_data_div').append(msg2);\n\t\t\t\t\t\t\n\t\t\t\t\t},\n\t\t\t\t\terror : function(){\n\n\t\t\t\t\t}\n\t\t\t\t}).submit();\n\t\t\t});\n\t\t";
     echo "</script>";
 }
示例#22
0
 /**
  *
  * @param <type> $id the user id to modify the values here
  * @param <type> $userInstanceNewValues  the new values of the user info
  *                                          that are in the user instance
  */
 public function modifyUserInfo($id, $userInstanceNewValues)
 {
     $connector = new DBConnector();
     $connection = $connector->createConnection();
     $userId = $userInstanceNewValues->getId();
     $gender = $userInstanceNewValues->gender;
     $maritalStatus = $userInstanceNewValues->maritalSt;
     $studies = $userInstanceNewValues->studies;
     $institutionName = $userInstanceNewValues->getInstitutionName();
     $country = $userInstanceNewValues->getCountry();
     $religion = $userInstanceNewValues->getReligion();
     $query = "UPDATE userinfo set gender='" . $gender . "', maritalSt='" . $maritalStatus . "', studies='" . $studies . "' , InstitutionName='" . $institutionName . "'  , currentLocation='" . $country . "' , religion='" . $religion . "'  where FK_users=" . $userId;
     mysql_query($query) or die("Error in query modifying user info : {$query}. " . mysql_error() . " and the user id is" . $id);
     mysql_close($connection);
 }
 public function Find()
 {
     global $whichThread;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return "?";
     } else {
         $query = "SELECT * FROM favoriler WHERE threadID='{$whichThread}'";
         $result = $connection->query($query);
         $connection->close();
         return $result->num_rows;
     }
 }
示例#24
0
 /**
  * @deprecated since version 4.0 Use selectDatabase('dbname', true) instead
  */
 public function createDatabase()
 {
     Deprecation::notice('4.0', 'Use selectDatabase(\'dbname\',true) instead');
     $database = $this->connector->getSelectedDatabase();
     $this->selectDatabase($database, true);
     return $this->isActive();
 }
 /**
  * Return the global unique instance of DBConnector.
  * 
  * @param string $sIncDir The base include path of the system. [optional, default=INC_DIR]
  * 
  * @return DBConnector
  * 
  * @throws Exception
  */
 public static function getInstance()
 {
     if (!isset(self::$aInstances) || !self::$aInstances instanceof DBConnector) {
         self::$aInstances = new DBConnector();
     }
     return self::$aInstances;
 }
示例#26
0
    public function AgentInsert($Device, $task, $data, $xtype)
    {
        try {
            if (self::getTaskUID($Device, $task) == "true") {
                parent::Sorgu("SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'");
                parent::Sorgu("INSERT INTO datas ( `deviceID`,`taskUID`,`data`,`type`) VALUES ( '" . @$Device . "', '" . @$task . "', '" . mysql_real_escape_string(@$data) . "','" . $xtype . "')");
                if (mysql_affected_rows() >= 0) {
                    parent::Sorgu("UPDATE tasklist SET taskStat='2' where  deviceId = '" . $Device . "' and taskUID = '" . $task . "'");
                    if (mysql_affected_rows() >= 0) {
                        $ExportXML = '<result>
						<stat>true</stat>
						<taskUID>' . $task . '</taskUID>
					</result>';
                        return $ExportXML;
                    } else {
                        $ExportXML = '<result>
						<stat>false</stat>
						<taskUID>' . $task . '</taskUID>
					</result>';
                        return $ExportXML;
                    }
                }
            }
        } catch (Exception $e) {
            return $e->getMessage();
        }
    }
示例#27
0
文件: posts.php 项目: helvete/resyst
    /**
     * Get posts from DB according to input parameters
     *
     * @param  int		$count
     * @param  int		$id
     * @param  string	$tag
     * @return Posts
     */
    public function get($count = false, $id = false, $tag = false)
    {
        $queryString = '
			SELECT resyst_db.time as timestamp, resyst_db.name as title,
				resyst_db.text as contents, resyst_db.id as id,
				resyst_tag.id as tag_id, resyst_tag.tagname as tag_name,
				resyst_tag.parenttag as tag_parentName,
				resyst_tag.colour as tag_colour
			FROM resyst_db
			INNER JOIN resyst_tag
				ON resyst_db.tag = resyst_tag.id
			' . ($id ? "WHERE resyst_db.id = {$id}" : '') . '
			' . ($tag ? "WHERE resyst_tag.tagname = '{$tag}'" : '') . '
			ORDER BY id DESC
			' . ($count ? "LIMIT {$count}" : '') . '
		';
        $pdo = DBConnector::getPDO();
        $query = $pdo->prepare($queryString);
        $query->execute(array());
        $result = $query->fetchAll(PDO::FETCH_ASSOC);
        foreach ($result as &$postData) {
            $postData['contents'] = html_entity_decode($postData['contents']);
            $postData = $this->_processTagData($postData);
            $this->_posts[] = new Post($postData);
        }
        return $this;
    }
 public function Find()
 {
     global $threadID;
     $myDBConnector = new DBConnector();
     $dbARY = $myDBConnector->infos();
     $connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
     if ($connection->connect_error) {
         return false;
     } else {
         $query = "SELECT count(comment) FROM `comments` WHERE threadID =  " . $threadID;
         $results = $connection->query($query);
         $resassoc = $results->fetch_assoc();
         $connection->close();
         return $resassoc["count(comment)"];
     }
 }
示例#29
0
 /**
  * returns an instance of a sqlite connection
  * 
  * @return instance of this class
  */
 public static function getInstance()
 {
     if (null === self::$instance) {
         self::$instance = new SQLite3(self::$dbfile);
     }
     return self::$instance;
 }
示例#30
0
 /**
  * Get PDO instance
  *
  * @return PDO
  */
 public static function getPDO()
 {
     if (empty(self::$_pdo)) {
         self::$_pdo = new PDO(Conf::get(self::DSN), Conf::get(self::USER), Conf::get(self::PASSWORD));
     }
     return self::$_pdo;
 }