We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Parse error; In PHP script
Topic Started: Oct 1 2005, 02:21 PM (462 Views)
SSS
Member
[ *  *  *  * ]
Hi,

I am working on a Button Generator (generates code for affiliates on your website), and it requests the footer from another PHP file on the server called "Footer.php". I'm having a problem. It gives me this error on the footer of the script:

Parse error: parse error, unexpected T_STRING, expecting ',' or ';' in /home/blahblahblah/public_html/sss/scripts/Footer.php on line 13

This is line 13 of Footer.php:


Code:
 
?><? $version = "v2.0.0 Build 100105 (BETA)"; echo ,'<div align='center' class='copyright'>Button Generator &copy; '.$version.' <br />[ Script Execution time: '.$totaltime.' secs ]</div>'?><br />


The "?>" part is the closing of another script in that PHP file.

I'm not really good at PHP, so I don't know what's wrong with line 13. :(

Anyone know what's wrong with it?
Offline Profile Quote Post Goto Top
 
Cool Dude 2k
Member Avatar
<?php echo "Linux"; ?>
[ *  * ]
Try out this. :)
Code:
 
?><? $version = "v2.0.0 Build 100105 (BETA)"; echo '<div align=\'center\' class=\'copyright\'>Button Generator &copy; '.$version.' <br />[ Script Execution time: '.$totaltime.' secs ]</div>'; ?><br />
Offline Profile Quote Post Goto Top
 
SSS
Member
[ *  *  *  * ]
Cool Dude 2k
October 1, 2005 01:30 PM
Try out this. :)
Code:
 
?><? $version = "v2.0.0 Build 100105 (BETA)"; echo '<div align=\'center\' class=\'copyright\'>Button Generator &copy; '.$version.' <br />[ Script Execution time: '.$totaltime.' secs ]</div>'; ?><br />

Thanks, that worked, but I have another problem. It reports the execution time as this:

[ Script Execution time: 3E-05 secs ]

instead of the correct one. How can I fix that?

Nevermind, I just removed the Execution time all together. It's not really useful for this script, as it doesn't really do much to make a high creation time. ;)
Offline Profile Quote Post Goto Top
 
Jeremy
Member Avatar
Member
[ *  *  *  *  *  * ]
The execution time it was generating was so low that it put it out in exponential value. 3e-05 (i.e. 3 x 10 ^ -5).

Edit:

To make it show the appropriate value, you can use sprintf(). This may produce trailing zeros, though.

Code:
 
$test = 3 * pow(10, -5); // 3E-05

echo preg_replace( "/0+$/", "", sprintf( "%f", $test ) ); // Kill trailing 0's.
Offline Profile Quote Post Goto Top
 
SSS
Member
[ *  *  *  * ]
How would I go about creating a script that will check if the version of the button generator is the latest?

Let's say if the latest version build is 100105. To use the version check, I would append ?v=100105 at the end of the checker URL and it would come up with this image since the version is the latest:

Posted Image

If the version input was lower than that number (i.e. ?v=697) I would want it to come up with this image:

Posted Image

How would I go about this? :unsure:
Offline Profile Quote Post Goto Top
 
Cool Dude 2k
Member Avatar
<?php echo "Linux"; ?>
[ *  * ]
Code:
 
<?php
if ($_GET['v']=="100105") {
header('Location: http://www.richardspage.co.uk/sss/scripts/versioncheck/uptodate.PNG'); }
else {
header('Location: http://www.richardspage.co.uk/sss/scripts/versioncheck/updateavail.PNG'); }
?>

Heres what I used. :)
http://df2k.5gigs.com/version/Pic.html
Offline Profile Quote Post Goto Top
 
SSS
Member
[ *  *  *  * ]
Cool Dude 2k
October 3, 2005 06:22 PM
Code:
 
<?php
if ($_GET['v']=="100105") {
header('Location: http://www.richardspage.co.uk/sss/scripts/versioncheck/uptodate.PNG'); }
else {
header('Location: http://www.richardspage.co.uk/sss/scripts/versioncheck/updateavail.PNG'); }
?>

Heres what I used. :)
http://df2k.5gigs.com/version/Pic.html

Thanks, that worked! :D
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Technology Chat · Next Topic »
Add Reply