1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Trying to install Elitius affiliate script, but have errors

Discussion in 'General Scripting Chat' started by MetalMan390, Jan 3, 2013.

  1. MetalMan390

    MetalMan390 Regular Member

    Joined:
    Sep 26, 2009
    Messages:
    285
    Likes Received:
    18
    I am trying to install the Elitius affiliate script on my site, but after the install I have a few errors. For reference, the installation instructions are here: http://www.elitius.com/docs/install.html

    After I was prompted to remove the install directory (last line of the instructions, in RED), I hit next and when on this page: http://www.mydomain.com/affiliate/admin/ I was presented with these errors:

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/affiliate/classes/XpDb.php on line 185

    Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/affiliate/classes/XpDb.php:185) in /home/xxxxxx/public_html/affiliate/admin/util.php on line 41

    I have absolutely zero experience with scripting, programming, etc, so I have no idea what this means. I have included the lines of code in question below. Any help would be appreciated.

    Code:
    /**
        * Returns recordset as associative array where the key is the first field
        *
        * @param str $aSql sql query
        *
        * @return arr
        */
        function getKeyValue($aSql)
        {
            $out = Array ();
            $res = $this->query($aSql);
        
            while ($temp = mysql_fetch_row($res))
            {
                $out[$temp[0]] = $temp[1];
            }
            return $out;
        }
    
    }
    Code:
    /**
    * Checks if admin is logged in
    */
    function admin_auth()
    {
        global $gXpAdmin;
    
        if ($_COOKIE['admin_name'])
        {
            $admin = $gXpAdmin->getAdminByUsername($_COOKIE['admin_name']);
    
            $pwd = crypt($admin['password'], 'secret_string');
            if ($pwd != $_COOKIE['admin_pwd'])
            {
                header("Location: {$gXpConfig['base']}{$gXpConfig['dir']}{$gXpConfig['admin']}login.php");
                exit;
            }
        }
        else
        {
            header("Location: {$gXpConfig['base']}{$gXpConfig['dir']}{$gXpConfig['admin']}login.php");
            exit;
        }
    }
     
  2. DarkPixel

    DarkPixel Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 4, 2011
    Messages:
    1,328
    Likes Received:
    1,239
    Location:
    ↓↓↓↓
    Home Page:
    Have you created a MySQL database and configured the script to use the database?
     
  3. MetalMan390

    MetalMan390 Regular Member

    Joined:
    Sep 26, 2009
    Messages:
    285
    Likes Received:
    18
    Thank you for the reply. I did create a database, but I must have missed the part in the instructions telling me to modify the xpdb.php file with the database info. I just did, but I think my password is giving me another error. Now I am just getting this:

    Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in /home/research/public_html/affiliate/classes/XpDb.php on line 25

    Line 25 is for the database password, and my password has a $ in it (I make very strong passwords), so I don't know if that's causing the error. So, my password line would look something like this: var $xxxxx$xxxxx;

    The first $ was already therre, the middle $ is a character in my password. I then tried to change the password of the database user to something simpler for now, then changed the password in the XpDb.php file to match. Now, I am getting this error:

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'myusername'@'localhost' (using password: YES) in /home/xxxxx/public_html/affiliate/classes/XpDb.php on line 33
    Could not connect: Access denied for user 'myusername'@'localhost' (using password: YES)Could not connect: Access denied for user 'myusername'@'localhost' (using password: YES)
     
  4. MetalMan390

    MetalMan390 Regular Member

    Joined:
    Sep 26, 2009
    Messages:
    285
    Likes Received:
    18
    Well, I just deleted the entire script from my sever and tried to reinstall. I thought that when I specified a password during the installation setup, it might not match with the new password I supplied in the xpdb.php file. So, reinstalled it and used a simpler password throughout the installation process. I am still getting the same error:

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/xxxxxx/public_html/affiliate/classes/XpDb.php on line 185

    Warning: Cannot modify header information - headers already sent by (output started at /home/xxxxxx/public_html/affiliate/classes/XpDb.php:185) in /home/xxxxxx/public_html/affiliate/admin/util.php on line 41

    Still getting this error even after I changed the database info in the xpdb.php file. Just to clarify, is this the code that I am supposed to be modifying in order to specify my database? It's from the xpdb.php file:


    Code:
    class XpDatabase
    {
        var $mDbhost;
        var $mDbuser;
        var $mDbpwd;
        var $mDbname;
    
        /**
        * Connects to database
        */
    And when I modify this, I'd change it from:

    var $mDbhost;

    To:

    var $localhost;

    Is this correct? Just replace everything in between $ and ; right?
     
  5. MetalMan390

    MetalMan390 Regular Member

    Joined:
    Sep 26, 2009
    Messages:
    285
    Likes Received:
    18
    I still haven't figured this out. I've reinstalled this a few times and still get those errors mentioned above. Anyone have any suggestions?
     
  6. themidiman

    themidiman Power Member

    Joined:
    Feb 25, 2011
    Messages:
    701
    Likes Received:
    1,535
    Location:
    root@pts/0
    The most recent code you pasted shouldn't be edited with your Database info. Those are variables. There should be a line in the config file that sets a value for those variables. E.G. $mDbuser = 'Database User';

    Also, have you made sure to assign the MySQL user to the database, and grant all privelages to the user for that database?