Guten Tag!
Ich habe mir folgende Klasse geschrieben:
PHP
<?php/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. *//** * Description of Functions * * @author L3nnart */class Functions { public function isUserCorrect($name, $pass) { $mysql = mysql_connect("localhost", "****", "****"); mysql_real_escape_string($name); mysql_real_escape_string($pass); if(mysql_num_rows(mysql_query("SELECT * FROM users WHERE name='$name' AND pass='$pass'")) == 0) { mysql_close($mysql); return FALSE; } else { mysql_close($mysql); return true; } } public function createInfoEntry($over, $text, $maker) { mysql_real_escape_string($maker); mysql_real_escape_string($over); mysql_real_escape_string($text); $mysql = mysql_connect("localhost", "****", "****"); $time = time(); if(mysql_query("INSERT INTO news (maker, text, over, time) VALUES ('$maker', '$text', '$over', $time")) { mysql_close($mysql); return TRUE; } else { mysql_close($mysql); return FALSE; } }}
Wenn ich nun mit folgendem Code darauf zugreifen möchte, bekomme ich einen Error:
PHP
<?php session_start();if(isset($_SESSION["user"])) { ?> <script> window.location = "http://nova-mc.de/admin.php"; </script> <?php} else { $class = new Functions(); if($class->isUserCorrect($_POST["login_name"], $_POST["login_pass"])) { ?> <script> window.location = "http://nova-mc.de/admin.php"; </script> <?php } else { ?> <script> window.location = "http://nova-mc.de/index.php#login"; </script> <?php }}?>
Wie kann ich das beheben?