Esempio n. 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;
            echo "<a href='" . $_SERVER['SCRIPT_NAME'] . "?func=newproject'>Create a new project</a>";
        }
        break;
    case "setproject":
        $pathsql = "SELECT * FROM homeproject_projects WHERE id = " . $validid . ";";
        //			$pathresult = mysql_query($pathsql);
        //			$pathrow = mysql_fetch_assoc($pathresult);
        $pathresult = $db->query($pathsql);
        $pathrow = $pathresult->fetchAll(PDO::FETCH_ASSOC);
        //			session_register("SESS_PROJECTID");
        //			session_register("SESS_PROJECTPATH");
        $_SESSION['SESS_PROJECTID'] = $validid;
        $_SESSION['SESS_PROJECTPATH'] = $pathrow[0]['pathname'];
        header("Location: " . $config_projectadminbasedir . basename($_SERVER['SCRIPT_NAME']) . "?func=main");
        break;
    case "changeproject":
        session_destroy();
        header("Location: " . $config_projectadminbasedir . basename($_SERVER['SCRIPT_NAME']));
        break;
    case "main":
        include_header();
        $projsql = "SELECT * FROM homeproject_projects WHERE id = " . $_SESSION['SESS_PROJECTID'] . ";";
        //			$projresult = mysql_query($projsql);
        $projresult = $db->query($projsql);
        //			$projrow = mysql_fetch_assoc($projresult);
        $projrow = $projresult->fetchAll(PDO::FETCH_ASSOC);
        echo "<h1>" . $projrow[0]['name'] . " Administration</h1>";
        menu_options();
        exit;
        break;
}