php - database not read from mysql database -


my login page doesnt redirect me next webpage if inputted correct data on username , password.

when check config.inc , made config.php

it doesnt displays on webpage.

any suggestions

config.inc

 $con=mysqli_connect("localhost","root@localhost","","test"); // check connection if (mysqli_connect_errno())   {   echo "failed connect mysql: " . mysqli_connect_error();   } 

loginproc page

<?php  // inialize session session_start();  // include database connection settings include('config.inc');  // retrieve username , password database according user's input $login = mysql_query("select * users (username = '" . mysql_real_escape_string($_post['username']) . "') , (password = '" . mysql_real_escape_string(md5($_post['password'])) . "')");  // check username , password match if (mysql_num_rows($login) == 1) { // set username session variable $_session['username'] = $_post['username']; // jump secured page header('location: securedpage.php'); } else { // jump login page header('location: index.php'); }  ?> 

securedpage.php

<?php  // inialize session session_start();  // check, if username session not set page jump login page if (!isset($_session['username'])) { header('location: index.php'); }  ?> <html>  <head> <title>secured page</title> </head>  <body>  <p>this secured page session: <b><?php echo $_session['username']; ?></b> <br>you can put restricted information here.</p> <p><a href="logout.php">logout</a></p>  </body>  </html> 

make sure nothing output before header function, including white space in php file , included php files


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -