Need help.
Nu tad lūk izmantoju madara php login kodu. https://coding.lv/read/php-mysql-login-skripts
Viss gāja labi, līdz man sāka rādīties šis -
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Documents and Settings\ServerServer\Desktop\fukzzs\mobile\index.php:1) in C:\Documents and Settings\ServerServer\Desktop\fukzzs\mobile\index.php on line 2
Redzams šeit:
http://fukzzs.info.tm/mobile/
Mans index fails.
<?php
session_start();
require('lib/class.mdb.php');
require('lib/class.auth.php');
$db = new mdb('root', '*******', '*****', 'localhost');
$auth = new Auth($db);
if (isset($_POST['username']) && isset($_POST['password'])) {
$auth->login($_POST['username'], $_POST['password']);
}
if (isset($_GET['logout'])) {
$auth->logout();
header('Location: index.php');
exit;
}
if ($auth->id) {
echo 'Čau, ' . $auth->username . '!<br />';
echo 'Tavs profils izveidots ' . $auth->created . '!<br />';
echo 'Tu te pēdējo reizi biji ' . $auth->accessed . '!<br />';
echo '<a href="?logout">Izlogoties?</a><br />';
} else {
?>
<html>
<head>
<LINK href="style.css" rel="stylesheet" type="text/css">
<meta name="viewport" content="width=device-width, initial-scale=3.0, maximum-scale=1.0, user-scalable=no" />
</head>
<body>
<center>
<div id="login">
<form action="" method="post">
<?php
if ($auth->error == 1) {
echo '<p><font color=red>Nepareizs logins un/vai parole!</font></p>';
}
?>
Vārds: <input type="text" name="username" /></br>
Parole: <input type="password" name="password" /> </br>
<input class="button" type="submit" value="Login" />
</form>
<div id="register"><a href="register.php">Reģistrēties</a> | <a href="#">Aizmirsi paroli?</a></div>
</div>
</center>
</body>
</html>
<?php
}
?>
Kas par vainu? Un kā to var salabot?
Fukzzs miniblogs
- 0
Fukzzs 11.12.2012. 16:25
- 0
Tev ir newline vai BOM simbols pirms <?php
Pirms session_start(); nedrīkst būt nekāds izvads. - 0
Man šī vieta
<?php
session_start();
staav pashaa faila sakumaa. nav nekāds newline.;/- 0
Tad pie vainas visticamāk ir https://en.wikipedia.org/wiki/Byte_order_mark
Kādu teksta redaktoru lieto?- 0
Parasto notepad nelieto. Viņš pieliek BOM UTF-8 faila sākumā un tas visu sačakarē.
Ielogojies vai izveido profilu, lai komentētu!