php help needed

Associate
Joined
24 Sep 2006
Posts
1,267
Hi,
I maintain a little website, including the gaming script vWar. My service provider upgraded its PHP however and now my vWar is not working :(

All pages display the error:
Fatal error: Cannot redeclare lcfirst() in /home/user/public_html/website/vwar/includes/functions_common.php on line 534

Can anyone help me fix this? I have no knowledge of PHP myself.

Thanks
 
Thanks for the help. I tried to apply the fix
Code:
<?php
if ( false === function_exists('lcfirst') ):
    function lcfirst( $str )
    { return (string)(strtolower(substr($str,0,1)).substr($str,1));}
endif;
?>

This had some success - the main page now loads but the following errors appear:
Code:
Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/user/public_html/website/vwar/includes/functions_common.php on line 94

Deprecated: Function eregi() is deprecated in /home/user/public_html/website/vwar/includes/_config.inc.php on line 2

Deprecated: Function eregi() is deprecated in /home/user/public_html/website/vwar/includes/_config.inc.php on line 2

In addition, the admin page is not loading, the following errors appear:
Code:
Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/user/public_html/website/vwar/includes/functions_common.php on line 94

Deprecated: Function eregi() is deprecated in /home/user/public_html/website/vwar/includes/_config.inc.php on line 2

Deprecated: Function eregi() is deprecated in /home/user/public_html/website/vwar/includes/_config.inc.php on line 2

Virtual War v1.5.0 Administrator Control Panel


Deprecated: Function split() is deprecated in home/user/public_html/website/vwar/includes/functions_admin.php on line 935
 
As of PHP 5.3 all of those functions have been deprecated. meaning some of the code will need to be rewritten.

for instance, set_magic_quotes_runtime() should be replaced with ini_set('magic_quotes_runtime', 0); and eregi() could be replaced with stristr() for a simple search, However -- if you do not really know what you are doing here It might be a good idea to contact the person who wrote it.
 
Thanks all, I managed to fix all the errors - or so I thought.
I now am getting the following:
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/website/vwar/admin/admin.php:210) in /home/user/public_html/website/vwar/admin/admin.php on line 335
This seems a more complicated problem than the above ones, so I was hoping someone could help.
The line of code in question is:
Code:
if ($GPC['action'] == "addwar")

Thanks for any help!
 
Thanks all, I managed to fix all the errors - or so I thought.
I now am getting the following:
Code:
Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/website/vwar/admin/admin.php:210) in /home/user/public_html/website/vwar/admin/admin.php on line 335
This seems a more complicated problem than the above ones, so I was hoping someone could help.
The line of code in question is:
Code:
if ($GPC['action'] == "addwar")

Thanks for any help!

Sounds like a secondary include/require is trying to change the header (i.e. re-direct the page), but it's already been redirected.

Search for the "header" redirects in your code.
 
Hey guys, thanks for the replies. Sadly I think you over estimate my PHP knowledge :p . It's not my code, I was only able to fix the other errors because they were very simple (changing "split" to "explode" for example).
I uploaded the page in question (to my space) perhaps someone can give it a quick look, if it's an easy fix.link
Thanks if you can! :)
 
I've had a quick look.

Line 210 is blank which is odd, are you _positive_ this is the file that is being executed? Could there be a cached version or something?

I would have expected to at least seen some code on line 210!
 
I will try to take another look at some point but at the moment nothing is making sense - neither line corresponds to something that would cause that error.

Maybe someone else has a clearer idea.
 
Thanks for all the help :) I re-downloaded the original script and line 210 does have content:
Code:
	list ($hour, $minute) = split("[:]", $wartime);
I am unsure why my version on the webspace does not. I may have changed the "split" but I would not have deleted it entirely :confused:
I replaced my hosted version with this one and now see the following:
Code:
Deprecated: Function split() is deprecated in /home/user/public_html/website/vwar/admin/admin.php on line 210

Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/website/vwar/admin/admin.php:210) in /home/user/public_html/website/vwar/admin/admin.php on line 335

The first error I think I can fix (replacing split with explode?) the second one I have no idea what to do with. The line it references contains:
Code:
		header("Location: admin.php?action=warlist");

Thanks again :)
 
Thanks for all the help :) I re-downloaded the original script and line 210 does have content:
Code:
	list ($hour, $minute) = split("[:]", $wartime);
I am unsure why my version on the webspace does not. I may have changed the "split" but I would not have deleted it entirely :confused:
I replaced my hosted version with this one and now see the following:
Code:
Deprecated: Function split() is deprecated in /home/user/public_html/website/vwar/admin/admin.php on line 210

Warning: Cannot modify header information - headers already sent by (output started at /home/user/public_html/website/vwar/admin/admin.php:210) in /home/user/public_html/website/vwar/admin/admin.php on line 335

The first error I think I can fix (replacing split with explode?) the second one I have no idea what to do with. The line it references contains:
Code:
		header("Location: admin.php?action=warlist");

Thanks again :)

I think the second error will go away once you fix split. It is telling you that content has been outputted - but i think the content it is referring to is the split error... Fix that one first and report back.

edit: yes, use explode instead of split.
 
Hi OP. Just wondering if it would be possible for you to perhaps let me have the fixed files?
My host has updated php and our team site no longer works (i have no knoledge of php :()
It would be greatly appreciated,
 
Back
Top Bottom