Hello, HashCode!
I want to add a variable to the cookie, but it gives an error. The php
code I used for this:
<?php session_start(); $val = "Хай"; setcookie("ref", $val); ?>
Mistake:
Warning: Cannot modify header information - headers already sent by (output started at Z:\home\ automatic.ru \www\index.php:9) in Z:\home\ automatic.ru \www\header.php on line 9
All code:
<html> <head> <?php session_start(); $elseref = $_GET["ref"]; if ($elseref != '') { $val = "Хай"; setcookie("ref", $val); } require("config.php"); if (isset($_SESSION["username"]) && isset($_SESSION["password"])) { $username = $_SESSION["username"]; $password = $_SESSION["password"]; $sql = mysql_query("SELECT * FROM t_user WHERE username = '$username' and pass = '$password'") or die(mysql_error()); $row = mysql_fetch_array($sql); $_SESSION["status"] = $row["status"]; } ?> </head> <body> <center><img src="img/logo.png" height="100"> </b></h1></center> <hr /> </body> </html>