PHP & HTML

chougard

In Runtime
Messages
148
Php & Html

Can I insert this html code

<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
var sc_project=1621564;
var sc_invisible=1;
var sc_partition=15;
var sc_security="578f130d";
var sc_remove_link=1;
</script>

<script type="text/javascript" language="javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><img src="http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0" alt="web stats analysis" border="0"> </noscript>
<!-- End of StatCounter Code -->

in a php file that says this?

<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";

redirect($settings['opening_page']);
?>

Thanks!
 
Yes...
Code:
<?php
/*---------------------------------------------------+
| PHP-Fusion 6 Content Management System
+----------------------------------------------------+
| Copyright © 2002 - 2005 Nick Jones
| http://www.php-fusion.co.uk/
+----------------------------------------------------+
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
+----------------------------------------------------*/
require_once "maincore.php";

print "<!-- Start of StatCounter Code -->
<script type=\"text/javascript\" language=\"javascript\">
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security=\"578f130d\"; 
var sc_remove_link=1; 
</script>

<script type=\"text/javascript\" language=\"javascript\" src=\"http://www.statcounter.com/counter/counter.js\"></script><noscript><img src=\"http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\" alt=\"web stats analysis\" border=\"0\"> </noscript>
<!-- End of StatCounter Code -->";

redirect($settings['opening_page']);
?>

But I'm not really sure I get why you would do this since as soon as the page is loaded it redirects to another page.
Code:
redirect($settings['opening_page']);
 
yes..


you use either print "code";

or echo 'code';

but bear in mind that whenever you open a statement with print " <-quote, it ends with another quote

so it you have quote marks in the code they have to be escaped with the escape char \

so this won't work
print "<img src="example.jpg">";

but this will

print "<img src=\"example.jpg\">";
 
I followed your instructions and put this:
Code:
print "<!-- Start of StatCounter Code -->
<script type=\text/javascript\ language=\javascript\>
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security="578f130d\; 
var sc_remove_link=1; 
</script>

<script type=\text/javascript\ language=\javascript\ src=\http://www.statcounter.com/counter/counter.js\></script><noscript><img  src=\http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\ alt=\simple hit counter\ border=\0\> </noscript>
<!-- End of StatCounter Code -->"
in a php file. Now I get an error that says "
Parse error: parse error, unexpected T_LNUMBER in /home/www/runekillerz.awardspace.com/phpBB2/index.php on line 475". When I take out the code, it works just fine but when I put it back in it does not. What did I do wrong? What you gave me in the first reply works fine.



I tried the wrong way of what you wrote here
so this won't work
print "<img src="example.jpg">";

but this will

print "<img src=\"example.jpg\">";
The php file works just fine when I use this method
Code:
print "<img src="example.jpg">";
and not this method
Code:
print "<img src=\"example.jpg\">";
 
The error refers to the fact that the script has found something that it didn't expect, for example if you miss a semi colon from the end of a statement you'll get an error like that, since the script interperetor expects a semi colon, or a boolean opperator to tie some functions together.
alternativly the error could be caused by missing a escape charector before a quote mark, since the script interperator assumes thats the end of the statement, and again expects a semi colon.

print "<!-- Start of StatCounter Code -->
<script type=\text/javascript\ language=\javascript\>
var sc_project=1621564;
var sc_invisible=1;
var sc_partition=15;
var sc_security="578f130d\;
var sc_remove_link=1;
</script>

<script type=\text/javascript\ language=\javascript\ src=\http://www.statcounter.com/counter/counter.js\></script><noscript><img src=\http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\ alt=\simple hit counter\ border=\0\> </noscript>
<!-- End of StatCounter Code -->"

I can tell you that if that's the code, then it's most likely that you've missed the semi colon from the end.

however, I don't quite understand why you've removed all the quote marks, (and left in the escape chars).
 
So this would be right?
Code:
print "<!-- Start of StatCounter Code -->
<script type=\"text/javascript\" language=\"javascript\">
var sc_project=1621564; 
var sc_invisible=1; 
var sc_partition=15; 
var sc_security=\"578f130d\"; 
var sc_remove_link=1; 
</script>

<script type=\"text/javascript\" language=\"javascript\" src=\"http://www.statcounter.com/counter/counter.js\"></script><noscript><img src=\"http://c16.statcounter.com/counter.php?sc_project=1621564&java=0&security=578f130d&invisible=0\" alt=\"web stats analysis\" border=\"0\"> </noscript>
<!-- End of StatCounter Code -->";
 
Back
Top Bottom