Example #1
0
File: log.php Project: kikijtl/PHP
        }
        // Select unread messages.
        $query = "select * from log where toUser='{$username}' and unread=1";
        $result = mysqli_query($db, $query);
        $rowcount = mysqli_num_rows($result);
        if ($rowcount == 0) {
            //			echo $rowcount;
            continue;
        }
        while ($row = mysqli_fetch_array($result)) {
            $json = json_encode($row);
            array_push($newMessages, $json);
        }
        if (!empty($newMessages)) {
            echo json_encode($newMessages);
            mysqli_close($db);
            exit;
        }
        mysqli_close($db);
    }
    echo "[]";
}
// Get unread messages from database.
if ($method == "GET") {
    $timeout = $_GET['timeout'];
    $newMessages = array();
    getUnread($timeout, $username, $newMessages);
}
?>

Example #2
0
<link rel="icon" href="../favicon.ico">
<title>伴遊網站</title>


<link href="../css/bootstrap.css" rel="stylesheet">
<link href="../css/serch.css" rel="stylesheet">
<link href="../css/main.css" rel="stylesheet">

</head>
<body>
<?php 
include "function.php";
if ($_SESSION['UserId'] == null) {
} else {
    $Userid = $_SESSION['UserId'];
    $cart = json_decode(getUnread($Userid));
}
?>
<!-- START Top nav -->
<nav class="navbar navbar-default navbar-static-top navbar-main">
    <div class="container">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button>
            <a class="navbar-brand" href="index.html"><img src="../image/apple-touch-icon.png" height="100%"></a></div>
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="navbar-search"><a href="#">找活動</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li>
					<img src="<?php