Click here to Skip to main content
15,175,733 members
Home / Discussions / Linux, Apache, MySQL, PHP
   

Linux, Apache, MySQL, PHP

 
AnswerRe: Toolbar image Pin
Luc Pattyn1-Mar-11 10:15
sitebuilderLuc Pattyn1-Mar-11 10:15 
GeneralRe: Toolbar image Pin
dpuskaa2-Mar-11 9:45
Memberdpuskaa2-Mar-11 9:45 
GeneralRe: Toolbar image Pin
Elham M3-Mar-11 5:10
MemberElham M3-Mar-11 5:10 
QuestionPython Pin
maliwar24-Feb-11 7:04
sussmaliwar24-Feb-11 7:04 
AnswerMessage Closed Pin
22-Dec-20 22:19
MemberTechiesBlogging22-Dec-20 22:19 
Questionrun once and insert twice in database Pin
nicholasng19-Feb-11 21:21
Membernicholasng19-Feb-11 21:21 
AnswerRe: run once and insert twice in database Pin
vicky8720-Feb-11 0:53
Membervicky8720-Feb-11 0:53 
Questiontrying to write a cookie Pin
MacRaider418-Feb-11 10:16
MemberMacRaider418-Feb-11 10:16 
Subject is pretty self explanatory. This is what I have for code and then I'll try to explain it.
<?php
	echo "Login page";
?>
	<form action="rememberMe.php" method="post">
		<div style="width: 30em;">
			<label for="name">Please Enter Your Name:</label>
			<input type="text" name="name" id="name" value="" />
			<br />
			<label for="location">In what location do you work<br />(Portland/Brewer)?</label>
			<input type="text" name="location" id="location value="" />
			<div style="clear: both;">
				<input type="submit" name="sendInfo" value="sendInfo" />
			</div>
		</div>
	</form>

and then
<?php

$name = $_POST["name"];
$location = $_POST["location"];
$cookie = $name. "," . $location;
//echo $cookie;

setcookie( "thomasEmployee", $cookie, time() + 60 * 60 * 24 * 365), "/", ".linuxserver", false, true);

if (isset($_COOKIE['thomasEmployee'])) {
	var_dump($_COOKIE);
}
else {
	header( 'Location: index.html' ) ;
}

?>

This is the page where I'm trying to "write" the cookie. The name I'm trying to use for the cookie is thomasEmployee, using the variable I created ($cookie) to hold the value, setting it for a year (though I'm sure it'll get deleted before then), and the domain (part I'm not sure about) is linuxserver. This is for a intranet site, the url for the indexpage is typed linuxserver/index.html so I'm guessing the domain is linuxserver?

What I have right now doesn't seem to be writing anything as when I go to look for it, it's not there and when I try to get to my test page, it brings me right back to the login page.
<?php 
if (isset($_COOKIE["thomasEmployee"])) {
//	var_dump($_COOKIE);
}
else {
	header( 'Location: login.php' ) ;
}

?>
<html>
	<head>

That's the top of the page where I currently have it checking for the cookie.

I'm sure it's something stupid, so thanks in advance!!!
AnswerRe: trying to write a cookie Pin
Peter_in_278018-Feb-11 11:30
professionalPeter_in_278018-Feb-11 11:30 
GeneralRe: trying to write a cookie Pin
MacRaider419-Feb-11 2:46
MemberMacRaider419-Feb-11 2:46 
AnswerRe: trying to write a cookie Pin
Peter_in_278023-Feb-11 13:34
professionalPeter_in_278023-Feb-11 13:34 
GeneralRe: trying to write a cookie Pin
Al4224-Feb-11 5:48
MemberAl4224-Feb-11 5:48 
AnswerRe: trying to write a cookie Pin
Luc Pattyn24-Feb-11 6:24
sitebuilderLuc Pattyn24-Feb-11 6:24 
GeneralRe: trying to write a cookie Pin
MacRaider422-Mar-11 6:26
MemberMacRaider422-Mar-11 6:26 
AnswerRe: trying to write a cookie Pin
Tony Wright (UK)24-Feb-11 3:39
MemberTony Wright (UK)24-Feb-11 3:39 
Questionwhy i cound't access apple's server with php curl Pin
wjun1976121918-Feb-11 6:10
Memberwjun1976121918-Feb-11 6:10 
AnswerRe: why i cound't access apple's server with php curl Pin
Tom Chantler23-Feb-11 22:21
professionalTom Chantler23-Feb-11 22:21 
QuestionData normalization Pin
Mutugi from Nairobi14-Feb-11 21:14
MemberMutugi from Nairobi14-Feb-11 21:14 
AnswerRe: Data normalization Pin
Eddy Vluggen19-Feb-11 4:04
professionalEddy Vluggen19-Feb-11 4:04 
QuestionGetting google photo result by php Pin
ty-exexch-ko10-Feb-11 10:31
Memberty-exexch-ko10-Feb-11 10:31 
Questionmysql_query error Pin
komanche7-Feb-11 23:31
Memberkomanche7-Feb-11 23:31 
AnswerRe: mysql_query error Pin
Gerben Jongerius8-Feb-11 4:13
MemberGerben Jongerius8-Feb-11 4:13 
Questiondisplay query result in a table using PHP Pin
PermissionDenied6-Feb-11 21:10
MemberPermissionDenied6-Feb-11 21:10 
AnswerRe: display query result in a table using PHP Pin
Jules VDV9-Feb-11 5:56
MemberJules VDV9-Feb-11 5:56 
AnswerRe: display query result in a table using PHP Pin
Al4211-Feb-11 13:02
MemberAl4211-Feb-11 13:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.