SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem in the php code and the database

    Hello all
    lol i know i got alot of problems and i dont know why lol
    im doing the registration system for the website ^_^
    and im using this code

    Code:
    <?php 
    $url = 'http://www.alheba.com/correct.php'; 
    $user = $_POST['username'];
    $pass = $_POST['password'];
    $pass2 = $_POST['password2'];
    $name = $_POST['name'];
    $domain = $_POST['domain'];
    $city = $_POST['city'];
    $email = $_POST['email'];
    $country = $_POST['country'];
    $address = $_POST['address'];
    $phone = $_POST['phone'];
    
    
    
    
    if (($pass)!=($pass2))
    {
        header("Location: Pssworerror.php"); 
        Die();
    }
    function CheckMail($email)
    {
        if (eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4}$", $email)) 
        { 
            return true;
        }
        else 
        { 
            return false; 
        }
    }
    if ((empty($email)) || (!CheckMail($email)))   
    {
        header("Location: Erroremail.php"); 
        Die();
    }
    
    
    if (empty($name))
    {
        header("Location: Errorname.php"); 
        Die();
    }
    
    
    if (empty($city))
    {
        header("Location: Errorcity.php"); //the user will be sent to this page
        Die();
    }
    
    
    if (empty($country))
    {
        header("Location: Errorcountry.php"); 
        Die();
    }
    
    
    if (empty($address))
    {
        header("Location: Erroraddress.php"); 
        Die();
    }
    
    
    
    
    if (empty($phone))
    {
        header("Location: Errorphone.php"); 
        Die();
    }
    
    
    $min_lenngth = 6;
    if(strlen($user) < $min_lenngth || strlen($pass) < $min_lenngth)
    {
        header("Location: Errorpass.php"); 
        Die();
    }
    $connection = mysql_connect("localhost", "*****", "****");
    
    @mysql_select_db(databasename) or die( "Unable to select database");
    
    $check = mysql_query("select username from users where username=\"$user\"");
    $returned = mysql_fetch_array($check);
    
    if(!empty($returned))
    {
        header("Location: userexists.php"); 
        mysql_close($connection); 
        Die();
    }
    else
    {
    
        $check = mysql_query("select email from users where email=\"$email\""); 
        $returned = mysql_fetch_array($check);
    
        if(!empty($returned))
        {
            header("Location: emailexists.php"); 
            mysql_close($link); 
            Die();
        }
        else     
        $pass=md5($pass); 
    
        $request = "INSERT INTO users values(NULL,'$name','$user','$pass','$email','$domain','$city',
        '$country','$address','$phone')";
        $results = mysql_query($request);
        if($results) 
        {
            header("Location: correct.php"); 
        }
        else 
        {
            header("Location: account.php"); 
        }
        mysql_close($link); 
        Die();
    }
    
    echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
    ?>

    and i also changed the php.ini and the config.inc.php

    and this is the code for config.inc.php




    Code:
    $cfg['Servers'][$i]['host']          = 'localhost'; // MySQL hostname or IP address
    $cfg['Servers'][$i]['port']          = '';          // MySQL port - leave blank for default port
    $cfg['Servers'][$i]['socket']        = '';          // Path to the socket - leave blank for default socket
    $cfg['Servers'][$i]['connect_type']  = 'tcp';       // How to connect to MySQL server ('tcp' or 'socket')
    $cfg['Servers'][$i]['extension']     = 'mysql';     // The php MySQL extension to use ('mysql' or 'mysqli')
    $cfg['Servers'][$i]['compress']      = FALSE;       // Use compressed protocol for the MySQL connection
                                                        // (requires PHP >= 4.3.0)
    $cfg['Servers'][$i]['controluser']   = 'pma';          // MySQL control user settings
                                                        // (this user must have read-only
    $cfg['Servers'][$i]['controlpass']   = '';          // access to the "mysql/user"
                                                        // and "mysql/db" tables).
                                                        // The controluser is also
                                                        // used for all relational
                                                        // features (pmadb)
    $cfg['Servers'][$i]['auth_type']     = 'config';    // Authentication method (config, http or cookie based)?
    $cfg['Servers'][$i]['user']          = '****';      // MySQL user
    $cfg['Servers'][$i]['password']      = '*********';          // MySQL password (only needed
                                                        // with 'config' auth_type)
    $cfg['Servers'][$i]['only_db']       = '';          // If set to a db-name, only
                                                        // this db is displayed in left frame
                                                        // It may also be an array of db-names, where sorting order is relevant.
    $cfg['Servers'][$i]['verbose']       = '';          // Verbose name for this host - leave blank to show the hostname
    
    $cfg['Servers'][$i]['pmadb']         = 'phpmyadmin';          // Database used for Relation, Bookmark and PDF Features
                                                        // (see scripts/create_tables.sql)
                                                        //   - leave blank for no support
                                                        //     DEFAULT: 'phpmyadmin'
    $cfg['Servers'][$i]['bookmarktable'] = 'PMA_bookmark';          // Bookmark table
                                                        //   - leave blank for no bookmark support
                                                        //     DEFAULT: 'pma_bookmark'
    $cfg['Servers'][$i]['relation']      = 'PMA_relation';          // table to describe the relation between links (see doc)
                                                        //   - leave blank for no relation-links support
                                                        //     DEFAULT: 'pma_relation'
    $cfg['Servers'][$i]['table_info']    = 'PMA_table_info';          // table to describe the display fields
                                                        //   - leave blank for no display fields support
                                                        //     DEFAULT: 'pma_table_info'
    $cfg['Servers'][$i]['table_coords']  = 'PMA_table_coords';          // table to describe the tables position for the PDF schema
                                                        //   - leave blank for no PDF schema support
                                                        //     DEFAULT: 'pma_table_coords'
    $cfg['Servers'][$i]['pdf_pages']     = 'PMA_pdf_pages';          // table to describe pages of relationpdf
                                                        //   - leave blank if you don't want to use this
                                                        //     DEFAULT: 'pma_pdf_pages'
    $cfg['Servers'][$i]['column_info']   = 'PMA_column_info';          // table to store column information
                                                        //   - leave blank for no column comments/mime types
                                                        //     DEFAULT: 'pma_column_info'
    $cfg['Servers'][$i]['history']       = 'PMA_history';          // table to store SQL history
                                                        //   - leave blank for no SQL query history
                                                        //     DEFAULT: 'pma_history'
    $cfg['Servers'][$i]['verbose_check'] = TRUE;        // set to FALSE if you know that your pma_* tables
                                                        // are up to date. This prevents compatibility
                                                        // checks and thereby increases performance.
    $cfg['Servers'][$i]['AllowRoot']     = TRUE;        // whether to allow root login
    $cfg['Servers'][$i]['AllowDeny']['order']           // Host authentication order, leave blank to not use
                                         = '';
    $cfg['Servers'][$i]['AllowDeny']['rules']           // Host authentication rules, leave blank for defaults
                                         = array();
    
    
    $i++;
    $cfg['Servers'][$i]['host']            = '';
    $cfg['Servers'][$i]['port']            = '';
    $cfg['Servers'][$i]['socket']          = '';
    $cfg['Servers'][$i]['connect_type']    = 'tcp';
    $cfg['Servers'][$i]['extension']       = 'mysql';
    $cfg['Servers'][$i]['compress']        = FALSE;
    $cfg['Servers'][$i]['controluser']     = '';
    $cfg['Servers'][$i]['controlpass']     = '';
    $cfg['Servers'][$i]['auth_type']       = 'config';
    $cfg['Servers'][$i]['user']            = '****';
    $cfg['Servers'][$i]['password']        = '*******';
    $cfg['Servers'][$i]['only_db']         = '';
    $cfg['Servers'][$i]['verbose']         = '';
    $cfg['Servers'][$i]['pmadb']           = ''; // 'phpmyadmin' - see scripts/create_tables.sql
    $cfg['Servers'][$i]['bookmarktable']   = ''; // 'pma_bookmark'
    $cfg['Servers'][$i]['relation']        = ''; // 'pma_relation'
    $cfg['Servers'][$i]['table_info']      = ''; // 'pma_table_info'
    $cfg['Servers'][$i]['table_coords']    = ''; // 'pma_table_coords'
    $cfg['Servers'][$i]['pdf_pages']       = ''; // 'pma_pdf_pages'
    $cfg['Servers'][$i]['column_info']     = ''; // 'pma_column_info'
    $cfg['Servers'][$i]['history']         = ''; // 'pma_history'
    $cfg['Servers'][$i]['verbose_check']   = TRUE;
    $cfg['Servers'][$i]['AllowRoot']       = TRUE;
    $cfg['Servers'][$i]['AllowDeny']['order']
                                           = '';
    $cfg['Servers'][$i]['AllowDeny']['rules']
                                           = array();
    
    $i++;
    $cfg['Servers'][$i]['host']            = '';
    $cfg['Servers'][$i]['port']            = '';
    $cfg['Servers'][$i]['socket']          = '';
    $cfg['Servers'][$i]['connect_type']    = 'tcp';
    $cfg['Servers'][$i]['extension']       = 'mysql';
    $cfg['Servers'][$i]['compress']        = FALSE;
    $cfg['Servers'][$i]['controluser']     = '';
    $cfg['Servers'][$i]['controlpass']     = '';
    $cfg['Servers'][$i]['auth_type']       = 'config';
    $cfg['Servers'][$i]['user']            = '****';
    $cfg['Servers'][$i]['password']        = '*****';
    $cfg['Servers'][$i]['only_db']         = '';
    $cfg['Servers'][$i]['verbose']         = '';
    $cfg['Servers'][$i]['pmadb']           = ''; // 'phpmyadmin' - see scripts/create_tables.sql
    $cfg['Servers'][$i]['bookmarktable']   = ''; // 'pma_bookmark'
    $cfg['Servers'][$i]['relation']        = ''; // 'pma_relation'
    $cfg['Servers'][$i]['table_info']      = ''; // 'pma_table_info'
    $cfg['Servers'][$i]['table_coords']    = ''; // 'pma_table_coords'
    $cfg['Servers'][$i]['pdf_pages']       = ''; // 'pma_pdf_pages'
    $cfg['Servers'][$i]['column_info']     = ''; // 'pma_column_info'
    $cfg['Servers'][$i]['history']         = ''; // 'pma_history'
    $cfg['Servers'][$i]['verbose_check']   = TRUE;
    $cfg['Servers'][$i]['AllowRoot']       = TRUE;
    
    $cfg['Servers'][$i]['AllowDeny']['order']
                                           = '';
    $cfg['Servers'][$i]['AllowDeny']['rules']
                                           = array();
    
    // If you have more than one server configured, you can set $cfg['ServerDefault']
    // to any one of them to autoconnect to that server when phpMyAdmin is started,
    // or set it to 0 to be given a list of servers without logging in
    // If you have only one server configured, $cfg['ServerDefault'] *MUST* be
    // set to that server.
    $cfg['ServerDefault'] = 1;              // Default server (0 = no default server)
    $cfg['Server']        = '';
    unset($cfg['Servers'][0]);
    and i got this stupid error and i dont know why

    im using win XP and im using xampp-win32-1.4.15-installer
    it got all the important things php mysql all these stuff


    and the error that im getting it is


    Warning: mysql_connect() [function.mysql-connect]: Access denied for user '*****'@'localhost' (using password: YES)
    Unable to select database



    so please guys if u can tell me wts is wrong

  2. #2
    Accredited Master scotty2260's Avatar
    Join Date
    Apr 2004
    Location
    California
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That means that either your password or username is not right.

    BTW. delete the error message from your last post ASAP! you don't want the wrong people to get that info.
    Scott

  3. #3
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol thnx alot for helping me

    but the username and password are the same in the all the files configration files

    ????

  4. #4
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysql database password error

  5. #5
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i fix it from the mysql admin but also i got the same error
    i dont know wts wrong i've tried everything ??? any ideas how to fix it let me try the rest of the ideas lol

  6. #6
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you try root again,password is NULL

  7. #7
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    it works when i change and make everything like the first
    using the root thing also

    so right now i dont know wts wrong lool ^_^

  8. #8
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ??? any help

  9. #9
    SitePoint Zealot rain5017's Avatar
    Join Date
    Sep 2005
    Posts
    166
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you ensure the user pass mysql server's authentication?
    Try reset the server

  10. #10
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the same problem i restarted everything and nothing wts worng with it damn lool

    my head is going to blow up

  11. #11
    SitePoint Enthusiast T.J's Avatar
    Join Date
    Jun 2005
    Location
    Dubai
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok i still got the same problem but i would like to add that
    im doing all this stuff at work and we have at work a server and a network between our pc's
    so is this is a problem for php or its ok if i did the same stuff ??

    even the root username can't use the phpmyadmin when i want to use it it gives me the same error ???


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •