SESSION or GET?
Posted: Sun Mar 14, 2010 5:48 am
Which is better?
This..
Or this..?
Where am I getting at? I want the URL to be secure from manipulation. The site I am making should prevent users from jumping or skipping pages.
This..
Code: Select all
<a href="forms.php?act=add&cat=venue">Add Venue</a>
// Once clicked, will go to the said page and...
URL: forms.php?act=add&cat=venue
<?php
if($_GET['act'] == 'add' && $_GET['cat'] == 'venue') {
// code here
}
?>
Code: Select all
<a href="controller.php?act=add&cat=venue">Add Venue</a>
// Once clicked, will go to the said page and...
URL: controller.php?act=add&cat=venue
<?php
if(isset($_GET['act']) && isset($_GET['cat'])) {
$_SESSION['act'] = $_GET['act'];
$_SESSION['cat'] = $_GET['cat'];
header('Location: form.php');
}
?>
// Will be redirected to this page..
URL: form.php
<?php
if($_SESSION['act'] == 'add' && $_SESSION['cat'] == 'venue') {
// code here
}
?>