own_way
Threadersteller
Dabei seit: 15.01.2004
Ort: Stuttgart
Alter: 44
Geschlecht:
|
Verfasst Mi 02.08.2006 21:38
Titel Blog-Script in PHP - wie lege ich einen Admin an? |
|
|
Hallo!
Ich habe folgendes Blog-Script gefunden und weiß nicht wie ich jetzt einen Admin anlegen muss um Einträge zu machen... Jedes Mal wenn ich eine Seite des Blogs aufrufen möchte, bleibe ich verständlicherweise an der login.php hängen. Kann mir jemand helfen?
login.php
Code: | <?
session_start();
require_once('settings.php');
$un = ucfirst($_REQUEST['username']);
$err = "";
if($users[$un] == $_REQUEST['password'] && $_REQUEST['username'] != NULL){
$_SESSION['username'] = $_REQUEST['username'];
header('location: index.php');
} else if (!empty($_REQUEST['username'])) {
$err = "invalid username or password<br>";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title><?= $title; ?> Login</title>
<link href="register.css" rel="stylesheet" type="text/css">
</head>
<body>
<span class="section"><?= $title; ?> Admin Login</span>
<form name="form1" method="post" action="">
<div id="msg"><?=$err;?></div>
<p>
<span class="item">Username</span>
<input name="username" type="text" id="username">
<br>
<span class="item">Password</span>
<input name="password" type="password" id="password">
<br>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
|
und hier die settings.php wo der Admin irgendwo definiert werden muss:
Code: | <?
/*
settings.php
by: Sosh Howell
contact: sosh@swingthis.net
desc: this page sets many of the default variables and functions that are used
in the webfooted site monitor
UPDATE NOTES:
This version has a new database field podcast, as well as some new folders - files and icons, as well as an .htaccess file to help with uploaded file sizes.
here is the SQL syntax for creating the needed table...
CREATE TABLE wfblog (
blog_id int(11) NOT NULL auto_increment,
title varchar(255) NOT NULL default '',
url varchar(255) NOT NULL,
podcast varchar(255) NOT NULL,
content text NOT NULL,
published timestamp NOT NULL default CURRENT_TIMESTAMP,
display char(1) default NULL,
PRIMARY KEY (blog_id)
)
*/
$version = '1.1';
/* declare variables */
$db_type = 'mysql';
$wfhostname = "localhost";
$wfdatabase = "blablabla";
$wfusername = "blablabla";
$wfpassword = "blablabla";
// for future use dont set now...
$wftable = "wfblog";
// COPY and bast these next two sections if you are replacing this file...
$users['User1'] = 'psswd';
$users['User2'] = 'psswd';
// basic blog settings for RSS feed - Edit this
$title = "Tiltle of Feed";
$linked = "http://www.urltolinkto.net";
$desc = "A brief discription of this feed";
/* create a persistant connection */
$wflink = mysql_pconnect($wfhostname, $wfusername, $wfpassword) or trigger_error(mysql_error(),E_USER_ERROR);
mysql_select_db($wfdatabase, $wflink);
function query($query){
global $wflink;
global $db_type;
/* execute mysql code */
if($db_type == "mysql"){
$result = mysql_query($query, $wflink) or die(mysql_error());
return $result;
}
}
?> |
//EDIT by Sarky
Bitte wähle aussagekräftige Titel für Deine Beiträge - siehe Regeln!
Zuletzt bearbeitet von Sarky am Do 03.08.2006 08:56, insgesamt 1-mal bearbeitet
|
|