php.de

Zurück   php.de > Webentwicklung > PHP Einsteiger > PHP Tipps 2005

 
 
LinkBack Themen-Optionen Thema bewerten
Alt 08.05.2005, 17:02  
Gast
 
Beiträge: n/a
Standard Slideshow mit Bildern vom anderen Server geht nicht! :-(

Hi,
ich möchte die fotos, deren pfad in zeile 184 angegeben ist auf einen anderen server verlegen, nur ich krieg dann die fehlermeldung aus zeile 174-180 ausgegeben, wenn ich die if-schleife wegnehme kommt trotzdem noch ne fehlermeldung. hat jemand ne idee wie ich das mit dem anderen server realisieren kann??

PHP-Code:
<?php
$datei 
basename(__FILE__); ;
$endung split("[.]",$datei);
$nr=substr("$endung[0]"43);
################################################################################
################################################################################
// PHPSlideShow v0.6.2 written by Greg Lawler
// from [url]http://www.zinkwazi.com/pages.php?page_name=scripts[/url]

// v0.6.2 august 2002 - minor upgrade, added javascript notes
// v0.6.1 july 2002 - fixed special character bug.
// v0.6 july 2002 - added lots of formatting options and a security patch
// v0.5.1 march 2002 - minor bug fixes, reg exp fix...
// v0.5 march 2002 - osx path fix, page headings for multi dir, cleaner...
// v0.4 july 10 2001
// v0.3.5 july 5 2001
// v0.3.4 april 19 2001
// v0.3.3 january 9 2001
// v0.3.1 september 29 2000 - added support for image buttons
// v0.3 september 12 2000 - added support for comments
// v0.2 august 28 2000
//
// Feel free to use/modify this little script
//
// IMPORTANT NOTE....
// if you want to send me a token of appreciation,
// anything from [url]http://www.starbucks.com[/url] will be gladly accepted ;)
// my address is:
// attention: greg lawler
// 801 alston road, santa barbara, ca 93108 usa
// otherwise it's free.
//
// this script comes with no implied warranty.
//
// enjoy :)
// greg

############################# Quick Start Installation #########################
// put this file in a directory that contains your images
// the slideshow should now work...

############################# Customized  Installation #########################
// Q: how do i add image comments/descriptions to the slideshow?
// A: make a file (e.g. pics.txt) that contains the image names and descriptions
// place each image name and description on a new line separated by a semi colon.
// an easy way to do this is type
// ls *.jpg > pics.txt in linux or
// dir /b *.jpg > pics.txt in dos - you will need edit this with notepad/vi to clean
// out any extra stuff that dir puts in there and to add the semi colon and
// description.
// the slideshow should now work including comments...
//
// Q: how do i give each directory of images it's own page heading?
// A: place a file called heading.txt in each directory. place the page heading
// on the first line of this file.
//
// Q: how do i use one slideshow for multiple different directories of images?
// A: all you need to do to enable this is to call the script and pass it the
// directory path.
//
// for example:
// pictures_directory -> phpslideshow.php
//                    -> dog_pics
//                    -> cat_pics
// so you have a directory called pictures_directory that contains your
// phpslideshow.php and two directories containing pictures of your pets...
// in order to access the shows:
// [url]http://yourserver.com/pictures_directory/phpslideshow.php?directory=dog_pics[/url]
// [url]http://yourserver.com/pictures_directory/phpslideshow.php?directory=cat_pics[/url]
//
// if there were images in the pictures_directory, you'd see them like this:
// [url]http://yourserver.com/pictures_directory/phpslideshow.php?directory=cat_pics[/url]
//
// these three examples will run phpslideshow but each one will load a different
// set of images and descriptions located in the directories shown
//
// NOTE: for security, you can only access directories within the same dir as
// the phpslideshow.php script...
//
// Q: how do i use phpslideshow.php in my existing web page or html template?
// A: change the $standalone variable from true to false.
// what this does is removes the html page headers and footers and only prints
// out the phpslideshow table...
// to use this in an existing php page, use the following line:
// include("phpslideshow.php");
// don't forget that this is php code so it needs to be inside the <? php tags.
// also, the // at the beginning of the line needs to be removed.
//
// Q: how do i make my php slide show appear in it's own popup window?
// A: copy the following lines into the body of a web page
// (minus the leading two comment slashes on each line...)
// 
//<script>
//  function pop(){
//      // change this to point to your PHPSlideshow URL
//    var your_slideshow_url="phpslideshow.php?directory=."
//    // change the width and height of your window here to fit your images.
//    winpops=window.open(your_slideshow_url,'','width=640,height=400,')
//  }
//</script>
//[url="javascript:pop()"]My cool PHPSlideshow[/url]
// 
//
// EXAMPLE pics.txt file
//
// greg.jpg;Me
// dog.png;My dog John
// cat;
// tux.jpg;My friend Tux
//
// NO BLANK LINES either!
// as you can see, not all pics need a description
// point your browser at the script and voilla!

#####  CREDITS  #####
// the following nice folks have contributed code snippets, bug fixes, ideas :)
// patrick, nicolas, otto, wei-min lee, tom, jonathan, jason rust, hai phung
// greg rundlett, laszlo (jabba), mike collard, justin, jadex, bunnyguy
################################################################################
################################################################################

// some formatting options...
$top_row_color "#cccccc";
$image_row_color "#ffffff";
$bottom_row_color "#cccccc";
$page_background_color "#ffffff";
$main_table_border_color "#000000";
$img_border_color "#000000";
$main_table_width "60%";
$home_link "HOME";
$next_alt "weiter";
$back_alt "zurück";
$your_home_url "index.php?site=home";

// set this to true to display the image filename
$show_image_name "false";

// set to true to display navigation icons instead of text...
$show_navigation_buttons "false";
$back_button "back.gif";
$next_button "next.gif";

// automated slideshow options
// set this to true to enable the auto slideshow feature
$auto_slideshow "false";
// $sec is number of seconds between slides...
$sec "2";

// set standalone to false if you are using this script in an existing php doc
// e.g. insert the following line in the page where
// you want phpslideshow to appear
// include("phpslideshow.php");
// dont forget to remove the comment slashes...
$standalone "false";

// file containing optional image descriptions
$pic_info_file="pics.txt";

// name of file containing optional page headings
$heading_info_file "heading.txt";

################################################################################
// grab the variables we want set for newer php version compatability
// the @ supress the error messages if your php.ini error level is too high
@$currentPic $GLOBALS['HTTP_GET_VARS']['currentPic'];
@
$directory $GLOBALS['HTTP_GET_VARS']['directory'];

// check for platform dependent path info... (for windows and mac OSX)
$path = empty($HTTP_SERVER_VARS['PATH_INFO'])?
$HTTP_SERVER_VARS['PHP_SELF']:$HTTP_SERVER_VARS['PATH_INFO'];

// a little security - check that the user did not change the path...
// the path may not contain .. or : (as in c:) or start with / (root dir)

                                     //DIESE ZEILEN HIERDRUNTER

if (preg_match(':(\.\.|^/|\:):'$directory)) {
    print 
"[b]ERROR:[/b] Your request contains an invalid path.
"
;
    print 
"For security purposes, you can only access directories ";
    print 
"within this one.
"
;
    print 
"Your dir path may not contain .. or : or start with a /
"
;
    print 
"
<a href=\"$path\">Try again</a>"
;
    exit;
}

// set directory
if (empty($directory)) $directory "./galerie/pics".$nr;

// if there is no $heading_info_file (see format above) set page heading here
if ( !file_exists("$directory/$heading_info_file")) {
    
$header "PHP Slideshow";
    
$browser_title "$header";
}
else {
    
$heading_info file("$directory/$heading_info_file");
    
$header htmlentities($heading_info[0]);
}

// image / text buttons
if ($show_navigation_buttons == "true") {
    
$back_src "<img src=\"$back_button\" alt=\"$back_alt\" border=\"0\">";
    
$next_src "<img src=\"$next_button\" alt=\"$next_alt\" border=\"0\">";
}
else {
    
$back_src "[b]$back_alt[/b]";
    
$next_src "[b]$next_alt[/b]";
}

    if ( !
file_exists("$directory/$pic_info_file")) {
        
$dh opendir"$directory" );
        while( 
$file readdir$dh ) ) {
// look for these file types....
                
if (eregi("(jpg|jpeg|gif|png)$",$file)) {
                        
$pic_info[] = $file;
              
sort$pic_info );
                }
        }
  }
  else 
$pic_info=file("$directory/$pic_info_file");

// begin messing with the array
$number_pics count ($pic_info);
if (empty(
$currentPic)) $currentPic 0;
if ((
$currentPic $number_pics)||($currentPic == $number_pics))
    
$currentPic '0';
$item explode (";"$pic_info[$currentPic]);
$last $number_pics 1;
$next $currentPic 1;
if (
$currentPic $back $currentPic 1;
else 
$currentPic "0";

    
// print the description if it exists
$blank = empty($item[1])?'':htmlentities($item[1]);
// a hack so that you can include 
 
tags in the comments...
$blank ereg_replace ("&lt;br&gt;""
"
$blank);
$show_name = ($show_image_name=="false")?'':htmlentities($item[0]);

if (
$currentPic $nav=$back;
else 
$nav=$last;
$naven number_format($nav,0);




if (
$naven 10)
$naven "0".$naven;

$code $nr $naven;

include(
"commentanzahl.php");
include(
"votes.php");
// meta refresh stuff for auto slideshow...
if ($auto_slideshow == "true") {
$meta_refresh "<meta http-equiv=\"refresh\" content=\"";
$meta_refresh .= "$sec;url=$path?directory=$directory&currentPic=$next\">";
}
else 
$meta_refresh "\n";

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

// top of html page stuff
// print the page header if in standalone mode
if ($standalone == "false") {
print <<< HERE



<html>
<head>
    $meta_refresh
    <body>

HERE;
}

// draw the main table in html
print <<< HERE

<center>
<table width="$main_table_width" align="center" valign="center"
    border="0" cellspacing="0" cellpadding="1" bgcolor="$main_table_border_color">
 <tr>
  <td>
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="$top_row_color">
     <td align="center" nowrap width="100%" bordercolor="#000000" bgcolor="#000000">


         [url="index.php?site=show$nr&directory=$directory&currentPic=$nav"]$back_src
[/url]
    ( $next von $number_pics )
         [url="index.php?site=show$nr&directory=$directory&currentPic=$next"]$next_src
[/url]
&nbsp
     </td>
    </tr>
   </table>
   <table width="100%" border="0" cellspacing="0" cellpadding="5">
    <tr>
    <td bgcolor="#000000" align="center" bordercolor="#000000">
      <a href="index.php?site=show$nr&directory=$directory&currentPic=$next">
      [img]$directory/$item
[0][/img]
      </a>
    </td>
<tr>
    <td align="center" nowrap width="100%" bgcolor="#000000" bordercolor="#000000">


         [url="index.php?site=show$nr&directory=$directory&currentPic=$nav"]$back_src
[/url]
    ( $next von $number_pics )
         [url="index.php?site=show$nr&directory=$directory&currentPic=$next"]$next_src
[/url]
     </td>

    </tr>
    <tr>
    <td>
    



    <p align="center"><font face="Stencil" style="font-size: 14pt" color="#FFFFFF">Comments</font>


Hier könnt ihr euch zu diesem Bild auslassen!!
</p>

    </td>
    </tr>
    </table>
  </td>
 </tr>
</table>
</center>
HERE;
//$code ist die identnummer für jedes einzelne pic
// print the page footer if in standalone mode
if ($standalone == "true") {
print <<< HERE
<p align="center">[url="index.php?site=pics"]zurück zur Übersicht[/url]</p>
</body>
</html>
HERE;
}
$now $next 1;
$postlink "index.php?site=show$nr&directory=$directory&currentPic=$now";

include(
"voting.php");
include(
"comments.php");
?>
Gruß Eike

// edit by supertramp: tag geändert
 
Sponsor Mitteilung
PHP Code Flüsterer

Registriert seit: 21.08.2005
Beiträge: 4682
PHP-Kenntnisse:
Fortgeschritten

Alt 08.05.2005, 17:07  
Gast
 
Beiträge: n/a
Standard

1. Wo sind die Zeilen 174-180, das zählt hier doch keiner ab.
2. Du solltest nur die wichtigen Zeilen posten.
3. Wer von if-Schleifen redet, sollte doch eher ins Anfänger-Forum posten.

Gruß
phpfan
 
Alt 08.05.2005, 17:30  
Erfahrener Benutzer
 
Registriert seit: 01.12.2003
Beiträge: 4.113
supertramp
Standard

Der Beitrag wurde verschoben, wegen...
... unzureichender Hintergrund-Informationen.
... Postings im falschen Forum.

moved to PHP - Anfänger
__________________
Aufstrebend, kompetent und werbefrei.
www.developers-guide.net
supertramp ist offline  
Alt 08.05.2005, 17:43  
Gast
 
Beiträge: n/a
Standard

1. Die Zeilen sind ungefähr inner Mitte, wo die smilies sind...
2. Wenn man nicht weiß was davon für euch wichtig ist, kann ich halt nur alles posten.
Ich dachte es wäre ein Hilfe-Forum und kein Motz-Forum!
Auch wenn jetzt wahrscheinlich keiner mehr antworten wird, viell hat ja jemand ne idee wie es geht und postet mir diese...

Gruß Eike
 
Alt 08.05.2005, 17:45  
Erfahrener Benutzer
 
Registriert seit: 01.12.2003
Beiträge: 4.113
supertramp
Standard

Zitat:
Zitat von Eike
1. Die Zeilen sind ungefähr inner Mitte, wo die smilies sind...
editiere doch einfach deinen Beitrag oben und deklariere, wo diese Zeile ist.
__________________
Aufstrebend, kompetent und werbefrei.
www.developers-guide.net
supertramp ist offline  
Alt 08.05.2005, 17:56  
Gast
 
Beiträge: n/a
Standard

anders herumgefragt, kann es sein dass ich mit den befehlen opendir und readdir nicht auf andere server zugreifen kann? wenn ja gibt es einen vergleichbaren befehl mit dem ich das könnte?!
 
Alt 08.05.2005, 18:00  
Moderator
 
Benutzerbild von robo47
 
Registriert seit: 03.09.2004
Beiträge: 11.792
PHP-Kenntnisse:
Fortgeschritten
robo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz seinrobo47 kann auf vieles stolz sein
Standard

ja definitiv
aber dazu kann ich nur sagen RTFM!!

www.php.net/opendir

desweiteren das nächste mal bitte
1) vernünftige angabe der fehlermeldungen
2) -> sollte keine kommen mal in der phpinof shcauen ob sie vieleicht deaktiviert sind

mfg
robo47
robo47 ist offline  
Alt 08.05.2005, 18:18  
Erfahrener Benutzer
 
Registriert seit: 01.12.2003
Beiträge: 4.113
supertramp
Standard

und immer schön am Anfang:

error_reporting(E_ALL);
__________________
Aufstrebend, kompetent und werbefrei.
www.developers-guide.net
supertramp ist offline  
 


Themen-Optionen
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
header informationen senden auf einem server läufts auf dem anderen nicht tunnel85 PHP Tipps 2008 17 23.04.2008 20:12
Skript auf einem anderen Server! aha_01 PHP Tipps 2008 3 05.12.2007 09:02
Client IP bei include über anderen Server PHP Tipps 2006 5 14.03.2006 14:55
Grundsatz: includes vom anderen Server PHP-Fortgeschrittene 6 09.03.2006 11:56
Dateiupload auf anderen Server! PHP Tipps 2006 7 28.02.2006 11:20
[Erledigt] PhpMyAdmin Gesicherte Datenbank auf einen anderen Server kop Datenbanken 12 21.11.2005 13:35
include von einem anderen server PHP Tipps 2005-2 7 06.09.2005 13:05
Suche Tipps für Persormance-Steigerung (Geld für Nützliches) Beitragsarchiv 18 16.08.2005 10:57
[Erledigt] Funktionssammlung auf externen Server auslagern PHP Tipps 2005 20 29.05.2005 14:04
Datei auf einen anderen Server laden Borlox PHP Tipps 2005 3 25.04.2005 20:12
[Erledigt] Sessions auf andere Server weiterleiten PHP-Fortgeschrittene 1 18.09.2004 16:17
[Erledigt] Dateien per ftp auf einen anderen server kopieren? PHP Tipps 2004 0 10.09.2004 21:48
[Erledigt] Daten auf anderen Server verschieben Datenbanken 4 01.09.2004 12:17
Fertig: PHP-Script - Server Online/Offline (TCP) Beitragsarchiv 10 29.08.2004 15:45
[Erledigt] Datenbanktabelle jeden Tag von einem Server zum anderen... Datenbanken 13 13.07.2004 01:57

Besucher kamen über folgende Suchanfragen bei Google auf diese Seite
otto slideshow script code, slideshow server, zinkwazi phpslideshow beschreibung deutsch, javascript ajax fixer pfad anderer server, slideshow in der mitte php, \php.ini\ \@$currentpic = $globals[\'http_get_vars\'][\'currentpic\']\

Alle Zeitangaben in WEZ +2. Es ist jetzt 13:23 Uhr.




Powered by vBulletin® Version 3.7.2 (Deutsch)
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
Aprilia-Forum, Aquaristik-Forum, Liebeskummer-Forum, Zierfisch-Forum, Geizkragen-Forum

Creative Commons License
Dieser Inhalt ist unter einer Creative Commons-Lizenz lizenziert.