WebsiteDays.com create your web site free, Hosting, Coding, E-commerce, Free Website Builder. Download free website builder to create your website! Personal, and ECommerce website builders...

WebsiteDays.com for france biarritz

Click on your region below to contact a Websitedays.com designer, or Websitedays.com sales person for info about Online Website builder system.

You can also send an email to

and we can forward your enquiry to respective designers in your area.

Agay Agen Aix-en-Provence
Aix-les-Bains Albertville Albi
Algajola Allevard Allinges
Allogny Ambert Amboise
Ambonnay Amiens Ammerschwihr
Ancenis Angers Angouleme
Annecy Annecy le Vieux Annemasse
Antibes Antony Apt
Arbois Archamps Archiac
Argeles-sur-Mer Argentat Argenteuil
Arlanc Arles Arpaillargues
Arras Ars-Laquenexy Artannes-sur-Indre
Asnieres Aubagne Aubervilliers
Aubiere Aubin Aubure
Aumont-Aubrac Auriac du Perigord Auribeau-sur-Siagne
Aurillac Aussois Auvillar
Avensan Avignon Avoriaz
Avranches Ax-les-Thermes Badefols-dAns
Bagneux Balaruc-les-Bains Bandol
Bar-Sur-Aube Barbizon Barcares Le
Barjac Barr Barre-de-Monts La
Baud Bayel Bayeux
Bayonne Baziege Bazoges-en-Pareds
Beaujeu Beaulieu-sur-Dordogne Beaumes-de-Venise
Beaune Beauvoir-sur-Mer Belfort
Belle-Ile-en-Mer Bellegarde sur Valserine Bellegarde-du-Razes
Bellevaux Bergerac Bergheim
Besancon Beynac Beynost
Beziers Bezouotte Biarritz
Bidart Biot Biron
Biscarrosse Blagnac Blere
Blois Boeschepe Bollene
Bondy Bonifacio Bons-en-Chablais
Bordeaux Bormes-les-Mimosas Boulogne
Boulogne-Billancourt Bourg-la-Reine Bourges
Bourgueil Brantome Bras
Brassac Brehemont Bresse La
Brest Breuil Le Brignoles
Brioude Brive Bugue Le
Buzet-sur-Baïse Cabanac Cabrieres-dAvignon
Caen Cagnes-sur-Mer Cagny
Cahors Calais Cambrai
Cambremer Camembert Cancale
Cannes Cantenac Cap-dAgde Le
Cap-dAil Carcassonne Carnac
Carnoux-en-Provence Carpentras Carquefou
Carros Cassis Castellane
Castelnau-de-Montmiral Castelsarrasin Castillon-la-Bataille
Cavaillon Cavalaire-sur-Mer Caylus
Cebazat Cerences Ceret
Cergy Cesson-Sevigne Cestas
Chablis Chalon-sur-Saone Chalons-en-Champagne
Chalus Chamalieres Chambery
Chambon-sur-Lignon Le Chamonix Champagne-Sur-Oise
Champagny-en-Vanoise Champigny-sur-Marne Champs-sur-Marne
Chaniers Chantilly Charolles
Chartres Chasseneuil Chateau-Chinon
Chateaubriant Chateaudun Chateauneuf-de-Gadagne
Chateauneuf-du-Pape Chateaurenard Chatel
Chatellerault Chatou Chaumont
Chenas Chennevieres-sur-Marne Chenoves
Cherbourg Cheylas Le Chigny-les-Roses
Chinon Civray Clairvaux-les-Lacs
Claix Clermont-Ferrand Clermont-lHerault
Clisson Cluny Cluses
Cognac Colle-sur-Loup La Collioure
Colmar Combloux Condom
Contamines-Montjoie Contrexville Corconne
Cordes-sur-Ceil Corte Cotignac
Coulaines Coulommiers Courbevoie
Courcelles de Touraine Courchevel Courneuve La
Cours-la-Ville Courseulles-sur-Mer Cramant
Cremieu Creon Creteil
Creutzwald Crillon le Brave Crolles
Cruet Cudos Curzay-sur-Vonne
Daglan Damery Deauville
Defense La Dieppe Dieulefit
Digne-les-Bains Dijon Dinan
Divonne-les-Bains Dizy Domevre-sur-Aviere
Douai Doue-la-Fontaine Draveil
Ducey Dunkerque Duras
Durtal Ecrosnes Ecueil
Ecully Epernay Epinal
Erbalunga Erstein Esperaza
Eugenie-les-Bains Evian Evreux
Evry Eze Faverges
Feilluns Felletin Ferrals-les-Montagnes
Ferte-Bernard La Foix Fondettes
Fontainebleau Fontcouverte-la-Toussuire Fontenay-sous-Bois
Forcalquier Foret Fouesnant La Forges
Fources Fourgs Les Fousseret Le
Frayssinet Frejus Furiani
Gaillac Galoubet Gap
Gardanne Garde La Garenne-Colombes La
Gassin Geispolsheim Genevraye La
Gennevilliers Gerardmer Geste
Gets Les Gevrey-Chambertin Ghisonaccia
Gif-sur-Yvette Giverny Golfe-Juan
Gordes Gramat Grand Pressigny
Grane Grasse Graulhet
Grenoble Guegon Gundershoffen
Haguenau Hardelot Havre Le
Haybes Heillecourt Herbiers Les
Hochfelden Hoerdt Honfleur
Hossegor Houilles Hourtin
Hyeres Ige Ile de Brehat
Illhaeusern Illzach Isle-sur-la-Sorgue
Issambres Les Issoire Issy-les-Moulineaux
Istres Jard-sur-Mer Jenlain
Joigny Jonvilliers Joue les Tours
Jouques Joyeuse Juan les Pins
LAigle Llle-Rousse La Bastide-Puylaurent
La Cadiere dAzur La Ciotat La Clusaz
La Ferte-Saint-Aubin La Grave La Madone
La Neuville-Aux-Larris La Rochelle La Rochepot
Labege Labruguiere Lacanau
Lagrave Lamalou-les-Bains Lamballe
Lambesc Lamotte-Beuvron Langeais
Langon Lanhelin Lapoutroie
Laudun-lArdoise Laurac-en-Vivarais Lauret
Laval Lege Lege-Cap-Ferret
Lens Les Houches Levallois-Perret
Ligre Lille Limeil-Brevannes
Limoges Lisle-sur-Tarn Loches
Locmariaquer Longueville Longwy
Lons-le-Saunier Lorcy Lorgues
Loudun Lourdes Lozanne
Luberon Ludon-Medoc Lunel
Lurais Luynes Lyon
Macon Mainxe Malakoff
Mandelieu la Napoule Manosque Mans Le
Marcq en Baroeul Margaux Marignane
Marlenheim Marnaz Marne-la-Vallee
Marseille Martel Massy
Matton-et-Clemency Maubourguet Maurepas
Mauroux Maussane les Alpilles Maylis
Megeve Meilhan-sur-Garonne Mende
Menerbes Menton Menuires Les
Mercurey Meribel Merignac
Messery Metz Meylan
Mieussy Miglos Mijoux
Millau Mirabel-aux-Baronnies Molsheim
Moncaret Monguilhem Mons-en-Baroeul
Montaigut-le-Blanc Montamel Montauroux
Montbrun-les-Bains Montceau-les-Mines Montelimar
Montfrin Montignac-Lascaux Montlhery
Montlouis-sur-Loire Montlucon Montmorillon
Montpellier Montreuil Seine-Saint-Denis Montreuil Pas-de-Calais
Morieres les Avignon Morlaix Morzine
Mougins Moustiers-Sainte-Marie Moux
Mouzillon Mulhouse Munster
Mur-de-Barrez Najac Nancy
Nanterre Nantes Narbonne
Nemours Neuf-Brisach Neufchateau
Neufchatel-en-Bray Neuilly-sur-Seine Neuvic
Neuville-en-Ferrain Nice Nimes
Niort Nissan-lez-Enserune Nogent-sur-Marne
Nolay Nuits Saint Georges Nyons
Obernai Olivet Oppede
Orange Orleans Orly
Orsay Orvault Osny
Ostwald Oullins Oyonnax
Paimpol Palaiseau Pamiers
Pantin Paris Parnac
Passy Pau Pauillac
Peisey-Nancroix Perpignan Pessac
Petite-Pierre La Peymeinade Peyrolles
Peyruis Peyzac-le-Moustier Pezenas
Pierrefeu-du-Var Pierrefitte-Nestalas Plagne La
Plazac Pleine-Fougeres Pleneuf-Val-Andre
Plombieres-les-Bains Plumaudan Poitiers
Pont Chateau Pont-de-Montvert Le Pontaumur
Pontgouin Pontivy Pontoise
Pontorson Port-Bail Port-de-Bouc
Port-Grimaud Portes-les-Valence Porto
Porto-Vecchio Pouilly-en-Auxois Prades
Premeaux-Prissey Propriano Puligny-Montrachet
Puteaux Quiberon Quillan
Quimper Rambouillet Ranton
Redorte La Reims Relecq-Kerhuon
Remaisnil Rennes Rennes-le-Chateau
Revel Ribeauville Riberac
Roanne Rocamadour Rocbaron
Roche-Bernard La Rochefort-en-Terre Rochefort-sur-Mer
Rognes Roissy-en-France Romaneche-Thorins
Ronchamp Roquebrune-Cap-Martin Roquebrune-sur-Argens
Roquefort-les-Pins Roscoff Roubaix
Rouen Rouffach Roujan
Roussillon Royat Rueil-Malmaison
Ruffec Rumilly Rungis
Ruoms Sables-dOlonne Les Sadirac
Saint Leons Saint Quentin en Yvelines Saint-Agreve
Saint-Amand-de-Coly Saint-Amans-Soult Saint-Aygulf
Saint-Barthelemy dAnjou Saint-Bauzeil Saint-Bertrand-de-Comminges
Saint-Bonnet-du-Gard Saint-Briac-sur-Mer Saint-Brieuc
Saint-Claude Saint-Cloud Saint-Cyr-en-Talmondais
Saint-Denis Saint-Disdier-en-Devoluy Saint-Emilion
Saint-Etienne Saint-Fargeau Saint-Florent
Saint-Flour Saint-Galmier Saint-Gaudens
Saint-Genis-de-Fontaines Saint-Germain-de-Belves Saint-Germain-en-Laye
Saint-Germain-sur-lArbresle Saint-Gervais Saint-Gervais-dAuvergne
Saint-Gilles Saint-Hilaire-de-Riez Saint-Hilaire-en-Lignieres
Saint-Jean-Cap-Ferrat Saint-Jean-de-Losne Saint-Jean-de-Maurienne
Saint-Jean-de-Sixt Saint-Jean-en-Royans Saint-Jean-Saverne
Saint-Jeannet Saint-Julien-en-Genevois Saint-Lary-Soulan
Saint-Laurent-de-Cerdans Saint-Laurent-du-Var Saint-Leu-la-Foret
Saint-Magne-de-Castillon Saint-Malo Saint-Mande
Saint-Martin-dArdeche Saint-Martin-de-Belleville Saint-Martin-Valmeroux
Saint-Matre Saint-Medard-en-Jalles Saint-Paul
Saint-Paul-de-Vence Saint-Paul-les-Trois-Chateaux Saint-Pons-de-Thomieres
Saint-Porchaire Saint-Quentin Saint-Raphael
Saint-Remy-de-Provence Saint-Romain Saint-Saturnin-les-Apt
Saint-Soupplets Saint-Victor-la-Coste Sainte Alvere
Sainte-Croix-du-Mont Sainte-Foy-la-Grande Sainte-Foy-Tarentaise
Sainte-Maure-de-Touraine Sainte-Maximin Saintes
Saisies Les Salignac-Eyvignes Sallanches
Salles-Curan Salon de Provence Salvagnac
Samoëns Sanary-sur-Mer Sancerre
Santenay Sarlat-la-Caneda Sarrians
Sartrouville Saugues Saulieu
Saumur Sausset-Les-Pins Sauvagnac
Saverne Savignac-les-eglises Scionzier
Seignelay Seillans Selestat
Semussac Senlis Sens
Serre-Chevalier Sete Sevres
Seyne-sur-Mer La Seyssuel Sezanne
Sierentz Sigy-le-Chatel Solenzara
Sophia Antipolis Soreze Sos
Soufflenheim Souillac Soulac-sur-Mer
Soulatge Soustons St Andre de Roquelongue
St Leon sur Vezere St Martin de Castillon St Tropez
St-Pierre-Quiberon St-Saens Strasbourg
Suevres Suresnes Tain-lHermitage
Taize Talence Talloires
Tarascon Tautavel Terraube
Thann Theoule-sur-Mer Thiers
Thieux Thor Le Thorens-Glieres
Tignes Tonneins Toul
Toulon Toulouse Touquet Le
Touquin Tours Tourtour
Treport Le Trinite-sur-Mer La Trouville
Troyes Turckheim Ulis Les
Uriage-les-bains Uzes Uztaritz
Val-dIsere Val-Thorens Valbonne
Valence Valflaunes Vallauris
Vallery Vallet Vallon-Pont-dArc
Vals-les-Bains Vannes Vanves
Varages Varenne-Saint-Hilaire La Vars
Vaucresson Vaulx-en-Velin Vauvert
Velizy-Villacoublay Vence Vendenheim
Venosc Vensat Ventabren
Ventron Vergisson Vergoncey
Vernon Versailles Verteillac
Vertus Vichy Villard-de-Lans
Villard-Reculas Ville Villefranche
Villefranche-de-Lauragais Villejuif Villemarechal
Villeneuve Villeneuve dAscq Villers-le-Lac
Villeurbanne Villie-Morgon Vincennes
Vinzelles Visan Vitry-sur-Seine
Vittel Voiron Vosne-Romanee
Vougeot Vouziers Voves
Wisembach

»   Developing State-enabled Applications With PHP

Article submitted in category: Web Design And Development
Tags: | session | php | cookie | cookies | user | file | website | id | handling | session file | session ha

Developing State-enabled Applications With PHP by: John L

Installment 1

Developing State-enabled Applications With PHP

When a user is browsing through a website and is surfing from one web page to another, sometimes the website needs to remember the actions (e.g. choices) performed by the user. For example, in a website that sells DVDs, the user typically browses through a list of DVDs and selects individual DVDs for check out at the end of the shopping session. The website needs to remember which DVDs the user has selected because the selected items needs to be presented again to the user when the user checks out. In other words, the website needs to remember the State - i.e. the selected items - of the user's browsing activities.

However, HTTP is a Stateless protocol and is ill-equipped to handle States. A standard HTML website basically provides information to the user and a series of links that simply directs the user to other related web pages. This Stateless nature of HTTP allows the website to be replicated across many servers for load balancing purposes. A major drawback is that while browsing from one page to another, the website does not remember the State of the browsing session. This make interactivity almost impossible.

In order to increase interactivity, the developer can use the session handling features of PHP to augment the features of HTTP in order to remember the State of the browsing session. The are basically 2 ways PHP does this:

Using cookies

Using Sessions

The next installment discusses how to manage sessions using cookies...

Installment 2

Cookies

Cookies are used to store State-information in the browser. Browsers are allowed to keep up to 20 cookies for each domain and the values stored in the cookie cannot exceed 4 KB. If more than 20 cookies are created by the website, only the latest 20 are stored. Cookies are only suitable in instances that do not require complex session communications and are not favoured by some developers because of privacy issues. Furthermore, some users disable support for cookies at their browsers.

The following is a typical server-browser sequence of events that occur when a cookie is used:

The server knows that it needs to remember the State of browsing session

The server creates a cookie and uses the Set-Cookie header field in the HTTP response to pass the cookie to the browser

The browser reads the cookie field in the HTTP response and stores the cookie

This cookie information is passed along future browser-server communications and can be used in the PHP scripts as a variable

PHP provides a function called setcookie() to allow easy creation of cookies. The syntax for setcookie is:

int setcookie(string name, [string val>, [int expiration_date>, [string path>, string domain, [int secure>)

The parameters are:

name - this is a mandatory parameter and is used subsequently to identify the cookie

value - the value of the cookie - e.g. if the cookie is used to store the name of the user, the value parameter will store the actual name - e.g. John

expiration_date - the lifetime of the cookie. After this date, the cookie expires and is unusable

path - the path refers to the URL from which the cookie is valid and allowed

domain - the domain the created the cookie and is allowed to read the contents of the cookie

secure - specifies if the cookie can be sent only through a secure connection - e.g. SSL enable sessions

The following is an example that displays to the user how many times a specific web page has been displayed to the user. Copy the code below (both the php and the html) into a file with the .php extension and test it out.

[?php

//check if the $count variable has been associated with the count cookie

if (!isset($count)) {

$count = 0;

} else {

$count++;

}

setcookie("count", $count, time()+600, "/", "", 0);

?>

[html>

[head>

[title>Session Handling Using Cookies[/title>

[/head>

[body>

This page has been displayed: [?=$count ?> times.

[/body>

[/html>

The next installment discusses how to manage sessions using PHP session handling functions with cookies enabled...

Installment 3

PHP Session Handling - Cookies Enabled

Instead of storing session information at the browser through the use of cookies, the information can instead be stored at the server in session files. One session file is created and maintained for each user session. For example, if there are three concurrent users browsing the website, three session files will be created and maintained - one for each user. The session files are deleted if the session is explicitly closed by the PHP script or by a daemon garbage collection process provided by PHP. Good programming practice would call for sessions to be closed explicitly in the script.

The following is a typical server-browser sequence of events that occur when a PHP session handling is used:

The server knows that it needs to remember the State of browsing session

PHP generates a sssion ID and creates a session file to store future information as required by subsequent pages

A cookie is generated wih the session ID at the browser

This cookie that stores the session ID is transparently and automatically sent to the server for all subsequent requests to the server

The following PHP session-handling example accomplishes the same outcome as the previous cookie example. Copy the code below (both the php and the html) into a file with the .php extension and test it out.

[?php

//starts a session

session_start();

//informs PHP that count information needs to be remembered in the session file

if (!session_is_registered("count")) {

session_register("count");

$count = 0;

}

else {

$count++;

}

$session_id = session_id();

?>

[html>

[head>

[title>PHP Session Handling - Cookie-Enabled[/title>

[/head>

[body>

The current session id is: [?=$session_id ?>

This page has been displayed: [?=$count ?> times.

[/body>

[/html>

A summary of the functions that PHP provides for session handling are:

boolean start_session() - initializes a session

string session_id([string id>) - either returns the current session id or specify the session id to be used when the session is created

boolean session_register(mixed name [, mixed ...>) - registers variables to be stored in the session file. Each parameter passed in the function is a separate variable

boolean session_is_registered(string variable_name) - checks if a variable has been previously registered to be stored in the session file

session_unregister(string varriable_name) - unregisters a variable from the session file. Unregistered variables are no longer valid for reference in the session.

session_unset() - unsets all session variables. It is important to note that all the variables remain registered.

boolean session_destroy() - destroys the session. This is opposite of the start_session function.

The next installment discusses how to manage sessions using PHP session handling functions when cookies are disabled...

Installment 4

PHP Session Handling - Without Cookies

If cookies are disabled at the browser, the above example cannot work. This is because although the session file that stores all the variables is kept at the server, a cookie is still needed at the browser to store the session ID that is used to identify the session and its associated session file. The most common way around this would be to explicitly pass the session ID back to the server from the browser as a query parameter in the URL.

For example, the PHP script generates requests subsequent to the start_session call in the following format:

http://www.yourhost.com/yourphpfile.php/PHPSESSID/[actual session ID>

The following are excerpts that illustrate the discussion:

Manually building the URL:

$url = "http://www.yoursite.com/yourphppage.php?PHPSESSID=" . session_id();

[a href="[?=$url ?>">Anchor Text[/a>

Building the URL using SID:

[a href="http://www.yoursite.com/yourphppage.php?[?=SID ?>">Anchor Text[/a>

About The Author

John L is the webmaster of http://www.bimmercenter.com..

daboss@bimmercenter.com

This article was posted on November 07, 2004