接続.php
<?php
$host = "localhost";
$user = "root";
$pass = "mikred###";
$db = "itsupportdb";
$mysqli = new mysqli($host, $user, $pass, $db);
if(mysqli_connect_errno())
{
printf("Connection Failed: %s\n", mysqli_connect_error());
exit();
}
?>
glbLoginFunct.php
<?php
include("connection.php");
class Functions {
public static function __Login()
{
session_start();
if(isset($_POST['btnLogin']))
{
$id = $_POST['user'];
$pass = $_POST['pass'];
$query = $mysqli->prepare("SELECT * FROM syslogin WHERE username=? AND password=? LIMIT 1");
$query->bind_param('ss', $id, $pass);
$query->execute();
$query->bind_result($id, $pass);
$row = $query->fetch();
if($row == true)
{
$_SESSION['LogID'] = 1;
$_SESSION['ProfID'] = 2;
header('Location: test.php');
exit();
}
else
{
?><script type="text/javascript"> alert('ERROR!'); </script><?php
}
}
}
}
?>
mainLogin.php
<?php require("includes/glbLoginFunct.php"); ?>
<form action="<?php $_PHP_SELF ?>" method="POST">
<fieldset>
<legend>LOGIN FORM:</legend>
<label id="user">Username: <input type="text" name="user" maxlenght="10"/></label><br />
<label id="pass">Password: <input type="password" name="pass" maxlenght="7"/></label><br />
<label id="buttons"><input type="submit" class="imgBtn" name="btnLogin" value="Login User"/></label><br />
<a href="index.php?link=Forgot">Forgot Password</a>
</fieldset>
</form>
<?php Functions::__Login() ?>
なぜそれは言うのですか:
注意: 未定義の変数: 14 行目の ...\includes\glbLoginFunct.php の mysqli
致命的なエラー: 14 行目の ...\includes\glbLoginFunct.php の非オブジェクトに対するメンバ関数 prepare() の呼び出し