| View previous topic :: View next topic |
| Author |
Message |
alexa-lol
Joined: 10 Mar 2006 Posts: 66
|
Posted: Fri Mar 10, 2006 5:49 am Cookie problem? help |
|
|
|
I dont know how to WRITE a cookie. I want that my cookie wuold remember which lenguage user chose. something like that
Select lenguege
Slovenian //this links to google.si
English //this links to google.com
Deutsch //this links to google.de
I wana that Cookie remembers this.
can anyone help me and write code, please
and if can he do it with rollover image. IMAGE1_OUT.jpg and IMAGE2_over for Slovenian lenguage etc.
help, I am newbi at this (site building) |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
|
alexa-lol
Joined: 10 Mar 2006 Posts: 66
|
Posted: Fri Mar 10, 2006 8:21 am |
|
|
|
| I dont know. |
|
alexa-lol
Joined: 10 Mar 2006 Posts: 66
|
Posted: Fri Mar 10, 2006 8:24 am |
|
|
|
I am going to install Linux Fedora Core 4 and then i will install what i am going to need? what do you recomend, I wanna to have that on my WebSite:
-html
+what i will need
and that is all
I am newbi at SiteBuilding, i am better at C++ and other stuff  |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
Posted: Fri Mar 10, 2006 9:21 am |
|
|
|
Here is an example of using a cookie in PHP
| Code: |
<?php
if(isset($_POST['Submit'])){
$lang = isset($_POST['lang'])? $_POST['lang'] : 'en';
$expire = strtotime("+5 years",time());
$path = '/';
$domain = '.domain.com'; // whatever your domain name is
setcookie("lang", $lang, $expire, $path, $domain);
header("Location: " . $_SERVER['PHP_SELF']);
}
if (isset($_COOKIE["lang"])){
$lang = $_COOKIE['lang'];
switch($lang){
case 'en':
$url = 'http://www.google.com';
break;
case 'fr':
$url = 'http://www.google.fr';
break;
}
header("Refresh: 5; URL=" . $url);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<?php
if (isset($_COOKIE["lang"])){
echo "You are set to " . $_COOKIE["lang"] . "!<br />Please wait while you are redirected";
}
else{
echo "No cookie set<br />";
}
?>
<form id="form1" name="form1" method="post" action="">
<p>
<label>
<input type="radio" name="lang" value="en" <?php ($lang == 'en')? print 'checked="checked"' : print ''; ?>/>
English</label>
<br />
<label>
<input type="radio" name="lang" value="fr" <?php ($lang == 'fr')? print 'checked="checked"' : print ''; ?>/>
French</label>
<br />
<input type="submit" name="Submit" value="Submit" />
</p>
</form>
</body>
</html>
|
|
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
|
alexa-lol
Joined: 10 Mar 2006 Posts: 66
|
Posted: Fri Mar 10, 2006 10:25 am |
|
|
|
ok good. tnx degsy.
1
Have you got any ideas how would i write this:
BACKGROUND
LENGUAGE BUTTONS->
->behind every Lenguage button a link to country site, and cookie which would memorise which country has USER selected and would Automaticly redirect him to country site
is this possible?
if it isnt, I have another idea
2
LOADING SCREEN
loading # # # # # 100%
and in this LOADING SCREEN there would be command to look at cookie?
bye
Last edited by alexa-lol on Fri Mar 10, 2006 11:34 am; edited 1 time in total |
|
degsy

Joined: 23 Feb 2005 Posts: 2440 Location: North East, UK
|
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8748 Location: Castle Pines North, CO USA
|
|
|