示例#1
0
<?php

function maxlevel($x, $y)
{
    $query = "select * from participer p where idpersonne='{$x}' and quete={$y} and where niv=(select max(n.id) from niveau n where n.queteid={$y}) ;";
    $mysqli = new mysqli("localhost", "root", "", "greenapp");
    if ($mysqli->query($query)) {
        return 1;
    } else {
        return 0;
    }
}
if (isset($_COOKIE['email']) && isset($_COOKIE['qid'])) {
    $email = $_COOKIE['email'];
    $qid = $_COOKIE['qid'];
    if (maxlevel($email, $qid)) {
        header('Location:quete?qid=$qid');
    } else {
        $query = "SELECT min(id) from niveau where queteid={$qid} and id>=(select niv from participer where idpersonne='{$email}' and quete={$qid});";
        $mysqli = new mysqli("localhost", "root", "", "greenapp");
        $ress = $mysqli->query($query);
        $r = $ress->fetch_row();
        $id = $r[0];
        if (!($ress = $mysqli->query("select * from niveau where queteid={$qid} and id={$id};"))) {
            $req = "select min(id) from niveau where queteid={$qid}";
            $ress = $mysqli->query($req);
            $val = $ress->fetch_row();
            $req = "insert into participer values('" . $_COOKIE['email'] . "',0,{$qid});";
        }
        $ress = $mysqli->query("select * from niveau where queteid={$qid} and id={$id};");
        $rx = $ress->fetch_row();
示例#2
0
									<?php 
if (!maxlevel($_COOKIE['email'], $_GET['qid'])) {
    setcookie("qid", $_GET['qid']);
    echo "<span><a href='nexthint.php'><img src='img/hint.png' width=150></a></span>";
}
?>
								</div>
								<div class="mid">
									<img src="<?php 
echo $photo;
?>
" width=300>
								</div>
							</div>
							<?php 
if (maxlevel($_COOKIE['email'], $_GET['qid'])) {
    setcookie("qid", $_GET['qid']);
    echo "<form method='POST' action='addcontribution.php'><input type='text' name='contri' value='Lien multimedia de votre contribution'><input type='submit'></form>";
} else {
}
?>
						</div>
					</div>
				</div>
			</section>
		</header>
		<div class="overlay navigation">
			<nav>
				<ul>
					<?php 
include_once "menu.php";