/** * Nothing needs to be supplied to this function because everything is taken * care of internally. This function authenticates the input and starts a * session for the user if the credentials supplied are correct. * * @return boolean * @since 1.1 * @version 0.2 */ public function authenticate() { $pseudo = trim($this->input->post('pseudo')); $password = trim($this->input->post('password')); $u = $this->db->select('user_id, password, current_login')->from('user')->where('pseudo', $pseudo)->get()->row(); if($u) { if($u->password === $this->encrypt->sha1($password)) { $this->session->set_userdata('user_id', $u->user_id); $this->db ->where('user_id', $u->user_id) ->update('user', array('current_login'=>date_mysql(), 'last_login'=>$u->current_login)); return TRUE; } return FALSE; } return FALSE; }
function show_mysql_date() { $this->load->helper('date'); echo "Curent date in Mysql format" . date_mysql(); }
<?php include 'config.php'; include 'db_functions.php'; extract($_GET); $from = date_mysql($from); $to = date_mysql($to); $sql = "select * from base where 1 "; if ($postcode != "") { $sql .= "and `mail_zip` = '{$postcode}' "; } if ($fes_id != "") { $sql .= "and `fe` = '{$fes_id}' "; } if ($dv != "") { $sql .= "and `dv` = '{$dv}' "; } if ($batch != "") { $sql .= "and `batch_code` = '{$batch}' "; } if ($ivr != "") { $sql .= "and `ivr_flag` = '{$ivr}' "; } if ($time_taken != "") { $time_for = "0" . $time_taken; if ($time_for > 9) { $time_for = intval($time_for) . ":00:00"; } else { $time_for = $time_for . ":00:00"; } $sql .= "and TIMEDIFF( `ivr_accepted_timestamp` , `upload_date_time` ) > TIME( '{$time_for}' )";
private function _prep() { if($this->prenom === '' AND $this->_row) $this->prenom = $this->_row->prenom; if($this->nom === '' AND $this->_row) $this->nom = $this->_row->nom; $this->_data = array( 'nom' => verify_case($this->nom), 'prenom' => verify_case($this->prenom), 'updated_at' => date_mysql() ); }
<?php session_start(); include 'config.php'; extract($_GET); $_SESSION['master_date'] = date_mysql($date); echo 1;
{ $content.=l("Keine Menüpunkte vorhanden."); } } } else { $menues = $db->get_results('SELECT * FROM menus WHERE menu_ts_delete IS NULL AND menu_id <> "0";'); include('inc_tpls/menues.tpl.php'); $content.= $tpl_menues_tablehead; foreach($menues as $menu) { $creator = ' von '.getUsername($menu->menu_id_create); $created = '<b>'.l('Erstellt').':</b> <br />'.date_mysql($menu->menu_ts_create, "d.m.y, H:i").' '.l('Uhr'); if($menu->menu_ts_update != '') { $change = '<br /><br /><b>'.l('Letzte Änderung').': </b><br />'.date_mysql($menu->menu_ts_update, "d.m.y, H:i").' '.l('Uhr'); $changer = ' von '.getUsername($menu->menu_id_update); } else { $change = ''; $changer = ''; } include('inc_tpls/menues.tpl.php'); $content.= $tpl_menues_tablelist; } /*$content.= " </table><br /><br /> <b>Seiten-Untermenü:</b><br />".$tpl_menues_tablehead; $menu->menu_id = '0'; $menu->menu_name = 'Untermenüs (Seitenspezifisch)';
function date_segments($sData = NULL) { if ($sData === NULL) { $sData = date_mysql(); } $segments = explode('-', $sData, 3); if (count($segments) < 3) { return FALSE; } $an = intval($segments[0]); if (strlen($an) != 4) { return FALSE; } $luna = intval($segments[1]); if ($luna < 1 || $luna > 12) { return FALSE; } $zi = intval($segments[2]); if ($zi < 1 || $zi > days_in_month($luna, $an)) { return FALSE; } return array($an, $luna, $zi); }
include('inc_tpls/pages.tpl.php'); $content.= $tpl_page_tablehead; foreach($pages as $pagess) { $creator = ' von '.getUsername($pagess->page_author); if($pagess->page_ts_update != '') { $change = '<br /><br /><b>Letzte Änderung: </b><br />'.date_mysql($pagess->page_ts_update, "d.m.y, H:i").' Uhr'; $changer = ' von '.getUsername($pagess->page_id_update); } else { $change = ''; $changer = ''; } $created = "<b>Erstellt:</b> <br />".date_mysql($pagess->page_ts_create, "d.m.y, H:i")." Uhr".$creator." ".$change.$changer; $page_plugin = $db->get_var('SELECT plugin_name FROM plugins INNER JOIN plugin2page ON plugin2page.plugin_id = plugins.plugin_id WHERE plugin2page.page_id = '.$pagess->page_id.';'); if($pagess->page_loginrequired == '1') { $login_ico_color = "color"; $login_ico_title = 'Seite ist nur eingeloggten Nutzern zugänglich'; } else { $login_ico_color = "gray"; $login_ico_title = 'Seite ist jedem zugänglich'; } if($pagess->page_comments == '1') { $comment_ico_color = "color"; $comment_ico_title = 'Kommentare erlaubt'; } else {
if($users->user_mobile == '0') $users->user_mobile = ''; include('inc_tpls/users.tpl.php'); $content.= $tpl_users_form2; } else { $users = $db->get_results('SELECT * FROM users WHERE user_ts_delete IS NULL;'); include('inc_tpls/users.tpl.php'); $content.= $tpl_users_tablehead; foreach($users as $userss) { $creator = ' von '.getUsername($userss->user_id_create); $created = '<b>Erstellt:</b> <br />'.date_mysql($userss->user_ts_create, "d.m.y, H:i").' Uhr'; if($userss->user_ts_update != '') { $change = '<br /><br /><b>Letzte Änderung: </b><br />'.date_mysql($userss->user_ts_update, "d.m.y, H:i").' Uhr'; $changer = ' von '.getUsername($userss->user_id_update); } else { $change = ''; $changer = ''; } if($userss->user_active == '1') { $user_active_color = 'color'; $user_active_title ='Benutzer ist aktiviert'; } else { $user_active_color = 'gray'; $user_active_title ='Benutzer ist nicht aktiviert'; } include('inc_tpls/users.tpl.php');
<?php session_start(); include 'config.php'; include 'db_functions.php'; $userid = $_SESSION['user_id']; extract($_POST); $date_of_joining = date_mysql($date_of_joining); $date_of_relieving = date_mysql($date_of_relieving); $insert_fes_sql = "INSERT INTO `fes` (`fes_name` ,`fes_mobile_no` ,`date_of_joining`,`date_of_relieving` ,`password` )VALUES ('{$fes_name}', '{$fes_mobile_no}', '{$date_of_joining}', '{$date_of_relieving}', '{$password}')"; mysql_query($insert_fes_sql); //Event 4 = inserted $affected_id = mysql_insert_id(); $description = " New Fes Created"; insert_log($userid, 4, 'fes', $affected_id, $description); ?> <script> <?php if ($from_base == 1) { ?> window.top.window.fes_inserted("<?php echo $fes_name; ?> "); <?php } else { ?> window.top.window.manage_fes(); <?php }
public function __construct($params) { extract($params); $this->_date = date_mysql(); //called from the MY_date_helper.php file $this->_u_id = $u_id; }
public function index() { $date = date_mysql(); $this->load->library('data', array('u_id'=>1)); //Creating the tables $this->db->trans_start(); $this->db->query("CREATE TABLE `user` ( `user_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `pseudo` varchar(20) NOT NULL, `password` char(40) NOT NULL, `email` varchar(255) NOT NULL, `gender` char(1) NOT NULL DEFAULT 'm', `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, `current_login` datetime DEFAULT NULL, `last_login` datetime DEFAULT NULL, PRIMARY KEY (`user_id`), UNIQUE KEY `Index_2` (`pseudo`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `auteur` ( `auteur_id` int(11) unsigned NOT NULL auto_increment, `nom` varchar(75) NOT NULL, `prenom` varchar(75) default NULL, `surnom` varchar(75) default NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`auteur_id`), UNIQUE KEY `nom` (`nom`,`prenom`), CONSTRAINT `FK_auteur_1` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_auteur_2` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `livre` ( `livre_id` int(11) unsigned NOT NULL auto_increment, `titre` varchar(250) NOT NULL, `sous_titre` varchar(250) default NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`livre_id`), UNIQUE KEY `titre` USING BTREE (`titre`,`sous_titre`), CONSTRAINT `FK_livre_1` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_livre_2` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `auteur_livre` ( `auteur_id` int(10) unsigned NOT NULL, `livre_id` int(10) unsigned NOT NULL, `ordre` smallint(5) unsigned NOT NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`auteur_id`,`livre_id`,`ordre`), CONSTRAINT `FK_auteur_livre_1` FOREIGN KEY (`auteur_id`) REFERENCES `auteur` (`auteur_id`) ON UPDATE CASCADE, CONSTRAINT `FK_auteur_livre_2` FOREIGN KEY (`livre_id`) REFERENCES `livre` (`livre_id`) ON UPDATE CASCADE, CONSTRAINT `FK_auteur_livre_3` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_auteur_livre_4` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `exemplaire` ( `livre_id` int(10) unsigned NOT NULL, `exemplaire` smallint(5) unsigned NOT NULL, `volume` smallint(5) unsigned default NULL, `pages` smallint(5) unsigned default NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`livre_id`,`exemplaire`), CONSTRAINT `FK_exemplaire_1` FOREIGN KEY (`livre_id`) REFERENCES `livre` (`livre_id`) ON UPDATE CASCADE, CONSTRAINT `FK_exemplaire_2` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_exemplaire_3` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `role` ( `role_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `role_name` varchar(45) NOT NULL, `description` varchar(45) DEFAULT NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`role_id`), UNIQUE KEY `name_unique` (`role_name`), CONSTRAINT `FK_role_1` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_role_2` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `role_user` ( `user_id` int(10) unsigned NOT NULL, `role_id` int(10) unsigned NOT NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`user_id`,`role_id`) USING BTREE, CONSTRAINT `FK_role_user_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_role_user_2` FOREIGN KEY (`role_id`) REFERENCES `role` (`role_id`) ON UPDATE CASCADE, CONSTRAINT `FK_role_user_3` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_role_user_4` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `cours` ( `cours_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `cours_nom` varchar(55) NOT NULL, `type` char(2) NOT NULL, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`cours_id`), UNIQUE KEY `Index_2` (`cours_nom`), CONSTRAINT `FK_cours_1` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_cours_2` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; "); $this->db->query("CREATE TABLE `cours_date` ( `cours_id` int(10) unsigned NOT NULL, `type` varchar(10) NOT NULL, `year` int(4) unsigned NOT NULL, `month` int(2) unsigned NOT NULL, `day` int(2) unsigned NOT NULL, `hour` int(1) unsigned NOT NULL, `ordre` smallint(5) unsigned NOT NULL DEFAULT 0, `count` int(10) unsigned NOT NULL DEFAULT 0, `created_by` int(10) unsigned NOT NULL, `updated_by` int(10) unsigned NOT NULL, `created_at` datetime NOT NULL, `updated_at` datetime NOT NULL, PRIMARY KEY (`cours_id`,`type`,`year`,`month`,`day`,`hour`,`ordre`) USING BTREE, CONSTRAINT `FK_cours_date_1` FOREIGN KEY (`cours_id`) REFERENCES `cours` (`cours_id`) ON UPDATE CASCADE, CONSTRAINT `FK_cours_date_2` FOREIGN KEY (`created_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE, CONSTRAINT `FK_cours_date_3` FOREIGN KEY (`updated_by`) REFERENCES `user` (`user_id`) ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; "); $this->db->trans_complete(); if( ! $this->db->trans_status())exit('There was problem creating the tables. Please verify the settings'); //Creating the users and inserting them into the proper table $user_data[0] = (object) array( 'pseudo' => 'admin', 'password' => 'password', 'email' => '*****@*****.**' ); foreach($user_data as $r) { $this->db->set('pseudo', $r->pseudo); $this->db->set('password', $this->encrypt->sha1($r->password)); $this->db->set('email', $r->email); $this->db->set('gender', 'm'); if( ! $this->db->insert('user', $this->data->prep()))exit('There was a problem adding the user :o('); } //Creating the roles and inserting them into the proper table $role_data[0] = (object) array( 'name' => 'Administrateur' ); $role_data[1] = (object) array( 'name' => 'Administration' ); $role_data[2] = (object) array( 'name' => 'Library' ); foreach($role_data as $r) { $this->db->set('role_name', $r->name); if( ! $this->db->insert('role', $this->data->prep()))exit('There was a problem adding the role :o('); } //Creating the relationships between the users and their roles $role_user[0] = (object) array( 'user_id' => 1, 'role_id' => 1 ); $role_user[1] = (object) array( 'user_id' => 1, 'role_id' => 2 ); $role_user[2] = (object) array( 'user_id' => 1, 'role_id' => 3 ); foreach($role_user as $r) { $this->db->set('user_id', $r->user_id); $this->db->set('role_id', $r->role_id); if( ! $this->db->insert('role_user', $this->data->prep()))exit('There was a problem assigning the roles :o('); } //Creating the initial class name $this->db->set('cours_id', 2); $this->db->set('cours_nom', 'Pause Café'); $this->db->set('type', 'y'); if( ! $this->db->insert('cours', $this->data->prep()))exit('There was a problem adding the class name :o('); echo "<html><head><meta http-equiv='refresh' content='2; URL=".base_url()."' /><title>Success!</title></head><body>The tables have been successfully created and populated.</body></html>"; }
<th style="width:30px;"> </th> <th style="width:25px">ID</th> <th>Titel</th> <th style="width:60px;">Autor</th> <th style="width:60px;"> </th> </tr>'; foreach($news as $new) { $creator = ' von '.getUsername($new->plugin_news_id_create); if($new->plugin_news_ts_update != '') { $change = '<br /><br /><b>Letzte Änderung: </b><br />'.date_mysql($pagess->plugin_news_ts_update, "d.m.y, H:i").' Uhr'; $changer = ' von '.getUsername($new->plugin_news_id_update); } $created = "<b>Erstellt:</b> <br />".date_mysql($new->plugin_news_ts_create, "d.m.y, H:i")." Uhr".$creator." ".$change.$changer; $content.= ' <tr> <td><a href="?action=plugins&plugin=news&edit='.$new->plugin_news_id.'" title="News bearbeiten">'.icon('edit', '2').'</a></td> <td>'.$new->plugin_news_id.'</td> <td style="text-align:left"><b>'.$new->plugin_news_title.'</b></td> <td><span class="miniprofile" rel="'.$new->plugin_news_id_create.'">'.getUsername($new->plugin_news_id_create).'</span></td> <td> <span title="'.$created.'">'.icon('info', '2').'</span> <span title="'.l('News löschen').'" onclick="deleteData(\'plugin_news\', '.$new->plugin_news_id.')">'.icon('delete', '2').'</span> </td> </tr>'; } $content.= '</table>';
<?php session_start(); include 'config.php'; include 'db_functions.php'; $userid = $_SESSION['user_id']; extract($_POST); $dob = date_mysql($dob); //$date_of_joining = date_mysql($date_of_joining); if ($device_name != "") { mysql_query("UPDATE `device` SET `device_imei`= '{$device_imei}',`device_name` = '{$device_name}',`device_number` = '{$device_number}' WHERE `id` = '{$device_id}'"); $affected_id = $device_id; $description = $device_name . " Updated"; insert_log($userid, 5, 'device', $affected_id, $description); } ?> <script> window.top.window.document.getElementById('add_user_td').innerHTML ="<br><b>Device updated Successfully</b><br><br><small>Redirecting in 3 secs...</small>"; window.top.window.setTimeout('manage_device()',1000); </script>
function mclose() { if (opener) { opener.window.document.location.reload(); opener.window.focus(); } window.close(); } </script> <body onLoad="window.focus()" bgcolor="#716b49"> <?php $visibled = isset($visibled) ? 'Y' : 'N'; if (@$post == 1) { require_once '../f_msg.php'; $pdate = date_mysql($pdate); $sql = "update as_board set person_id = '{$person_id}', name = '{$name}', email = '{$email}', pdate = '{$pdate}', memo = '{$memo}', visibled = '{$visibled}' where id = {$id}"; $result = @mysql_query($sql); if ($result) { msg('Информация', "<a href='#' onClick='mclose()'>Информация успешно сохранена</a>", 'info'); die; } else { msg('Ошибка', "!!! Ошибка сохранения запроса !!!", 'error'); die; } } else { # Запрос информации $sql = "select id, person_id, name, email, date_format(pdate, '%d.%m.%Y') as pdate, memo, visibled from as_board where id = {$id}"; $result = mysql_query($sql); $row = mysql_fetch_object($result); ?>
public function show_mysql_date() { $this->load->helper('date'); //this loads boths the original and the new one echo "Current date in mysql format " . date_mysql(); }
<th style="width:30px;"> </th> <th style="width:25px">ID</th> <th style="width:150px">Name</th> <th>Beschreibung</th> <th style="width:60px;"> </th> </tr>'; foreach($gallerys as $gallery) { $creator = ' von '.getUsername($gallery->plugin_gallery_id_create); if($gallery->plugin_gallery_ts_update != '') { $change = '<br /><br /><b>Letzte Änderung: </b><br />'.date_mysql($gallery->plugin_gallery_ts_update, "d.m.y, H:i").' Uhr'; $changer = ' von '.getUsername($gallery->plugin_gallery_id_update); } $created = "<b>Erstellt:</b> <br />".date_mysql($gallery->plugin_gallery_ts_create, "d.m.y, H:i")." Uhr".$creator." ".$change.$changer; $content.= ' <tr> <td><a href="?action=plugins&plugin=gallery&edit='.$gallery->plugin_gallery_id.'" title="Galerie bearbeiten">'.icon('edit', '2').'</a></td> <td>'.$gallery->plugin_gallery_id.'</td> <td style="text-align:left"><b>'.$gallery->plugin_gallery_name.'</b></td> <td>'.$gallery->plugin_gallery_description.'</td> <td> <span title="'.$created.'">'.icon('info', '2').'</span> <span title="'.l('Galerie löschen').'" onclick="deleteData(\'plugin_gallery\', '.$gallery->plugin_gallery_id.')">'.icon('delete', '2').'</span> </td> </tr>'; } $content.= '</table>';