} else {
         //หาคนที่จะถูกส่งไปถึงทั้งหมด
         $alluserid = findAllDestinationUserId($con, $groupid, $msgid);
         //ไปส่ง push
         $pushresult = prepareAndPush($con, $alluserid, $userid, $msgpayload);
         //update reach+read ของคนส่ง
         $sqlupdateread = "UPDATE  `workingalert`.`has_message` SET  `read_status` =  'y',\n        `reach_status` =  'y' WHERE  `has_message`.`user_id` = '{$userid}'\n        AND `has_message`.`message_id` = '{$msgid}';";
         if ($con->query($sqlupdateread) === TRUE) {
             $response = array("status" => "success", "description" => "message create complete", "push" => $pushresult);
         }
     }
 } else {
     if (groupisreal($con, $groupid) == 2) {
         //only admin can send message
         if (isAdmin($groupid, $con, $userid)) {
             $msgid = createmessage($msgpayload, $priority, $userid, $con, $groupid);
             if ($msgid == 0) {
                 $response = array("status" => "failed", "description" => "insert messege to db failed");
             } else {
                 //หาคนที่จะถูกส่งไปถึงทั้งหมด
                 $alluserid = findAllDestinationUserId($con, $groupid, $msgid);
                 //ไปส่ง push
                 $pushresult = prepareAndPush($con, $alluserid, $userid, $msgpayload);
                 //update reach+read ของคนส่ง
                 $sqlupdateread = "UPDATE  `workingalert`.`has_message` SET  `read_status` =  'y',\n          `reach_status` =  'y' WHERE  `has_message`.`user_id` = '{$userid}'\n          AND `has_message`.`message_id` = '{$msgid}';";
                 if ($con->query($sqlupdateread) === TRUE) {
                     $response = array("status" => "success", "description" => "message create complete", "push" => $pushresult);
                 }
             }
         } else {
             $response = array("status" => "failed", "description" => "invalid group permission you are not admin of this group");
			     }	
	</style>

    </head>

    <body>

        <!-- Top content -->
        <div class="top-content">
        	
            <div class="inner-bg">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-8 col-sm-offset-2 text">
                            <h1><strong><?php 
createmessage($x);
?>
</strong></h1>
                            <div class="description">
                            	<p>
	                           
                            	</p>
                            </div>
                        </div>
                    </div>
					<button style="border-radius:2px; color:white; background-color:black"><a href="forum_main.php"> <i class="fa fa-arrow-left"></i> Back to Forum</button></a>
                    
                    <div class="row">
                        <div class="col-sm-6 col-sm-offset-3 social-login">
                        	<h3>Find us on..</h3>
                        	<div class="social-login-buttons">
Example #3
0
<?php

/*
 * created by Alwin Ebermann (alwin@alwin.net.au)
 */
include "include/config.inc.php";
include "include/functions.inc.php";
include "include/user.inc.php";
$user = checklogin(filter_input(INPUT_COOKIE, 'auth'), $db, filter_input(INPUT_GET, "token"));
$res = logout($user);
$login = $user["login"];
$user["login"] = false;
echo createhead();
echo createnav("Logout", $user);
if ($login) {
    echo createlogout($res);
} else {
    echo createmessage("You can't log out if you are not logged in. <br/> <a href=\"index.php\">Home</a>");
}
echo createfooter();