Пример #1
0
<?php

//authors.php
$title = 'Author Page';
$vnum = '';
$viewop = '';
$pid = '';
$keys = '';
$adfl = '';
include 'config/config.php';
include 'functions.php';
head_page($title);
menu_options($title, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($title);
echo 'Welcome';
if (isset($_SESSION['first_name'])) {
    echo ", {$_SESSION['first_name']}!";
    if (isset($_SESSION['user_id'])) {
        $aid = $_SESSION['user_id'];
    }
    $authorsql = "SELECT AuthorID FROM authors WHERE AuthorID = '{$aid}'";
    $result = mysql_query($authorsql);
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
        $authorid = "{$row['AuthorID']}";
    }
    include 'aal.php';
} else {
    echo <<<_EOF
 Guest<br />
<p>Feel free to create a guest <a href="./saa.php">article</a>, or <a href="login.php">Login<a/>.</p>
_EOF;
Пример #2
0
// View Registered Users
//includes
include './config/config.php';
include 'functions.php';
include "./classes/mysql.class.php";
//starting database
$mysqldb = new mysql();
$mysqldb->connect();
$mysqldb->select();
//variables
$adfl = TRUE;
$pagetitle = 'View Registered Users';
head_page($pagetitle);
menu_options($pagetitle, $vnum, $viewop, $pid, $keys, $adfl);
contentinit($pagetitle);
// Number of Records to show per page:
$display = DB_MAX_REC;
// Determine where in the db results to start returning results
if (isset($_GET['s'])) {
    // Already determined
    $start = mifi($_GET['s']);
} else {
    $start = 0;
}
$query = "SELECT CONCAT(au.LastName, ', ', au.FirstName) AS name, au.AuthorID, DATE_FORMAT(RegistrationDate, '%M %d, %Y') AS dr,(SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='N' AND a.ParentID='0') AS pending, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='S' AND a.ParentID='0') AS saved, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND a.Approved='Y' AND a.ParentID='0') AS approved, (SELECT COUNT(*) FROM articles AS a WHERE a.AuthorID=au.AuthorID AND  a.ParentID='0') AS total FROM authors AS au";
$viewquery = $query . " LIMIT {$start}, {$display}";
// That's the end of our query making.
$mysqldb->query($query);
$num_records = $mysqldb->numRows($query);
$mysqldb->query($viewquery);