PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello this is my first post on this forum...
Here it go!
Ok I encrypted my password on the page Register.php
In login.php I made script to encrypt the password and then look if does match or not with the Database
My problem is there they match but that not working well
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Last edited by DarkWolfXP on Sun Jul 02, 2006 2:54 am, edited 1 time in total.
DarkWolfXP wrote:Hello this is my first post on this forum...
Here it go!
Ok I encrypted my password on the page Register.php
In login.php I made script to encrypt the password and then look if does match or not with the Database
My problem is there they match but that not working well
<?
include "configuration.php";
$db = mysql_connect($host, $login_php, $password);
$basedados = mysql_select_db($database);
$pass = md5($pass);
$check = mysql_query("SELECT * FROM `$table` WHERE login = '$login' AND pass = '$pass'", $db);
$count = mysql_num_rows($check);
thx for the encryption page
About $login $pass I folowed a tutorial and he didnt define that 2 strings :s
And now I see they are not defined can that be the problem?
I know $login is to the text field named 'login' and $pass to the text field 'pass'
How can I define that 2 strings to textfield?
P.S if I dont use md5 and copy the password on database it will show "Welcome user"
So I think they are defined to the textfields already.
Well you could define $user and $pass to $_POST['user'] and $_POST['pass'] and then all you would have to do is setup your login form and set the name value of the inputs to user and pass. If this doesn't help post your login page also.
<?php
include "configuration.php";
$db = mysql_connect($host, $login_php, $password);
$basedados = mysql_select_db($database);
// You really should be doing an if() check here instead of assuming
// but seeing this is a tutorial, lets assume, shall we?
$login = $_POST['login'];
$pass = md5($_POST['pass']);
$table = ''; //Set this value to the mysql table you are selecting from
$check = mysql_query("SELECT * FROM `$table` WHERE login = '$login' AND pass = '$pass'", $db);
$count = mysql_num_rows($check);
if ( $count == 1 ) {
echo "Welcome User";
} else {
echo "Login fail";
}
?>
This is really not a good example of a login system. If I were you I would look through the code snippets forum on these boards for a tutorial by Maugrim_the_Reaper regarding login systems. But for the sake of testing, try the code above and see what comes of it.
"login Fail" -.-
I go to Tutorial part and look some secure system this is anoying XD
thx for all ppl
U guys really fast answering
Really nice ^^
Thx all