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

Thread: [REWARD] Help With PHP (1 line)

  1. #1
    Soki is offline Banned Soki is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    127.0.0.1
    Posts
    857

    [REWARD] Help With PHP (1 line)

    Alright. So, Installed this ad manager that manages my ads (obviously) and it said everything was install correctly. It does not use MySQL, just pure PHP. Well, I added an ad to test it out and it didn't shwo up. So, I check my PHP links and one gave me an error.

    Fatal error: Class 'bannerAds' not found in /home/***/public_html/ads/js.php on line 16


    I checked the file and I don't know much about PHP. So, here it is:

    Code:
    <?php
    $bannerAdsPath = '/home/***/public_html/ads/ads.dat';
    require '/home/***/public_html/ads/ads.inc.php';
    ///////////////////////////////////////
    // Don't Edit Anything Below This Line!
    ///////////////////////////////////////
    if (!isset($_GET['id']) || !ereg('^[0-9]+$', $_GET['id'])) {
        $_GET['id'] = null;
    }
    if (!isset($_GET['width']) || !ereg('^[0-9]+$', $_GET['width'])) {
        $_GET['width'] = 0;
    }
    if (!isset($_GET['width']) || !isset($_GET['height']) || !ereg('^[0-9]+$', $_GET['height'])) {
        $_GET['height'] = 0;
    }
    $buttons = new bannerAds($_GET['id'], 1, $_GET['width'], $_GET['height']);
    header('Content-type: application/x-javascript');
    echo "<!--\n";
    echo "document.write(\"" .addslashes($buttons->ad[0]). "\");\n";
    echo "//-->";
    ?>
    Line 16:
    Code:
    $buttons = new bannerAds($_GET['id'], 1, $_GET['width'], $_GET['height']);
    Anyone who helps me out will end up with a reward (if your solution works).
    Last edited by Soki; 01-30-2009 at 07:09 PM.

  2. #2
    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: [REWARD] Help With PHP (1 line)

    ok, here's the deal w/ classes.

    when you did new bannerAds, you created a new class. if there's no class named bannerAds in ads.inc.php, then it'll throw the error.

    do you mind posting ads.inc.php, as that may be the answer to our problems (no class bannerAds created ;))


    i'm very intrigued by this "reward" that you offer o.O
    Last edited by xPlozion; 01-30-2009 at 07:17 PM.

  3. #3
    Soki is offline Banned Soki is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    127.0.0.1
    Posts
    857

    Re: [REWARD] Help With PHP (1 line)

    Here you go:

    Code:
    <?php
    $ads = array();
    $bannerAds = array();
    $bannerAdsTime = time();
    $lines = file($bannerAdsPath) or die();
    foreach ($lines as $line) {
        $line = chop($line);
        if (($line != '') && (!ereg('^#', $line))) {
            if (ereg('^[A-Za-z0-9]+\|\|', $line)) {
                $ads[] = $line;
            } else {
                list ($key, $val) = explode('=', $line);
                $bannerAds[$key] = $val;
            }
        }
    }
    function writeads()
    {
        global $bannerAdsPath, $ads, $bannerAds;
        $data = fopen($bannerAdsPath, 'w') or die();
        flock($data, 2) or die();
        fputs($data, @join("\n", $ads)."\n");
        while (list ($key, $val) = each ($bannerAds)) {
            if (($key != '') && ($val != '')) {
                fputs($data, $key.'='.$val."\n");
            }
        }
        flock($data, 3);
        fclose($data);
        reset($bannerAds);
    }
    ?>
    Last edited by Soki; 01-30-2009 at 07:21 PM.

  4. #4
    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: [REWARD] Help With PHP (1 line)

    yea, you're trying to use classes when you don't have any defined.

    http://us3.php.net/new
    new

    To create an instance of a class, a new object must be created and assigned to a variable. An object will always be assigned when creating a new object unless the object has a constructor defined that throws an exception on error. Classes should be defined before instantiation (and in some cases this is a requirement).
    the way
    PHP Code:
    echo "document.write(\"" .addslashes($buttons->ad[0]). "\");\n"
    is written is sorta confusing, cause they create a new class on line 16, then they use what appears to be an array ad[0] where there should be a function call.
    Last edited by xPlozion; 01-30-2009 at 07:36 PM.

  5. #5
    Soki is offline Banned Soki is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    127.0.0.1
    Posts
    857

    Re: [REWARD] Help With PHP (1 line)

    Quote Originally Posted by xPlozion View Post
    yea, you're trying to use classes when you don't have any defined.

    http://us3.php.net/new
    I just don't have the time right now to read through it and figure out what is the exact solution (as in what to edit/add).
    Do you have any clue what I should add?

    Then, I'll give the reward as stated (if it works).

  6. #6
    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: [REWARD] Help With PHP (1 line)

    hmm, looking over the code, it became a bit more confusing. did you modify either of the code you posted, or just the contents in the .dat file?

    also, what script is this, so i can dl it and inspect it
    Last edited by xPlozion; 01-30-2009 at 07:47 PM.

  7. #7
    Soki is offline Banned Soki is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    127.0.0.1
    Posts
    857

    Re: [REWARD] Help With PHP (1 line)

    Quote Originally Posted by xPlozion View Post
    hmm, looking over the code, it became a bit more confusing. did you modify either of the code you posted, or just the contents in the .dat file?

    also, what script is this, so i can dl it and inspect it
    No I didn't edit anything at all and this is the ads.inc.php not the .dat file.
    The .dat file just has my banner ad info that just added in the Admin cpanel of it (nothing special).

  8. #8
    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: [REWARD] Help With PHP (1 line)

    Quote Originally Posted by Soki View Post
    No I didn't edit anything at all and this is the ads.inc.php not the .dat file.
    The .dat file just has my banner ad info that just added in the Admin cpanel of it (nothing special).
    i was aware that it was the inc file, it was just a general knowledge q.

    i'm not sure what the
    Code:
    $buttons->ad[0]
    is for, but the only thing i can think of is replace it with `$bannerAds[0]`. depending on how the other side of the = in the dat file looks, it may be properly formatted already, and this is the only thing i can think of ;)

  9. #9
    Soki is offline Banned Soki is an unknown quantity at this point
    Join Date
    Jan 2008
    Location
    127.0.0.1
    Posts
    857

    Re: [REWARD] Help With PHP (1 line)

    Quote Originally Posted by xPlozion View Post
    i was aware that it was the inc file, it was just a general knowledge q.

    i'm not sure what the
    Code:
    $buttons->ad[0]
    is for, but the only thing i can think of is replace it with `$bannerAds[0]`. depending on how the other side of the = in the dat file looks, it may be properly formatted already, and this is the only thing i can think of ;)
    Nope, thanks anyways.
    Small reward for effort was sent.
    I'm going to try a different script instead.

  10. #10
    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: [REWARD] Help With PHP (1 line)

    ok, sorry i couldnt make it work. better luck w/ the next one ;)

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 08-17-2008, 08:30 PM
  2. perl script for guestbook, need help
    By shifeng in forum Scripts & 3rd Party Apps
    Replies: 14
    Last Post: 01-06-2008, 12:31 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