Пример #1
0
 public function getEventCategories()
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     mysql_query("set names 'utf8'");
     $query = mysql_query("SELECT * FROM `EventCatigories` ") or die(mysql_error());
     $stack = array();
     while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) {
         array_push($stack, $row);
     }
     echo json_encode($stack);
     $dbConnect->close();
 }
Пример #2
0
 public function getGroupList($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $query = mysql_query("SELECT * FROM `groups` LIMIT " . $inputs->limit . "") or die(mysql_error());
     $stack = array();
     while ($row = mysql_fetch_array($query)) {
         $respond = array('id' => $row['Gid'], 'name' => $row['Gname'], 'ProfilePic' => $row['GProfilePic'], 'Royal' => $row['Royal']);
         array_push($stack, $respond);
     }
     echo json_encode($stack);
     $dbConnect->close();
 }
Пример #3
0
 public function GetFullNews($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     mysql_query("set names 'utf8'");
     $query = mysql_query("SELECT * FROM News WHERE NewsID=" . $inputs->NewsID . "");
     if ($query) {
         $row = mysql_fetch_array($query, MYSQL_ASSOC);
         echo json_encode($row);
     } else {
         $respond = array('sucess' => false);
         echo json_encode($respond);
     }
     $dbConnect->close();
 }
Пример #4
0
 public function SendFeedback($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $sql = "INSERT INTO `" . DB_DATABASE . "`.`Feedbacks` (`SenderID`,  `FeedbackType`, `Subject`, `Message`)\n    VALUES ('" . $inputs->SenderID . "', '" . $inputs->FeedbackType . "', '" . $inputs->Subject . "',  '" . $inputs->Message . "');";
     if (mysql_query($sql)) {
         $respond = array('sucess' => true);
         echo json_encode($respond);
         //successfully Registering new user
     } else {
         $respond = array('success' => false);
         echo json_encode($respond);
         //an error has been accourd
     }
     $dbConnect->close();
 }
Пример #5
0
 public function GetUserBlockList($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $sql = mysql_query("SELECT InvitationID FROM BlockList WHERE memberID=" . $inputs->memberID . "  ORDER BY InvitationID");
     if ($sql) {
         $stack = array();
         while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) {
             array_push($stack, $row);
         }
         echo json_encode($stack);
     } else {
         $respond = array('sucess' => false);
         echo json_encode($respond);
     }
     $dbConnect->close();
 }
Пример #6
0
 public function retriveComments($inputs)
 {
     $tableName = $inputs->POSTType == 0 ? "EventsComments" : "NewsComments";
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $sql = mysql_query("SELECT  `" . $tableName . "`.`CommentID`,`members`.`name` ,`members`.`id`, `members`.`ProfilePic`\n      , `" . $tableName . "`.`comment` from `" . $tableName . "` INNER JOIN `members`\n      ON `members`.`id`=`" . $tableName . "`.`memberID`\n      WHERE `" . $tableName . "`.`POSTID` = \"" . $inputs->POSTID . "\"\n       LIMIT " . $inputs->start . ", " . $inputs->limit . "  ") or die(mysql_error());
     if ($sql) {
         $stack = array();
         while ($row = mysql_fetch_array($sql, MYSQL_ASSOC)) {
             array_push($stack, $row);
         }
         echo json_encode($stack);
     } else {
         $respond = array('sucess' => false);
         echo json_encode($respond);
     }
     $dbConnect->close();
 }
Пример #7
0
 public function getInvitationList($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $query = mysql_query("SELECT * FROM `invitationPackages` LIMIT " . $inputs->limit . "") or die(mysql_error());
     $stack = array();
     while ($row = mysql_fetch_array($query)) {
         $invitations = new invitationPackages();
         $invitations->id = $row['Packageid'];
         $invitations->number = $row['number'];
         $invitations->packageName = $row['packageName'];
         //$invitations->VIP=$row['VIP'];
         $invitations->price = $row['price'];
         array_push($stack, $invitations);
     }
     echo json_encode($stack);
     $dbConnect->close();
 }
Пример #8
0
 public function getUserInvNumber($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     mysql_query("set names 'utf8'");
     $MembersQuery = mysql_query("SELECT `inNOR` , `inVIP` FROM `members` WHERE `id` = \"" . $inputs->id . "\"  ") or die(mysql_error());
     $membersRow = mysql_fetch_array($MembersQuery);
     if ($membersRow) {
         $respond = array('success' => true, 'inNOR' => $membersRow['inNOR'], 'inVIP' => $membersRow['inVIP']);
         echo json_encode($respond);
     } else {
         $respond = array('success' => false);
         echo json_encode($respond);
     }
     $dbConnect->close();
 }
Пример #9
0
 public function getEvents($inputs)
 {
     //$inputs->groupID;// -1:home page  anyother value i am on a group
     //$inputs->catID;//-1 uncatigorized , anyother value catigorized
     //$inputs->start;
     //$inputs->limit;
     $timeNow = Date("Y-m-d h:m:s");
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     mysql_query("set names 'utf8'");
     $Filters = "";
     if ($inputs->groupID == -1) {
         $Filters .= "AND `Events`.`VIP` = 1";
         //Homepage
     } else {
         $Filters .= "AND `members`.`groupID` = " . $inputs->groupID . " ";
         //Group page
     }
     if ($inputs->catID != -1) {
         $Filters .= " AND `Events`.`eventType` = " . $inputs->catID . " ";
         //catigorized
     }
     if (1) {
         $Filters .= " AND `Events`.`TimeEnded` >= '" . $timeNow . "' ";
         //catigorized
     }
     $query = mysql_query("SELECT\n      `Events`.`id` ,\n      `members`.`name`,\n      `members`.`groupID` ,\n      `members`.`ProfilePic` ,\n      `Events`.`subject` ,\n      `Events`.`VIP` ,\n      `Events`.`eventType` ,\n      `Events`.`picture` ,\n      `Events`.`TimeEnded` ,\n      `Events`.`approved`\n      from `Events` INNER JOIN `members` ON   `Events`.`CreatorID`=`members`.`id`\n      WHERE `Events`.`approved`=1 " . $Filters . "\n      ORDER BY  `Events`.`VIP` DESC,\n      `Events`.`timeCreated` DESC\n      LIMIT " . $inputs->start . ", " . $inputs->limit . " ") or die(mysql_error());
     $stack = array();
     while ($row = mysql_fetch_array($query)) {
         $user = array('Eventid' => $row['id'], 'CreatorName' => $row['name'], 'CreatorPic' => $row['ProfilePic'], 'subject' => $row['subject'], 'EventPic' => $row['picture'], 'catID' => $row['eventType'], 'VIP' => $row['VIP'], 'TimeEnded' => $row['TimeEnded']);
         array_push($stack, $user);
     }
     echo json_encode($stack);
     $dbConnect->close();
 }
Пример #10
0
            $dbConnect->close();
            // if everything is ok, try to upload file
        } else {
            if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                $respond = array('success' => true, 'id' => $TicketId);
                createthumb($target_file, $FileName . "150x150." . $imageFileType, 150, 150);
                $dbConnect = new DatabaseConnect();
                mysql_query("UPDATE `" . DB_DATABASE . "`.`Images` SET `imageSrc` = '" . $FileNameOnline . "', `ext` = '" . $imageFileType . "' WHERE `Images`.`imageID` = " . $TicketId . "");
                echo json_encode($respond);
                //SUCESS uploading
            } else {
                $respond = array('success' => false);
                echo json_encode($respond);
                $dbConnect = new DatabaseConnect();
                mysql_query("DELETE  FROM `Images` WHERE `imageID`=" . $TicketId . "");
                $dbConnect->close();
            }
        }
    }
}
function createthumb($name, $filename, $new_w, $new_h)
{
    $system = explode(".", $name);
    if (preg_match("/jpg|jpeg/", $system[1])) {
        $src_img = imagecreatefromjpeg($name);
    }
    if (preg_match("/png/", $system[1])) {
        $src_img = imagecreatefrompng($name);
    }
    $old_x = imageSX($src_img);
    $old_y = imageSY($src_img);
Пример #11
0
 public function DisapproveEventbyID($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $sql = mysql_query("SELECT `VIP` FROM `Events` WHERE `Events`.`id`=" . $inputs->Eventid) or die(mysql_error());
     if ($sql) {
         $row = mysql_fetch_array($sql);
         if ($row["VIP"] == 1) {
             //Give the user back his points
         } else {
             // Just Send the dissaproval messege ي
         }
     }
     $dbConnect->close();
 }
Пример #12
0
 public function isInvited($inputs)
 {
     require_once "DataBaseConnection.php";
     $dbConnect = new DatabaseConnect();
     $query = mysql_query("SELECT * FROM `invitationsLog` WHERE `EventID` = \"" . $inputs->eventID . "\" AND\n  `memberID` = \"" . $inputs->memberID . "\" ") or die(mysql_error());
     $row = mysql_fetch_array($query);
     $respond = array('sucess' => false);
     if (!empty($row)) {
         $respond = array('sucess' => true);
     }
     echo json_encode($respond);
     $dbConnect->close();
 }