+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Simple script

  1. #1
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Simple script

    I am having problems with some simple scripts:

    PHP Code:
    <html>
    <body>
    <?php
    $skill 
    $fletching;
    if (empty(
    $user)); { ?>
        Welcome to ParsaAkbaris calculator, Parsa Akbari ftw!
        <form action="runescapefletching.php" method="get">
        <input type="text" name="user" size="1">
        <input type="submit" value="Send">
    <?php
    }
    else {
        
    $order = array( "Fletching",); 
        
    $user $_POST['user']; 
        
    $get file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user");
        
    $get explode("\n"$get);
        
    $i 0;

        foreach (
    $order as $key => $value) {
            
    $value strtolower($value);
            
    $temp explode(","$get[$i]);
            
    $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]);
            
    $stats[$value] = $temp;
            
    $eval "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);";
            eval(
    $eval);
            
    $i++;
        }
        if (
    $fletching[2] < 0){
        echo 
    'Your $skill is not on the hiscores, enter the amount of xp you have in $skill';
        
    ?>
        <form action="runescapefletching.php" method="get">
        The amount of xp:<input type="text" name="xp" size="1">
        Also your RuneScape username:<input type="text" name="user" size="1">
        <input type="submit" value="Send">
        <?php 
        
    }    
        else{ 
        echo 
    ' <insert command here> ' ;
        }
        }
        
    ?>

        
    </body>
    </html>

  2. #2
    Aravinthan is offline x10Hosting Member Aravinthan is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    68

    Re: Simple script

    Whats the error?

  3. #3
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: Simple script

    Quote Originally Posted by Aravinthan View Post
    Whats the error?

    parse error

  4. #4
    nightscream is offline x10 Lieutenant nightscream is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hallaar, Belgium
    Posts
    474

    Re: Simple script

    I have found a few errors, maybe try this:

    If(text) never ends with a ;
    and if you delcare an array it ends with a ) not a ,) because if you put a , it will think you add another thing to the array.

    PHP Code:
    <html>
    <body>
    <?php
    $skill 
    $fletching;
    if (empty(
    $user)) { ?>
        Welcome to ParsaAkbaris calculator, Parsa Akbari ftw!
        <form action="runescapefletching.php" method="get">
        <input type="text" name="user" size="1">
        <input type="submit" value="Send">
    <?php
    }
    else {
        
    $order = array("Fletching"); 
        
    $user $_POST['user']; 
        
    $get file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user");
        
    $get explode("\n"$get);
        
    $i 0;

        foreach (
    $order as $key => $value) {
            
    $value strtolower($value);
            
    $temp explode(","$get[$i]);
            
    $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]);
            
    $stats[$value] = $temp;
            
    $eval "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);";
            eval(
    $eval);
            
    $i++;
        }
        if (
    $fletching[2] < 0){
        echo 
    'Your $skill is not on the hiscores, enter the amount of xp you have in $skill';
        
    ?>
        <form action="runescapefletching.php" method="get">
        The amount of xp:<input type="text" name="xp" size="1">
        Also your RuneScape username:<input type="text" name="user" size="1">
        <input type="submit" value="Send">
        <?php 
        
    }    
        else{ 
        echo 
    ' <insert command here> ' ;
        }
        }
        
    ?>
        
    </body>
    </html>
    ------------------------------------------------------------------------------------------
    If you have any troubles with a website or a script, just send me a pm.

    I also code websites in xHTML/css, can code javascript and php too if needed

  5. #5
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: Simple script

    Thanks but there still seems to be a error on line 12
    Ah right it seems to work thanks mate, can you tell me where my mistakes where?







    Okay i made some edits to the script it still doesnt seem to work:


    PHP Code:
    <html>
    <body>
    <?php
    $skill 
    'fletching';
    $user $_GET['user'];
    if (empty(
    $user)) { echo'
        Welcome to ParsaAkbaris calculator, Parsa Akbari ftw!
        <form action="runescapefletching.php" method="get">
        <input type="text" name="user" size="17">
        <input type="submit" value="Send">'
    ;
    }
    else {
        
    $order = array("Fletching"); 
        
    $get file_get_contents("http://hiscore.runescape.com/index_lite.ws?player=$user");
        
    $get explode("\n"$get);
        
    $i 0;

        foreach (
    $order as $key => $value) {
            
    $value strtolower($value);
            
    $temp explode(","$get[$i]);
            
    $temp = array("rank" => $temp[0], "level" => $temp[1], "exp" => $temp[2]);
            
    $stats[$value] = $temp;
            
    $eval "\$$value = array(\$temp[\"rank\"], \$temp[\"level\"], \$temp[\"exp\"]);";
            eval(
    $eval);
            
    $i++;
                                           }
        if (
    $fletching[2] < 0){
        echo 
    'Your $skill is not on the hiscores, enter the amount of xp you have in $skill
        
        <form action="runescapefletching.php" method="get">
        The amount of xp:<input type="text" name="xp" size="1">
        Also your RuneScape username:<input type="text" name="user" size="1">
        <input type="submit" value="Send">'
    ;
                               }    
        else{ 
        echo 
    ' <insert command here> ' ;
            }
        }
        
    ?>
        
    </body>
    </html>
    Last edited by Parsa44; 01-25-2009 at 03:59 AM. Reason: Automerged Doublepost

  6. #6
    t2t2t's Avatar
    t2t2t is offline x10 Elder t2t2t is an unknown quantity at this point
    Join Date
    Sep 2006
    Location
    Europe, Estonia
    Posts
    690

    Re: Simple script

    Works for me, expect for some small errors:
    Your $skill is not on the hiscores, enter the amount of xp you have in $skill
    It's something I have answered before (in fact yesterday):
    PHP doesn't look for variables inside ' and '. Fix:
    (Either change ' to " or wrap variables into '. and .' )
    This post has been marked spam 52 times.


  7. #7
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: Simple script

    So i changed:

    PHP Code:
    $skill 'fletching'
    to

    PHP Code:
    $skill "fletching"

    but it still doesnt work for me.

  8. #8
    nightscream is offline x10 Lieutenant nightscream is an unknown quantity at this point
    Join Date
    Feb 2006
    Location
    Hallaar, Belgium
    Posts
    474

    Re: Simple script

    Quote Originally Posted by Parsa44 View Post
    Thanks but there still seems to be a error on line 12
    Ah right it seems to work thanks mate, can you tell me where my mistakes where?
    Those were your mistakes
    if (empty($user)); {
    $order = array("Fletching",);

    what errors do you get now?
    ------------------------------------------------------------------------------------------
    If you have any troubles with a website or a script, just send me a pm.

    I also code websites in xHTML/css, can code javascript and php too if needed

  9. #9
    xPlozion's Avatar
    xPlozion is offline x10 Elder xPlozion is an unknown quantity at this point
    Join Date
    Mar 2008
    Location
    Delaware, USA
    Posts
    872

    Re: Simple script

    Quote Originally Posted by Parsa44 View Post
    So i changed:

    PHP Code:
    $skill 'fletching'
    to

    PHP Code:
    $skill "fletching"
    but it still doesnt work for me.
    no, he means make
    PHP Code:
    echo 'Your $skill is not on the hiscores, enter the amount of xp you have in $skill
        
        <form action="runescapefletching.php" method="get">
        The amount of xp:<input type="text" name="xp" size="1">
        Also your RuneScape username:<input type="text" name="user" size="1">
        <input type="submit" value="Send">'

    to
    PHP Code:
    echo 'Your '.$skill.' is not on the hiscores, enter the amount of xp you have in '.$skill.'
        
        <form action="runescapefletching.php" method="get">
        The amount of xp:<input type="text" name="xp" size="1">
        Also your RuneScape username:<input type="text" name="user" size="1">
        <input type="submit" value="Send">'


  10. #10
    Parsa44 is offline x10 Sophmore Parsa44 is an unknown quantity at this point
    Join Date
    Aug 2008
    Posts
    232

    Re: Simple script

    Quote Originally Posted by nightscream View Post
    Those were your mistakes
    if (empty($user)); {
    $order = array("Fletching",);

    what errors do you get now?
    I would do that but what would i achieve? I am trying it to ASK for variable $user if it doesnt exist.
    Edit:
    Quote Originally Posted by nightscream View Post
    Those were your mistakes
    if (empty($user)); {
    $order = array("Fletching",);

    what errors do you get now?
    I would do that but what would i achieve? I am trying it to ASK for variable $user if it doesnt exist.

    Now what i try it it just comes up with a blank screen, which is rather annoying.
    Last edited by Parsa44; 01-26-2009 at 11:35 AM. Reason: Automerged Doublepost

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. All In One Simple PHP Test Script Need Help
    By dquigley in forum Programming Help
    Replies: 8
    Last Post: 12-13-2008, 07:20 PM
  2. Simple Header Script, Need Help
    By dquigley in forum Programming Help
    Replies: 14
    Last Post: 12-12-2008, 09:06 PM
  3. Access to 300+ PHP scripts (2500 credits)
    By jonathanyaniv in forum The Marketplace
    Replies: 11
    Last Post: 06-03-2008, 10:58 PM
  4. Replies: 8
    Last Post: 12-03-2007, 04:12 PM
  5. simple script
    By swirly in forum Scripts & 3rd Party Apps
    Replies: 10
    Last Post: 06-17-2006, 06:32 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