Jump to content

Some quick help.


Demonic

Recommended Posts

Well im converting all my cookies to sessions for security reasons imo, but when i add session_start() at the head of my config file I get errors:

 


Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/nbb/public_html/131/config.php:1) in /home/nbb/public_html/131/config.php on line 2

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/nbb/public_html/131/config.php:1) in /home/nbb/public_html/131/config.php on line 2

 

 

	<?php
				session_start();

	?>
	<?php
					mysql_connect("localhost","*******","********") or die(mysql_error());
					mysql_select_db("********") or die(mysql_error());
					/*
					$cookieid = htmlspecialchars($_COOKIE[uid]);
					$cookiepass = htmlspecialchars($_COOKIE[upass]);
					*/

					if(isset($_SESSION['uid'])){
					$session_id = htmlspecialchars($_SESSION['uid']);
					$session_pass = htmlspecialchars($_SESSION['upass']);
						$logged = mysql_query("SELECT * FROM `users` WHERE `id` = '$session_id' AND `password` = '$session_pass' ");
						$logged = mysql_fetch_array($logged);

					}
					if(!isset($session_id)){
						$logged = array();
						$logged['dskin'] = "2";

					};
					/*
					if((!$cookieid) || (!$cookiepass)){
						$logged = array();
						$logged['dskin'] = "2";
						$logged['username'] = "Guest";
					}else{

						$logged = mysql_query("SELECT * FROM users WHERE id='$cookieid' AND password='$cookiepass' ");
						$logged = mysql_fetch_array($logged);
					}
					*/
				?>

Link to comment
https://forums.phpfreaks.com/topic/37001-some-quick-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.