Jump to content

gzfile disabled


NoMansLand

Recommended Posts

Hello,

 

I need something different from gzfile(), as my webhost has decided to disable it, So yeah 29% of my scripts now dont work.. i really want to kick them hard.

 

Here is the code:

 

$lines = gzfile('http://en26.tribalwars.net/map/village.txt.gz');
if(!is_array($lines)) die("File could not be opened"); 
foreach($lines as $line) {
list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
$name = urldecode($name)

 

So i need to open that file, explode it.. blah blah blah, insert it into the database.

 

So i need something new instead of gzfile()

Link to comment
Share on other sites

Thanks Daniel0 your a legend, it now works.

 

But one last question, would cURL be able to replace:

 

$handle = fopen($base_url . "&to=$to&subject=$subject&message=$message$play$user$unplay$important$coords$x$code$y$close$space$info$newcount$space$end$space$ender", 'r');

 

im ready to kick my webhost.

Link to comment
Share on other sites

This is my current code:

 

My Current Error: MySQL server has gone away.

 

so i have re-shuffled it. and i would love some ideas, to fix this error.

 

<?php

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'http://en26.tribalwars.net/map/village.txt');

$fp = fopen('village.txt', 'w');
/**
* Ask cURL to write the contents to a file
*/
curl_setopt($ch, CURLOPT_FILE, $fp);
/**
* Execute the cURL session
*/
curl_exec ($ch);

mysql_connect('localhost','********','***********') or die(mysql_error());
mysql_select_db('**********') or die(mysql_error());

mysql_query("TRUNCATE TABLE village") or die(mysql_error());
$lines = file('village.txt');
if(!is_array($lines)) die("File could not be opened"); 
foreach($lines as $line) {
list($id, $name,$x, $y, $player, $points, $rank) = explode(',', $line);
$name = urldecode($name);

$name = addslashes($name);
mysql_query("INSERT INTO Statement Here");
?>

Link to comment
Share on other sites

<?php
mysql_query("INSERT INTO claim (x,y,name,points,claims,days,claimer) VALUES ('$x','$y','$name','$points','$owner','$claimtime','$claimee')") or die(mysql_error());
echo "<br />";
echo "Congragulations, This Village Is Now Yours<br />";
echo "You Now Have: <strong>" . $claimtime;
echo " </strong>Days To Get it Before Your Claim Expires.";
$to = $claimee;
$subject = urlencode('Village Claiming System: Claimed Village');
$copyright = urlencode('[b]Do Not Reply To This Message, IT IS AUTOMATIC                    [/b]');
$message = urlencode('Thank you for using the [ally]Pure[/ally] Village Claiming System, Remember this is not a reserving System!                ');
$space = urlencode('[code]                                 

');

$coords = urlencode('Co-Ordinates: [village]');

$code = urlencode('|');

$close = urlencode('[/village]');

$bpoints = urlencode('Points: ');

$thankyou= urlencode('Thank you for using the Village Claiming System, Please delete this claim, once you have captured this village.');

$time = urlencode('Days Until Claim Is Deleted: ');

$base_url = "http://en26.tribalwars.net/send_mail.php?from_id=152932&password=dba0079f1cb3a3b56e102dd5e04fa2af";

// go to URL

 

$ch = curl_init();

 

curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou');

curl_exec ($ch);

 

echo "<br />";

?>

[/code]

 

The error im recieving now is: [Mon May 11 07:08:19 2009] [error] [client 58.161.150.45] PHP Parse error:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/austchat/public_html/vcsclaim.php on line 117, referer: http://www.puredomination.org/check_claim.php

 

But i've looked all through the code, and you guys seem to be a bunch of geniuses.. So thanks for your help

Link to comment
Share on other sites

Yes thats VCS Claim,

 

The line is:

 

curl_setop($ch, CURLOPT_URL 'http://en26.tribalwars.net/send_mail.php?from_id=152932&password=My Password Here f&to=$to&subject=$subject&message=$copyright$space$message$space$time$claimtime$space$coords$x$code$y$close$space$bpoints$points$space$thankyou');

Link to comment
Share on other sites

But i cant see any missing '(s)

 

In reply #6 you posted code. In the line that begins "$space = urlencode" there is the word code in square brackets. It looks like you have a quote mark after the end square bracket, but not before the opening bracket. But it could just be the forum screwing up because it thinks you wrote a forum bbcode tag for "code"

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.