include php Frage

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
Post Reply
cyber-james
Posts: 100
Joined: Mon 28. Jun 2004, 23:43

include php Frage

Post by cyber-james »

Hallo liebe phpWCMS Freunde

zur Zeit versuche ich eine statische Site in phpWCMS Dev121 zu stöppseln. Dabei stosse ich auf ein Problem. Der folgende Sitecounter funzt nicht mehr auf der neuen Eingangsseite. Habe diesen Code in der Vorlage eingefügt (erzeugt Textausgabe auf gelbem Table im Frontend):

Code: Select all

<table width="100%" border="0" cellpadding="5" cellspacing="0" class="smalltext">
<tr>
<td><font color="#FF9933"><?php include('05scripts/sitecounter.php'); ?></font></td>
</tr>
<tr>
<td><?php include('05scripts/useronline.php'); ?></td>
</tr>
</table>
Hier noch der Link: http://www.wolfsland.ch/index.php?index
Gleichzeitig das selbe Script bei der Arbeit:
http://www.wolfsland.ch/entry.php
Hat jemand eine Idee? Pfadproblem sollte es nicht sein.
:?

Gruss
Cyber
Last edited by cyber-james on Tue 8. Mar 2005, 15:48, edited 1 time in total.
Pappnase

Post by Pappnase »

hallo cyber

sconmal probiert den gesamten pfad mit in das include einzugeben!? sprich die url!?
cyber-james
Posts: 100
Joined: Mon 28. Jun 2004, 23:43

hmm ... Pfadproblem?

Post by cyber-james »

Hallo Pappnase

nein, würde bei echtem ansprechen des Scripts mit Pfadproblemen nicht php-Fehler im Frontend erscheinen? Ich habe das dumpfe Gefühl, das Script wird gar nich abgearbeitet. Weshalb ist mir doch etwas schleierhaft.

Aber danke, ich werd's versuchen ...
Last edited by cyber-james on Tue 8. Mar 2005, 15:35, edited 1 time in total.
cyber-james
Posts: 100
Joined: Mon 28. Jun 2004, 23:43

Post by cyber-james »

:roll: Pfad war's leider nicht ...
Pappnase

Post by Pappnase »

hallo cyber

hmm schade also ich habe auch includes auf der docu seite die funzen! ok sind aber auch nur template geschichten die ich da lade!
cyber-james
Posts: 100
Joined: Mon 28. Jun 2004, 23:43

[PHP]mein_PHP_code[/PHP]

Post by cyber-james »

Hallo zusammen

manchmal sucht man echt zu weit. Einfach [PHP]include ... [/PHP] und es tut!

Danke Pappnase für Deine Mühe.

Gruss
Cyber
cyber-james
Posts: 100
Joined: Mon 28. Jun 2004, 23:43

Post by cyber-james »

... und es tut doch nicht ganz.

Hallo Leute

Ist es möglich, dass sich PHP-Skripte gegenseitig stören? Ausserhalb von phpWCMS läuft useronline.php prima. Nur innerhalb von phpWCMS gibt es Fehlermeldungen:
Warning: fopen(): open_basedir restriction in effect. File(/) is not within the allowed path(s): (/home/httpd/vhosts/wolfsland.ch/httpdocs:/tmp:/usr/bin) in /home/httpd/vhosts/wolfsland.ch/httpdocs/05scripts/useronline.php on line 60

Warning: fopen(/): failed to open stream: Operation not permitted in /home/httpd/vhosts/wolfsland.ch/httpdocs/05scripts/useronline.php on line 60

Warning: fclose(): supplied argument is not a valid stream resource in /home/httpd/vhosts/wolfsland.ch/httpdocs/05scripts/useronline.php on line 61

Warning: readdir(): supplied argument is not a valid Directory resource in /home/httpd/vhosts/wolfsland.ch/httpdocs/05scripts/useronline.php on line 64

Warning: closedir(): supplied argument is not a valid Directory resource in /home/httpd/vhosts/wolfsland.ch/httpdocs/05scripts/useronline.php on line 76
Zur Zeit sind 0 Besucher online.
Hier der code von useronline:

Code: Select all

<?php
#################################################
# :: planetUser :: Version vom 11.04.2003
#################################################
#
# COPYRIGHT NOTICE                                                           
# Copyright 2003 PlaNet Concept e.K.     
# All Rights Reserved.                     
# EMail: kontakt@planetc.de
# URL  : http://www.planetc.de

// Anzahl der Minuten, die ein User als online gelten soll (ein Tag hat 1440 Minuten ;-)
$ip_time = 180; 

// Mindest-User-Anzahl die angezeigt wird
$fake_user = 0;

// Anzahl der online befindlichen User anzeigen
// 1 = Ja || 0 = Nein
$display = 1;

// Formatierung der Anzeige
$count_font_face = "verdana";                // Schriftart
$count_font_size = "2";                                        // Schrift-Größe
$count_font_color = "#ffffff";                        // Farbe der Schrift

#################################################
# ab hier muß nichts geändert werden, es sei denn, Sie wissen was Sie tun...
#################################################

$rem_adr = $HTTP_SERVER_VARS['REMOTE_ADDR'];
$data_path = dirname(__FILE__).'/data';

# IP-Adresse prüfen
$count_user = check_ipfile($rem_adr);

if ($display) {
        // User-Online Anzeige
        if ($count_user=="1") {
                $pre = "ist";
        } else {
                $pre = "sind";
        }
        echo "Zur Zeit $pre <b>$count_user</b> Besucher online.";
}

#############################
# IP-Adresse checken
#############################
function check_ipfile($senders_ip) {

        global $ip_time, $data_path, $fake_user;

        $ip_dat = $data_path.'/'.$senders_ip;

        $ip_folder = opendir($data_path);
        $now_date = date("U");

        // IP hinzufügen oder alte mit aktueller Zeit überschreiben
        $ip_file = fopen("$ip_dat","w+");
        fclose ($ip_file); 

        // alte IP-Files löschen
        while ($datfile = readdir($ip_folder)) {
                if (preg_match("=\d{2}.*=", $datfile)) {
                        $dat_date = date("U", filectime($data_path.'/'.$datfile));
                        $keep_time = 60*$ip_time;
                        $dif_time = $now_date - $keep_time;
                        if ($dat_date < $dif_time) {
                                @unlink($data_path.'/'.$datfile);
                        } else {
                                $ip_count++;
                        }
                }
        }
        closedir($ip_folder);

        $ip_count = $ip_count + $fake_user;
        return ($ip_count);

} // end func
#################################################
?>
cmod hab' ich gefummelt, Pfadangaben dito ... nichts. Hat jemand eine Idee?

Gruss
cyber
smudo
Posts: 1
Joined: Tue 24. May 2005, 11:47
Contact:

Post by smudo »

Ändere Code wie folgt:

Code: Select all

$rem_adr = $_SERVER['REMOTE_ADDR'];
$path = 'data';

Code: Select all

# IP-Adresse prüfen
$count_user = check_ipfile($rem_adr, $path);

Code: Select all

function check_ipfile($senders_ip, $data_path) {

        global $ip_time, $fake_user;

so jetzt sollte das Script funzen ! ;-)


greets Smudo
Alle gefundenen Rechtschreibfehler dienen nur der allgemeinen Belustigung ! ;-)
Post Reply