Changeset 45 for trunk/profile.php


Ignore:
Timestamp:
Jul 27, 2003, 10:24:10 AM (21 years ago)
Author:
z0rglub
Message:

optional cookie identification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/profile.php

    r26 r45  
    104104      mysql_query( $query );
    105105    }
     106    if ( $_POST['create_cookie'] == 1 )
     107    {
     108      setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'],
     109                 cookie_path() );
     110    }
    106111    // redirection
    107112    $url = 'category.php?cat='.$page['cat'].'&expand='.$_GET['expand'];
     
    110115      $url.= '&search='.$_GET['search'].'&mode='.$_GET['mode'];
    111116    }
    112     $url = add_session_id( $url, true );
     117    if ( $_POST['create_cookie'] != 1 ) $url = add_session_id( $url, true );
    113118    header( 'Request-URI: '.$url ); 
    114119    header( 'Content-Location: '.$url ); 
     
    122127initialize_template();
    123128$tpl = array( 'customize_page_title','customize_title','password','new',
    124               'reg_confirm','submit' );
     129              'reg_confirm','submit','create_cookie' );
    125130templatize_array( $tpl, 'lang', $handle );
    126131//----------------------------------------------------------------- form action
     
    341346  $vtp->closeSession( $handle, 'line' );
    342347}
     348//--------------------------------------------------------------- create cookie
     349if ( $conf['authorize_cookies'] )
     350{
     351  $vtp->addSession( $handle, 'cookie' );
     352  $options = array(
     353    array( 'message' => '1 '.$lang['customize_day'],
     354           'value' => time() + 24*60*60 ),
     355    array( 'message' => '1 '.$lang['customize_week'],
     356           'value' => time() + 7*24*60*60 ),
     357    array( 'message' => '1 '.$lang['customize_month'],
     358           'value' => time() + 30*24*60*60 ),
     359    array( 'message' => '1 '.$lang['customize_year'],
     360           'value' => time() + 365*24*60*60 )
     361    );
     362  foreach ( $options as $option ) {
     363    $vtp->addSession( $handle, 'expiration_option' );
     364    $vtp->setVar( $handle, 'expiration_option.option', $option['message'] );
     365    $vtp->setVar( $handle, 'expiration_option.value', $option['value'] );
     366    $vtp->closeSession( $handle, 'expiration_option' );
     367  }
     368  $vtp->closeSession( $handle, 'cookie' );
     369}
    343370//----------------------------------------------------------- html code display
    344371$code = $vtp->Display( $handle, 0 );
Note: See TracChangeset for help on using the changeset viewer.