Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Semi Kolon

Pages: [1]
1
Programming / How to add PHP code?
« on: June 03, 2009, 06:25:58 PM »
Hey i got a problem adding PHP code to my side :(
I want this code:

Code: [Select]
<?php

//
//BACKLINKSELLER WEBSITE-CODE VERSION 1.4
//

//Ihre Domain-ID. (Diese ist standardmaessig richtig eingestellt)
$BACKLINK_SELLER['DOMAIN_ID'] = '908****';

//Ihre Account-ID. (Diese ist standardmaessig richtig eingestellt)
$BACKLINK_SELLER['ACCOUNT_ID'] = '3543****';

//Wenn Sie folgenden Parameter auf TRUE setzen, dann
//werden alle Fehlermeldungen ausgegeben und Sie
//können somit leichter die Fehlerursache feststellen
$BACKLINK_SELLER['DEBUG_FLAG'] = false//true (aktiviert) oder false (deaktiviert)

//Wenn Sie diesen Parameter aktivieren, dann wird von unserem Server
//ein HTML-Code mit einem Beispiel-Textlink zurückgeben
//Somit können Sie die Verbindung mit unserem Server testen,
//auch wenn auf Ihrer Webseite noch keine Textlinks gebucht sind.
//ACHTUNG: BITTE VERGESSEN SIE NICHT, DIESE OPTION 
//NACH DEM TEST WIEDER ZU DEAKTIVIEREN 
$BACKLINK_SELLER['TEST_FLAG'] = false//true (aktiviert) oder false (deaktiviert)

//Benutzerdefinierte HTML-Code, der vor jedem Textlink hinzugefügt wird
//(Diese Einstellung ist optional)
$BACKLINK_SELLER['HTML_BEFORE_BACKLINK'] = '';

//Benutzerdefinierte HTML-Code, der nach jedem Textlink hinzugefügt wird
//(Diese Einstellung ist optional)
$BACKLINK_SELLER['HTML_AFTER_BACKLINK'] = '<br>';

//Hier wird die CSS-Class Bezeichnung definiert, welche
//bei jedem Hyperlink hinzugefügt wird. Zum Beispiel
//<a href='...' class='class_908****'>...</a>
//Wir empfehlen diesen Wert durch einen anderen zu ersetzen.
$BACKLINK_SELLER['HYPERLINK_CLASS'] = 'class_908****';

//URL, die zu der Seite Ihrer Webpräsenz führt (z.B. http://www.example.com/my_page/)
//(Die Defaulteinstellung muss in den meisten Fällen nicht geändert werden)
$requestUri $_SERVER['REQUEST_URI'];
if(
substr($requestUri01) == '/') {$requestUri substr($requestUri1);} //remove leading slash
$requestUri str_replace('http://www.website.de/'''$requestUri); //make sure that request uri is without domain
$BACKLINK_SELLER['PAGE_URL'] = 'http://www.website.de/' $requestUri;

//Mit einem aktivierten Caching wird der zurückgegebene HTML-Code
//in einer Datei für mindestens eine Stunde gespeichert.
//Bitte definieren Sie auch einen gültigen Dateipfad (siehe weiter unten)
//ACHTUNG: WIR EMPFEHLEN DAS CACHING ZU AKTIVIEREN, DA DIES DIE
//ZUGRIFFSZEITEN IHRER WEBSEITE ERHÖHT. AUSSERDEM BESEITIGT DAS AKTIVIERTE
//CACHING EINIGE TIMEOUT-PROBLEME, FALLS UNSER SERVER VORÜBERGEHEND NICHT ZUR VERFÜGUNG STEHT.
$BACKLINK_SELLER['CACHING_ENABLED_FLAG'] = true//true (aktiviert) oder false (deaktiviert)

//Dateipfad zu der Caching-Datei.
//Für jede URL wird eine solche Datei angelegt
//ACHTUNG: DIESE DATEI MUSS SCHREIB- UND LESE-RECHTE BESITZEN.
//SIE KÖNNEN DIESE RECHTE ÜBER DIE CHMOD-EINSTELLUNG SETZEN.
//BITTE KONFIGURIEREN SIE AUCH EINEN UNTERVERZEICHNIS, IN DEM DIESE 
//CACHE-DATEIEN ERSTELLT WERDEN - ANSONSTEN WERDEN DIESE DIREKT IM 
//ROOT-VERZEICHNISS IHRER WEBPRESENZ ERSTELLT.
$BACKLINK_SELLER['CACHED_FILE_PATH'] = $_SERVER['DOCUMENT_ROOT'] . '/bs-908***-' md5($BACKLINK_SELLER['PAGE_URL']) . '.txt';

//IP von dem Benutzer, der auf Ihre Webpräsenz zugreift
$BACKLINK_SELLER['USER_IP'] = $_SERVER['REMOTE_ADDR'];

define("BACKLINK_SELLER"serialize($BACKLINK_SELLER));
class 
BacklinkSeller
{
    var 
$config null;
    function 
retrieveHTML()
    {
        
$this->config unserialize(BACKLINK_SELLER);
        if(
$this->config['CACHING_ENABLED_FLAG']) {return $this->retrieveHTMLWithCaching();}
        return 
$this->retrieveHTMLFromServer();
    }
    function 
retrieveHTMLWithCaching()
    {
        if(
$this->isCachedFileExpired())
        {
            
$response $this->retrieveHTMLFromServer();

            
//if server is down then cache HTML response for max 48 hours
            
if($response == 'UNABLE_TO_CONNECT' && $this->isCachedFileExpired(48))
            {
                
//backlinkseller server is still not available
                //in this case we empty cached file
                
$this->writeHTMLToCachedFile('');
            }
            else
            {
                
//update cached file
                
$this->writeHTMLToCachedFile($response);
            }
        }
        return 
$this->loadHTMLFromCachedFile();
    }
    function 
retrieveHTMLFromServer()
    {
        
//build request
        
$request '/channel.php?domain_id=' $this->config['DOMAIN_ID'] .
                   
'&account_id=' $this->config['ACCOUNT_ID'] .
                   
'&html_before=' urlencode($this->config['HTML_BEFORE_BACKLINK']) .
                   
'&html_after=' urlencode($this->config['HTML_AFTER_BACKLINK']) .
                   
'&page=' urlencode($this->config['PAGE_URL']) .
                   
'&user_ip=' $this->config['USER_IP'];
        if(
$this->config['TEST_FLAG']) {$request .= '&test=1';}
        if(isset(
$this->config['HYPERLINK_CLASS'])) {$request .= '&class=' urlencode($this->config['HYPERLINK_CLASS']);}

        
//try to connect to backlinkseller server
        
@$socket fsockopen('channel.backlinkseller.de'80$errorNumber$errorMessage5);
        if(!
$socket) {return 'UNABLE_TO_CONNECT';}

        
//retrieve response 
        
$response null;
        
stream_set_timeout($socket5);
        
fwrite($socket'GET ' $request " HTTP/1.1\r\nHost: channel.backlinkseller.de\r\n\r\n");
        
$response fread($socket1000000);
        
fclose($socket);
        if(
strpos($response"\r\n\r\n") !== false)
        {
$response trim(substr($responsestrpos($response"\r\n\r\n")));}

        if(!
$this->config['DEBUG_FLAG']) //if debug is disabled
        
{
            
//if response contains any message and not HTML code as expected
            
if(substr($response07) == 'ERROR: ' || substr($response04) == 'OK: ')
            {return 
'';} //do not display this message
        
}
        return 
$response;
    }
    function 
writeHTMLToCachedFile($html)
    {
        
$handle fopen($this->config['CACHED_FILE_PATH'], 'w');
        
flock($handleLOCK_EX);
        
fwrite($handle$html);
        
flock($handleLOCK_UN);
        
fclose($handle);
    }
    function 
loadHTMLFromCachedFile()
    {
        if(
file_exists($this->config['CACHED_FILE_PATH']))
        {return 
file_get_contents($this->config['CACHED_FILE_PATH']);}
        return 
'';
    }
    function 
isCachedFileExpired($hoursToLive 1)
    {
        if(!
file_exists($this->config['CACHED_FILE_PATH'])) {return true;}
        if(
filemtime($this->config['CACHED_FILE_PATH']) < time() - (60 60 $hoursToLive)){return true;}
        return 
false;
    }
}

//output backlinkseller html with backlinks
$backlinkseller = new BacklinkSeller();
echo(
$backlinkseller->retrieveHTML());

?>



I want the result of this code "Textlink" to appear on my index.php side in the template from "random_image"...
this is the output $backlinkseller = new BacklinkSeller();
echo($backlinkseller->retrieveHTML()); needed

I hope anyone is able to help me, i tried for hours...

2
Mods & Plugins (Requests & Discussions) / SMF and PMs
« on: February 13, 2009, 05:34:56 PM »
English:
Hey, i always had a special mod providing a pm service on my page.
but now i integraded SMF in my 4images gallery and i would like to find out if there is a way to get the SMF PMs work on the gallery site.
I would like to have a link on my userlogin_info.html that shows: "Messages (x New)" everything that needs to be done, is that the x shows the number of new messages(PMs) i currently have in SMF and when i click on it i should be transfered to that page.

---------------------------------------------------------------------------------------------------------------------------------------------------------------
Deutsch:
Hi, ich hatte immer eine mod für meine PMs installiert, aber nun habe ich SMF in der Gallerie laufen und würde gerne die PMs von dort verwenden.
Ich hätte gerne einen Link der in der userlogin_info.html ist und folgendes anzeigt: "Messages (x New)" alles was passieren sollte ist das, dass x durch die nummer der neuen Pms in SMF ersetzt wird und ich durch einen klick darauf dorthin geleitet werde.
Ist soetwas leicht umzusetzen?

Liebe Grüße  :)

3
Discussion & Troubleshooting / Warning: mysql_num_rows()
« on: February 07, 2009, 03:53:31 PM »
Hey,
i'm fighting an error for almost an hour but i can't find out what is wrong.

the "warning" is:
Code: [Select]
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/www/***/html/***/4images/includes/functions.php on line 527
installed mods are: SMF bridge and Ajaxs Starrating
(same order)
all happened after i installed the starrating.
i tried to "//" (comment out) the line and i thought it works problem is then i get different errors on search page because he doesn't find the voted variable anymore.

i hope anyone can help me :)

i found similiar problems in the search here but nothing worked...

4
Deutsch:
Hi,
ich habe ein Problem.
Ich habe versucht mein SMF in meine Gallery einzubinden als iframe.
Allerdings kann ich die höhe (height) des iframes nicht verändern.
http://doodling.de/index.php?template=forums wer sich das ganze einmal angucken möchte.
Folgende "Mod" habe ich für das ganze verwendet: http://www.4homepages.de/forum/index.php?topic=22672.0
Ich hoffe jemand hat einen Einfall und kann mir damit helfen.

English:
Hi,
i'm trying to include my SMF via an iframe into my gallery.
the problem is, i cannot change the height of that iframe i already tried a lot...
if you wanna take a look at it http://doodling.de/index.php?template=forums
i used a mod for "smf integration" from this forum. link http://www.4homepages.de/forum/index.php?topic=22672.0
hopefully someone has a good idea i really need ur help :)



// edit

okay die größe kann ich nun einstellen allerdings hätte ich das sehr gerne dynamisch das sich das iframe an den inhalt des iframes anpasst also nicht immer automatisch 1300px hat.


okay it works now but i still have trouble getting it dynamic... now the iframe is always 1300px but i want it the size of the content of that iframe any ideas?

Pages: [1]