示例#1
0
        } elseif ($page > $countp) {
            $current = $countp;
        } else {
            $current = $page;
        }
        // sinon la page courante est bien celle indiquée dans l'URL
    }
    /* $start est la valeur de départ du LIMIT dans notre requête SQL (est fonction de la page courante) */
    $start = $current * $epp - $epp;
    /* Récupération des données à afficher pour la page courante */
    $uh = mysql_query("select * from notes where user='******' and (type='1' or type='2') order by notes_id desc LIMIT {$start}, {$epp}");
    if ($uh) {
        /* Affichage des données */
        while ($yow = mysql_fetch_array($uh)) {
            $pic = loadpic($yow['user']);
            $userN = nameUser($yow['user']);
            $timestamp = Timesince($yow['date']);
            $noteIDs = hashit($yow['notes_id']);
            $notes = stripslashes(nl2br($yow['note']));
            $notes = wordwrap($notes, 20, "\n", 1);
            echo "\n\n\t\t\t\t<table width='765' border='0'>\n\t\t\t\t  <tr>\n\t\t\t\t\t<td width='10' height='21' valign='top'><a href='user/{$userN}'>{$pic}</a></td>\n\t\t\t\t\t<td width='745' valign='top'><a href='user/{$userN}'><font color='blue'>{$userN}</font></a> <a href='note/{$noteIDs}'>" . $notes . "</a><br /><em><font color='grey'>Posted {$timestamp} ago</font></em></td>\n\t\t\t\t  </tr>\n\t\t\t\t  \t\n\n\t\t\t\t  \n\t\t\t\t</table>\n\t\t\t\t<hr />\n\n\t\t\t\n\t\t\t\n\t\t\t\t\t";
        }
        /* Libération du résultat */
        mysql_free_result($uh);
    }
    //else echo mysqli_error($dbc);
}
//while of friends
/* Appel de la fonction */
echo @paginate("welcome.php", '?p=', $countp, $current);
////////////////////////////////////////////////////////////////////////
示例#2
0
文件: note.php 项目: rymaga/notes-app
$id = $q[1];
//echo $id;
if (!isset($id) || empty($id) || !is_numeric($id)) {
    echo "ERROR 404";
} else {
    ?>
    <style type="text/css">
	label{display: block;}
	</style>
    <?php 
    //lets get type of this note
    $sql = mysql_query("select * from notes where notes_id='{$id}'");
    $row = mysql_fetch_array($sql);
    $type = $row['type'];
    $authorID = $row['user'];
    $author = nameUser($authorID);
    $note = stripslashes(nl2br($row['note']));
    $date = $row['date'];
    echo $noteID = $row['notes_id'];
    if ($authorID == $uid) {
        $s = 1;
    } else {
        $s = 0;
    }
    /////////////////////////second test////////////////////
    //       0 = for only the author
    //       1 = for public
    //       2 = for only friends
    if ($type == 0) {
        if ($s == 1) {
            echo "Note by " . $author . " on " . date("M j'G", $date) . "<hr />";
示例#3
0
session_start();
include 'config.php';
include 'functions.php';
@($uid = $_SESSION['user_id']);
@($user = $_SESSION['user']);
loggedin();
$id = intval($_GET['id']);
$userCheck = user_Check($id);
if ($userCheck != 0) {
    $a = "user='******'";
    $b = "friend='{$id}'";
    $sql = mysql_query("select * from friends where ({$a} or {$b}) and permet='1'");
    $oopn = mysql_num_rows($sql);
    $user = nameUser($id);
    echo "<em>{$user} has {$oopn} Friends</em>";
    while ($oop = mysql_fetch_array($sql)) {
        $userID = $oop['user'];
        $friendID = $oop['friend'];
        if ($userID == $id) {
            $s = $oop['friend'];
        } else {
            $s = $oop['user'];
        }
        $userN = nameUser($s);
        $pic = loadpic($s);
        echo "\n\t\t\t\n\t\t\t\t<table width='200' border='0'>\n\t\t\t\t  <tr>\n\t\t\t\t\t<td><a href='user/{$userN}'>{$pic}</a></td>\n\t\t\t\t  </tr>\n\t\t\t\t  <tr>\n\t\t\t\t\t<td><a href='user/{$userN}'>{$userN}</a></td>\n\t\t\t\t  </tr>\n\t\t\t\t</table>\n\t\t\t\n\t\t\t\n\t\t\t";
    }
} else {
    echo "<div id='wrong'>We don't have this user in our DB</div>";
}
示例#4
0
<?php

session_start();
include 'config.php';
include 'functions.php';
@($uid = $_SESSION['user_id']);
@($user = $_SESSION['user']);
$date = time();
if ((!isset($uid) || empty($uid) || !is_numeric($uid)) && isset($user)) {
    echo "ERROR 404";
} else {
    $sql = mysql_query("select * from notification where user_id='{$uid}'");
    while ($row = mysql_fetch_array($sql)) {
        $id = hashit($row['note_id']);
        $fromID = $row['from_id'];
        echo "<p><a href='profile.php?id={$fromID}'>" . nameUser($row['from_id']) . "</a> <em>posted a comment about this <a href='note.php/{$id}'>Note</a></em></p>";
        //update all UNREAD messages
        $up = mysql_query("UPDATE notification set unread='0' where user_id='{$uid}' and unread='1'");
    }
}
示例#5
0
文件: freq.php 项目: rymaga/notes-app
						});

						

					}

				});

				

				return false;

			});
	
			
				
				
});
</script>
<?php 
$sql = mysql_query("select * from friends where friend='{$uid}' and permet='0' order by friend_id desc");
$num = mysql_num_rows($sql);
if ($num == "0") {
    echo "You have no friendship demands for now !!";
} else {
    while ($row = mysql_fetch_array($sql)) {
        $friendID = $row['user'];
        $friend = nameUser($friendID);
        echo "<p>" . $friend . " <a class='req' id='1|{$friendID}' href='#'>[ALLOW]</a> <a class='req' id='0|{$friendID}' href='#'>[REFUSE]</a><div id='show'></a></p>";
    }
}
示例#6
0
            $current = $page;
        }
        // sinon la page courante est bien celle indiquée dans l'URL
    }
    /* $start est la valeur de départ du LIMIT dans notre requête SQL (est fonction de la page courante) */
    $start = $current * $epp - $epp;
    /* Récupération des données à afficher pour la page courante */
    $qry = "select * from `notes` where `note` LIKE '%{$q}%' and `type`='1' LIMIT {$start}, {$epp}";
    $res = @mysql_query($qry);
    $num = mysql_num_rows($res);
    if ($num == 0) {
        echo "<div id='wrong'>No Results</div>";
    }
    if ($res) {
        while ($row = mysql_fetch_array($res)) {
            $user = $row['user'];
            $userN = nameUser($user);
            $pic = loadpic($user);
            $timestamp = Timesince($row['date']);
            $note = stripslashes(nl2br($row['note']));
            $noteID = hashit($row['notes_id']);
            echo "\n\n\t\t\t\t\t\t\t\t\t\t\t\t<table width='765' border='0'>\n\t\t\t\t\t\t\t\t\t\t\t\t  <tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td width='10' height='21' valign='top'><a href='user/{$userN}'>{$pic}</a></td>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<td width='745' valign='top'><a href='user/{$userN}'><font color='blue'>{$userN} \t     \t\t\t\t\t\t\t\t\t\t</font></a> <a href='note/{$noteID}'>" . $note . "</a><br /><em><font color='grey'>Posted       \t\t\t\t\t\t\t\t\t\t{$timestamp} ago</font></em>  \t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t\t\t  </tr>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t  \n\t\t\t\t\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t\t\t\t\t\t<hr />\n\n\t\t\t\n\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
        }
    }
    /* Libération du résultat */
    mysql_free_result($res);
    //else echo mysqli_error($dbc);
    /* Appel de la fonction */
    echo paginate("search2.php?q={$q}", '&p=', $countp, $current);
}
//else error
示例#7
0
function show_comments($noteID)
{
    $getcom = mysql_query("select * from note_comment where note_id='{$noteID}'");
    $numcom = mysql_num_rows($getcom);
    if ($numcom == 0) {
        echo "<h1><strong>Make</strong> the first comment!</h1>";
    } else {
        echo "<h1><strong># Comments</strong> on this note</h1>";
        while ($oopcom = mysql_fetch_array($getcom)) {
            $userID = $oopcom['user'];
            $user = nameUser($userID);
            $com = stripslashes(nl2br($oopcom['comment']));
            //echo "<em>Posted by : </em>$user <br />$com<hr />";
            ?>
        



			<div id="comment">
			<li id="comment_profile_pic"><img src="<?php 
            echo loadpic($userID);
            ?>
" width='30' height='30' /></li>
			<li id="comment_content">
				<span class="note_meta"><?php 
            echo "Posted by <a href='profile.php?id={$userID}'>{$user}</a>";
            ?>
</span><br />
				<?php 
            echo $com;
            ?>
			</li>
			</div>



        
        <?php 
        }
        // else
    }
}
    echo "<div class='col-md-3'></div><div class='col-md-6'>\n  \t<form class='form-signin' action='updateGame.php' id='myForm2' method='POST'>\n    <div class='form-group'>\n      <label for='gameid'>Game ID</label>\n      <input type='number' class='form-control' name='gameid' value='" . $item['game_id'] . "' readonly>\n    </div>\n    <div class='form-group'>\n      <label for='date'>Game Date</label>\n      <input type='text' class='form-control' name='date' value='" . $item['game_date'] . "' readonly>\n    </div>\n    <div class='form-group'>\n      <label for='notes'>Notes</label>\n      <input type='text' class='form-control' name='date' value='" . $item['game_notes'] . "'>\n    </div>\n    <div class='form-group'>\n      <label for='winner'>Winner</label>\n      <select class='form-control' name='winner' form='myForm2'>\n        <option ";
    if (is_null($item['winner_user'])) {
        echo "selected='selected' ";
    }
    echo "disabled='disabled' >Select Winner</option>";
    $queryopen = $db->query($sql2);
    foreach ($queryopen as $thing) {
        echo "<option ";
        if ($item['winner_user'] == $thing['id']) {
            echo "selected='selected' ";
        }
        echo "value=" . $thing['id'] . ">" . $thing['display_name'] . "</option>";
    }
}
echo " </select>\n    </div>";
$query = $db->query($sql3);
foreach ($query as $item) {
    $user = nameUser($item['user'], $db);
    $deck1 = nameDeck($item['deck1'], $db);
    $deck2 = nameDeck($item['deck2'], $db);
    echo "<div class='col-md-6 text-center'><u><h3>" . $user . "</h3></u>" . $deck1 . "</br>" . $deck2 . "</div>";
}
if (isset($_SESSION['userid'])) {
    echo "<button class='btn btn-lg btn-inverse btn-block' name='update' type='submit'><span class='glyphicon glyphicon-ok-sign'></span> Submit</button>\n  \t<button class='btn btn-lg btn-warning btn-block' type='button' onclick=location.href='gameRecords.php'><span class='glyphicon glyphicon-remove-sign'></span> Cancel</button>";
    if ($_SESSION['usergroup'] == "Admin") {
        echo "\t<button class='btn btn-lg btn-danger btn-block' name='delete' type='submit'><span class='glyphicon glyphicon-remove'></span> Delete</button>";
    }
    echo "</form></div>";
}
include '../footer.php';
echo "</div></body></html>";