aboutsummaryrefslogtreecommitdiffstats
path: root/profile.php
diff options
context:
space:
mode:
authorz0rglub <z0rglub@piwigo.org>2003-07-27 08:24:10 +0000
committerz0rglub <z0rglub@piwigo.org>2003-07-27 08:24:10 +0000
commit45a8139acdc9a175f8f8e1536d42fa36bc57ff4c (patch)
treedf7b51fc1b5063cdbcd46856cd16d0dacc28acd7 /profile.php
parent4e775187b8d054835b179ff136ccd5ad5393711f (diff)
optional cookie identification
git-svn-id: http://piwigo.org/svn/trunk@45 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'profile.php')
-rw-r--r--profile.php31
1 files changed, 29 insertions, 2 deletions
diff --git a/profile.php b/profile.php
index 7a47783a5..6d7cf557c 100644
--- a/profile.php
+++ b/profile.php
@@ -103,13 +103,18 @@ if ( isset( $_POST['submit'] ) )
$query.= ';';
mysql_query( $query );
}
+ if ( $_POST['create_cookie'] == 1 )
+ {
+ setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
+ cookie_path() );
+ }
// redirection
$url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
if ( $page['cat'] == 'search' )
{
$url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
}
- $url = add_session_id( $url, true );
+ if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true );
header( 'Request-URI: '.$url );
header( 'Content-Location: '.$url );
header( 'Location: '.$url );
@@ -121,7 +126,7 @@ $vtp = new VTemplate;
$handle = $vtp->Open( './template/'.$user['template'].'/profile.vtp' );
initialize_template();
$tpl = array( 'customize_page_title','customize_title','password','new',
- 'reg_confirm','submit' );
+ 'reg_confirm','submit','create_cookie' );
templatize_array( $tpl, 'lang', $handle );
//----------------------------------------------------------------- form action
$url = './profile.php?cat='.$page['cat'].'&amp;expand='.$page['expand'];
@@ -340,6 +345,28 @@ if ( in_array( 'show_nb_comments', $infos ) )
$vtp->closeSession( $handle, 'group' );
$vtp->closeSession( $handle, 'line' );
}
+//--------------------------------------------------------------- create cookie
+if ( $conf['authorize_cookies'] )
+{
+ $vtp->addSession( $handle, 'cookie' );
+ $options = array(
+ array( 'message' => '1 '.$lang['customize_day'],
+ 'value' => time() + 24*60*60 ),
+ array( 'message' => '1 '.$lang['customize_week'],
+ 'value' => time() + 7*24*60*60 ),
+ array( 'message' => '1 '.$lang['customize_month'],
+ 'value' => time() + 30*24*60*60 ),
+ array( 'message' => '1 '.$lang['customize_year'],
+ 'value' => time() + 365*24*60*60 )
+ );
+ foreach ( $options as $option ) {
+ $vtp->addSession( $handle, 'expiration_option' );
+ $vtp->setVar( $handle, 'expiration_option.option', $option['message'] );
+ $vtp->setVar( $handle, 'expiration_option.value', $option['value'] );
+ $vtp->closeSession( $handle, 'expiration_option' );
+ }
+ $vtp->closeSession( $handle, 'cookie' );
+}
//----------------------------------------------------------- html code display
$code = $vtp->Display( $handle, 0 );
echo $code;