include function does not work in HTML5

Thread Starter

metric_electric

Joined Aug 21, 2013
33
@mcgyvr

I got it working now, I have to enter 'localhost/<filename.php>' to get it to output right.

Thanks.

Now..... I am trying to log into a demo database which I created on mysql and when I type in my username and password, the browser outputs a blank page when I click the login button. Below are my codes



login.php:
<?php

include 'connect.php';
include 'init.php';

if (empty($_POST)==false)
{
$username=$_POST['username'];
$password=$_POST['pass'];

echo $username,' ',$password;

if(empty($username)==true || empty($password)== true)
{
$errors[]='You need to enter a username and password';

}
else if (user_exists($username)==false)
{
$errors[]='We can\'t find that username. Have you registered?';
}

}


?>




init.php:
<?php

session_start();
error_reporting(0);

require 'connect.php';
require 'users.php';

$errors = array();

?>





connect.php:
<?php

mysql_connect('localhost','root','');
mysql_select_db('test');

?>




users.php:
<?php

function user_exists($username)
{
$query = mysql_query("SELECT COUNT(`user_id`) FROM `users` WHERE `username` = '$username'");
}


?>






Please help
 

sirch2

Joined Jan 21, 2013
1,037
Where are you typing in your Username and Password, is that on a different page? If so show us that page.

In the login.php you never echo or print the errors array, so you won't see anything.
 

Thread Starter

metric_electric

Joined Aug 21, 2013
33
@sirch2,

below is the page I am typing in my username and password:

<!doctype html>
<html lang="en">

<head>

<meta charset="utf-8" />
<title> Aikays Website </title>
<link rel="stylesheet" href="main.css"/>

</head>

<body>

<div id="Big_Wrapper">
<header id="Top_Header">

</header>

<nav id="Top_Menu">
<ul>
<li> <a href="html5.html" STYLE="text-decoration: none"> Home </a> </li>
<!-- <li> <a href="example1.html" STYLE="text-decoration: none"> Register/Login </a> </li> -->
<li> Contact Us </li>
</ul>
</nav>

<div id="New_Div">

<section id="Main_Section">
<div id="aboutMe">
<form method="post" action="">
<ul>
<li>
Name: <br>
<input type="text" name="username">
</li>
<li>
Email: <br>
<input type="email" name="email">
</li>
<li>
Message: <br>
<textarea name="message" cols="35" rows="10"></textarea>
</li>
<br>
<input type="submit" value="submit">
<br>

</ul>
</form>
</div>
</section>

<aside id="Side_News">

</aside>

</div>


<footer id="Main_Footer">
<p> copyright 2013 </p>
</footer>
</div>

</body>
</html>


sorry for the above code format, I tried to paste a screen shot but it didn't work for me.

As I said earlier, the browser (chrome) stays blank when I try to login to my database (mysql) on phpmyadmin
 
Top