Jump to content

Function call problem


bilabong007

Recommended Posts

Hi,

 

I taught myself php about 2 weeks ago and i have been struggling to install my first script successfully.  I have battled throught many problems and got it functioning well, but then i noticed what is a pretty fatal error.

 

The script is a directory script (Duncan Carvers - Link Manager Assistant), a bit like phpMydirectory, but free.  The support for the script isnt that good at all and i have been searching for thos who now more about Php than I.  I hope someone can point me in the right direction.

 

The link checking routine is on the admin file and is called from the directory index if it hasnt ran in X amount of time.  I have proven that the function runs fine (by putting it on a seperate page and running it).  So i think the problem is with my host/the function call/both.

 

The host (4uhosting.co.uk) runs PHP 5.22, MySQL 5.027 on Apache 1.337 and Linux. They dont let me run php(info) and seem to restrict a lot of things. I have had problems with eg A GD Lib version check and Captcha.

 

The function call bit of the directory script is:

$fp = fsockopen($_SERVER['SERVER_NAME'], 80);
	fputs($fp,"GET ".str_replace($basedir, "", $_SERVER['SCRIPT_NAME'])."admin.php?user=$username&pass=$password&action=linkcheck HTTP/1.1\r\nAccept: */*\r\nAccept-Language: es-mx\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows 98)\r\nHost: ".$_SERVER['SERVER_NAME']."\r\nConnection: Close\r\n\r\n");
	fclose($fp);

 

It doesnt allow the admin page to run with the varialbes its passed.

 

Any help advice or thoughts would be much appreciated.

 

Graeme

 

Link to comment
Share on other sites

Hi,

 

Im not getting any errors.

 

Thats the most annoying part as it would give me something to go on.  It took me a while to figure out that the script wasnt running the function.  Basically, you can tell if its ran unless i put up a fake link and try and get the script to remove it.

 

Is there any other way you can think of setting up the call to admin from the directory and passing it the variables (without interfering with the user).  I would hate to have to put the link checking routine on the directory index page (although it works, it laggs the page a lot when it runs the check).

 

I will look into the wrappers disabled idea and see what it throws up.

 

Many Thanks for you thoughts and help.

 

Graeme

Link to comment
Share on other sites

Hi,

 

Thanks for your help so far, i think im on the right track now trying to get this function to work properly.

 

My host says that "allow_url_fopen = On" Is that the same as url wrappers?

 

Sorry if that sounds incredibly stupid, but im only 2 weeks into my php voyage and really dont get the jargon yet.

 

I wrote another function call with different syntax (it just seemed easier to undertand than the way the code was written before).  It doesnt work either, but i thought i would post it; just in case one of the many experts in here could spot an obvious mistake.

 

$gjtserver = $_SERVER['SERVER_NAME'];
$gjtport = 80;
$gjturl = "/resources/admin.php?user=$username&pass=$password&action=linkcheck";
$gjtuser_agent = "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98)";
$gjtheaders = "GET $gjturl HTTP/1.1\r\nAccept: */*\r\nAccept-Language: en-au\r\nUser-Agent: $gjtuser_agent\r\nHost: $gjtserver\r\nCookie: {$gjtcookie}\r\nCache-Control: no-cache\r\nConnection: close\r\n\r\n";
$fp = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (!socket_connect($fp, $gjtserver, $gjtport))
{
	socket_close($fp);
}
socket_set_option($fp, SOL_SOCKET, SO_KEEPALIVE, TRUE);
socket_send($fp, $gjtheaders, strlen($gjtheaders), 0);
socket_close($fp);

 

If anyone has any pointers at all on either bits of code.... or a way to get this fucntion to work properly... i will have your children.

 

Many Thanks

 

Graeme

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.