Jump to content

php4->php5


dzedward

Recommended Posts

I have 3 php files, all of them created for php4.  Well, I've just upgraded to php5, and don't know how to update them.  These files were supplied to me, and the company doesn't plan to update them, so I'm s.o.l.  Can someone please look at them and see if they can tell me either, a) where to begin, or if its easy enough, tell me what to change.  I'll attach them as text files.

 

Thank you in advance to anyone willing.

 

 

[attachment deleted by admin]

Link to comment
Share on other sites

There really isn't allot of difference between php4 and php5 and most differences that there are can be changed via configuration.

 

The only real issues I can see with those small script is $HTTP_GET_VARS needs to be replaced with $_GET in phpbb_login_chat.txt.

Link to comment
Share on other sites

Can you inform me of the changes I should make?  The reason I'm asking is, as you can see from the link I'm about to post, it's giving me sql_escape() errors, if I take that out it gives me utf8_clean_string, if I then take that out, I get sql_query error on the next line.  That leads me to believe there is some sort of major difference :)

 

http://flashgods.kicks-ass.net/forums/phpbb_login_chat.php

Link to comment
Share on other sites

That error refers to this line -

$user->session_begin();

 

It means that the object $user does not exist. If we assume that the class and the instance of $user is defined in one of the include files, that would indicate that the include statement(s) are not working.

 

Start by checking your web server log file for errors to see if they pinpoint what is happening. Also, putting the following two lines in after the first opening <?php tag would help in debugging -

 

ini_set ("display_errors", "1");
error_reporting(E_ALL);

Link to comment
Share on other sites

user is defined in common.php

 

$user = new user();

 

I check the path for the include, and its right.  Also, I don't see anything in the apache error logs about this error.  After inserting the code you gave, I got this

Notice: Undefined variable: user in C:\wamp\www\LiveSupport\client\123flashchat.php on line 34

 

Fatal error: Call to a member function session_begin() on a non-object in C:\wamp\www\LiveSupport\client\123flashchat.php on line 34

 

Should I just instantiate user in that file?

 

Edit: tried instantiating user in that file, got this:

Fatal error: Class 'user' not found in C:\wamp\www\LiveSupport\client\123flashchat.php on line 32

Link to comment
Share on other sites

Since this code worked before, there should be no reason to move code around. My guess is that common.php is being included, but it is doing something that is preventing the object from being created and any errors occurring within it from being reported.

 

Post or attach common.php. If you post it, make sure you include any starting/ending php tags so we can see those as well (if code is using a short open tag <? then the code won't necessarily execute, meaning no error messages generated either.)

Link to comment
Share on other sites

There are two things in that file that could be preventing helpful errors from being reported.

 

Temporarily comment out line 23 - error_reporting(E_ALL ^ E_NOTICE);

 

and line 196 - set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');

Link to comment
Share on other sites

I guess if one file has modified the error reporting, more could have.

 

Is this a phpbb modification that you can provide a link to the author's site so that all the files can be downloaded and examined or is this some custom code?

 

Edit: Nevermind the above question, I found the 123chat web site and downloaded the script.

 

About the only other thing I can suggest is to add the two error reporting lines I posted above (ini_set(...)/error_reporting(...)) in common.php, right before the $user = new user(); statement.

Link to comment
Share on other sites

Actually I found that, but your script looks to be a heavily modified version.

 

Try my suggestion to add the two error reporting lines right before the $user object is created. If that does not provide any information, then it would take finding out why the code is not executing or why errors are not being generated and reported.

Link to comment
Share on other sites

The only thing I've modified is the parameters I had to set to connect to my forum and client.  Also, the phpbb_login_chat.php file only had <? for opening the php so I changed to <?php, and one other thing, change HTTP_GET_VARS to _GET as per thorpe's suggestion, which cleared that file of all errors.  I did what you said, and still, the same error appears...  Its like its not executing the require statement?!??

Link to comment
Share on other sites

The difference in the code is due to phpbb2 and phpbb3 (the 123flashchat file does not indicate which it was for and I downloaded the first link I found which was for the phpbb2 version.)

 

The files in question that might be either modifying the error reporting or conditionally executing the $user = new user(); statement are part of phpbb. This says that phpbb is being prevented from creating the $user object (or it is getting overwritten.)

Link to comment
Share on other sites

The functions_chat.txt (.php) that you attached is not the same version as the other files and it appear to be from the phpbb2 set of files, not the phpbb3 set. While this is probably not directly causing the error, it would play a role.

 

I will continue to look and see if I can see why the $user object is not being created, but please use a consistent set of files.

 

I don't think it is the include path because the error reporting lines should have indicated an error, at least for the first include.

 

You can change the include() statements to require() statement to see if they are failing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.