Retarded LP Rotator Question

Spliffic

Loves Cron Jobs
Apr 5, 2008
1,214
27
0
VanCity
Hey Gurus, I'm trying to implement Prosper's LP rotator script.

I get the following error (Line 35 btw is the include_once command). Do you know what config changes I need to do to enable "URL file-access"?


Warning: include_once() [function.include-once]: URL file-access is disabled in the server configuration in /home/yo/public_html/index.php on line 35

PHP:
<?

//Tracking202 Landing Page Rotation Script

//landing pages filenames, theses will be rotated between eachother
//theses landing pages must be in the same DIRECTORY as this file
//you can add as many landing pages here as you like
$landingpage[1] = 'http://example.com/LP1';
$landingpage[2] = 'http://example.com/LP2';
$landingpage[3] = 'http://example.com/LP3';

//this is the text file, which will be stored in the same directory as this file, 
//count.txt needs to be CHMOD to 777, full privlledges, to read and write to it.
$myFile = "count.txt";

//open the txt file
$fh = @fopen($myFile, 'r');
$lpNumber = @fread($fh, 5);
@fclose($fh);

//see which landing page is next in line to be shown.
if ($lpNumber >= count($landingpage)) {
    $lpNumber = 1;
} else {
    $lpNumber = $lpNumber + 1;
}

//write to the txt file.
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $lpNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);

//include the landing page
include_once($landingpage[$lpNumber]); 

//terminate script
die();

?>

Sorry for the retarded question guys, but hope you can hook me up with your knowledge bombs. Thanks!
 


Thanks crackpot. Let's say I use an internal directory (LP1 is a directory within the root of the domain), I get the following errors:

$landingpage[1] = '/LP1';

I now get the error:
Warning: include_once(/start) [function.include-once]: failed to open stream: No such file or directory in /home/yo/public_html/index.php on line 35

Warning: include_once() [function.include]: Failed opening '/LP1' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/yo/public_html/index.php on line 35

Am I not able to assign $landingpage[1] another directory name?
 
No I'm still getting the same errors in post #3.

$landingpage[1] = '/home';
$landingpage[1] = '/start';

Spits everything out. Am I not able to assign different directories with this script??
 
Thanks crackpot. Let's say I use an internal directory (LP1 is a directory within the root of the domain), I get the following errors:

$landingpage[1] = '/LP1';

I now get the error:
Warning: include_once(/start) [function.include-once]: failed to open stream: No such file or directory in /home/yo/public_html/index.php on line 35

Warning: include_once() [function.include]: Failed opening '/LP1' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/yo/public_html/index.php on line 35

Am I not able to assign $landingpage[1] another directory name?

Try

$landingpage[1] = '/home/yo/public_html/LP1';

You need the full path. By using / it's telling PHP to look at the / not your webroot directory.
 
I just tested and could only get it to work with files in the same directory as the rotator script. I was not able to do directories either.
 
Ok so I setup the script here's one that works.

The directories have to be as such

webroot/rotate.php
webroot/LP1
webroot/LP1/index.html



PHP:
<?

//Tracking202 Landing Page Rotation Script 

//landing pages filenames, theses will be rotated between eachother 
//theses landing pages must be in the same DIRECTORY as this file 
//you can add as many landing pages here as you like 
$landingpage[1] = 'LP1/index.html';  // change to .php or whatever

//this is the text file, which will be stored in the same directory as this file,  
//count.txt needs to be CHMOD to 777, full privlledges, to read and write to it. 
$myFile = "count.txt";

//open the txt file 
$fh = @fopen($myFile, 'r');
$lpNumber = @fread($fh, 5);
@fclose($fh);

//see which landing page is next in line to be shown. 
if ($lpNumber >= count($landingpage)) {
    $lpNumber = 1;
} else {
    $lpNumber = $lpNumber + 1;
}

//write to the txt file. 
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = $lpNumber . "\n";
fwrite($fh, $stringData);
fclose($fh);

//include the landing page 
include_once($landingpage[$lpNumber]);

//terminate script 
die();
 
Ok so I setup the script here's one that works.

The directories have to be as such

webroot/rotate.php
webroot/LP1
webroot/LP1/index.html

PHP:

Thanks crackpot, u da man! +rep

Do you know if I'm able to append the prosper variables within this assignment? e.g.
PHP:
$landingpage[1] = 'LP1/index.html/?t202id='.$_GET['t202id'].'&t202kw='.$_GET['t202kw'];

I thought I could simply do this but it's crashing. Thanks for your time dude, really appreciate it.
 
No you can't. Not with our calling it as a url =(.

However, if you're calling something in the other one that's hitting a url you could set those as values then append them to the url that's getting hit in the index.html
 
Ahhh shit I knew it was too good to be true!

Anyways thanks for the help though bro, much appreciated.
 
Are those get variables use to pop a pixel that's in index.html?

like <img src="http://someplace/img?a=1" /> ?

if it is then you can use them inside of the other index file.