SetaPDF
-


Hinweise


Antwort
 
LinkBack Themen-Optionen Thema durchsuchen Thema bewerten
Alt 16.07.2004, 07:24   #1
TP-Junior
 
Registriert seit: Jul 2004
pain macht alles soweit korrekt

problem mit cutenews (www.cutephp.com)


hi,

vielleicht kennt hier jemand das php-newsscript von cutephp --> www.cutephp.com. dies ist ein kostenloses newsscript in php, welches man frei benutzen kann und ohne mysql datenbanken auskommt, was auch das gute daran ist, da nicht jeder eine datenbank zur verfügung hat. das script schreibt aller news und comments in extra dafür vorgesehene textdateien, die dann das archiv darstellen.
mein problem ist die einbindung des scriptes in die page. das einloggen geht ohne probleme. ich habe mir eine login box in meinepage integriert, die sehr gut funktioniert. nur wenn ich mich einlogge und dann news poste, erscheinen diese nicht auf meiner page. da ich mich auch nicht sonderlich gut in php auskenne, wollte ich mal hier nachhorchen, ob jemand eine lösung parat hat oder dieses script auch benützt?

hier der code der index.php:

<bold>
<?PHP
error_reporting (E_ALL ^ E_NOTICE);

require_once("./inc/functions.inc.php");
//#################

$PHP_SELF = "index.php";
$cutepath = ".";
$config_path_image_upload = "./data/upimages";

$config_use_cookies = TRUE; // Use Cookies When Checking Authorization
$config_use_sessions = FALSE; // Use Sessions When Checking Authorization
$config_check_referer = TRUE; // Set to TRUE for more seciruty
//#################

$Timer = new microTimer;
$Timer->start();

// Check if CuteNews is not installed
$all_users_db = file("./data/users.db.php");
$check_users = $all_users_db;
$check_users[1] = trim($check_users[1]);
$check_users[2] = trim($check_users[2]);
if((!$check_users[2] or $check_users[2] == "") and (!$check_users[1] or $check_users[1] == "")){
require("./inc/install.mdu"); die();
}

require_once("./data/config.php");
if(isset($config_skin) and $config_skin != "" and file_exists("./skins/${config_skin}.skin.php")){
require_once("./skins/${config_skin}.skin.php");
}else{
require_once("./skins/default.skin.php");
}


if($config_use_sessions){
@session_start();
@header("Cache-control: private");
}

if($action == "logout")
{
setcookie("md5_password","");
setcookie("username","");
setcookie("login_referer","");

if($config_use_sessions){
@session_destroy();
@session_unset();
setcookie(session_name(),"");
}
msg("info", "Logout", "You are now logged out, <a href=\"$PHP_SELF\">login</a><br /><br>");
}


$is_loged_in = FALSE;
$cookie_logged = FALSE;
$session_logged = FALSE;
$temp_arr = explode("?", $HTTP_REFERER);
$HTTP_REFERER = $temp_arr[0];
if(substr($HTTP_REFERER, -1) == "/"){ $HTTP_REFERER.= "index.php"; }

// Check if The User is Identified

if($config_use_cookies == TRUE){
/* Login Authorization using COOKIES */

if(isset($username))
{
if(isset($HTTP_COOKIE_VARS["md5_password"])){ $cmd5_password = $HTTP_COOKIE_VARS["md5_password"]; }
elseif(isset($_COOKIE["md5_password"])){ $cmd5_password = $_COOKIE["md5_password"]; }
else{ $cmd5_password = md5($password); }

if(check_login($username, $cmd5_password))
{
$cookie_logged = TRUE;
setcookie("lastusername", $username, time()+1012324305);
setcookie("username", $username);
setcookie("md5_password", $cmd5_password);

}else{
$result = "<font color=red>Wrong username or password</font>";
$cookie_logged = FALSE;
}
}
/* END Login Authorization using COOKIES */
}

if($config_use_sessions == TRUE){
/* Login Authorization using SESSIONS */
if(isset($HTTP_X_FORWARDED_FOR)){ $ip = $HTTP_X_FORWARDED_FOR; }
elseif(isset($HTTP_CLIENT_IP)) { $ip = $HTTP_CLIENT_IP; }
if($ip == "") { $ip = $REMOTE_ADDR; }
if($ip == "") { $ip = "not detected";}

if($action == "dologin")
{
$md5_password = md5($password);
if(check_login($username, $md5_password)){
$session_logged = TRUE;

@session_register('username');
@session_register('md5_password');
@session_register('ip');
@session_register('login_referer');

$_SESSION['username'] = "$username";
$_SESSION['md5_password'] = "$md5_password";
$_SESSION['ip'] = "$ip";
$_SESSION['login_referer'] = "$HTTP_REFERER";

}else{
$result = "<font color=red>Wrong username and/or password</font>";
$session_logged = FALSE;
}
}elseif(isset($_SESSION['username'])){ // Check the if member is using valid username/password
if(check_login($_SESSION['username'], $_SESSION['md5_password'])){
if($_SESSION['ip'] != $ip){ $session_logged = FALSE; $result = "The IP in the session doesn not match with your IP"; }
else{ $session_logged = TRUE; }
}else{
$result = "<font color=red>Wrong username and/or password !!!</font>";
$session_logged = FALSE;
}
}

if(!$username){ $username = $_SESSION['username']; }
/* END Login Authorization using SESSIONS */
}

###########################

if($session_logged == TRUE or $cookie_logged == TRUE){
if($action == 'dologin'){
//-------------------------------------------
// Modify the Last Login Date of the user
//-------------------------------------------
$old_users_db = $all_users_db;
$modified_users = fopen("./data/users.db.php", "w");
foreach($old_users_db as $old_users_db_line){
$old_users_db_arr = explode("|", $old_users_db_line);
if($member_db[0] != $old_users_db_arr[0]){
fwrite($modified_users, "$old_users_db_line");
}else{
fwrite($modified_users, "$old_users_db_arr[0]|$old_users_db_arr[1]|$old_users_db_arr[2]|$old_users_db_arr[3]|$old_users_db_arr[4]|$old_users_db_arr[5]|$old_users_db_arr[6]|$old_users_db_arr[7]|$old_users_db_arr[8]|".time()."||\n");
}
}
fclose($modified_users);
}

$is_loged_in = TRUE;
}

###########################

// If User is Not Logged In, Display The Login Page
if($is_loged_in == FALSE)
{
if($config_use_sessions){
@session_destroy();
@session_unset();
}
setcookie("username","");
setcookie("password","");
setcookie("md5_password","");
setcookie("login_referer","");
echoheader("user","Please Login");

echo "
<table border=0 cellspacing=0 cellpadding=1>
<form name=login action=\"$PHP_SELF\" method=post>
<tr>
<td width=80>Username: </td>
<td><input tabindex=1 type=text name=username value='$lastusername' style=\"width:134\"></td>
</tr>
<tr>
<td>Password: </td>
<td><input type=password name=password style=\"width:134\"></td>
</tr>
<tr>
<td></td>
<td ><input accesskey=\"s\" type=submit style=\"width:134; background-color: #F3F3F3;\" value=' Login... '></td>
</tr>
<tr>
<td align=center colspan=3>$result</td>
</tr>
<input type=hidden name=action value=dologin>
</form>
</table>";

echofooter();
}
elseif($is_loged_in == TRUE)
{

//----------------------------------
// Check Referer
//----------------------------------
if($config_check_referer == TRUE){
$self = $_SERVER["SCRIPT_NAME"];
if($self == ""){ $self = $_SERVER["REDIRECT_URL"]; }
if($self == ""){ $self = "index.php"; }

if(!eregi("$self",$HTTP_REFERER) and $HTTP_REFERER != ""){
die("<h2>Sorry but your access to this page was denied !</h2><br>try to <a href=\"?action=logout\">logout</a> and then login again<br>To turn off this security check, change \$config_check_referer in index.php to FALSE");
}
}
// ********************************************************************************
// Include System Module
// ********************************************************************************
if($HTTP_SERVER_VARS['QUERY_STRING'] == "debug"){ debug(); }
//name of mod //access
$system_modules = array('addnews' => 'user',
'editnews' => 'user',
'main' => 'user',
'options' => 'user',
'images' => 'user',
'editusers' => 'admin',
'editcomments' => 'admin',
'tools' => 'admin',
'ipban' => 'admin',
'about' => 'user',
'preview' => 'user',
'categories' => 'admin',
'massactions' => 'user',
'help' => 'user',
'snr' => 'admin',
'debug' => 'admin',
);


if($mod == ""){ require("./inc/main.mdu"); }
elseif( $system_modules[$mod] )
{
if($system_modules[$mod] == "user"){ require("./inc/". $mod . ".mdu"); }
elseif($system_modules[$mod] == "admin" and $member_db[1] == 1){ require("./inc/". $mod . ".mdu"); }
elseif($system_modules[$mod] == "admin" and $member_db[1] != 1){ msg("error", "Access denied", "Only admin can access this module"); exit;}
else{ die("Module access must be set to <b>user</b> or <b>admin</b>"); }
}
else{ die("$mod is NOT a valid module"); }
}

echo"<!-- execution time: ".$Timer->stop()." -->";
?>
</bold>





und hier noch die readme:

<bold>
Getting The News On Your Page...

You can show the news, archives on your page by using some of the following php codes in your page.
The page where you include news, should be with extension .php


--------------------------------------------------------------------------------

General

when showing news, archives you can use $number = x; to limit the to x the number of maximum showed news on one page. If you use $number, "next >>" link to remaining news will be displayed.

if you want to show news, archives from certain category you can use $category = "ID"; where ID is the id of the category, you can choose and more that one category like this: $category = "ID1,ID2,ID3";

when you want to display news and headlines on one page for example, and want when a headline is clicked, the article to be displayed on the place of the news you must use $static = TRUE; before including headlines.

Showing Active News

<?PHP
include("path/to/show_news.php");
?>


Showing with Different Template

<?PHP
$template = "YOUR_TEMPLATE_NAME";
include("path/to/show_news.php");
?>

Showing Archives

<?PHP
include("path/to/show_archives.php");
?>

Showing 5 Latest News

<?PHP
$number = "5";
include("path/to/show_news.php");
?>

Showing 5 News from Category with ID 2

<?PHP
$number = "5";
$category = "2";
include("path/to/show_news.php");
?>

Showing All Headlines And The 1 Latest News Article On One Page

<?PHP
$static = TRUE;
$template = "Headlines";
include("path/to/show_news.php");

$number = "1";
include("path/to/show_news.php");
?>



--------------------------------------------------------------------------------

Remember that:

in all of the above examples you must replace path/to/... to with your path where you installed CuteNews
and not to use the URL but the path
WRONG: include("http://site.com/cutenews/show_news.php);
CORRECT: include("cutenews/show_news.php);
in most cases when you include news and headlines in one page, you must use $static = TRUE; .
when you use $number, $category, $template or any other variable, it must be BEFORE include("show_news.php");
</bold>
pain ist offline   Mit Zitat antworten


Alt 16.07.2004, 13:29   #2
TP-Senior
 
Benutzerbild von Billahonk
 
Registriert seit: Sep 2001
Billahonk ist auf einem guten Weg
Weiß jetzt nicht ob es an deiner Login-Box liegt, die sowieso unnötig ist. Steuere diese doch besser über den Browser an, sieht m.E. soweiso blöd aus, wenn da ne Login Box irgendwo auftaucht. Ansonsten findest du doch alles in der Readme zu den Cute News. Du must Deine Templates einfach nur includen. Per PHP$SELF kannst Du auch erreichen, dass Deine News auf einer seperaten Seite erscheinen (falls man das möchte).

Hier mal ein Beispiel Code:
<?php
$number = "3";
$category = "1,2,3,4,6";
include("news/show_news.php");
?>

Dies bewirkt, dass Du die drei aktuellsten Artikel von den Kategorien 1-6 einbindest.

Aber auf cutephp.com gibt es doch ein eigenes Forum, das wesentlich besser geeignet ist Deine Fragen zu beantworten...
__________________
modern life is rubbish
Billahonk ist offline   Mit Zitat antworten
Antwort

  Aktuelles Thema
  TP Hilfe Forum > Web-Editoren & Coding > Traum-Dynamik
problem mit cutenews (www.cutephp.com) problem mit cutenews (www.cutephp.com)
« [C++] Finde Fehler in Klasse nicht! | SMARTY, wie Tabellen erstellen? »

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)
 
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Thema bewerten
Thema bewerten:

Forumregeln
Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are an
Gehe zu

Ähnliche Themen
Thema Autor Forum Antworten Letzter Beitrag
Problem mit Einbau von FW htm Datein in DW puritive.de Fireworks 2 09.01.2004 00:45
problem mit ap-scrollable area und links woodyWoodPecker Dreamweaver 3 14.12.2003 15:12
Problem mit PopUp ASchwiedy Flash 5 01.12.2003 23:37
Problem mit DropDown Liste Flow09 HTML Puristen 0 22.11.2002 11:49
Problem mit "gotoandPlay" AignerEDV Flash 1 20.06.2002 09:35


Alle Zeitangaben in WEZ +2. Es ist jetzt 09:08 Uhr.

Powered by: vBulletin Version 3.7 (Deutsch)
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd. / Search Engine Friendly URLs by vBSEO 3.2.0 ©2008, Crawlability, Inc.
Traum-Projekt.com | Suchen | Archiv | Impressum | Kontakt | | | Nach oben |



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67