Random Splash Scripts
Moderator: General Moderators
i tried another webserver and i get this new error
Parse error: parse error, unexpected T_GLOBAL in /home3/loyalty/public_html/splash.php on line 8
my new line 8 is:
global $img_array;
following lines is:
$img_array[1] = "splashes/1/index.php";
$img_array[2] = "splashes/2/index.php";
$img_array[3] = "splashes/3/index.php";
global $random;
// if $random hasn't been defined by a prior call to this function
if (!isset($random)) {
// initialize the random-generator (obsolete for php 4.2+
srand ((double) microtime() * 1000000);
// get a random number that can be used as index for img_array
$random = rand(1, count($img_array));
Parse error: parse error, unexpected T_GLOBAL in /home3/loyalty/public_html/splash.php on line 8
my new line 8 is:
global $img_array;
following lines is:
$img_array[1] = "splashes/1/index.php";
$img_array[2] = "splashes/2/index.php";
$img_array[3] = "splashes/3/index.php";
global $random;
// if $random hasn't been defined by a prior call to this function
if (!isset($random)) {
// initialize the random-generator (obsolete for php 4.2+
srand ((double) microtime() * 1000000);
// get a random number that can be used as index for img_array
$random = rand(1, count($img_array));
but a simpler script works?for example?
what version do you use on what OS? phpinfo() will tell you.
Code: Select all
<?php phpinfo() ?>what version do you use on what OS? phpinfo() will tell you.
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK
yes this worksvolka wrote:but a simpler script works?for example?Code: Select all
<?php phpinfo() ?>
what version do you use on what OS? phpinfo() will tell you.
line 1-8twigletmac wrote:What are the lines before the line on which the error is reported (1-7).
<?php
/**
creates an array img_array in global scope containing
the paths to all available splash-documents
returns a random doc-path once a request (if called again within the same request returns the same doc)
*/
function random_background() {
global $img_array;
it seems tat nothing was wrong...........
i can't get it running why?
i just add some comments
what version do you use on what OS? phpinfo() will tell you.
does this work?
Code: Select all
<?php
/**
dummy comment
dummy function
*/
function dummy() {
echo 'test';
}
dummy();
?>i am trying it on 2 webhost,volka wrote:what version do you use on what OS? phpinfo()
spaceports and tripod
tripod is using php 4.1
spaceport's php version is 4.2.2
both doesnot work........
does it means that the features only support version 4.3 and above?
this is from spaceports' error (version 4.2.2)
Parse error: parse error, unexpected T_ECHO in /home3/loyalty/public_html/dummy.php on line 7
i downloaded php 4.3.1 and bad blue on my computer to try it
but it is still the same:
Parse error: parse error, unexpected T_STRING in D:\Program Files\BadBlue\PE\php\splash.php on line 2
line 1 and line 2 is:
<?php
function random_background() {
according to site admin, if i get a parse error means the above line got errors in it....
but
wat is the error in <?php
but it is still the same:
Parse error: parse error, unexpected T_STRING in D:\Program Files\BadBlue\PE\php\splash.php on line 2
line 1 and line 2 is:
<?php
function random_background() {
according to site admin, if i get a parse error means the above line got errors in it....
but
wat is the error in <?php