Rotator script work fne in cpanel but not working in DirectAdmin

Lotanas

Verified User
Joined
Oct 29, 2012
Messages
8
Hello everyone,

i had this php script hosted in cpanel it's rotating web pages in this exaple ( landingpage1.php and landingpage2.php ) but when i upload the script to my directadmon server i got this :

PHP:
= 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(); ?>

The script
PHP:
<?php
//Tracking202 Landing Page Rotation Script

//landing pages filenames, theses will be rotated between each other
//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] = 'landingpage1.php';
$landingpage[2] = 'landingpage2.php';


//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();
?>

what i have to do to make it work
Thanks
 
What is the exact error logs you getting while accessing this file ?
 
i have no error logs as i told you when i access to the php page i got this :

= 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(); ?>
 
Hello,

It seems PHP support is not enabled for the domain adn/or user. Check it on domain settings page at user level in Directadmin.
 
I could check it for you, send me login details into Directadmin by PM and will do a quick check it for you (free of cost).
 
Back
Top