Posted by:
Nevon
(---.01-77-73766c10.cust.bredbandsbolaget.se)
Yes, my files are outside of wamp/www folder. However, it's not accessing the files that is the problem. Nor is it because of short_open_tags.
This is what appears on the top of my sites:
"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at D:\Webbdesign\common.php:1) in D:\Webbdesign\common.php on line 3
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\Webbdesign\common.php:1) in D:\Webbdesign\common.php on line 3
Warning: Cannot modify header information - headers already sent by (output started at D:\Webbdesign\common.php:1) in D:\Webbdesign\common.php on line 80"
This is the top of each site in PHP:
"<?php
require_once('../common.php');
checkUser();
?>"
And this is the content of the file called common.php:
"<?php
session_start();
function registerUser($user,$pass1,$pass2){
$errorText = '';
// Check passwords
if ($pass1 != $pass2)
$errorText = "Passwords are not identical!";
elseif (strlen($pass1) < 6)
$errorText = "Password is to short!";
// Check user existance
$pfile = fopen("userpwd.txt","a+"

;
rewind($pfile);
while (!feof($pfile)) {
$line = fgets($pfile);
$tmp = explode(':', $line);
if ($tmp[0] == $user) {
$errorText = "The selected user name is taken!";
break;
}
}
// If everything is OK -> store user data
if ($errorText == ''){
// Secure password string
$userpass = md5($pass1);
fwrite($pfile, "rn$user:$userpass"

;
}
fclose($pfile);
return $errorText;
}
function loginUser($user,$pass){
$errorText = '';
$validUser = false;
// Check user existance
$pfile = fopen("userpwd.txt","r"

;
rewind($pfile);
while (!feof($pfile)) {
$line = fgets($pfile);
$tmp = explode(':', $line);
if ($tmp[0] == $user) {
// User exists, check password
if (trim($tmp[1]) == trim(md5($pass))){
$validUser= true;
$_SESSION['userName'] = $user;
}
break;
}
}
fclose($pfile);
if ($validUser != true)
$errorText = "Invalid username or password!";
if ($validUser == true) $_SESSION['validUser'] = true;
else $_SESSION['validUser'] = false;
return $errorText;
}
function logoutUser(){
unset($_SESSION['validUser']);
unset($_SESSION['userName']);
}
function checkUser(){
if ((!isset($_SESSION['validUser']))
|| ($_SESSION['validUser'] != true)){
header('Location: ../index.php');
}
}
?>"
I hope this helps in clearing things up, because right now I am considering ditching Wamp and manually installing apache and PHP. Wamp works great otherwise, but this problem is really getting annoying.