Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

MySQL Database Login/Registration

Options
124

Comments

  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    gahim wrote: »
    Please see the image attached
    I can see that myself now if I wanted. Please change your password NOW.

    Btw try this
    INSERT INTO users (`username`,`password`,`email`,`title`,`name`) VALUES ('web', 'web', 'web@webmonkey.com', 'My title', 'my name');
    


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    change database name and username too


  • Closed Accounts Posts: 112 ✭✭gahim


    It wasn't my real password, does anyone know what I should do?


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    gahim wrote: »
    It wasn't my real password, does anyone know what I should do?
    Well clearly it was gahim if I got into your control panel. If you don't change it I'll change it and PM you with the new password.

    Edit: You seem to have it changed. Well I hope it was you and not someone else!


  • Closed Accounts Posts: 112 ✭✭gahim


    How do I change my SQL Database password? I use cPanel X


  • Advertisement
  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    gahim wrote: »
    How do I change my SQL Database password? I use cPanel X
    More than likely you can do this via a database manager section. I can't remember CPanel.


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    I'm sure you did it yourself. If someone else did then start a new database and get rid of the old one.


  • Closed Accounts Posts: 112 ✭✭gahim


    I did it, so I changed things, looked over and I attempted to signup but there is still no one on the database :(


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    gahim wrote: »
    How do I change my SQL Database password? I use cPanel X

    In cpanel, you can use MySQL Databases to delete username. Then add a new username and password assigned to that user.


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    You will have to go into your php code now and change your username and password to the new one you just assigned. I think its located in the log.php.....can't remember


  • Advertisement
  • Closed Accounts Posts: 112 ✭✭gahim


    <?
    session_name("Login");
    session_start();

    if($_GET == "login") {
    $conn = mysql_connect("localhost","usernamehere","passwordhere"); // your MySQL connection data
    $db = mysql_select_db("username_members"); //put your database name in here
    $name = $_POST;
    $q_user = mysql_query("SELECT * FROM users WHERE login='$name'");

    if(mysql_num_rows($q_user) == 1) {

    $query = mysql_query("SELECT * FROM users WHERE login='$name'");
    $data = mysql_fetch_array($query);

    echo $_POST;
    echo $data;

    if($_POST == $data) {
    session_register("name");
    header("Location: http://beta.gahim.com/builder"); // success page. put the URL you want
    exit;
    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Wrong Password'));
    exit;
    }
    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Invalid User'));
    exit;
    }
    }

    // if the session is not registered
    if(session_is_registered("name") == false) {
    header("Location: login.php");
    }
    ?>

    I have updated it and it doesn't work :(


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    You are now signed up, you may now login!

    This is what i got after signing up. Is it still not working? Looks like it is. Due to you using:
    Print "You are now signed up, you may now login!";

    in the process.php file, it is going to stay in that file. If you want it brought to your success page you will have to redirect it within that php file.


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi,
    It says that but when you try to login (http://beta.gahim.com/start/login.php) it says invalid login...

    login.php
    <title>Login</title>
    <FONT FACE="Arial">
    <?
    session_name("Login");
    session_start();
    session_destroy();

    if($_GET == "failed") {
    print $_GET;
    }
    ?>
    <form name="login_form" method="post" action="log.php?action=login">
    Login: <input type="text" name="username"><BR>
    Password: <input type="password" name="password"><BR>
    <input type="submit" value="Start Building">
    </form>
    </font>


    log.php

    <?
    session_name("Login");
    session_start();

    if($_GET == "login") {
    $conn = mysql_connect("localhost","username","password"); // your MySQL connection data
    $db = mysql_select_db("gahimcom_members"); //put your database name in here
    $name = $_POST;
    $q_user = mysql_query("SELECT * FROM users WHERE login='$name'");

    if(mysql_num_rows($q_user) == 1) {

    $query = mysql_query("SELECT * FROM users WHERE login='$name'");
    $data = mysql_fetch_array($query);

    echo $_POST;
    echo $data;

    if($_POST == $data) {
    session_register("name");
    header("Location: http://beta.gahim.com/builder"); // success page. put the URL you want
    exit;
    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Wrong Password'));
    exit;
    }
    } else {
    header("Location: login.php?login=failed&cause=".urlencode('Invalid User'));
    exit;
    }
    }

    // if the session is not registered
    if(session_is_registered("name") == false) {
    header("Location: login.php");
    }
    ?>


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    back to your process file:
    [URL]http://beta.gahim.com/start/process.php[/URL]
    <?
    $name=$_POST['name'];
    $email=$_POST['email'];
    $email=$_POST['password'];
    $email=$_POST['username'];
    $email=$_POST['title'];
    
    $location=$_POST['location'];
    mysql_connect("localhost", "gahimcom", "aransean11") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";
    ?>
    

    Why do you have this??
    $email=$_POST['password'];
     $email=$_POST['username'];
     $email=$_POST['title'];
    

    You have assigned $email 4 times. should be:
    $password=$_POST['password'];
      $username=$_POST['username'];
      $title=$_POST['title'];
    


  • Closed Accounts Posts: 112 ✭✭gahim


    <?
    $name=$_POST;
    $email=$_POST;
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    $location=$_POST;
    mysql_connect("localhost", "gahimcom", "aransean11") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";
    ?>


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    I don't think that will work. I already gave you the insert statement but you seem to have chosen not to bother with it or ignore it.

    That will always print you are signed up as you do no error checking what so ever.


  • Closed Accounts Posts: 112 ✭✭gahim


    Updated process.php to
    <?
    $name=$_POST;
    $email=$_POST;
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;
    mysql_connect("localhost", "gahimcom", "passwordhere") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `users` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";
    ?>


  • Closed Accounts Posts: 112 ✭✭gahim


    When I use the form and check if anyone signed up

    MySQL returned an empty result set (i.e. zero rows). (Query took 0.0003 sec)


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    The only thing this thread is useful for is increasing ones post count. No offense gahim but you don't seem to read anyone's posts.


  • Closed Accounts Posts: 112 ✭✭gahim


    <?
    $name=$_POST;
    $email=$_POST;
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    $location=$_POST;
    mysql_connect("localhost", "gahimcom", "aransean11") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";

    $password=$_POST;
    $username=$_POST;
    $title=$_POST;
    ?>

    aren' you putting in
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    twice?


  • Advertisement
  • Registered Users Posts: 981 ✭✭✭fasty


    gahim wrote: »
    <?
    $name=$_POST;
    $email=$_POST;
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    $location=$_POST;
    mysql_connect("localhost", "gahimcom", "aransean11") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";

    $password=$_POST;
    $username=$_POST;
    $title=$_POST;
    ?>

    aren' you putting in
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    twice?

    Try printing the values you want to insert to the page, check if the insert throws and error.

    Seriously, do these things without posting the same code over and over and people might be bothered to help you further.


  • Closed Accounts Posts: 112 ✭✭gahim


    Try printing the values you want to insert to the page, check of the insert throws and error.

    What does this mean?


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    gahim wrote: »
    <?
    $name=$_POST;
    $email=$_POST;
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    $location=$_POST;
    mysql_connect("localhost", "gahimcom", "aransean11") or die(mysql_error());
    mysql_select_db("gahimcom_members") or die(mysql_error());
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    Print "You are now signed up, you may now login!";

    $password=$_POST;
    $username=$_POST;
    $title=$_POST;
    ?>

    aren' you putting in
    $password=$_POST;
    $username=$_POST;
    $title=$_POST;

    twice?

    Once at the beginning is enough. Now, try the insert statement webmonkey provided.


  • Closed Accounts Posts: 112 ✭✭gahim


    I would like to thank everyone for their patience, could you please tell me what is the code I need to put in, what I need to remove and where?

    Thanks


  • Closed Accounts Posts: 263 ✭✭HandWS LTD


    Ok.....as webmonkey accessed your database he may have seen that your table name is 'users' so typing the webmonkeys code manually into your mysql database via the phpMyAdmin will tell you if it works or not.

    It looks like you are using 'data' as your table name as shown in the process.php file with which i don't know if it is the correct name or not:
    mysql_query("INSERT INTO `data` VALUES ('$name', '$email', '$password', '$username', '$title')");
    
    This may be the reason why the info is not going into your database. If webmonkeys code does work then you'll need to change the table name in your process.php file from 'data' to 'users'.

    Webmonkeys code:
    INSERT INTO users (`username`,`password`,`email`,`title`,`name`) VALUES ('web', 'web', 'web@webmonkey.com', 'My title', 'my name');


  • Closed Accounts Posts: 112 ✭✭gahim


    I have changed this but it still doesn't login....

    I have inserted the fields
    Inserted rows: 1
    Inserted row id: 3 (Query took 0.0117 sec)

    username web
    password web

    I am trying to login


  • Closed Accounts Posts: 112 ✭✭gahim


    It has been added to the table users, I tried to login and it doesn't work..

    The signup form doesn't work either...


  • Registered Users Posts: 9,579 ✭✭✭Webmonkey


    Are you sure you are now selecting from data table? From the previous page I see you are doing the select statement on the users table.

    At least you got it registering now


  • Closed Accounts Posts: 112 ✭✭gahim


    Hi,
    I only have one table called users in gahimcom_members database, I have changed the code in the log.php and process.php files...

    Both the signup and login form doesn't work :(


  • Advertisement
  • Closed Accounts Posts: 112 ✭✭gahim


    Webmonkey wrote: »
    Are you sure you are now selecting from data table? From the previous page I see you are doing the select statement on the users table.

    At least you got it registering now
    Only have the one table called users...

    The code should work right?

    Attempting to signup it just doesn't work...

    Attempting to login it still doesn't work...

    I have added a user to the database using a code in the SQL...

    I tried to login but it says invalid user...


Advertisement