0

I just recently set up an account with GoDaddy since my computer doesn't want to host a site, at all.

I didn't have issues creating an account testing on my PC but when it comes to trying to set everything up via GoDaddy's hosting it fails to write characters and gives me that error.

Here is the php file for that directory. I'm extremely new to website coding and such, but I'm at a loss on what to do here. Anyone help?

If it adds information I'm attempting to throw up a server for the game Legend of the Green Dragon.

<?php

function db_query($sql, $die=true){
    if (defined("DB_NODB") && !defined("LINK")) return array();
    global $session,$dbinfo;
    $dbinfo['queriesthishit']++;
    $fname = DBTYPE."_query";
    $starttime = getmicrotime();
    $r = $fname($sql, LINK);

    if (!$r && $die === true) {
        if (defined("IS_INSTALLER")){
            return array();
        }else{
            if ($session['user']['superuser'] & SU_DEVELOPER || 1){
                require_once("lib/show_backtrace.php");
                die(
                    "<pre>".HTMLEntities($sql, ENT_COMPAT, getsetting("charset", "ISO-8859-1"))."</pre>"
                    .db_error(LINK)
                    .show_backtrace()
                    );
            }else{
                die("A most bogus error has occurred.  I apologise, but the page you were trying to access is broken.  Please use your browser's back button and try again.");
            }
        }
    }
    $endtime = getmicrotime();
    if ($endtime - $starttime >= 1.00 && ($session['user']['superuser'] & SU_DEBUG_OUTPUT)){
        $s = trim($sql);
        if (strlen($s) > 800) $s = substr($s,0,400)." ... ".substr($s,strlen($s)-400);
        debug("Slow Query (".round($endtime-$starttime,2)."s): ".(HTMLEntities($s, ENT_COMPAT, getsetting("charset", "ISO-8859-1")))."`n");
    }
    unset($dbinfo['affected_rows']);
    $dbinfo['affected_rows']=db_affected_rows();
    $dbinfo['querytime'] += $endtime-$starttime;
    return $r;
}

//& at the start returns a reference to the data array.
//since it's possible this array is large, we'll save ourselves
//the overhead of duplicating the array, then destroying the old
//one by returning a reference instead.
function &db_query_cached($sql,$name,$duration=900){
    //this function takes advantage of the data caching library to make
    //all of the other db_functions act just like MySQL queries but rely
    //instead on disk cached data.
    //if (getsetting("usedatacache", 0) == 1) debug("DataCache: $name");
    //standard is 15 minutes, als hooks don't need to be cached *that* often, normally you invalidate the cache properly
    global $dbinfo;
    $data = datacache($name,$duration);
    if (is_array($data)){
        reset($data);
        $dbinfo['affected_rows']=-1;
        return $data;
    }else{
        $result = db_query($sql);
        $data = array();
        while ($row = db_fetch_assoc($result)) {
            $data[] = $row;
        }
        updatedatacache($name,$data);
        reset($data);
        return $data;
    }
}

if (file_exists("lib/dbremote.php")) {
    require_once("lib/dbremote.php");
}

function db_error($link=false){
    $fname = DBTYPE."_error";
    if ($link!==false)
        $r = @$fname($link);
    else
        $r = @$fname();
    if ($r=="" && defined("DB_NODB") && !defined("DB_INSTALLER_STAGE4")) return "The database connection was never established";
    return $r;
}

function db_fetch_assoc(&$result){
    if (is_array($result)){
        //cached data
        if (list($key,$val)=each($result))
            return $val;
        else
            return false;
    }else{
        $fname = DBTYPE."_fetch_assoc";
        $r = $fname($result);
        return $r;
    }
}

function db_insert_id(){
    if (defined("DB_NODB") && !defined("LINK")) return -1;
    $fname = DBTYPE."_insert_id";
    $r = $fname(LINK);
    return $r;
}

function db_num_rows($result){
    if (is_array($result)){
        return count($result);
    }else{
        if (defined("DB_NODB") && !defined("LINK")) return 0;
        $fname = DBTYPE."_num_rows";
        $r = @$fname($result); //Whyfor turn off error reporting here?
        return $r;
    }
}

function db_affected_rows($link=false){
    global $dbinfo;
    if (isset($dbinfo['affected_rows'])) {
        return $dbinfo['affected_rows'];
    }
    if (defined("DB_NODB") && !defined("LINK")) return 0;
    $fname = DBTYPE."_affected_rows";
    if ($link===false) {
        $r = $fname(LINK);
    }else{
        $r = $fname($link);
    }
    return $r;
}

function db_pconnect($host,$user,$pass){
    $fname = DBTYPE."_pconnect";
    $r = $fname($host,$user,$pass);
    return $r;
}

function db_connect($host,$user,$pass){
    $fname = DBTYPE."_connect";
    $r = $fname($host,$user,$pass);
    return $r;
}

function db_get_server_version()
{
    $fname = DBTYPE."_get_server_info";
    if (defined("LINK")) $r = $fname(LINK);
    else $r = $fname();
    return $r;
}

function db_select_db($dbname){
    $fname = DBTYPE."_select_db";
    if(!defined("LINK")) $r = $fname($dbname);
    else $r = $fname($dbname, LINK);
    return $r;
}
function db_free_result($result){
    if (is_array($result)){
        //cached data
        unset($result);
    }else{
        if (defined("DB_NODB") && !defined("LINK")) return false;
        $fname = DBTYPE."_free_result";
        $r = $fname($result);
        return $r;
    }
}

function db_table_exists($tablename){
    if (defined("DB_NODB") && !defined("LINK")) return false;
    $fname = DBTYPE."_query";
    $exists = $fname("SELECT 1 FROM `$tablename` LIMIT 0");
    if ($exists) return true;
    return false;
}

function db_prefix($tablename, $force=false) {
    global $DB_PREFIX;

    if ($force === false) {
        $special_prefixes = array();

        // The following file should be used to override or modify the
        // special_prefixes array to be correct for your site.  Do NOT
        // do this unles you know EXACTLY what this means to you, your
        // game, your county, your state, your nation, your planet and
        // your universe!
        if (file_exists("prefixes.php")) require_once("prefixes.php");

        $prefix = $DB_PREFIX;
        if (isset($special_prefixes[$tablename])) {
            $prefix = $special_prefixes[$tablename];
        }
    } else {
        $prefix = $force;
    }
    return $prefix . $tablename;
}

?>
  • Show where you're defining LINK. You're not using the proper database credentials. – aynber Aug 12 '16 at 14:50
  • I'm not sure exactly what that means. I've never ran into this before and threw it up on GD's hosting hoping it'd do the same thing, but it's not for me. The files themselves came with an installer, which according to it, gave no issues writing to the databases etc, but refuses to create accounts. – Sabastian McMahan Aug 12 '16 at 14:52
  • Those are just functions. They don't do anything on their own. Somewhere in the rest of your code, you'll need to pass the database credentials (host, username, password, database name). Aside from that, this seems to be pretty old and insecure code. `mysql_*` functions have been deprecated for over 2 years now because it's vulnerable to [SQL Injection](https://en.wikipedia.org/wiki/SQL_injection) – icecub Aug 12 '16 at 14:53
  • Yeah the files are kinda older. It was moreso a server for me and a couple of my buddies to mess around on. I'll sift around and see if I can figure it out there, it'd be awesome if someone had an outright answer for it though, as doubtful as I see it – Sabastian McMahan Aug 12 '16 at 14:58
  • It's not that hard. There's probebly some `config.php` (or anything close to that) file where you have to insert your MySQL credentials. Those should be given to you by GoDaddy or you can find them on the config panel of your GoDaddy server. Just insert them into the config file and you're done. – icecub Aug 12 '16 at 15:01
  • If you really can't get it done, you can find my Email address on my profile. We can setup a teamviewer session which allows me to view / control your computer screen and I'll help you out with it. – icecub Aug 12 '16 at 15:04
  • The key is in the error message. Look at the file /home/susanooeyes/public_html/lib/dbwrapper_mysql.php at lines around line 136, and you might be able to figure it out from there. Or get a clue about the issue, anyway. – aynber Aug 12 '16 at 15:06
  • @icecub I'll take you up on that offer, I'll shoot you a message later today, I've been trying to wrap my head around this all night. – Sabastian McMahan Aug 12 '16 at 15:22
  • That's fine. I can't promise I'll be online the entire evening, but with some luck I'll see your message on time and I'll send you a reply. – icecub Aug 12 '16 at 15:32

0 Answers0