+ Reply to Thread
Results 1 to 8 of 8

Thread: Need PHP help with this script

  1. #1
    shanes's Avatar
    shanes is offline x10Hosting Member shanes is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    35

    Need PHP help with this script

    Well i'm trying to make a dynamic signature image which uses GD libary and for part of it I want there to be a dynamic image which changes if i'm online or not on a site , here's the segment of the script that checks:
    PHP Code:
    $check file_get_contents("http://habbo.$hotel/home/$habbo);
    function check()
     {
       if (eregi('<h2 class="
    title">Page not found!', $check))
       {
         return == true;   
       }
        else
       {
         return == false;
       }
     }
    $im = imagecreatefromgif("back.gif");
    if check() return true
    {
      
    $in = imagecreatefromgif("exist.gif");  
    }
    else
    {
      
    $in = imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=&direction=3&head_direction=3&size=l&img_format=gif");

    I keep getting several different errors such as unexpected T_String or expecting a < etc even though it seems fine , Someone fix it for me please
    Last edited by shanes; 01-18-2008 at 10:48 AM.


  2. #2
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: Need PHP help with this script

    Your first line is FUBAR.

    Code:
    $check = file_get_contents("http://habbo.$hotel/home/$habbo);


    Needs the " at the end (it's actually buggering this post too cause of it; make it this:

    Code:
    $check = file_get_contents("http://habbo.$hotel/home/$habbo");


    And see what happens.



    Edit: Heh, apparently x10's posting thing didn't like me copy/pasting colors XD
    Last edited by Livewire; 01-18-2008 at 12:10 PM.


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  3. #3
    mattura's Avatar
    mattura is offline x10 Elder mattura is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    563

    Re: Need PHP help with this script

    where it says "unexpected T_STRING" or whatever, check the line number.
    It usually means the lexer can't pair up the " or ' or {} ... or you missed a semi colon
    ----
    Life is a game. The conception is terrible but the graphics are amazing!
    matt.elementfx.com

  4. #4
    shanes's Avatar
    shanes is offline x10Hosting Member shanes is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    35

    Re: Need PHP help with this script

    I've tidied it up and it seems fine yet I keep getting errors grr :
    PHP Code:
    $check file_get_contents("http://habbo.$hotel/home/$habbo");
    function 
    check()
     {
       if (
    eregi('<h2 class="title">Page not found!'$check))
       {
         return 
    true;   
       }
        else
       {
         return 
    false;
       }
     }
    $im imagecreatefromgif("back.gif");
    if 
    check() true
    {
      
    $in imagecreatefromgif("exist.gif");  
    }
    else
    {
      
    $in imagecreatefromgif("http://www.habbo.$hotel/habbo-imaging/avatarimage?user=$habbo&action=&direction=3&head_direction=3&size=l&img_format=gif");



  5. #5
    diabolo's Avatar
    diabolo is offline Community Advocate diabolo is on a distinguished road
    Join Date
    Nov 2007
    Location
    Jersey Shore
    Posts
    1,683

    Re: Need PHP help with this script

    what is the error you are getting now?

  6. #6
    shanes's Avatar
    shanes is offline x10Hosting Member shanes is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    35

    Re: Need PHP help with this script

    Quote Originally Posted by diabolo View Post
    what is the error you are getting now?
    Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/shanessa/public_html/hhgs/2.php on line 18

    line 18 =
    if check() true


  7. #7
    Livewire's Avatar
    Livewire is offline Abuse Compliance Officer Livewire is a glorious beacon of lightLivewire is a glorious beacon of light
    Join Date
    Jun 2005
    Location
    Behind a keyboard.
    Posts
    8,998

    Re: Need PHP help with this script

    Quote Originally Posted by shanes View Post
    Parse error: syntax error, unexpected T_STRING, expecting '(' in /home/shanessa/public_html/hhgs/2.php on line 18

    line 18 =
    if check() true
    Code:
    if (check())
    or

    Code:
    if (check () == true)
    Without that equals sign it won't evaluate properly; it's taking true as a string instead of "if check equals true".

    Leaving out the word true will work as well as long as check returns true when it's supposed to; that'd evaluate as "if true" if check() == true.


    Long story short, pick whichever, they both should work


    TOS breakers will be suspended regardless of race, creed, national origin, hair color, or favorite food. Thanks for your understanding!

  8. #8
    cowctcat's Avatar
    cowctcat is offline x10 Lieutenant cowctcat is an unknown quantity at this point
    Join Date
    Nov 2007
    Location
    In front of a computer
    Posts
    401

    Re: Need PHP help with this script

    Doth thine script now worketh
    --cowctcat

+ Reply to Thread

Similar Threads

  1. Unstand PHP?
    By o0slowpaul0o in forum Tutorials
    Replies: 8
    Last Post: 01-07-2008, 09:16 PM
  2. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  3. Sigo con problemas con phpbb2
    By reciecho in forum Soporte
    Replies: 7
    Last Post: 10-20-2007, 06:28 PM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers