Account Website MySQL Help menu

User Tag List

Results 1 to 4 of 4
  1. #1
    iterrorist's Avatar Banned
    Reputation
    90
    Join Date
    Dec 2007
    Posts
    210
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Account Website MySQL Help

    My site brings up this error after trying to create an account...

    Code:
    Warning:  mysql_real_escape_string() expects parameter 2 to be resource, boolean given in /home/content/i/t/e/iterrorist/html/index.php on line 155
    Lost connection to MySQL server at 'reading initial communication packet', system error: 113

    here is my index.php:

    Code:
    <?php
    
        $db_host='94.***.158.154';
        $db_user='root';
        $db_pass='***';
        $db_name='logon';
        $server_message='Welcome to My Warcraft!';
    
    
        $db = new DBLayer($db_host, $db_user, $db_pass, $db_name, $db_prefix, $p_connect);
        
    class DBLayer
    {
        var $prefix;
        var $link_id;
        var $query_result;
    
        var $saved_queries = array();
        var $num_queries = 0;
    
    
        function DBLayer($db_host, $db_user, $db_pass, $db_name, $db_prefix, $p_connect)
        {
            $this->prefix = $db_prefix;
    
            if ($p_connect)
                $this->link_id = @mysql_pconnect($db_host, $db_user, $db_pass);
            else
                $this->link_id = @mysql_connect($db_host, $db_user, $db_pass);
    
            if ($this->link_id)
            {
                if (@mysql_select_db($db_name, $this->link_id))
                    return $this->link_id;
                else
                    error('Unable to select database. MySQL reported: '.mysql_error(), __FILE__, __LINE__);
            }
        }
    
    
        function select_db($dbsel)
        {
    
        return @mysql_select_db($dbsel, $this->link_id);
    
        }
        
        function pun_htmlspecialchars($str)
        {
        $str = preg_replace('/&(?!#[0-9]+;)/s', '&amp;', $str);
        $str = str_replace(array('<', '>', '"'), array('&lt;', '&gt;', '&quot;'), $str);
    
        return $str;
        }
        
        function start_transaction()
        {
            return;
        }
    
    
        function end_transaction()
        {
            return;
        }
    
    
        function query($sql, $unbuffered = false)
        {
            if (defined('PUN_SHOW_QUERIES'))
                $q_start = get_microtime();
    
            if ($unbuffered)
                $this->query_result = @mysql_unbuffered_query($sql, $this->link_id);
            else
                $this->query_result = @mysql_query($sql, $this->link_id);
    
            if ($this->query_result)
            {
                if (defined('PUN_SHOW_QUERIES'))
                    $this->saved_queries[] = array($sql, sprintf('%.5f', get_microtime() - $q_start));
    
                ++$this->num_queries;
    
                return $this->query_result;
            }
            else
            {
                if (defined('PUN_SHOW_QUERIES'))
                    $this->saved_queries[] = array($sql, 0);
    
                return false;
            }
        }
    
    
        function result($query_id = 0, $row = 0)
        {
            return ($query_id) ? @mysql_result($query_id, $row) : false;
        }
    
        function fetch_assoc($query_id = 0)
        {
            return ($query_id) ? @mysql_fetch_assoc($query_id) : false;
        }
    
    
        function fetch_row($query_id = 0)
        {
            return ($query_id) ? @mysql_fetch_row($query_id) : false;
        }
    
    
        function num_rows($query_id = 0)
        {
            return ($query_id) ? @mysql_num_rows($query_id) : false;
        }
    
    
        function affected_rows()
        {
            return ($this->link_id) ? @mysql_affected_rows($this->link_id) : false;
        }
    
    
        function insert_id()
        {
            return ($this->link_id) ? @mysql_insert_id($this->link_id) : false;
        }
    
    
        function get_num_queries()
        {
            return $this->num_queries;
        }
    
    
        function get_saved_queries()
        {
            return $this->saved_queries;
        }
    
    
        function free_result($query_id = false)
        {
            return ($query_id) ? @mysql_free_result($query_id) : false;
        }
    
    
        function escape($str)
        {
            if (is_array($str))
                return '';
            else if (function_exists('mysql_real_escape_string'))
                return mysql_real_escape_string($str, $this->link_id);
            else
                return mysql_escape_string($str);
        }
    
    
        function error()
        {
            $result['error_sql'] = @current(@end($this->saved_queries));
            $result['error_no'] = @mysql_errno($this->link_id);
            $result['error_msg'] = @mysql_error($this->link_id);
    
            return $result;
        }
    
    
        function close()
        {
            if ($this->link_id)
            {
                if ($this->query_result)
                    @mysql_free_result($this->query_result);
    
                return @mysql_close($this->link_id);
            }
            else
                return false;
        }
    }
    
            $flags=0;
            if(!empty($_POST['TBC'])){
                $flags=8;
            }
            if(!empty($_POST['WotLK'])){
                $flags=24;
            }
    
    
    if (isset($_POST['action']))
    {
        $login = ereg_replace( "[^A-Za-z0-9]", "", $_POST['username'] );
        if ($login=='')
        {
            $war1="<font color='red'>Type in a username!</font>";
        }
        else
        {
            $db->select_db($acc_db);
            $result = $db->query("SELECT login FROM accounts WHERE login = '".$db->escape($login)."' LIMIT 1") or die(mysql_error());
            $rows   = $db->num_rows($result);
            if ($rows>=1)
            {
                $war1="<font color='red'>Username '".$login."' already exist!</font>";
                $db->select_db($db_name);
            }
            else
            {
                $pass1 = ereg_replace( "[^A-Za-z0-9]", "", $_POST['password'] );
                $pass2 = ereg_replace( "[^A-Za-z0-9]", "", $_POST['password2'] );
                if ($pass1=='')
                {
                    $war2="<font color='red'>Type in a password!</font>";
                }
                else
                {
                    if ($pass1<>$pass2) 
                    {
                        $war2="<font color='red'>Passwords does not match!</font>";
                    }
                    else
                    {
                        $email = htmlspecialchars($_POST['email']);
                        if ($email=='')
                        {
                            $war3="<font color='red'>Type in a email!</font>";
                        }
                        else
                        {
                            $db->select_db($acc_db);
                            $result = $db->query("SELECT login FROM accounts WHERE email = '".$db->escape($email)."' LIMIT 1") or die(mysql_error());
                            $rows   = $db->num_rows($result);
                            if ($rows>=1)
                            {
                                $war3="<font color='red'>Email '".$email."' is already in use!</font>";
                                $db->select_db($db_name);
                            }
                            else
                            {
                                    $db->select_db($acc_db);
                                    $result = $db->query("INSERT INTO accounts (login, password, gm, banned, email, flags) VALUES ('".$login."','".$pass1."','0','0','".$db->escape($email)."','".$flags."')") or die(mysql_error());                                
                                    
                                            $db->select_db($acc_db);
                                            $result = $db->query("SELECT login FROM accounts WHERE login = '".$db->escape($login)."' LIMIT 1") or die(mysql_error());
                                            $rows   = $db->num_rows($result);
                                                if ($rows>=1)
                                    {
                                                        $war5="<font color='#00FF00'>Your account has been successfully created account.<br><br>Username: ".$login."<br><br>Password: ".$pass1."</font>";
                                                        $db->select_db($db_name);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <style type="text/css";>
    body {
        background: #000000 url(background.png) top no-repeat;
        margin: 10px;
        cursor: default;
        color: #FFF;
        padding-top: 160px;
        padding-right: 35px;
    
    }
    body,td,th {
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 11px;
        color: #fff;
        text-align: left;
        vertical-align: top;
        font-size: 13px;
    }
    </style>
    </head>
    
    <body>
    <table align="center" border="0">
    <tr>
    <td>
    <form action="" method="post">
    <label for="username">Username:</label><br />
    <input type="text" id="username" maxlength="20" name="username" /><br />
    <label for="password">Password:</label><br />
    <input type="password" id="password" maxlength="20" name="password" /><br />
    <label for="password2">Confirm Password:</label><br />
    <input type="password" id="password2" maxlength="20" name="password2" /><br />
    <label for="email">Email Address:</label><br />
    <input type="text" id="email" maxlength="40" name="email" /><br /><br />
    <label for="expansions">World of Warcraft Version:</label><br />
    <input type="checkbox" name= "TBC" value="tb">Burning Crusade<br />
    <input type="checkbox" name="WotLK" value="ww">Wrath of the Lich King<br /><br />
    <input type="submit" name="action" value="Create Account" />
    </form>
    </td>
    </tr>
    </table>
    <center><br /><?php print $server_message; ?><br />
    <?php echo $war1; echo $war2; echo $war3; echo $war4; echo $war5; ?></center>
    </body>
    </html>

    Account Website MySQL Help
  2. #2
    Areius's Avatar Member
    Reputation
    3
    Join Date
    Oct 2008
    Posts
    30
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have the same error for line 155, but have not found out what to do about it yet as I am self educated, and class just started last night, lol. Hope you got yours fixed! Hope I get mine working too.

  3. #3
    iterrorist's Avatar Banned
    Reputation
    90
    Join Date
    Dec 2007
    Posts
    210
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Absolute waste of post. I do not really care about other peoples problems when they post in my thread unless they are offering a solution. It helps nobody.

    Regards,

    iTerrorist

  4. #4
    beltic's Avatar Member
    Reputation
    9
    Join Date
    May 2007
    Posts
    127
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, here is another post you wont like. Your attitude sucks bud. You came to a community to ask for help, and flame the first person that replys to your thread, no matter they couldnt help YOU directly.

    Its obvious you need to go learn PHP and fix the thing yourself, for you probably wont get any help like this.

    Good luck.
    Beltic
    Former Admin/Owner/Developer - Dead n Pissed PVP

Similar Threads

  1. I need help with Accounts Website, Hamachi
    By matafakas in forum WoW EMU Questions & Requests
    Replies: 2
    Last Post: 09-03-2008, 09:13 AM
  2. Website Info Help please!
    By cpskater in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 10-01-2007, 04:59 AM
  3. account hacked please help
    By smithen1 in forum Community Chat
    Replies: 7
    Last Post: 03-21-2007, 12:30 AM
  4. Notice of Account Closure- PLEASE help!
    By Cloud in forum World of Warcraft General
    Replies: 10
    Last Post: 01-19-2007, 05:56 PM
All times are GMT -5. The time now is 06:12 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search