Ignore:
Timestamp:
Feb 19, 2004, 9:21:56 PM (20 years ago)
Author:
gweltas
Message:

Template migration

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/identification.php

    r364 r365  
    3737  $query = 'SELECT password';
    3838  $query.= ' FROM '.USERS_TABLE;
    39   $query.= " WHERE username = '".$_POST['login']."';";
     39  $query.= " WHERE username = '".$_POST['username']."';";
    4040  $row = mysql_fetch_array( mysql_query( $query ) );
    4141  if( $row['password'] == md5( $_POST['pass'] ) )
    4242  {
    43     $session_id = session_create( $_POST['login'] );
     43    $session_id = session_create( $_POST['username'] );
    4444    $url = 'category.php?id='.$session_id;
    4545    header( 'Request-URI: '.$url );
     
    6060include('include/page_header.php');
    6161
    62 $handle = $vtp->Open( './template/default/identification.vtp' );
    63 // language
    64 $vtp->setGlobalVar( $handle, 'ident_title',      $lang['ident_title'] );
    65 $vtp->setGlobalVar( $handle, 'login',            $lang['login'] );
    66 $vtp->setGlobalVar( $handle, 'password',         $lang['password'] );
    67 $vtp->setGlobalVar( $handle, 'submit',           $lang['submit'] );
    68 $vtp->setGlobalVar( $handle, 'ident_guest_visit',$lang['ident_guest_visit'] );
    69 $vtp->setGlobalVar( $handle, 'ident_register',   $lang['ident_register'] );
    70 $vtp->setGlobalVar( $handle, 'ident_forgotten_password',
    71                     $lang['ident_forgotten_password'] );
    72 // conf
    73 $vtp->setGlobalVar( $handle, 'mail_webmaster',   $conf['mail_webmaster'] );
    74 // user
    75 $vtp->setGlobalVar( $handle, 'user_template',    $user['template'] );
     62$template->set_filenames( array('identification'=>'identification.tpl') );
    7663initialize_template();
     64
     65$template->assign_vars(array(
     66  'MAIL_ADMIN' => $conf['mail_webmaster'],
     67
     68  'L_TITLE' => $lang['ident_title'],
     69  'L_USERNAME' => $lang['login'],
     70  'L_PASSWORD' => $lang['password'],
     71  'L_LOGIN' => $lang['submit'],
     72  'L_GUEST' => $lang['ident_guest_visit'],
     73  'L_REGISTER' => $lang['ident_register'],
     74  'L_FORGET' => $lang['ident_forgotten_password'],
     75 
     76  'T_STYLE' => $user['template'],
     77 
     78  'F_LOGIN_ACTION' => add_session_id('identification.php')
     79  ));
     80
    7781//-------------------------------------------------------------- errors display
    7882if ( sizeof( $errors ) != 0 )
    7983{
    80   $vtp->addSession( $handle, 'errors' );
    81   foreach ( $errors as $error ) {
    82     $vtp->addSession( $handle, 'li' );
    83     $vtp->setVar( $handle, 'li.li', $error );
    84     $vtp->closeSession( $handle, 'li' );
     84  $template->assign_block_vars('errors',array());
     85  for ( $i = 0; $i < sizeof( $errors ); $i++ )
     86  {
     87    $template->assign_block_vars('errors.error',array('ERROR'=>$errors[$i]));
    8588  }
    86   $vtp->closeSession( $handle, 'errors' );
    8789}
    88 //------------------------------------------------------------------ users list
    89 // retrieving all the users login
    90 $query = 'select username from '.USERS_TABLE.';';
    91 $result = mysql_query( $query );
    92 if ( mysql_num_rows ( $result ) < $conf['max_user_listbox'] )
    93 {
    94   $vtp->addSession( $handle, 'select_field' );
    95   while ( $row = mysql_fetch_array( $result ) )
    96   {
    97     if ( $row['username'] != 'guest' )
    98     {
    99       $vtp->addSession( $handle, 'option' );
    100       $vtp->setVar( $handle, 'option.option', $row['username'] );
    101       $vtp->closeSession( $handle, 'option' );
    102     }
    103   }
    104   $vtp->closeSession( $handle, 'select_field' );
    105 }
    106 else
    107 {
    108   $vtp->addSession( $handle, 'text_field' );
    109   $vtp->closeSession( $handle, 'text_field' );
    110 }
     90
    11191//-------------------------------------------------------------- visit as guest
    11292if ( $conf['access'] == 'free' )
    11393{
    114   $vtp->addSession( $handle, 'guest_visit' );
    115   $vtp->closeSession( $handle, 'guest_visit' );
    116 }
    117 //---------------------------------------------------------------- registration
    118 if ( $conf['access'] == 'free' )
    119 {
    120   $vtp->addSession( $handle, 'register' );
    121   $vtp->closeSession( $handle, 'register' );
     94  $template->assign_block_vars('free_access',array());
    12295}
    12396//----------------------------------------------------------- html code display
    124 $code = $vtp->Display( $handle, 0 );
    125 echo $code;
     97$template->pparse('identification');
    12698include('include/page_tail.php');
    12799?>
Note: See TracChangeset for help on using the changeset viewer.