When Im on my localhost SQL, it works. But now when I uploaded it to my clients SQL, it doesent. When I log in, it supposed to redirect to edit.php, after it has checked from database whether the name and password are correct or not, but it stays blank. Im out of ideas what to do, because it does work on my localhost sql.
Where I login, login form, (login.php)
<?php
include_once("logikinnitus.php");
session_start();
if(isset($_SESSION['logged']))
{
header('Refresh: 2; URL=http://www.heakohv.ee/fava/admin/edit.php');
echo "olete juba sisse logitud!";
}else {
if (isset($_POST["submit"])){
$name = $_POST["user"];
$pass = $_POST["pass"];
$object = new User();
$object -> login($name, $pass);
}
?>
<html>
<head></head>
<body>
<form method="post" action="login.php">
Username: <input type="text" name="user"/>
Password: <input type="password" name="pass"/>
<input type="submit" name="submit" value="login">
</form>
<?php
}
?>
</body>
</html>
Where I check if the password and user are correct (logikinnitus.php)
<?php
include_once("connection.php");
Class User {
private $db;
public function __construct(){
$this->db = new Connection();
$this->db = $this->db->dbConnect();
}
public function login($name, $pass){
if(!empty($name) && !empty($pass)){
$st = $this -> db -> prepare("select * from users where name=? and pass=?");
$st -> bindParam(1, $name);
$st -> bindParam(2, $pass);
$st -> execute();
if($st -> rowCount() == 1){
session_start();
$_SESSION['logged'] = true;
echo "Olete edukalt sisse logitud";
header('URL=http://www.heakohv.ee/fava/admin/edit.php');
exit();
}
else{
echo "Parool või kasutajanimi on vale";
}
}
else{
echo "Palun täida kõik väljad!";
}
}
}
?>
connect php, (connection.php)
<?php
class Connection{
public function dbConnect(){
return new PDO("mysql:host=host; dbname=name", "pass", "");
}
}
?>
Warning I get when error report turned on.
Warning: session_start() [function.session-start]: open(/home/la02/16840949/tmp/sess_46e83b3c6e65b60a68dd14f525bd92a5, O_RDWR) failed: No such file or directory (2) in /home/la02/16840949/admin/login.php on line 6
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/la02/16840949/admin/connection.php:3) in /home/la02/16840949/admin/login.php on line 6
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/la02/16840949/admin/connection.php:3) in /home/la02/16840949/admin/login.php on line 6
Warning: Unknown: open(/home/la02/16840949/tmp/sess_46e83b3c6e65b60a68dd14f525bd92a5, O_RDWR) failed: No such file or directory (2) in Unknown on line 0
Warning: Unknown: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (/home/la02/16840949/tmp) in Unknown on line 0
If I add session.save_path"folder" it doesnt bring even my login form up anymore... I see only blank page from the beginning, even no errors –
Any questions, feel free to ask.
echoing before redirecting to edit.php?<?php error_reporting(E_ALL); ini_set('display_errors',1); .../home/la02/16840949/tmpexists and has write privileges. If that is not the correct location, you should update the tmp folder location in your php.ini filesession.save_path