php - Why I failed to query database? -
currently, i'm using 000webhost build website. configure wordpress in 000webhost free hosting. currently, problem when try login, shows me message
failed query database access denied user 'id1351040_wp_f95ca011d778539df40db16f9d312e34'@'%' database 'login_table'
based on wordpress pages, created form , coding shown below
<form id="form1" name="form1" method="post" action="../wp-content/themes/main/process.php" onsubmit="return check();">
according phpmyadmin, directory /public_html/wp-content/themes/main/process.php let form action link here. code process.php shown below:
<?php error_reporting(e_all & ~e_notice); error_reporting(e_all & ~e_notice & ~e_deprecated); // connect server , select database $con = mysqli_connect("localhost", "id1351040_wp_f95ca011d778539df40db16f9d312e34", "xxxxxx", "id1351040_wp_f95ca011d778539df40db16f9d312e34"); mysqli_select_db($con,"login_table") or die(mysqli_error($con)); // values passe form in login.php file $username = $_post['user']; $password = $_post['pass']; // prevent mysql injection $username = stripcslashes($username); $password = stripcslashes($password); $username = mysqli_real_escape_string($con, $username); $password = mysqli_real_escape_string($con, $password); // query database user $result = mysqli_query($con, "select * login id = '$username' , password = '$password'") or die("failed query database ".mysqli_error($con)); $row = mysqli_fetch_array($con, $result); session_start(); if($row['id'] == $username && $row['password'] == $password ){ header( 'location: https://xxxxxx/' ) ; } else{ echo "failed login!"; } ?>
the screenshot phpmyadmin screenshot of phpmyadmin result of result
Comments
Post a Comment