我有这些错误:
警告:mysqli :: mysqli():( 28000/1045):拒绝访问用户' pmartine_myapp' @' localhost' (使用密码:是)在第6行的/home4/pmartinez/public_html/eadetv/php/conexion.php
警告:mysqli :: query():无法在第11行的/home4/pmartinez/public_html/eadetv/php/login.php中获取mysqli
致命错误:在第12行的/home4/pmartinez/public_html/eadetv/php/login.php中调用非对象的成员函数fetch_array()
这是conexion.php
<?php
$host="localhost";
$db="pmartine_myapp";
$user="pmartine_maynor";
$password="eUZchUvC[wqb";
$con = new mysqli($host,$db,$user,$password);
?>
这是login.php
<?php
if(!empty($_POST)){
if(isset($_POST["username"]) &&isset($_POST["password"])){
if($_POST["username"]!=""&&$_POST["password"]!=""){
include "conexion.php";
$sql1= "select * from user where (username=\"$_POST[username]\" or email=\"$_POST[username]\") and password=\"$_POST[password]\" ";
$query = $con->query($sql1);
while ($r=$query->fetch_array()) {
$user_id=$r["id"];
$user_name=$r['username'] ;
$full_name=$r['fullname'] ;
$carrera=$r['carrera'] ;
$seccion=$r['seccion'] ;
$password=$r['password'] ;
$online=$r['online'];
break;
}
if($user_id==$_POST["username"]){
print "<script>alert(\"Acceso invalido.\");window.location='../login.php';</script>";
}else{
session_start();
$_SESSION["user_id"]=$user_id;
$_SESSION["user_name"]=$user_name;
$_SESSION["full_name"]=$full_name;
$_SESSION["carrera"]=$carrera;
$_SESSION["seccion"]=$seccion;
$_SESSION["password"]=$password;
$modificar = $con->query("UPDATE user SET online = '1' WHERE id = '".$_SESSION['user_id']."'");
$_SESSION["online"]=$online;
print "<script>window.location='../home.php';</script>";
}
}
}
}
?>