function pwg_query($query) { global $conf, $page, $debug, $t2; $start = microtime(true); $result = mysql_query($query) or my_error($query, $conf['die_on_sql_error']); $time = microtime(true) - $start; if (!isset($page['count_queries'])) { $page['count_queries'] = 0; $page['queries_time'] = 0; } $page['count_queries']++; $page['queries_time'] += $time; if ($conf['show_queries']) { $output = ''; $output .= '<pre>[' . $page['count_queries'] . '] '; $output .= "\n" . $query; $output .= "\n" . '(this query time : '; $output .= '<b>' . number_format($time, 3, '.', ' ') . ' s)</b>'; $output .= "\n" . '(total SQL time : '; $output .= number_format($page['queries_time'], 3, '.', ' ') . ' s)'; $output .= "\n" . '(total time : '; $output .= number_format($time + $start - $t2, 3, '.', ' ') . ' s)'; if ($result != null and preg_match('/\\s*SELECT\\s+/i', $query)) { $output .= "\n" . '(num rows : '; $output .= mysql_num_rows($result) . ' )'; } elseif ($result != null and preg_match('/\\s*INSERT|UPDATE|REPLACE|DELETE\\s+/i', $query)) { $output .= "\n" . '(affected rows : '; $output .= mysql_affected_rows() . ' )'; } $output .= "</pre>\n"; $debug .= $output; } return $result; }
function connection_mysql($er_connec = 1, $my_bd = '', $bd = 1, $er_bd = 1) { global $opac_nb_documents; global $charset, $SQL_MOTOR_TYPE; global $charset, $SQL_MOTOR_TYPE, $time_zone, $time_zone_mysql; if (isset($time_zone) && trim($time_zone)) { date_default_timezone_set($time_zone); } //Pour l'heure PHP $my_connec = @pmb_mysql_connect(SQL_SERVER, USER_NAME, USER_PASS); if ($my_connec == 0 && $er_connec == 1) { die(my_error(0)); } if ($bd) { $my_bd == '' ? $my_bd = DATA_BASE : $my_bd; if (pmb_mysql_select_db($my_bd, $my_connec) == 0 && $er_bd == 1) { die(my_error(0)); } } $opac_nb_documents = @pmb_mysql_result(pmb_mysql_query("select count(*) from notices", $my_connec), 0, 0) * 1; if ($charset == 'utf-8') { pmb_mysql_query("set names utf8 ", $my_connec); } else { pmb_mysql_query("set names latin1 ", $my_connec); } if ($SQL_MOTOR_TYPE) { pmb_mysql_query("set storage_engine={$SQL_MOTOR_TYPE}", $my_connec); } if (isset($time_zone_mysql) && trim($time_zone_mysql)) { pmb_mysql_query("SET time_zone = {$time_zone_mysql}", $my_connec); } //Pour l'heure MySQL return $my_connec; }
if (Request::option('com') == 'copyconfig') { if (Request::option('copyinstid') && Request::option('copyconfigid')) { $config = ExternConfig::GetInstance(Request::option('copyinstid'), '', Request::option('copyconfigid')); $config_copy = $config->copy($range_id); my_msg(sprintf(_("Die Konfiguration wurde als \"%s\" nach Modul \"%s\" kopiert."), htmlReady($config_copy->getConfigName()), htmlReady($GLOBALS['EXTERN_MODULE_TYPES'][$config_copy->getTypeName()]['name'])), 'blank', 1, false); } else { Request::set('com',''); } } if (Request::option('com') == 'delete') { $config = ExternConfig::GetInstance($range_id, '', $config_id); if ($config->deleteConfiguration()) { my_msg(sprintf(_("Konfiguration <strong>\"%s\"</strong> für Modul <strong>\"%s\"</strong> gelöscht!"), htmlReady($config->getConfigName()), htmlReady($GLOBALS['EXTERN_MODULE_TYPES'][$config->getTypeName()]['name'])), 'blank', 1, false); } else { my_error(_("Konfiguration konnte nicht gelöscht werden")); } } echo "<tr><td class=\"blank\" width=\"100%\" valign=\"top\">\n"; if (Request::option('com') == 'delete_sec') { $config = ExternConfig::GetConfigurationMetaData($range_id, $config_id); $message = sprintf(_("Wollen Sie die Konfiguration <b>"%s"</b> des Moduls <b>%s</b> wirklich löschen?"), $config["name"], $GLOBALS["EXTERN_MODULE_TYPES"][$config["type"]]["name"]); $message .= '<br><br>'; $message .= LinkButton::createAccept("JA", URLHelper::getURL('?com=delete&config_id='.$config_id)); $message .= LinkButton::createCancel("NEIN", URLHelper::getURL('?list=TRUE&view=extern_inst')); my_info($message, "blank", 1); print_footer();
function parse_window($long_msg, $separator="§", $titel, $add_msg="") { if ($titel == "") $titel= _("Fehler"); if ($add_msg == "") $add_msg= sprintf(_("%sHier%s geht es zurück zur Startseite."), "<a href=\"index.php\"><em>", "</em></a>") . "<br>"; ?> <table border="0" bgcolor="#000000" align="center" cellspacing="0" cellpadding="2" width="70%"> <tr> <td class="table_header_bold"><b><? echo $titel?></b></td> </tr> <tr> <td class="blank"> </td> </tr> <?php $msg = explode ($separator,$long_msg); for ($i=0; $i < count($msg); $i=$i+2) { switch ($msg[$i]) { case "error" : my_error($msg[$i+1], "blank", 1); break; case "info" : my_info($msg[$i+1], "blank", 1); break; case "msg" : my_msg($msg[$i+1], "blank", 1); break; } } ?> <tr> <td class="blank"><?= $add_msg ?></td> </tr> </table> <? }
$res = mysql_query($sql); if ($rs=mysql_fetch_array($res)){ $user_id = $rs["id"]; } else { $sql="INSERT INTO users (nik) VALUES ('$user')"; debug($sql); mysql_query($sql); $user_id = mysql_insert_id(); if (!$user_id) my_error(); } // добавим МП если есть такое исправим $sql="SELECT * FROM masterplate WHERE tz_id='$tz' AND posintz='$posintz'"; debug($sql); $res = mysql_query($sql); if (mysql_num_rows($res) == 0){ $sql="INSERT INTO masterplate (tz_id,posintz,mpdate,user_id) VALUES ('$tz','$posintz','$mpdate','$user_id')"; debug($sql); mysql_query($sql); $mp_id = mysql_insert_id(); if (!$mp_id) my_error(); } else { $sql="UPDATE masterplate SET mpdate='$mpdate', user_id='$user_id' WHERE tz_id='$tz' AND posintz='$posintz'"; debug($sql); mysql_query($sql); $rs=mysql_fetch_array($res); $mp_id = $rs["id"]; } printf("%08d",$mp_id); ?>
/** * UAM specific database dump (only for MySql !) * Creates an SQL dump of UAM specific tables and configuration settings * * @returns : Boolean to manage appropriate message display * */ function UAM_dump($download) { global $conf; $plugin = PluginInfos(UAM_PATH); $version = $plugin['version']; // Initial backup folder creation and file initialisation // ------------------------------------------------------ if (!is_dir(UAM_PATH . '/include/backup')) { mkdir(UAM_PATH . '/include/backup'); } $Backup_File = UAM_PATH . '/include/backup/UAM_dbbackup.sql'; $fp = fopen($Backup_File, 'w'); // Writing plugin version $insertions = "-- " . $version . " --\n\n"; fwrite($fp, $insertions); // Saving UAM specific tables // -------------------------- $ListTables = array(USER_CONFIRM_MAIL_TABLE, USER_LASTVISIT_TABLE); $j = 0; while ($j < count($ListTables)) { $sql = 'SHOW CREATE TABLE ' . $ListTables[$j]; $res = pwg_query($sql); if ($res) { $insertions = "-- -------------------------------------------------------\n"; $insertions .= "-- Create " . $ListTables[$j] . " table\n"; $insertions .= "-- ------------------------------------------------------\n\n"; $insertions .= "DROP TABLE IF EXISTS " . $ListTables[$j] . ";\n\n"; $array = pwg_db_fetch_row($res); $array[1] .= ";\n\n"; $insertions .= $array[1]; $req_table = pwg_query('DESCRIBE ' . $ListTables[$j] . ';') or die(my_error()); $nb_fields = pwg_db_num_rows($req_table); $req_table2 = pwg_query('SELECT * FROM ' . $ListTables[$j]) or die(my_error()); while ($line = pwg_db_fetch_row($req_table2)) { $insertions .= 'INSERT INTO ' . $ListTables[$j] . ' VALUES ('; for ($i = 0; $i < $nb_fields; $i++) { $insertions .= '\'' . pwg_db_real_escape_string($line[$i]) . '\', '; } $insertions = substr($insertions, 0, -2); $insertions .= ");\n"; } $insertions .= "\n\n"; } fwrite($fp, $insertions); $j++; } // Saving UAM configuration // ------------------------ $insertions = "-- -------------------------------------------------------\n"; $insertions .= "-- Insert UAM configuration in " . CONFIG_TABLE . "\n"; $insertions .= "-- ------------------------------------------------------\n\n"; fwrite($fp, $insertions); $pattern = "UserAdvManager%"; $req_table = pwg_query('SELECT * FROM ' . CONFIG_TABLE . ' WHERE param LIKE "' . $pattern . '";') or die(my_error()); $nb_fields = pwg_db_num_rows($req_table); $nb_fields = $nb_fields - 1; // Fix the number of fields because pwg_db_num_rows() returns a bad number while ($line = pwg_db_fetch_row($req_table)) { $insertions = 'INSERT INTO ' . CONFIG_TABLE . ' VALUES ('; for ($i = 0; $i < $nb_fields; $i++) { $insertions .= '\'' . pwg_db_real_escape_string($line[$i]) . '\', '; } $insertions = substr($insertions, 0, -2); $insertions .= ");\n"; fwrite($fp, $insertions); } fclose($fp); // Download generated dump file // ---------------------------- if ($download == 'true') { if (@filesize($Backup_File)) { $http_headers = array('Content-Length: ' . @filesize($Backup_File), 'Content-Type: text/x-sql', 'Content-Disposition: attachment; filename="UAM_dbbackup.sql";', 'Content-Transfer-Encoding: binary'); foreach ($http_headers as $header) { header($header); } @readfile($Backup_File); exit; } } return true; }
echo "Каталог на диске К (для сверловок): <input type=text name=kdir size=50 value='".$rs["kdir"]."'><br>"; echo "<input type=button value='Сохранить' onclick=\"editrecord('customers',$('#editform').serialize())\"><input type=button value='Отмена' onclick='closeedit()'>"; } else { // сохрнение if ($edit) { // редактирование $sql = "UPDATE customers SET customer='$customer', fullname='$fullname', kdir='$kdir' WHERE id='$edit'"; mylog('customers',$edit,'UPDATE'); mylog($sql); } else { // добавление $sql = "INSERT INTO customers (customer,fullname,kdir) VALUES ('$customer','$fullname','$kdir')"; mylog($sql); } if (!mysql_query($sql)) { my_error("Не удалось внести изменения в таблицу customers!!!"); } else { echo "<script>updatetable('$tid','customers','');closeedit();</script>"; } } } elseif (isset($delete)) { // удаление $sql = "DELETE FROM customers WHERE id='$delete'"; mylog('customers',$delete); mysql_query($sql); // удаление связей // удалить и платы заказчика $sql = "SELECT * FROM plates WHERE customer_id='$delete'"; $res = mysql_query($sql); while ($rs=mysql_fetch_array($res)) { $sql = "DELETE FROM plates WHERE id='".$rs["id"]."'";
$sql="INSERT INTO sk_".$sklad."_dvizh_arc (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price) VALUES ('0','$numd','$numdf','$docyr','$id','$ost','$ddate','$post_id','$comment_id','0')" ; mylog1($sql); print $sql."<br>"; if(!mysql_query($sql)) my_error(); // создадим первое движение года // коментарий $sql="SELECT id FROM coments WHERE comment='Остаток на 31.12.$docyr'"; print $sql."<br>"; $res1 = mysql_query($sql); if ($rs1=mysql_fetch_array($res1)){ $comment_id = $rs1["id"]; } else { $sql="INSERT INTO coments (comment) VALUES ('Остаток на 31.12.$docyr')"; mylog1($sql); mysql_query($sql); $comment_id = mysql_insert_id(); if (!$comment_id) my_error(); } $docyr = date("Y"); $ddate = date("Y-m-d",mktime(0,0,0,1,1,$docyr)); $sql="INSERT INTO sk_".$sklad."_dvizh (type,numd,numdf,docyr,spr_id,quant,ddate,post_id,comment_id,price) VALUES ('1','$numd','$numdf','$docyr','$id','$ost','$ddate','$post_id','$comment_id','0')" ; mylog1($sql); print $sql."<br>"; if(!mysql_query($sql)) my_error(); } print "<script>window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."';</script>"; ?>
$spr_id = mysql_insert_id(); if(!$spr_id) my_error(); $sql="INSERT INTO sk_".$sklad."_ost (spr_id,ost) VALUES ($spr_id,'0')" ; } else { $sql="UPDATE sk_".$sklad."_spr SET nazv='$nazv', edizm='$edizm', krost='$krost' WHERE id='$edit'"; } mylog1($sql); if(!mysql_query($sql)) my_error(); print "<script>window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."';</script>"; } else { if($edit!=0) { $sql="SELECT * FROM sk_".$sklad."_spr WHERE id='".$edit."'"; $res=mysql_query($sql); if (!$rs=mysql_fetch_array($res)) my_error(); } print "<form action='' method=post>Наименование:<input size=50 type=text name=nazv value='".$rs["nazv"]."'><br>Единица измерения:<input type=text name=edizm value='".$rs["edizm"]."'><br>Критический остаток:<input type=text name=krost value='".$rs["krost"]."'><br><input type=submit name=submit value='Сохранить'><input type=button onclick='history.back()' value='Отмена'><input type=hidden name=edit value='$edit'></form>"; } } else { // вывести таблицу if(isset($view) & $view=='all') print "<center><a href='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."'>Первые 20</a>"; else print "<center><a href='?view=all'>Все</a>"; print "<form method=post action=''><input type=hidden name=action value='find'>Поиск:<input type=text name='ssrt' size=10><input type=hidden name=tz></form>"; print "<input type=button onclick=\"window.location='http://".$_SERVER['HTTP_HOST'].$GLOBALS["PHP_SELF"]."?edit=0'\" value='Добавить новый'><br>"; print "<form name=treb target=_blank method=post action='../treball.php'>"; include "trebformall.php"; print "<table width=100% border=1>";
debug($sql); mysql_query($sql); $user_id = mysql_insert_id(); if (!$user_id) my_error(); } // добавим if (!isset($ts)) $ts='NOW()'; else $ts="'$ts'"; $sql="INSERT INTO phototemplates (ts,user_id,filenames) VALUES ($ts,'$user_id','$filenames')"; debug($sql); mysql_query($sql); $filenames_id = mysql_insert_id(); if (!$filenames_id) my_error(); } else { // вывести таблицу print "<center><a href='?action=".($action=='all'?"'>Последние 20":"all'>Все")."</a></center><br><form method=post action=''><input type=hidden name=action value='find'>Поиск:<input type=text name='ssrt' size=10></form>"; print "<table class='listtable' cellspacing=0 cellpadding=0>"; print "<thead>"; print "<tr>"; print "<td>Дата - время</td><td>Кто добавил</td><td>Количество шаблонов и каталог</td>"; print "</tr>"; print "<tbody>"; $sql="SELECT *,unix_timestamp(ts) AS uts FROM phototemplates JOIN users ON phototemplates.user_id=users.id ".($action=='find'?"WHERE filenames LIKE '%$ssrt%'":"")."ORDER BY ts DESC ".($action=='all'?"":"LIMIT 20"); debug($sql); $res = mysql_query($sql);
echo "<br><input type=button value='Сохранить' onclick=\"editrecord('conductors',$('#editform').serialize())\"><input type=button value='Отмена' onclick='closeedit()'><input type=button onclick=\"alert($('#editform').serialize())\">"; echo "</form>"; } else { // сохранение if ($edit!=0) { $sql = "UPDATE conductors SET board_id='$plate_id', pib='$pib', side='$side', lays='$lays', user_id='$userid', ts=NOW() WHERE id='$edit'"; } else { $sql = "INSERT INTO conductors (board_id,pib,side,lays,user_id,ts) VALUES('$plate_id','$pib','$side','$lays','$userid',NOW())"; } if (!mysql_query($sql)) { my_error("Не удалось изменить Кондуктор"); } else { echo "<script>updatetable('$tid','conductors','');closeedit();</script>"; } } } elseif (isset($print)) { } else { // вывести таблицу // sql $sql="SELECT *,conductors.id FROM conductors JOIN (plates,customers) ON (conductors.board_id=plates.id AND plates.customer_id=customers.id ) WHERE ready='0' ".(isset($find)?"AND (plates.plate LIKE '%$find%')":"").($order!=''?" ORDER BY ".$order." ":" ORDER BY conductors.id DESC ").(isset($all)?"":"LIMIT 20");
<? if (!empty($new_account_cms)) { $output = ELearningUtils::getNewAccountForm($new_account_cms); } if ($messages["info"] != "") { echo "<table>"; my_info($messages["info"]); echo "</table>"; } if ($messages["error"] != "") { echo "<table>"; my_error($messages["error"]); echo "</table>"; } ?> <table cellpadding="10" cellspacing="01" border="0" width="100%"><tr><td> <? echo $output; if ($new_account_cms == "") { echo _("Hier können Sie nach Lernmodulen suchen."); ?> <br><br> <?
* @author Arne Schroeder <*****@*****.**> * @access public * @modulegroup export_modules * @module export_view * @package Export */ if (($o_mode != "direct") AND ($o_mode != "passthrough")) { // Start of Output PageLayout::setTitle($export_pagename); Navigation::activateItem('/tools/export'); ?> <? if (isset($export_error)) my_error($export_error); if (isset($export_msg)) my_msg($export_msg); if (isset($export_info)) my_info($export_info); ?> <? echo $export_pagecontent; if (isset($xml_printlink)) { ?> <table cellspacing="0" cellpadding="0" border="0" width="100%"> <tr> <? printhead ("99%", FALSE, "", "open", true, ' ' . $xml_printimage, $xml_printlink, $xml_printdesc);
function logout() { global $dbname; if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db("zaompp") ) my_error("Не удалось выбрать таблицу zaompp"); $sql="DELETE FROM session WHERE session='".$sessionid."'"; mysql_query($sql); if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db($dbname) ) my_error("Не удалось выбрать таблицу $dbname"); setcookie("sessionid","",time() - 3600,'/'); //echo $sql; //header('Location: http://'.$_SERVER['HTTP_HOST'].''); echo "<script>window.location='http://".$_SERVER['HTTP_HOST']."'</script>"; }
/** * Exports a Stud.IP-institute. * * This function gets the data of an institute and writes it into $data_object. * It calls one of the functions export_sem, export_pers or export_teilis and then output_data. * * @access public * @param string $inst_id Stud.IP-inst_id for export * @param string $ex_sem_id allows to choose if only a specific lecture is to be exported */ function export_inst($inst_id, $ex_sem_id = "all") { global $ex_type, $o_mode, $xml_file, $xml_names_inst, $xml_groupnames_inst, $INST_TYPE; $query = "SELECT * FROM Institute WHERE Institut_id = ?"; $statement = DBManager::get()->prepare($query); $statement->execute(array($inst_id)); $institute = $statement->fetch(PDO::FETCH_ASSOC); $data_object .= xml_open_tag($xml_groupnames_inst["object"], $institute['Institut_id']); while (list($key, $val) = each($xml_names_inst)) { if ($val == '') { $val = $key; } if ($key == 'type' && $INST_TYPE[$institute[$key]]['name'] != '') { $data_object .= xml_tag($val, $INST_TYPE[$institute[$key]]['name']); } elseif ($institute[$key] != '') { $data_object .= xml_tag($val, $institute[$key]); } } reset($xml_names_inst); $query = "SELECT Name, Institut_id, type\n FROM Institute\n WHERE Institut_id = ? AND fakultaets_id = Institut_id"; $statement = DBManager::get()->prepare($query); $statement->execute(array($institute['fakultaets_id'])); $faculty = $statement->fetch(PDO::FETCH_ASSOC); if ($faculty['Name'] != '') { $data_object .= xml_tag($xml_groupnames_inst["childobject"], $faculty['Name'], array('key' => $faculty['Institut_id'])); } // freie Datenfelder ausgeben $data_object .= export_datafields($inst_id, $xml_groupnames_inst["childgroup2"], $xml_groupnames_inst["childobject2"], 'inst', $faculty['type']); output_data($data_object, $o_mode); $data_object = ""; switch ($ex_type) { case "veranstaltung": export_sem($inst_id, $ex_sem_id); break; case "person": if ($ex_sem_id == "all") { export_pers($inst_id); } elseif ($GLOBALS['perm']->have_studip_perm('tutor', $ex_sem_id)) { export_teilis($inst_id, $ex_sem_id); } else { $data_object .= xml_tag("message", _("KEINE BERECHTIGUNG!")); } break; default: echo "</td></tr>"; my_error(_("Der gewählte Exportmodus wird nicht unterstützt.")); echo "</table></td></tr></table>"; die; } $data_object .= xml_close_tag($xml_groupnames_inst["object"]); output_data($data_object, $o_mode); $data_object = ""; }
// определим идентификатор позиции в тз $sql="SELECT id, numbers FROM posintz WHERE $wheresql AND posintz='$posintz'"; $rs=mysql_fetch_array(mysql_query($sql)); $posid = $rs[0]; $numbers=$rs[1]; // добавим или обновим $sql="SELECT * FROM lanch WHERE ".$wheresql." AND pos_in_tz='$posintz' AND part='$party'"; debug($sql); $res = mysql_query($sql); if (mysql_num_rows($res) == 0){ $sql="INSERT INTO lanch (ldate,board_id,part,numbz,numbp,comment_id,file_link_id,user_id,pos_in_tz,tz_id,pos_in_tz_id) VALUES ('$sl_date','$plate_id','$party','$numbz','$numbp','$comment_id','$file_id','$user_id','$posintz','$tz','$posid')"; debug($sql); mysql_query($sql); $lanch_id = mysql_insert_id(); if (!$lanch_id) my_error(); } else { $rs = mysql_fetch_array($res); $lanch_id = $rs["id"]; $sql="UPDATE lanch SET ldate='$sl_date', board_id='$plate_id', numbz='$numbz', numbp='$numbp', comment_id='$comment_id', user_id='$user_id', tz_id='$tz', pos_in_tz_id='$posid' WHERE id='".$rs["id"]."'"; debug($sql); mysql_query($sql); } printf("%08d",$lanch_id); $sql="DELETE FROM lanched WHERE board_id='$plate_id'"; mysql_query($sql); $sql="INSERT INTO lanched SELECT board_id,MAX(ldate),SUM(numbp) FROM `lanch` WHERE board_id='$plate_id' AND pos_in_tz_id='$posid' GROUP BY board_id"; mysql_query($sql); // если всё запущено закроем позицию $sql="SELECT SUM(numbp) FROM lanch WHERE pos_in_tz_id='$posid' GROUP BY pos_in_tz_id";
$block_id = $rs["block_id"]; } else { // не буду добавлять - данных нет и это делается в другом месте } // добавим МП если есть такое исправим $sql="SELECT * FROM posintz WHERE tz_id='$tz' AND posintz='$posintz'"; debug($sql); $res = mysql_query($sql); if (mysql_num_rows($res) == 0){ $sql="INSERT INTO posintz (tz_id,posintz,plate_id,board_id,block_id,numbers,first,srok,priem,constr,template_check,template_make,eltest,numpl,numbl,pitz_mater,pitz_psimat,comment_id) VALUES ('$tz','$posintz','$plate_id','$board_id','$block_id','$numbers','$first','$srok','$priem','$constr','$template_check','$template_make','$eltest','$numpl','$numbl','$textolite','$textolitepsi','$comment_id')"; debug($sql); mylog1($sql); mysql_query($sql); $pit_id = mysql_insert_id(); if (!$pit_id) my_error(); } else { $sql="UPDATE posintz SET numbers='$numbers', plate_id='$board_id',plate_id='$board_id', block_id='$block_id',first='$first',srok='$srok',priem='$priem',constr='$constr',template_check='$template_check',template_make='$template_make', eltest='$eltest', numpl='$numpl', numbl='$numbl', pitz_mater='$textolite', pitz_psimat='$textolitepsi', comment_id='$comment_id' WHERE tz_id='$tz' AND posintz='$posintz'"; debug($sql); mylog1($sql); mysql_query($sql); $rs=mysql_fetch_array($res); $pit_id = $rs["id"]; } // обновить запуски если некоторые позиции уже запускались $sql="SELECT * FROM lanch WHERE tz_id='$tz' AND pos_in_tz='$posintz'"; $res = mysql_query($sql); if($rs=mysql_fetch_array($res)) { $sql="UPDATE lanch SET pos_in_tz_id='$pit_id' WHERE id='".$rs["id"]."'";
break; } my_msg("User \"{$username}\" changed.<BR>"); } break; case "u_kill": // Do we have permission to do so? if (!$perm->have_perm("admin")) { my_error("You do not have permission to delete users."); break; } // Delete that user. $query = "delete from auth_user where user_id='{$u_id}' and username='******'"; $db->query($query); if ($db->affected_rows() == 0) { my_error("<b>Failed:</b> {$query}"); break; } my_msg("User \"{$username}\" deleted.<BR>"); break; default: if (debug == 1) { printf("default switch: u_id: .{$u_id}. <br>"); } break; } } /* Output user administration forms, including all updated information, if we come here after a submission... */ function showPassRecord($db)
</title> </head> <body > <? echo "<div class=sun id=sun><img onclick=showuserswin() title='Admin здесь' src=/picture/sun.gif></div>"; echo '<div class="glavmenu" onclick="window.location=\'http://'.$_SERVER['HTTP_HOST'].'/\';">Главное меню</div>'; $mes = "<div class='soob'>"; if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db("zaompp") ) my_error("Не удалось выбрать таблицу zaompp"); $sqlquery = "SELECT *, (YEAR(NOW())-YEAR(dr)) as let FROM workers WHERE DAYOFYEAR(dr)>= DAYOFYEAR(CURRENT_DATE()) AND DAYOFYEAR(dr)<= (DAYOFYEAR(CURRENT_DATE())+4) ORDER BY DAYOFYEAR(dr)"; $res = mysql_query($sqlquery); if (isset($dbname) && $dbname!="zaompp" && !mysql_select_db($dbname) ) my_error("Не удалось выбрать таблицу $dbname"); while ($rs=mysql_fetch_array($res)) { $dr = true; $mes .= "<div>День рождения - ".$rs["fio"]." - ".$rs["dr"]." - ".$rs["let"]." лет</div>"; } $mes .= "</div>"; if (isset($dr)) print $mes; // цитаты баша //echo file_get_contents("http://computers/getbashlocal.php?$bash"); include $GLOBALS["DOCUMENT_ROOT"]."/getbashlocal.php"; ?>
include PHPWG_ROOT_PATH . 'include/dblayer/functions_' . $conf['dblayer'] . '.inc.php'; if (isset($conf['show_php_errors']) && !empty($conf['show_php_errors'])) { @ini_set('error_reporting', $conf['show_php_errors']); @ini_set('display_errors', true); } include PHPWG_ROOT_PATH . 'include/constants.php'; include PHPWG_ROOT_PATH . 'include/functions.inc.php'; include PHPWG_ROOT_PATH . 'include/template.class.php'; include PHPWG_ROOT_PATH . 'include/cache.class.php'; include PHPWG_ROOT_PATH . 'include/Logger.class.php'; $persistent_cache = new PersistentFileCache(); // Database connection try { pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']); } catch (Exception $e) { my_error(l10n($e->getMessage()), true); } pwg_db_check_charset(); load_conf_from_db(); $logger = new Logger(array('directory' => PHPWG_ROOT_PATH . $conf['data_location'] . $conf['log_dir'], 'severity' => $conf['log_level'], 'filename' => 'log_' . date('Y-m-d') . '_' . sha1(date('Y-m-d') . $conf['db_password']) . '.txt', 'globPattern' => 'log_*.txt', 'archiveDays' => $conf['log_archive_days'])); if (!$conf['check_upgrade_feed']) { if (!isset($conf['piwigo_db_version']) or $conf['piwigo_db_version'] != get_branch_from_version(PHPWG_VERSION)) { redirect(get_root_url() . 'upgrade.php'); } } ImageStdParams::load_from_db(); session_start(); load_plugins(); // users can have defined a custom order pattern, incompatible with GUI form if (isset($conf['order_by_custom'])) { $conf['order_by'] = $conf['order_by_custom'];
/** * PH specific database dump * Creates an SQL dump of history table for safety before manual prune * * @returns : Boolean to manage appropriate message display * */ function PH_dump($download) { global $conf; $plugin = PHInfos(PH_PATH); $version = $plugin['version']; // Initial backup folder creation and file initialisation // ------------------------------------------------------ if (!is_dir(PH_PATH . '/include/backup')) { mkdir(PH_PATH . '/include/backup'); } $Backup_File = PH_PATH . '/include/backup/PH_Historybackup.sql'; $fp = fopen($Backup_File, 'w'); // Writing plugin version $insertions = "-- " . $version . " --\n\n"; fwrite($fp, $insertions); // Saving History table // -------------------- $ListTables = array(HISTORY_TABLE); $j = 0; while ($j < count($ListTables)) { $sql = 'SHOW CREATE TABLE ' . $ListTables[$j]; $res = pwg_query($sql); if ($res) { $insertions = "-- -------------------------------------------------------\n"; $insertions .= "-- Create " . $ListTables[$j] . " table\n"; $insertions .= "-- ------------------------------------------------------\n\n"; $insertions .= "DROP TABLE IF EXISTS " . $ListTables[$j] . ";\n\n"; $array = pwg_db_fetch_row($res); $array[1] .= ";\n\n"; $insertions .= $array[1]; $req_table = pwg_query('DESCRIBE ' . $ListTables[$j] . ';') or die(my_error()); $nb_fields = pwg_db_num_rows($req_table); $req_table2 = pwg_query('SELECT * FROM ' . $ListTables[$j]) or die(my_error()); while ($line = pwg_db_fetch_row($req_table2)) { $insertions .= 'INSERT INTO ' . $ListTables[$j] . ' VALUES ('; for ($i = 0; $i < $nb_fields; $i++) { $insertions .= '\'' . pwg_db_real_escape_string($line[$i]) . '\', '; } $insertions = substr($insertions, 0, -2); $insertions .= ");\n"; } $insertions .= "\n\n"; } fwrite($fp, $insertions); $j++; } fclose($fp); // Download generated dump file // ---------------------------- if ($download == 'true') { if (@filesize($Backup_File)) { $http_headers = array('Content-Length: ' . @filesize($Backup_File), 'Content-Type: text/x-sql', 'Content-Disposition: attachment; filename="PH_Historybackup.sql";', 'Content-Transfer-Encoding: binary'); foreach ($http_headers as $header) { header($header); } @readfile($Backup_File); exit; } } return true; }
function upgrade_db_connect() { global $conf; try { pwg_db_connect($conf['db_host'], $conf['db_user'], $conf['db_password'], $conf['db_base']); pwg_db_check_version(); } catch (Exception $e) { my_error(l10n($e->getMessage()), true); } }
$sql="SELECT max(pos_in_order) FROM tz WHERE order_id='$order_id'"; debug($sql); $res = mysql_query($sql); if ($rs=mysql_fetch_array($res)) { $pos_in_order = $rs[0]+1; } else { $pos_in_order = 1; } // добавим ТЗ если есть такое добавим вторую позицию - типа ДПП1 ДПП2 и т.д. $sql="SELECT * FROM tz WHERE file_link_id='$file_id'"; debug($sql); $res = mysql_query($sql); if (!$rs=mysql_fetch_array($res)){ $sql="INSERT INTO tz (order_id,tz_date,user_id,pos_in_order,file_link_id) VALUES ('$order_id','$tz_date','$user_id','$pos_in_order','$file_id')"; debug($sql); mysql_query($sql); $tz_id = mysql_insert_id(); if (!$tz_id) my_error(); } else { $sql="DELETE FROM posintz WHERE tz_id='".$rs["id"]."'"; debug($sql); mysql_query($sql); $sql="UPDATE tz SET order_id='$order_id', tz_date='$tz_date', user_id='$user_id' WHERE file_link_id='$file_id'"; debug($sql); mysql_query($sql); //$rs=mysql_fetch_array($res); $tz_id = $rs["id"]; } printf("%08d",$tz_id); ?>