Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. The Cayo Perico Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

      1. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
    6. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
    7. GTA III

      1. Guides & Strategies
      2. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

      1. GTANet 20th Anniversary
    2. Support

      1. Court House
    3. Suggestions

[PHP]Help with reverse post counter


Chalkstar

Recommended Posts

Not long ago PresKiller got a bit of code for me so that I have a post counter that counts down until 3500 posts (where I will stop using this account and use my new one).

 

This was the code he gave me:

 

<?phpheader("Content-type: image/png");$posts = file_get_contents("http://gtaforums.com/memberBuddy.php?mid=56487&info=posts");if (strncmp($posts,"Error",5)==0)$posts = "gtfo";$font = 3;$im = imagecreate(220,imagefontheight($font)+3);$background_color = imagecolorallocate($im,0,0,0);//imagecolortransparent($im, $background_color);$text_color = imagecolorallocate( $im , 255,255, 255);//int imagestring ( resource image, int font, int x, int y, string s, int col )if(strcmp($posts,"gtfo")!=0)$posts=3500-intval($posts);imagestring($im, $font, 15, 1, "$posts posts 'till retirement...",$text_color);imagepng($im);imagedestroy($im);?>

 

 

It wouldn't work when I tried to host it as it said there were some errors. When I used IE to view them the following came up.:

 

 

Warning: file_get_contents(): URL file-access is disabled in the server configuration in /data/hosted/Chalks/ReverseCount.php on line 4Warning: file_get_contents(http://gtaforums.com/memberBuddy.php?mid=56487&info=posts): failed to open stream: no suitable wrapper could be found in /data/hosted/Chalks/ReverseCount.php on line 4Fatal error: Call to undefined function: imagecreate() in /data/hosted/Chalks/ReverseCount.php on line 8

 

 

 

EDIT: I don't blame him but I thought there might have been an error in the code (such as he gave me a code which he edited by gave me the wrong one etc.) Or perhaps there are other reasons for this.

 

Cheers

Link to post
Share on other sites

The reason you get those errors isn't his fault.

 

I can tell you how to fix the first problem... replace the code with this:

 

 

<?phpheader("Content-type: image/png");$posts = geturl("http://gtaforums.com/memberBuddy.php?mid=56487&info=posts");if (strncmp($posts,"Error",5)==0)$posts = "gtfo";$font = 3;$im = imagecreate(220,imagefontheight($font)+3);$background_color = imagecolorallocate($im,0,0,0);//imagecolortransparent($im, $background_color);$text_color = imagecolorallocate( $im , 255,255, 255);//int imagestring ( resource image, int font, int x, int y, string s, int col )if(strcmp($posts,"gtfo")!=0)$posts=3500-intval($posts);imagestring($im, $font, 15, 1, "$posts posts 'till retirement...",$text_color);imagepng($im);imagedestroy($im);function geturl($url){ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER , 1); $out = curl_exec($ch); curl_close($ch); return $out;}?>

 

 

Try it now. If you still get the error about imagecreate() then there's something wrong with the GD library on your server, and I don't really know what you'd do about that apart from contacting your webhost.

Link to post
Share on other sites

The only error now is with:

 

 

Fatal error: Call to undefined function: curl_init() in /data/hosted/Chalks/PostCount.php on line 21

 

 

 

Link to post
Share on other sites

Typical.

 

Who's your webhost?

 

To show you it isn't the code's problem:

 

user posted image

 

Edit: Feel free to use that if you can't be bothered to get it working on your webhost. I have enough bandwidth to spare.

Edited by segosa
Link to post
Share on other sites

Can I assume that it's safe to delete after you reach 3500 posts? I can keep it for longer if you want, but I don't know if you'll deem it necessary after you reach your goal.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.