[Mod request] alter...
 
Notifications
Clear all

[Mod request] alternative version check

8 Posts
5 Users
0 Reactions
2,890 Views
(@guest1448)
Posts: 0
 

Hi,

because my webhost doesn't allow opening of URL files via php, the eFiction Versionchecker isn't working on my site and produces errors like this:

Warning : fopen() [ function.fopen]: URL file-access is disabled in the server configuration in /home/.../admin/versioncheck.php on line  9 

Is there any other possible way to get version information? My first idea was to get version information with an iframe, but this is a little difficult, because you would have to put the versionchecker into an external php-script and upload it to another server that supports URL file opening. The next thing I would try is Javascript, but I don't know much about this programming language.

Any other ideas how to fix this problem?

Steffen


 
Posted : 20/01/2007 11:31 am
(@becca)
Posts: 553
Honorable Member
 

If your host is dreamhost like mine, I believe there is a dreamhost wiki about this, wiki.dreamhost.com


 
Posted : 20/01/2007 11:54 am
(@carissa)
Posts: 791
Member Moderator
 

The only way to do it is to have it check a file on our site so that we can update the information. I only know how to do that via php, but you could possibly use some other kind of script. I'm guessing that if your host disabled it for php, they might have disabled other ways also.

The best way for you to keep up with updates is to subscribe to the 3.0 News and Updates forum. You'll get an email letting you know when a new version is released. That forum was set up just for that, and only admins can start topics there, so you won't get a lot of junk.


 
Posted : 20/01/2007 12:30 pm
(@guest1448)
Posts: 0
 

OK thanks for your help. @Becca: Yes it's dreamhost, but I had this problem on another server too. I think I'll use the forums updates and turn the versionchecker off.


 
Posted : 21/01/2007 4:58 am
(@carissa)
Posts: 791
Member Moderator
 

This has already been done and added to efiction. The latest version check should work on any host that has either cURL or allow_url_fopen support. If the host has neither, it displays a message telling you it won't work on your server.

Please let me know if it doesn't work for you. I believe it was added in either 3.1.1 or 3.2.


 
Posted : 07/03/2007 2:40 pm
Jan_AQ
(@jan_aq)
Posts: 1300
Noble Member
 

in the meantime, you could always just subscribe to the News forum here.

https://efiction.org/forums/index.php?board=37.0

You'll get an e-mail when a new topic is posted a lot sooner than going to the archive and checking if you are out of date.


Whoever said nothing is impossible never tried slamming a revolving door.

url: https://www.potionsandsnitches.org/fanfiction
php: 7.4.33 msql: 5.6.51-community GPL
efic version: 3.5.5 latest patches: yes
bridges: none mods: challenges, tracker, story end, beta, word

 
Posted : 07/03/2007 4:08 pm
(@carissa)
Posts: 791
Member Moderator
 

There shouldn't be an "in the meantime"... I've already fixed it.


 
Posted : 07/03/2007 6:39 pm
(@jrabbit)
Posts: 64
Trusted Member
 

The following fuction could be used in versioncheck.php to download the version number - it uses CURL if available like the current version check code, but then falls back on using raw sockets calls. It does not attempt to use the URL support in fopen as it is poor security practice to enable that setting.

$host is the name or IP address to download from. $path is the local path on that server begining with '/'.


function http_fetch($host,$path) {

if (function_exists('curl_init')) {

  $ch = curl_init();

  curl_setopt($ch, CURLOPT_URL, " http://$host$path");
  curl_setopt($ch, CURLOPT_HEADER, 0);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  $content = curl_exec($ch);
  curl_close($ch);
  return $content;
}

if (!function_exists("socket_create")) {
return false;
}
$address = gethostbyname($host);
$socket = socket_create(AF_INET, SOCK_STREAM, 0);
if ($socket === false) {
return false;
}

$result = socket_connect($socket, $address, 80);
if ($result === false) {
  return false;
  }

$in = "GET $path HTTP/1.1rn";
$in .= "Host: $hostrn";
$in .= "Connection: Closernrn";
$out = '';

socket_write($socket, $in, strlen($in));
while ($outb = socket_read($socket, 4096)) {
  $out.=$outb;
}

socket_close($socket);

if (substr($out,0,12) != "HTTP/1.1 200") {
return false;
}


return substr($out,strpos($out,"rnrn")+4);
}

 
Posted : 07/03/2007 8:37 pm
Share: