Esempio n. 1
0
 session_cache_limiter('private_no_cache');
 //session_cache_limiter('public');
 function show_login($message = '')
 {
     global $_SERVER;
     print body(form($_SERVER['PHP_SELF'], $message . table(row2("Username:"******"username")) . row2("Password:"******"password")) . row2('', submit('Log In')))));
 }
 if (isset($_POST['username'])) {
     if (succeeds(authenticate($_POST['username'], $_POST['password'], AUTH_VERIFY))) {
         if (authorized($_POST['username'], LOGIN_SERVICE, AUTH_VERIFY)) {
             session_start();
             $LOGIN_USERNAME = $_POST['username'];
             $LOGIN_PASSWORD = $_POST['password'];
             $_SESSION['LOGIN_USERNAME'] = $LOGIN_USERNAME;
             $_SESSION['LOGIN_PASSWORD'] = $LOGIN_PASSWORD;
             http_302($SCRIPT_NAME);
             exit;
         } else {
             $message = "You are not authorized for this operation";
             unset($_SESSION['LOGIN_USERNAME']);
             unset($_SESSION['LOGIN_PASSWORD']);
             unset($LOGIN_PASSWORD);
             unset($LOGIN_USERNAME);
         }
     } else {
         $message = "Login Failed";
     }
 }
 if ($message) {
     unset($LOGIN_USERNAME);
     unset($LOGIN_PASSWORD);
Esempio n. 2
0
require_once dirname(__FILE__) . "/livejournal.php";
if ($REQUEST_METHOD == 'POST' and is_logged_in() and authorized($LOGIN_USERNAME, 'updatejournal')) {
    if (!$contenttype) {
        $contenttype = 'text/wiki';
    }
    if ($timezone) {
        setcookie('timezone', $timezone, 782000);
        $date = timezone_date($timezone, 'Y-m-d H:i:s', $entrydate);
        print $date;
    } else {
        $timezone = 'Universal';
    }
    $q = "INSERT INTO journal (" . "date, timezone, subject, data, contenttype, username" . ") VALUES (" . "'{$date}', '{$timezone}', " . ($subject ? "'{$subject}'" : "NULL") . ", '{$data}', '{$contenttype}', " . "'" . JOURNAL_USERNAME . "');";
    if (mysql_query($q)) {
        if ($livejournal_submit) {
            insert_livejournal(stripslashes($subject), stripslashes($data), $date);
        }
        http_302($PHP_SELF);
    } else {
        print mysql_error() . "(Query = {$q})";
    }
} else {
    if (!authorized($LOGIN_USERNAME, 'updatejournal')) {
        print 'Please log in';
    } else {
        if (!$timezone) {
            $timezone = 'America/Los_Angeles';
        }
        print form($PHP_SELF, table(row2("Date:", hidden('entrydate', time()) . timezone_date($timezone, 'Y-m-d H:i:s T')) . row2("Subject:", field('subject')) . row2("Timezone:", select('timezone', timezones_list(), $timezone)) . row2('', "<textarea name='data' cols='50' rows='10'>" . ($template != 'default' ? join('', file($template)) : '') . "</textarea>") . row2("Content-type:", "<input type='radio' name='contenttype' " . "value='text/wiki' / checked='checked'>WikiWiki " . "<input type='radio' name='contenttype' " . "value='text/html' /> HTML") . ((defined('LIVEJOURNAL_USER') and defined('LIVEJOURNAL_PASSWD')) ? row2("Submit to LiveJournal?", checkbox('livejournal_submit', FALSE)) : '') . row2('', submit('Post'))));
    }
}
Esempio n. 3
0
    }
    print "</dl>";
} elseif ($action == 'info') {
    print "SCRIPT_NAME = " . $_SERVER['SCRIPT_NAME'];
    print "PHP_SELF = " . $_SERVER['PHP_SELF'];
    phpinfo();
} elseif (succeeds($page = wiki_load($pagename, $version))) {
    if (isset($page['mtime']) and $action != 'edit') {
        header("Last-Modified: " . gmdate('r', $page['mtime']));
    }
    if ($action == 'view') {
        if (WIKI_TRACK_VERSIONS and isset($_COOKIE['autodiff'])) {
            if ($seen_versions[$pagename] and !$initialpage) {
                $initialversion = $seen_versions[$pagename];
                if (rcs_cmpver($initialversion, $real_version) == -1) {
                    http_302($_SERVER['SCRIPT_NAME'] . $PATH_INFO . ";{$initialversion}:Current");
                    ob_exit();
                }
            }
            $seen_versions[$pagename] = $real_version;
            setcookie('versions', serialize($seen_versions), time() + 30 * 24 * 60 * 60, '/');
        }
        if (isset($_GET['as']) and $_GET['as'] == 'text/plain') {
            while (ob_get_level()) {
                ob_end_clean();
            }
            header('Content-type: text/plain');
            print $page['body'];
            exit;
        }
        if (isset($initialpage)) {
Esempio n. 4
0
//	require_once(dirname(__FILE__)."/db.php");
require_once dirname(__FILE__) . "/../login/login.php";
require_once dirname(__FILE__) . "/../http.php";
if (!($journal_db = mysql_connect("localhost", "ljk", "ljk"))) {
    print mysql_error();
    exit;
}
mysql_select_db("ljk", $journal_db);
$messageboard_db =& $journal_db;
if ($QUERY_STRING) {
    $QUERY_STRING = '?' . $QUERY_STRING;
}
$SCRIPT_URI = preg_replace('!' . preg_quote($PATH_INFO) . '$!', '', $PHP_SELF);
if ($action == 'login' and $REQUEST_METHOD == 'POST') {
    if (is_logged_in()) {
        http_302($SCRIPT_URI);
    } else {
        print p("Invalid username or password.  Please try again.");
    }
}
unset($mode);
require_once dirname(__FILE__) . "/paths.php";
if (!$mode) {
    if ($REQUEST_METHOD == 'GET') {
        $mode = 'read';
    } else {
        $mode = 'post';
    }
}
?>
	</head>