Author |
Message |
HAMM3R
New Member


Joined: Jun 14, 2006
Posts: 22
Location: New Mexico, USA
|
Posted:
Fri Dec 21, 2007 7:09 pm |
|
I have a php script that uses fsockopen to retrieve stats from a game server. I have this script in a separate php file and It works perfect. However, when I integrate the code into a phpnuke module, the socket doesn't open and I get an error. Below is the socket code and the error. Any ideas?
Code: if (!isset($ip))
$ip = '123.123.123.123';
if (!isset($port))
$port = 7776;
$fp = fsockopen('udp://' . $ip, $port, $errno, $errstr);
if (!$fp)
{
echo "<tr><td bgcolor=\"#2B5486\">Socket Error: $errno - $errstr</td></tr>\n";
}
else
{
|
Quote: | Socket Error: 137599788 - |
HAMM3R |
|
|
|
 |
Gremmie
Former Moderator in Good Standing

Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Fri Dec 21, 2007 9:06 pm |
|
There is nothing unique to nuke that would prevent fsockopen() from failing. However, some hosts don't allow fsockopen() calls. Does the separate php file work on the same server where the module is failing? |
_________________ Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module |
|
|
 |
HAMM3R

|
Posted:
Fri Dec 21, 2007 9:40 pm |
|
Yes, it is locacted at /novserver.php and nuke is at root (/)
Same server, same domain, only difference is that it's run through nuke. Very odd indeed. |
|
|
|
 |
montego
Site Admin

Joined: Aug 29, 2004
Posts: 9457
Location: Arizona
|
Posted:
Fri Dec 21, 2007 10:30 pm |
|
Maybe there is a variable name collision. Give these variables a very unique name and see if that changes anything. |
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
HAMM3R

|
Posted:
Fri Dec 21, 2007 10:35 pm |
|
YES! Excellent idea, I added a prefix to all the variables and it worked like a charm.
Thanks so much! |
|
|
|
 |
Gremmie

|
Posted:
Fri Dec 21, 2007 10:35 pm |
|
That's a very bizarre error number. |
|
|
|
 |
Gremmie

|
Posted:
Fri Dec 21, 2007 10:36 pm |
|
Good one montego. $ip or $port must have already been used for something? |
|
|
|
 |
montego

|
Posted:
Sat Dec 22, 2007 8:35 am |
|
Yeah, I had a feeling that it was $ip. Glad this worked! |
|
|
|
 |
HAMM3R

|
Posted:
Sat Dec 22, 2007 9:56 pm |
|
Got a problem regarding this module that maybe you can help with. I have made a subdirectory inside the modules folder, called "sampmonitor". I have my index.php in there that has the code in it. The module works perfect for myself as an admin. I activated the module in the admin panel, but 10 minutes later it was deactivated again.
This is an exact copy of index.php: http://novclan.com/modules/sampmonitor/index.phps
Every time I activate this module, it's only a few minutes later when all of a sudden, without myself doing anything, it becomes deactivated again. I don't have any problems with any other modules.
Any ideas what may be causing this?
Thanks! |
|
|
|
 |
Gremmie

|
Posted:
Sat Dec 22, 2007 10:09 pm |
|
So when you try to execute it, Nuke reports "Sorry, this module isn't activated" or something like that? |
|
|
|
 |
HAMM3R

|
Posted:
Sat Dec 22, 2007 10:11 pm |
|
Exactly. As an admin, I can always view it, however everyone else encounters that error you described. |
|
|
|
 |
Gremmie

|
Posted:
Sat Dec 22, 2007 11:14 pm |
|
And you have it set for registered users? |
|
|
|
 |
HAMM3R

|
Posted:
Sat Dec 22, 2007 11:22 pm |
|
It is set for All Visitors. After I activate the module it will work fine for everyone. Then a few minutes later it is deactivated again and only admins can view it. |
|
|
|
 |
montego

|
Posted:
Sun Dec 23, 2007 7:18 am |
|
Was an extension of ".phps" just a typo above? If not, why is it not ".php"? doubt that is it, but since I've never experienced this issue, we need to rule out what we can... |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 10:49 am |
|
I made a copy of index.php and renamed it to .phps so that you could see the php source code and the server wouldn't attempt to run the code. The index.php file is still there. |
|
|
|
 |
Gremmie

|
Posted:
Sun Dec 23, 2007 12:03 pm |
|
The actual module code seems fine, it would more likely be something in your modules.php file. What version of Nuke? Is it patched? |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 12:18 pm |
|
|
|
 |
Gremmie

|
Posted:
Sun Dec 23, 2007 1:36 pm |
|
Never heard this one before. So activate it, then log completely out of admin. And get everyone else who might be admin to log out. After say 30 minutes is it still active? The only code that I know of to deactivate a module is in an admin function. |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 2:37 pm |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 2:43 pm |
|
And now... "Sorry, this Module isn't active!"
:S
Edit: Checked the nuke_modules table in phpMyAdmin and found that the module is NOT listed in the table. So it seems that the module is not being deactivated ("active" field being set to 0) but in fact it is disappearing from the mysql table completely. |
|
|
|
 |
Gremmie

|
Posted:
Sun Dec 23, 2007 3:21 pm |
|
This happens when RavenNuke thinks that the module has been removed. It does this by checking to see if the directory exists under modules. Perhaps Nuke can't read the directory name due to a permissions problem. What are the permissions on your sampmonitor directory? |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 4:14 pm |
|
The permissions on the sampmonitor directory are the same as all the rest of the modules, 755 (recursive, includes index.php file). |
|
|
|
 |
Gremmie

|
Posted:
Sun Dec 23, 2007 5:01 pm |
|
Please post the structure of your modules table. |
|
|
|
 |
Gremmie

|
Posted:
Sun Dec 23, 2007 5:03 pm |
|
And do you still have the modules/Groups directory? |
|
|
|
 |
HAMM3R

|
Posted:
Sun Dec 23, 2007 5:41 pm |
|
Here is the table now:
Now I go into admin.php -> Modules -> Activate "sampmonitor"
And the table now looks like this:
Then a few seconds/minutes later, it's back to looking like the first image.
I'm so confused!
Edit: Yes I have a modules/Groups folder. |
|
|
|
 |
|