"; //print_r($_COOKIE); //print ""; $session_id=session_id(); $ip_address=$_SERVER['REMOTE_ADDR']; $query="select * from $kirjautumistaulu where session_id='$session_id' and ip_address='$ip_address' and cookie='".fs_clean_var_for_db($cook)."' and logged='logged_in'"; //print $query; $result=mysql_query($query); if(@mysql_num_rows($result)==1){ db_query("update $kirjautumistaulu set last_used=now(), logout=now(), logged='logged_out' where session_id='$session_id' and ip_address='$ip_address' and cookie='".fs_clean_var_for_db($cook)."'"); } // TODO tarkista miten sessio ja cookie päätetään //unset($_COOKIE['hamis_cookie']); if(isset($_COOKIE[COOKIE_NAME]))setcookie(COOKIE_NAME,"",time()-500000); session_unset(); $_SESSION=array(); session_destroy(); session_start(); session_regenerate_id(); header("Location: index.php"); exit(); } function vk_tulosta_login_formi() { // global $outbuff; $output .= "





"; $output .= "
"; $output .= "
"; $output .= "Kirjaudu verkkokauppaan"; $output .= "
"; $output .= "
"; $output .= "

"; $output .= ""; $output .= ""; $output .= ""; $output .= ""; $output .= ""; $output .= ""; $output .= ""; $output .= ""; $output .= "
Tunnus
Salasana
"; $output .= "
"; $output .= "
"; $output .= "
"; $output .= " "; $output .= "
"; $output .= "
"; $output .= "
Rekisteröidy   Salasana unohtunut?
"; $output .= "




"; $output .= "
"; $GLOBALS['output']['body_contenthead'] .= $output; } function vk_give_client_ip() { return $_SERVER['REMOTE_ADDR']; } ?> elementin action */ function create_form($data,$form_info,$form_act,$noform=false) { // global $outbuff; //print"noform=".$noform; if(empty($form_act['onsubmit']))$form_act['onsubmit']=""; $form=""; if(!$noform)$form.="
"; $form.=""; $textarea_default_size="rows=6 cols=40"; $textbox_default_size="size=30"; // print_r($form_info); if(!empty($form_info)){ while (list($a, $b) = each($form_info)) { // print "data=".$a.",values=".print_r($b); // print_r($b); if(empty($b['id']))$value=$a; else $value=$b['id']; $label=$b['label']; if(!empty($b['size']) && isset($b['size']))$textbox_default_size="size=".$b['size'].""; if($b['form_ignore']==true)continue; if(empty($data[$value]))$data[$value]=$b['default']; switch($b['type']) { case 'text': $form.=""; break; case 'select': //print_r($data); $form.=""; break; case 'checkbox': //print $val." ".$data[$value]; //print_r($data); //print_r($form_info[$value]); //print_r($form_info); $form.= ""; // foreach($b['default'] as $val) // { if($data[$value]['default']==1)$form.=""; else if(empty($data[$value]['default']) && $form_info[$value]['default']==1){ $form.=""; } else $form.=""; // } $form.= ""; break; case 'hidden': $form.=""; // TODO tarvitseeko hiddenin olla taulun solussa? break; case 'visible': $form.=""; $form.=""; break; case 'password': if($b['required']==false)$form.=""; else $form.=""; break; case 'textarea': $form.=""; break; case 'file': $form.=""; break; case 'radiobutton': $form.=""; break; case 'submit': $form.=""; break; //case 'checkbox': // if($label==0) $form.=""; //else $form.=""; // break; } $textbox_default_size="size=30"; } } $form.="
$label
$label
$label
$label$data[$value]
$label
$label
$label
$label
$label
"; if(!$noform)$form.="
"; return $form; } ?>