##########################################################
config.php leeg laten!
#######################################################
##########################################################
index.php
#######################################################
<?php
require_once("init.php");
require_once(HEADERF);
$action = (isset($_GET['action']) ?
$_GET['action'] : "news");
if(!$action || $action == "news") {
$pn->setTable(MPREFIX."news");
$pn->setMax($config['max_news']);
$pn->setOrder("news_id", "DESC");
$pn->setWhere(" WHERE news_active=1");
$pn->getTotal();
$pn->showNews("news");
} else if($action == "archive") {
$pn->setTable(MPREFIX."news");
$pn->setMax(10000000000);
$pn->setOrder("news_id", "DESC");
$pn->setWhere(" WHERE news_active=1");
$pn->getTotal();
echo "<table width='100%' class='fborder'> <tr>
<td colspan='3' class='forumheader'>Nieuws archief</td>
</tr>
";
$pn->showNews("cat");
}
require_once(FOOTERF);
?>
###################################################
read.php
###################################################
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Lucky News Nieuws systeem. (c) Copyright 2005 Lucas van Dijk
| File: read.php
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require_once("init.php");
define('PAGE_TITLE', "Lees nieuws"); require_once(HEADERF);
$action = (isset($_GET['action']) ?
$_GET['action'] : "comments"); $news_id = (isset($_GET['news_id']) ?
$_GET['news_id'] : false);
if(!$news_id) {
show_error(GENERAL, "Geen id opgegeven");
}
if(isset($_POST['post_comment'])) {
if(!$name || !$comment) {
show_error(MESSAGE, "Geen bericht of naam ingevuld. Ga terug en probeer het opnieuw");
}
$sql = "INSERT INTO ".MPREFIX."comments (comment_news_id, comment_author, comment_date, comment_body, comment_ip)
VALUES (".$news_id.", '".$name."', ".time().", '".$comment."', '".$_SERVER['REMOTE_ADDR']."')"; show_error(GENERAL, "Kon reactie niet toevoegen", __LINE__, __FILE__, $sql);
}
tablerender("Ok", "Uw reactie is toegevoegd.");
}
if($action == "extended") {
$pn->setTable(MPREFIX."news");
$pn->setMax(1);
$pn->setOrder("news_id", "DESC");
$pn->setWhere(" WHERE news_id=".$news_id);
$pn->getTotal();
$pn->showNews("extended");
}
if($action == "comments") {
//
// Show news item
//
$sql = "SELECT * FROM ".MPREFIX."news WHERE news_id=".$news_id;
show_error(GENERAL, "Kon nieuws niet selecteren", __LINE__, __FILE__, $sql);
}
$ns -> showNews_item($newsrow, "comments");
echo "<h4>Reacties</h4>"; //
// Show comments
//
$pn->setTable(MPREFIX."comments");
$pn->setMax($config['max_comments']);
$pn->setOrder("comment_id", "DESC");
$pn->setWhere(" WHERE comment_news_id=".$news_id);
$pn->getTotal();
$pn->showComments();
}
if($action == "post_comment") {
$text = "
<form method='post' action='read.php?action=comments&news_id=".$news_id."'>
<table width='100%' cellpadding='0' cellspacing=0' border='0'>
<tr>
<td width='50%' valign='top'>Naam:</td>
<td width='50%' valign='top'><input type='text' name='name' size='40' maxlength='20' class='tbox'></td>
</tr>
<tr>
<td width='50%' valign='top'>Reactie:</td>
<td width='50%' valign='top'><textarea id='commentform' name='comment' class='tbox' cols='40' rows='7'></textarea><br />".$msg -> render_help('commentform')."</td>
</tr>
<tr>
<td colspan='2' style='text-align: center'><input type='submit' name='post_comment' value='Toevoegen!' class='button'></td>
</tr>
</table>
</form>";
tablerender("Plaats reactie", $text);
}
require_once(FOOTERF);
?>
######################################################
category.php
######################################################
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Lucky News Nieuws systeem. (c) Copyright 2005 Lucas van Dijk
| File: category.php
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require_once("init.php");
define('PAGE_TITLE', "Categorieën"); require_once(HEADERF);
if(!isset($_GET['cat_id'])) { $pn->setTable(MPREFIX."categories");
$pn->setMax(1000000);
$pn->setOrder("category_name", "ASC");
$pn->showCats("cats");
} else {
$id = (isset($_GET['cat_id']) ?
$_GET['cat_id'] : false); if(!$id) {
show_error(GENERAL, "Geen id opgegeven");
}
$sql = "SELECT * FROM ".MPREFIX."categories WHERE category_id=".$id;
show_error(GENERAL, "Kon categorie niet selecteren", __LINE__, __FILE__, $sql);
}
$pn->setTable(MPREFIX."news");
$pn->setMax($config['max_news']);
$pn->setOrder("news_id", "DESC");
$pn->setWhere(" WHERE news_category=".$id);
$pn->getTotal();
echo "<table width='100%' class='fborder'> <tr>
<td colspan='3' class='forumheader'>".$catrow['category_name']."</td>
</tr>
";
$pn -> showNews("cat");
}
require_once(FOOTERF);
?>
######################################################
init.php
######################################################
<?
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Lucky News Nieuws systeem. (c) Copyright 2005 Lucas van Dijk
| File: init.php
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
include('config.php');
//error_reporting(E_ALL);
// Not installed, redirect
header("Location: install.php"); }
//
// Define some dirs
//
$link_prefix = "";
for ($i = 1; $i <= $num_levels; $i++) {
$link_prefix .= "../";
}
define('LN_ROOT', $link_prefix); define('LN_IMAGE', LN_ROOT
."images/");
if (preg_match("/\[(.*?)\].*?/i", $_SERVER['QUERY_STRING'], $matches)) { } else {
}
//
// Include some files
//
include_once("includes/error_functions.php");
include_once("includes/functions_misc.php");
include_once("includes/template.php");
include_once("includes/page_nav.php");
include_once("includes/show_class.php");
include_once("includes/user_class.php");
include_once("includes/message_class.php");
include_once("includes/rss_class.php");
//
// Define class vars
//
$tp = new template;
$ns = new show;
$pn = new pageNav;
$us = new user;
$msg = new message;
$rss = new rss;
//
// Connect to DB
//
if(!$connect || !$selectDb) {
show_error(CRITICAL, "Kon niet met de database verbinding maken.", __LINE__, __FILE__);
}
//
// Create config array
//
$sql = "SELECT * FROM ".$mprefix."config";
show_error(CRITICAL, "Fout bij het selecteren uit de config tabel!", __LINE__, __FILE__, $sql);
}
$config[$row['config_name']] = $row['config_value'];
}
//
// Error levels
//
//
// User levels
//
//
// Other constants
//
define('SITENAME', $config['site_name']); define('SITEDISCLAIMER', $config['sitedisclaimer']); define('TIMEZONE', $config['timezone']); define('THEME', LN_ROOT
."themes/".$config['theme']."/");
//
// Theme
//
$themeFile = THEME."theme.php";
include($themeFile);
} else {
show_error(CRITICAL, "Theme kan niet worden geladen! Zorg dat je een theme.php bestand in je theme hebt!");
}
//
// Header and footer
//
define("HEADERF", LN_ROOT
."themes/templates/header.php"); define("FOOTERF", LN_ROOT
."themes/templates/footer.php");
//
// If user logged in get information and set his ID
//
if(isset($_SESSION['user_id'])) { $us -> setId($_SESSION['user_id']);
$user_info = $us -> getInfo();
}
//
// Check if banned
//
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT * FROM ".MPREFIX."banlist WHERE ban_ip='".$ip."'";
show_error(GENERAL, "Kon IP niet selecteren!", __LINE__, __FILE__, $sql);
}
if($aantal > 0 && $user_info['user_rank'] != HEAD_ADMIN) {
require_once(HEADERF);
tablerender("Fout!", "Je bent gebanned van deze site! Je mag de site niet meer bezoeken.<br />
<b>Rede:</b><br />".$ban['ban_reason']);
require_once(FOOTERF);
}
?>
#######################################################
login.php
#######################################################
<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Lucky News Nieuws systeem. (c) Copyright 2005 Lucas van Dijk
| File: login.php
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
require_once("init.php");
define('PAGE_TITLE', "Inloggen"); require_once(HEADERF);
if(!isset($_POST['submit'])) { $text = "<form method='post' action='login.php'>
<table width='100%' class='fborder'>
<tr>
<td width='40%' class='forumheader3' valign='top'>Username:</td>
<td width='60%' class='forumheader3' valign='top'><input type='text' name='username' class='tbox' size='40'></td>
</tr>
<tr>
<td width='40%' class='forumheader3' valign='top'>Wachtwoord:</td>
<td width='60%' class='forumheader3' valign='top'><input type='password' name='password' class='tbox' size='40'></td>
</tr>
<tr>
<td colspan='2' class='forumheader2' style='text-align: center'><input type='submit' name='submit' value='Inloggen!' class='button'></td>
</tr>
</table>
</form>";
tablerender("Inloggen", $text);
} else {
$password = md5($_POST['password']); $username = $_POST['username'];
$sql = "SELECT * FROM ".MPREFIX."users WHERE user_name='".$username."' AND user_pass='".$password."'";
show_error(GENERAL, "Kon gebruikers niet selecteren.", __LINE__, __FILE__, $sql);
}
if($aantal > 0) {
$_SESSION['user_id'] = $user['user_id'];
$text = "Je bent nu ingelogd. Klik <a href='".LN_ROOT."admin/index.php'>hier</a> om naar de admin te gaan.";
} else {
$text = "Je hebt een verkeerd wachtwoord of gebruikersnaam op gegeven. Ga terug en probeer het opnieuw.";
}
tablerender("", $text);
}
require_once(FOOTERF);
?>
######################################################
install.php
######################################################
<?
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
| Lucky News Nieuws systeem. (c) Copyright 2005 Lucas van Dijk
| File: install.php
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$stage = (isset($_GET['stage']) ?
$_GET['stage'] : 1); $PATH = substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], "/"))."/"; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Lucky news installeren</title>
<style type="text/css">
body {
font-size: 12px;
color: #fff;
font-family: tahoma, verdana, arial, sans-serif;
background-color: #500000;
margin:0px;
text-align:left
}
.selected {
background-color: #620000;
font-size: 12px;
border: 1px dashed #bebebe;
}
.notselected {
background-color: #840000;
font-size: 12px;
}
.darkrow {
background-color: #620000;
font-size: 12px;
}
.lightrow {
background-color: #840000;
font-size: 12px;
}
.background {
background-color: #840000;
font-size: 12px;
}
.button {
color: #fff;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color: #5d0000;
text-align: center;
border: solid 1px #370000
}
.tbox {
color: #fff;
font-size: 10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
background-color: #620000;
border: solid 1px #370000
}
.ttl_area { background-color: #620000; width: 75%; text-align: center; padding-top: 2px; padding-bottom: 2px; border-bottom: 1px solid #370000 }
</style>
</head>
<body>
<?
<div align="center">
<div class="ttl_area">
<img src="images/logo.gif" alt="" border="0">
</div>
<table width="75%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="3" class="lightrow">Stap:</td>
</tr>
<tr>
<td width="33%" class="'.($stage == 1 ? "selected" : "notselected").'">1. Welkom!</td>
<td width="33%" class="'.($stage == 2 ? "selected" : "notselected").'">2. Gegevens invoeren</td>
<td width="33%" class="'.($stage == 3 ? "selected" : "notselected").'">3. Klaar!</td>
</tr>
</table>';
if($stage == 1) {
echo '<table width="75%" cellpadding="0" cellspacing="0" border="0"> <tr>
<td class="background">
<h3>Welkom!</h3>
Welkom bij het installatie script van Lucky News. Dit script zal het nieuws systeem installeren.<br />
We hebben wel wat gegevens van je nodig dus klik op de knop om verder te gaan!
</td>
</tr>
<tr>
<td class="darkrow" style="text-align: center"><input type="button" value="Verder!" onclick="document.location=\''.$_SERVER['PHP_SELF'].'?stage=2\'" class="button"></td>
</tr>
</table>';
} else if($stage == 2) {
<form method="post" action="install.php?stage=3">
<table width="75%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td colspan="2" class="darkrow">Gegevens invoeren</td>
</tr>
<tr>
<td class="lightrow" colspan="2"><b>Mysql gegevens</b></td>
</tr>
<tr>
<td class="background">Mysql host</td>
<td class="background"><input type="text" name="mysql_host" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Mysql username</td>
<td class="background"><input type="text" name="mysql_user" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Mysql password</td>
<td class="background"><input type="text" name="mysql_pass" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Mysql database</td>
<td class="background"><input type="text" name="mysql_db" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Mysql prefix</td>
<td class="background"><input type="text" name="mprefix" class="tbox" size="35" value="ln_"></td>
</tr>
<tr>
<td colspan="2" class="lightrow"><b>Admin gegevens</b></td>
</tr>
<tr>
<td class="background">Username</td>
<td class="background"><input type="text" name="username" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Email</td>
<td class="background"><input type="text" name="email" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Wachtwoord</td>
<td class="background"><input type="password" name="pass1" class="tbox" size="35"></td>
</tr>
<tr>
<td class="background">Wachtwoord (bevestigen)</td>
<td class="background"><input type="password" name="pass2" class="tbox" size="35"></td>
</tr>
<tr>
<td colspan="2" class="darkrow" style="text-align: center"><input type="submit" class="button" name="submit" value="Installeren!"></td>
</tr>
</table>';
} else if($stage == 3 && isset($_POST['submit'])) { $text = '';
if(!$mysql_host || !$mysql_user || !$mysql_pass || !$mysql_db || !$username || !$pass1) {
die("U heeft iets niet ingevuld! Ga terug en probeer het opnieuw!"); }
//
// News table
//
$queries[] = "
CREATE TABLE ".$_POST['mprefix']."news (
news_id INT NOT NULL AUTO_INCREMENT ,
news_author VARCHAR( 100 ) NOT NULL ,
news_title VARCHAR( 255 ) NOT NULL ,
news_category INT NOT NULL ,
news_date INT NOT NULL ,
news_body TEXT NOT NULL ,
news_extended TEXT NOT NULL ,
news_active INT NOT NULL ,
news_allow_comments INT NOT NULL ,
PRIMARY KEY ( news_id )
);";
//
// Catgeories table
//
$queries[] = "
CREATE TABLE ".$_POST['mprefix']."categories (
category_id INT NOT NULL AUTO_INCREMENT ,
category_desc VARCHAR( 255 ) NOT NULL ,
category_name VARCHAR( 100 ) NOT NULL ,
category_icon VARCHAR( 150 ) NOT NULL ,
PRIMARY KEY ( category_id )
);";
//
// Users table
//
$queries[] = "
CREATE TABLE ".$_POST['mprefix']."users (
user_id INT NOT NULL AUTO_INCREMENT ,
user_name VARCHAR( 100 ) NOT NULL ,
user_email VARCHAR( 100 ) NOT NULL ,
user_pass VARCHAR( 150 ) NOT NULL ,
user_rank INT NOT NULL ,
PRIMARY KEY ( user_id )
);";
//
// Config table
//
$queries[] = "
CREATE TABLE ".$_POST['mprefix']."config (
config_name TEXT NOT NULL ,
config_value TEXT NOT NULL
);";
//
// News comments table
//
$queries[] = "CREATE TABLE ".$_POST['mprefix']."comments (
comment_id INT NOT NULL AUTO_INCREMENT ,
comment_news_id INT NOT NULL ,
comment_author VARCHAR( 100 ) NOT NULL ,
comment_date INT NOT NULL ,
comment_body TEXT NOT NULL ,
comment_ip VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( comment_id )
);";
//
// Banlist table
//
$queries[] = "CREATE TABLE ".$_POST['mprefix']."banlist (
ban_id INT NOT NULL AUTO_INCREMENT ,
ban_ip VARCHAR( 20 ) NOT NULL ,
ban_reason TEXT NOT NULL ,
PRIMARY KEY ( ban_id )
);";
//
// Config values
//
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('theme', 'Raid Silver')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('max_news', '5')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('max_comments', '10')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('max_admin', '15')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('site_name', 'Lucky News nieuws systeem')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('site_desc', 'Een beschrijving over je site. ')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('timezone', '1')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('sitedisclaimer', '© Copyright 2005 bij (je site naam).')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('date_format', 'd M Y H:i:s')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('max_rss', '10')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('filter', 'worden,die,gefilterd,moeten,worden')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('logo', '{LN_IMAGE}logo.gif')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('filter_replace', '-filter-')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('enable_bbcode', 'TRUE')";
$queries[] = "
INSERT INTO ".$_POST['mprefix']."config (config_name, config_value) VALUES ('enable_smilies', '1')";
//
//Admin
//
$queries[] = "
INSERT INTO ".$_POST['mprefix']."users (user_name, user_email, user_pass, user_rank) VALUES ('".$_POST['username']."', '".$_POST['email']."', '".md5($_POST['pass1'])."', 1)";
if($_POST['pass1'] != $_POST['pass2']) {
die("De wachtwoorden komen niet overeen! Ga terug en probeer het opnieuw!"); }
$connect = mysql_connect($_POST['mysql_host'], $_POST['mysql_user'], $_POST['mysql_pass']);
if(!$connect) {
$text .= "<b>Kon niet met de database verbinden!</b>";
$error = true;
}
foreach($queries as $sql_query) {
$text .= $sql_query;
$text .= "<br /><font style='color: #FF0000'>Mislukt: ".mysql_error()."</font><br /><br />"; $error = true;
} else {
$text .= "<br /><font style='color: #00FF00'>Gelukt!</font><br /><br />";
}
}
if($file = fopen('config.php', "w")) { $write = "
<?
//
// Lucky news auto generated config file
//
\$dbServer = \"".$_POST['mysql_host']."\";
\$dbUser = \"".$_POST['mysql_user']."\";
\$dbPass = \"".$_POST['mysql_pass']."\";
\$dbDbName = \"".$_POST['mysql_db']."\";
\$mprefix = \"".$_POST['mprefix']."\";
define('PATH', '".$PATH."');
?>
";
$text .= "<font style='color: #FF0000;'>Kon de gegevens niet schrijven naar het config.php bestand!</font><br /><br />";
$error = true;
}
} else {
$text .= "<font style='color: #FF0000;'>Kon config.php niet openen!</font><br /><br />";
$error = true;
}
} else {
$text .= "<font style='color: #FF0000;'>config.php is niet beschrijfbaar!</font><br /><br />";
$error = true;
}
$text .= "<b>Alles is succesvol geinstalleerd! Verwijder dit bestand nu van de server en ga naar je admin om alles te configureren.</b>";
} else {
$text .= "<b>Er is een fout opgetreden. Als je niet weet hoe je het moet oplossen, neem dan contact op met de maker.</b>";
}
<table width="75%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="darkrow">Installeren...</td>
</tr>
<tr>
<td class="background">
'.$text.'
</td>
</tr>
</table>';
} else {
$stage = 1;
}
?>
</div>
</body>
</html>
#######################################
ER ZIJN NOG MEER BESTANDEN MAAR DAT IS ZOVEEL EN HEB NIET ZO ZIN OM DAT ALLEMAAL TE GAAN PLAATSEN. DOWNLOAD HET MAAR VOOR DE SORCE VAN DE ANDERE BESTANDEN
############################################