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

Linux, Apache, MySQL, PHP

 
AnswerRe: Passing variables to form in iframe Pin
Kyro Zetera2-Mar-11 6:09
Kyro Zetera2-Mar-11 6:09 
GeneralRe: Passing variables to form in iframe Pin
nickmaroulis21-Mar-11 14:08
nickmaroulis21-Mar-11 14:08 
Questionhow to use temporary values Pin
kennyhibs27-Feb-11 15:06
kennyhibs27-Feb-11 15:06 
AnswerRe: how to use temporary values Pin
Tony Richards27-Feb-11 23:55
Tony Richards27-Feb-11 23:55 
QuestionAccessing local machine from web page Pin
pstsp91127-Feb-11 3:56
pstsp91127-Feb-11 3:56 
AnswerRe: Accessing local machine from web page Repost Pin
Richard MacCutchan27-Feb-11 6:26
mveRichard MacCutchan27-Feb-11 6:26 
AnswerRe: Accessing local machine from web page Pin
nickmaroulis21-Mar-11 14:34
nickmaroulis21-Mar-11 14:34 
QuestionHelp me please...!!!........ Pin
Hapyak25-Feb-11 23:07
sussHapyak25-Feb-11 23:07 
AnswerRe: Help me please...!!!........ Pin
jschell26-Feb-11 14:12
jschell26-Feb-11 14:12 
QuestionPHP Proksy ! Pin
I Believe In GOD25-Feb-11 8:48
I Believe In GOD25-Feb-11 8:48 
AnswerRe: PHP Proksy ! Pin
Elham M26-Feb-11 21:18
Elham M26-Feb-11 21:18 
AnswerNice Day! Pin
vonguyenthanhlong31-Mar-11 16:40
vonguyenthanhlong31-Mar-11 16:40 
GeneralRe: Nice Day! Pin
I Believe In GOD1-Apr-11 12:30
I Believe In GOD1-Apr-11 12:30 
QuestionToolbar image Pin
Elham M25-Feb-11 3:40
Elham M25-Feb-11 3:40 
AnswerRe: Toolbar image Pin
Luc Pattyn25-Feb-11 4:18
sitebuilderLuc Pattyn25-Feb-11 4:18 
GeneralRe: Toolbar image Pin
Elham M26-Feb-11 21:38
Elham M26-Feb-11 21:38 
AnswerRe: Toolbar image Pin
Luc Pattyn26-Feb-11 23:20
sitebuilderLuc Pattyn26-Feb-11 23:20 
GeneralRe: Toolbar image Pin
dpuskaa1-Mar-11 9:04
dpuskaa1-Mar-11 9:04 
AnswerRe: Toolbar image Pin
Luc Pattyn1-Mar-11 9:15
sitebuilderLuc Pattyn1-Mar-11 9:15 
GeneralRe: Toolbar image Pin
dpuskaa2-Mar-11 8:45
dpuskaa2-Mar-11 8:45 
GeneralRe: Toolbar image Pin
Elham M3-Mar-11 4:10
Elham M3-Mar-11 4:10 
QuestionPython Pin
maliwar24-Feb-11 6:04
sussmaliwar24-Feb-11 6:04 
Questionrun once and insert twice in database Pin
nicholasng19-Feb-11 20:21
nicholasng19-Feb-11 20:21 
AnswerRe: run once and insert twice in database Pin
vicky8719-Feb-11 23:53
vicky8719-Feb-11 23:53 
Questiontrying to write a cookie Pin
MacRaider418-Feb-11 9:16
MacRaider418-Feb-11 9: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!!!

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.