-
Posts
8 -
Joined
-
Last visited
Never
Posts posted by Arnold_26
-
-
Thanks for the reply but there is another problem.
Tried it already
Show an error.
Parse error: parse error, unexpected $end in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\user_conn.php on line 61
The line is 61 is the </html> tag.
here's the code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Log In</title>
<link href="user_main.css" rel="stylesheet" type="text/css" />
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$password = trim($password);
if (!$username && !$password){
echo 'Enter you username followed by your password';
exit;
}
$mysqli = new mysqli("localhost", "user", "dbpassword", "db");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT username, password FROM users ORDER by username = '$username'
and password = '$password' ";
$result = mysqli_query($mysqli, $query);
if (!$result)
{
echo 'Cannot connect sorry';
exit;
}
else
{
if(mysqli_num_rows($result) == 0){
echo "Username or password is incorrect";
die();
}else {
/* fetch associative array */
while ($row = mysqli_fetch_row($result))
{
printf ( $row[0], $row[1]);
}
/* free result set */
mysqli_free_result($result);
printf ("connection success");
}
$mysqli->close();
?>
</head>
<body>
<center>
</center>
</body>
</html>
-
Hi guys..
I have a little problem on my codes.
I've tested the connection of MySql and PHP that's fine.
Now my problem is the authentication of it.
When ever I've entered a not valid username and password it will connect to my other page.
Did I miss something?
What's seem the problem here?
Here's the code:
<?php
$username = $_POST['username'];
$password = $_POST['password'];
$password = trim($password);
if (!$username && !$password){
echo 'Enter you username followed by your password';
exit;
}
$mysqli = new mysqli("localhost", "my_user", "mypassword", "my_db");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "SELECT username, password FROM users ORDER by username = '$username'
and password = '$password' ";
$result = mysqli_query($mysqli, $query);
if (!$result)
{
echo 'Cannot connect sorry';
exit;
}
else
{
/* fetch associative array */
while ($row = mysqli_fetch_row($result))
{
printf ( $row[0], $row[1]);
}
/* free result set */
mysqli_free_result($result);
printf ("connection success");
}
$mysqli->close();
?>
Help!!
Thanks guys.
-
Ho there.
I need to know on how to use the myfile.sql into mysql 5.0
all I see is %
how do I execute this one?
what procedures will I do?
thanks.
-
Hey thanks also.
about the codings.
-
I'm using PHP and MySQL Web Development 3rd edition.
By Luke Welling and Laura Thomson
-
Thanks for the suggestion.
@Ober: I what way sir? DeMorgan's are negation right? how did you integrate it on PHP?
Thanks.
-
Hi guys.
In computer science we are using discrete math right?
I want know what is the role of discrete math in computing.
I mean in our everyday lives, I'd like to see the importance of it.
I want to see the theories in discrete math is used in the field programming / software developing, games, web developing, business, or operating system stuff like that.
Cos I don't see it. Especially if you are living where outsourcing is in rapid growth.
I've asked my professor on this one he will just answer "is included to my course a pre-requisite of automata" or "in some technology today"
I don't want a general answer, I want a specific answer on this.
Thanks guys.
Implementing an authentication in user login....
in PHP Coding Help
Posted
Thans it works but the problem still exist.
even I type in my username and password eventhough they are not in the database still enters the site which a validation is needed.
Thanks..