当前位置: 首页>>代码示例>>PHP>>正文


PHP SQLInsert函数代码示例

本文整理汇总了PHP中SQLInsert函数的典型用法代码示例。如果您正苦于以下问题:PHP SQLInsert函数的具体用法?PHP SQLInsert怎么用?PHP SQLInsert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SQLInsert函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: EndMeasure

/**
* Ending measurement
*
* Ending measurement of time for specified block
*
* @param string $mpoint monitoring block name
*/
function EndMeasure($mpoint, $save_to_db = 0)
{
    global $perf_data;
    if (!$perf_data[$mpoint]['START']) {
        return;
    }
    $perf_data[$mpoint]['END'] = getmicrotime();
    if (!$perf_data[$mpoint]['MEMORY_END'] && function_exists('memory_get_usage')) {
        $perf_data[$mpoint]['MEMORY_END'] = memory_get_usage();
    }
    $perf_data[$mpoint]['TIME'] += $perf_data[$mpoint]['END'] - $perf_data[$mpoint]['START'];
    $perf_data[$mpoint]['NUM']++;
    return;
    if ($save_to_db) {
        global $db;
        if ($db->dbh) {
            $rec = array();
            $rec['OPERATION'] = substr($mpoint, 0, 200);
            $rec['COUNTER'] = 1;
            $rec['TIMEUSED'] = $perf_data[$mpoint]['TIME'];
            $rec['ADDED'] = date('Y-m-d H:i:s');
            if ($_SERVER['REQUEST_URI']) {
                $rec['SOURCE'] = 'web';
            } else {
                $rec['SOURCE'] = 'cmd';
            }
            SQLInsert('performance_log', $rec);
        }
    }
}
开发者ID:vasvlad,项目名称:majordomo,代码行数:37,代码来源:perfmonitor.class.php

示例2: InsertClient

function InsertClient($nom, $prenom, $mail, $tel, $dateNaiss, $mdp, $numAdr, $rueAdr, $villeAdr, $codePostal)
{
    // On insère l'utilisateur dans 'user' avec le champ 'fonction' à 0
    $sql = "INSERT INTO user(nom,prenom,mail,mdp,telephone,dateNaissance,fonction,numeroADR,rueADR,villeADR,codePostal) VALUES ('{$nom}','{$prenom}','{$mail}', '{$mdp}', '{$tel}','{$dateNaiss}','0','{$numAdr}', '{$rueAdr}', '{$villeAdr}', '{$codePostal}')";
    $res = SQLInsert($sql);
    return $res;
}
开发者ID:BeletteIG2I,项目名称:circuit2000,代码行数:7,代码来源:bdd.php

示例3: updateAccess

function updateAccess($cmd_id, $users_id)
{
    SQLSelect("DELETE from tlg_user_cmd where CMD_ID=" . $cmd_id);
    $users = explode(",", $users_id);
    foreach ($users as $value) {
        $recCU = array();
        $recCU['CMD_ID'] = $cmd_id;
        $recCU['USER_ID'] = $value;
        $recCU['ID'] = SQLInsert('tlg_user_cmd', $recCU);
    }
}
开发者ID:Anisan,项目名称:majordomo-telegram,代码行数:11,代码来源:cmd_edit.inc.php

示例4: subscribeToEvent

function subscribeToEvent($module_name, $event_name, $filter_details = '')
{
    $rec = SQLSelectOne("SELECT * FROM settings WHERE NAME='HOOK_EVENT_" . DBSafe(strtoupper($event_name)) . "'");
    if (!$rec['ID']) {
        $rec = array();
        $rec['NAME'] = 'HOOK_EVENT_' . strtoupper($event_name);
        $rec['TITLE'] = $rec['NAME'];
        $rec['TYPE'] = 'json';
        $rec['PRIORITY'] = 0;
        $rec['ID'] = SQLInsert('settings', $rec);
    }
    $data = json_decode($rec['VALUE'], true);
    if (!isset($data[$module_name])) {
        $data[$module_name] = 1;
        $rec['VALUE'] = json_encode($data);
        SQLUpdate('settings', $rec);
    }
}
开发者ID:AirKing555,项目名称:majordomo,代码行数:18,代码来源:hooks.inc.php

示例5: getValueIdByName

function getValueIdByName($object_name, $property)
{
    $value = SQLSelectOne("SELECT ID FROM pvalues WHERE PROPERTY_NAME = '" . DBSafe($object_name . '.' . $property) . "'");
    if (!$value['ID']) {
        $object = getObject($object_name);
        if (is_object($object)) {
            $property_id = $object->getPropertyByName($property, $object->class_id, $object->id);
            //
            $value = SQLSelectOne("SELECT ID FROM pvalues WHERE PROPERTY_ID='" . (int) $property_id . "' AND OBJECT_ID='" . (int) $object->id . "'");
            if (!$value['ID'] && $property_id) {
                $value = array();
                $value['PROPERTY_ID'] = $property_id;
                $value['OBJECT_ID'] = $object->id;
                $value['PROPERTY_NAME'] = $object_name . '.' . $property;
                $value['ID'] = SQLInsert('pvalues', $value);
            }
        }
    }
    return (int) $value['ID'];
}
开发者ID:AirKing555,项目名称:majordomo,代码行数:20,代码来源:objects.class.php

示例6: addToList

 /**
  * Title
  *
  * Description
  *
  * @access public
  */
 function addToList($id)
 {
     $product = SQLSelectOne("SELECT * FROM products WHERE ID='" . (int) $id . "'");
     if ($product['ID']) {
         SQLExec("DELETE FROM shopping_list_items WHERE PRODUCT_ID='" . (int) $id . "'");
         $rec = array();
         $rec['PRODUCT_ID'] = $product['ID'];
         $rec['TITLE'] = $product['TITLE'];
         $rec['IN_CART'] = 0;
         SQLInsert('shopping_list_items', $rec);
         if (defined('DROPBOX_SHOPPING_LIST')) {
             $data = LoadFile(DROPBOX_SHOPPING_LIST);
             $data = str_replace("\r", '', $data);
             $lines = explode("\n", $data);
             $total = count($lines);
             $found = 0;
             for ($i = 0; $i < $total; $i++) {
                 if ($found) {
                     continue;
                 }
                 if (is_integer(strpos($lines[$i], $product['TITLE']))) {
                     $found = 1;
                 }
             }
             if (!$found) {
                 if (!$data) {
                     $lines = array();
                     $lines[] = 'SHOPPING LIST';
                     $lines[] = '';
                 }
                 $lines[] = $product['TITLE'];
                 $data = implode("\n", $lines);
                 SaveFile(DROPBOX_SHOPPING_LIST, $data);
             }
         }
     }
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:44,代码来源:app_products.class.php

示例7: admin


//.........这里部分代码省略.........
                 if ($item['RENDER_DATA'] != $item['DATA'] || $item['RENDER_TITLE'] != $item['TITLE']) {
                     $tmp = SQLSelectOne("SELECT * FROM commands WHERE ID='" . $item['ID'] . "'");
                     $tmp['RENDER_TITLE'] = $item['TITLE'];
                     $tmp['RENDER_DATA'] = $item['DATA'];
                     $tmp['RENDER_UPDATED'] = date('Y-m-d H:i:s');
                     SQLUpdate('commands', $tmp);
                 }
                 echo json_encode($res);
             }
             endMeasure('getLabel ' . $item['TITLE'], 1);
             endMeasure('getLabel', 1);
             exit;
         }
         if ($op == 'get_value') {
             startMeasure('getValue');
             $item = SQLSelectOne("SELECT * FROM commands WHERE ID='" . (int) $item_id . "'");
             if ($item['ID']) {
                 $res = array();
                 $res['DATA'] = $item['CUR_VALUE'];
                 echo json_encode($res);
             }
             endMeasure('getValue', 1);
             exit;
         }
         if ($op == 'value_changed') {
             global $new_value;
             $item = SQLSelectOne("SELECT * FROM commands WHERE ID='" . (int) $item_id . "'");
             if ($item['ID']) {
                 $old_value = $item['CUR_VALUE'];
                 $item['CUR_VALUE'] = $new_value;
                 SQLUpdate('commands', $item);
                 if ($item['LINKED_PROPERTY'] != '') {
                     //$old_value=gg($item['LINKED_OBJECT'].'.'.$item['LINKED_PROPERTY']);
                     sg($item['LINKED_OBJECT'] . '.' . $item['LINKED_PROPERTY'], $item['CUR_VALUE'], array($this->name => 'ID!=' . $item['ID']));
                 }
                 $params = array('VALUE' => $item['CUR_VALUE'], 'OLD_VALUE' => $old_value);
                 if ($item['ONCHANGE_METHOD'] != '') {
                     if (!$item['LINKED_OBJECT']) {
                         $item['LINKED_OBJECT'] = $item['ONCHANGE_OBJECT'];
                     }
                     getObject($item['LINKED_OBJECT'])->callMethod($item['ONCHANGE_METHOD'], $params);
                     //ONCHANGE_OBJECT
                     //DebMes("calling method ".$item['ONCHANGE_OBJECT'].".".$item['ONCHANGE_METHOD']." with ".$item['CUR_VALUE']);
                 }
                 if ($item['SCRIPT_ID']) {
                     //DebMes('Running on_change script #'.$item['SCRIPT_ID']);
                     runScript($item['SCRIPT_ID'], $params);
                 }
                 if ($item['CODE']) {
                     //DebMes("Running on_change code");
                     try {
                         $code = $item['CODE'];
                         $success = eval($code);
                         if ($success === false) {
                             DebMes("Error menu item code: " . $code);
                             registerError('menu_item', "Error menu item code: " . $code);
                         }
                     } catch (Exception $e) {
                         DebMes('Error: exception ' . get_class($e) . ', ' . $e->getMessage() . '.');
                         registerError('menu_item', get_class($e) . ', ' . $e->getMessage());
                     }
                 }
             }
             echo "OK";
         }
         exit;
     }
     if (isset($this->data_source) && !$_GET['data_source'] && !$_POST['data_source']) {
         $out['SET_DATASOURCE'] = 1;
     }
     if ($this->data_source == 'commands' || $this->data_source == '') {
         if ($this->view_mode == '' || $this->view_mode == 'search_commands') {
             startMeasure('searchCommands');
             $this->search_commands($out);
             endMeasure('searchCommands', 1);
         }
         if ($this->view_mode == 'moveup' && $this->id) {
             $this->reorder_items($this->id, 'up');
             $this->redirect("?");
         }
         if ($this->view_mode == 'movedown' && $this->id) {
             $this->reorder_items($this->id, 'down');
             $this->redirect("?");
         }
         if ($this->view_mode == 'edit_commands') {
             $this->edit_commands($out, $this->id);
         }
         if ($this->view_mode == 'clone_commands') {
             $rec = SQLSelectOne("SELECT * FROM commands WHERE ID='" . $this->id . "'");
             unset($rec['ID']);
             $rec['TITLE'] = $rec['TITLE'] . ' (copy)';
             $rec['ID'] = SQLInsert('commands', $rec);
             $this->redirect("?id=" . $rec['ID'] . "&view_mode=edit_commands");
         }
         if ($this->view_mode == 'delete_commands') {
             $this->delete_commands($this->id);
             $this->redirect("?");
         }
     }
 }
开发者ID:NioFBI,项目名称:majordomo,代码行数:101,代码来源:commands.class.php

示例8: usual

 /**
 * FrontEnd
 *
 * Module frontend
 *
 * @access public
 */
 function usual(&$out)
 {
     global $session;
     if ($this->action == 'addevent') {
         global $mode;
         $this->mode = $mode;
         if ($this->mode == 'update') {
             global $type;
             global $window;
             global $details;
             global $terminal_to;
             global $user_to;
             $event = array();
             $event['EVENT_TYPE'] = $type;
             $event['WINDOW'] = $window;
             $event['DETAILS'] = $details;
             $event['TERMINAL_TO'] = $terminal_to;
             $event['TERMINAL_FROM'] = $session->data['TERMINAL'];
             $event['USER_TO'] = $user_to;
             $event['USER_FROM'] = $session->data['USERNAME'];
             $event['ADDED'] = date('Y-m-d H:i:s');
             $event['EXPIRE'] = date('Y-m-d H:i:s', time() + 5 * 60);
             //5 minutes expire
             SQLInsert('events', $event);
         }
         $terminals = SQLSelect("SELECT * FROM terminals ORDER BY TITLE");
         $total = count($terminals);
         for ($i = 0; $i < $total; $i++) {
             if ($terminals[$i]['NAME'] == $session->data['TERMINAL']) {
                 $terminals[$i]['SELECTED'] = 1;
                 $out['TERMINAL_TITLE'] = $terminals[$i]['TITLE'];
             }
         }
         $out['TERMINALS'] = $terminals;
         $users = SQLSelect("SELECT * FROM users ORDER BY NAME");
         $total = count($users);
         for ($i = 0; $i < $total; $i++) {
             if ($users[$i]['USERNAME'] == $session->data['USERNAME']) {
                 $users[$i]['SELECTED'] = 1;
                 $out['USER_TITLE'] = $users[$i]['NAME'];
             }
         }
         $out['USERS'] = $users;
     }
     if ($this->action == 'getnextevent') {
         if (!$session->data['TERMINAL']) {
             $session->data['TERMINAL'] = 'temp' . date('YmdHis');
         }
         //echo "next event for ".$session->data['USERNAME']." on ".$session->data['TERMINAL'];//.date('H:i:s')
         SQLExec("DELETE FROM events WHERE EXPIRE<NOW() AND EVENT_TYPE!='system'");
         $qry = "1";
         //$qry.=" AND TERMINAL_FROM!='".DBSafe($session->data['TERMINAL'])."'";
         $qry .= " AND EVENT_TYPE!='system'";
         $qry .= " AND PROCESSED=0";
         $qry .= " AND (TERMINAL_TO='*' OR TERMINAL_TO='" . DBSafe($session->data['TERMINAL']) . "')";
         $qry .= " AND (USER_TO='*' OR USER_TO='" . DBSafe($session->data['USERNAME']) . "')";
         $event = SQLSelectOne("SELECT * FROM events WHERE {$qry} ORDER BY ADDED");
         if ($event['ID']) {
             $res = $event['ID'] . '|' . $event['EVENT_TYPE'] . '|' . $event['WINDOW'] . '|' . str_replace("\n", '\\n', $event['DETAILS']);
             echo $res;
             $event['PROCESSED'] = 1;
             SQLUpdate('events', $event);
         }
         exit;
     }
 }
开发者ID:NioFBI,项目名称:majordomo,代码行数:73,代码来源:events.class.php

示例9: enregistrerMessage

function enregistrerMessage($idConversation, $idAuteur, $contenu)
{
    // Enregistre un message dans la base en encodant les caractères spéciaux HTML : <, > et &
    // pour interdire les messages HTML
    $SQL = "INSERT INTO messages(idConversation,idAuteur,contenu) ";
    $SQL .= " VALUES('{$idConversation}', '{$idAuteur}', '" . htmlspecialchars($contenu) . "')";
    return SQLInsert($SQL);
}
开发者ID:loicbourgois,项目名称:letsdev,代码行数:8,代码来源:bdd.php

示例10: install

/**
* Installing current module
*
* Adding information about module in project registry and
* processing to database installation routine if file "installed" does not
* exists in module directory.
*
* @param string $parent_name optional parent module for installing packages (reserved for future development)
* @access private
*/
 function install($parent_name="") {
  $this->dbInstall("");
  $rec=SQLSelectOne("SELECT * FROM project_modules WHERE NAME='".$this->name."'");
  if (!IsSet($rec["ID"])) {
   $rec["NAME"]=$this->name;
   if (!IsSet($this->title)) {
    $this->title=$this->name;
   }
   $rec["TITLE"]=$this->title;
   if (IsSet($this->module_category)) {
    $rec["CATEGORY"]=$this->module_category;
   }
   $rec["ID"]=SQLInsert("project_modules", $rec);
  }
  if (!file_exists(DIR_MODULES.$this->name."/installed")) {
   SaveFile(DIR_MODULES.$this->name."/installed", date("H:m d.M.Y"));
  }
 }
开发者ID:novozhenets,项目名称:majordomo,代码行数:28,代码来源:module.class.php

示例11: import_classes

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function import_classes(&$out)
 {
     global $file;
     global $overwrite;
     global $only_classes;
     $data = LoadFile($file);
     $records = unserialize($data);
     if (is_array($records)) {
         $total = count($records);
         for ($i = 0; $i < $total; $i++) {
             $old_class = SQLSelectOne("SELECT ID FROM classes WHERE TITLE LIKE '" . DBSafe($records[$i]['TITLE']) . "'");
             $total_o = 0;
             if ($old_class['ID']) {
                 $old_objects = SQLSelect("SELECT * FROM objects WHERE CLASS_ID='" . $old_class['ID'] . "'");
                 $total_o = count($old_objects);
                 for ($io = 0; $io < $total_o; $io++) {
                     $old_objects[$io]['CLASS_ID'] = 0;
                     SQLUpdate('objects', $old_objects[$io]);
                 }
                 if ($overwrite) {
                     $this->delete_classes($old_class['ID']);
                     $records[$i]['ID'] = $old_class['ID'];
                 } else {
                     $records[$i]['TITLE'] = $records[$i]['TITLE'] . rand(0, 500);
                 }
             }
             $objects = $records[$i]['OBJECTS'];
             unset($records[$i]['OBJECTS']);
             $methods = $records[$i]['METHODS'];
             unset($records[$i]['METHODS']);
             $properties = $records[$i]['PROPERTIES'];
             unset($records[$i]['PROPERTIES']);
             $records[$i]['ID'] = SQLInsert('classes', $records[$i]);
             if ($total_o) {
                 for ($io = 0; $io < $total_o; $io++) {
                     $old_objects[$io]['CLASS_ID'] = $records[$i]['ID'];
                     SQLUpdate('objects', $old_objects[$io]);
                 }
             }
             if (is_array($properties)) {
                 $total_p = count($properties);
                 for ($p = 0; $p < $total_p; $p++) {
                     $properties[$p]['CLASS_ID'] = $records[$i]['ID'];
                     $properties[$p]['ID'] = SQLInsert('properties', $properties[$p]);
                 }
             }
             if (is_array($methods)) {
                 $total_m = count($methods);
                 for ($m = 0; $m < $total_m; $m++) {
                     $methods[$m]['CLASS_ID'] = $records[$i]['ID'];
                     $methods[$m]['ID'] = SQLInsert('methods', $methods[$m]);
                 }
             }
             if (is_array($objects) && !$only_classes) {
                 $total_o = count($objects);
                 for ($o = 0; $o < $total_o; $o++) {
                     $objects[$o]['CLASS_ID'] = $records[$i]['ID'];
                     $methods = $objects[$o]['METHODS'];
                     unset($objects[$o]['METHODS']);
                     $properties = $objects[$o]['PROPERTIES'];
                     unset($objects[$o]['PROPERTIES']);
                     $objects[$o]['ID'] = SQLInsert('objects', $objects[$o]);
                     if (is_array($properties)) {
                         $total_p = count($properties);
                         for ($p = 0; $p < $total_p; $p++) {
                             $properties[$p]['OBJECT_ID'] = $objects[$o]['ID'];
                             $properties[$p]['ID'] = SQLInsert('properties', $properties[$p]);
                         }
                     }
                     if (is_array($methods)) {
                         $total_m = count($methods);
                         for ($m = 0; $m < $total_m; $m++) {
                             $methods[$m]['OBJECT_ID'] = $objects[$o]['ID'];
                             $methods[$m]['ID'] = SQLInsert('methods', $methods[$m]);
                         }
                     }
                 }
             }
         }
         //print_r($records);
     }
     $this->updateTree_classes();
     $this->redirect("?");
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:91,代码来源:classes.class.php

示例12: SQLEditor

function SQLEditor()
{
    extract($_SESSION);
    $conn = @mysql_connect($mhost . ":" . $mport, $muser, $mpass);
    if ($conn) {
        echo "Logged in as {$muser}@{$mhost} <a href='{$self}?act=logout'>[Logout]</a><center>";
        echo "<form method='POST' action='{$self}?'>\n            Quick SQL query: <input type='text' style='width: 300px' value='select * from users' name='sqlquery'>\n            <input type='hidden' name='db' value='{$_GET['db']}'>\n            <input type='submit' value='Go' name='sql'>\n            </form>";
        echo "<form action='{$self}?act=sqledit' method='post'>\n            <input type='submit' style='border: none;' value='[ List Processes ]' name='sql_list_proc'>\n            </form></center></br></br>";
        if (isset($_POST['sql_list_proc'])) {
            $res = mysql_list_processes();
            echo "<table style='margin: auto; text-align: center;'><tr>\n                <td>Proc ID</td><td>Host</td><td>DB</td><td>Command</td><td>Time</td>\n                </tr>";
            while ($r = mysql_fetch_assoc($res)) {
                echo "<tr><td>{$r['Id']}</td><td>{$r['Host']}</td><td>{$r['db']}</td><td>{$r['Command']}</td><td>{$r['Time']}</td></tr>";
            }
            mysql_free_result($res);
            echo "</table></br>";
        }
        if (!isset($_GET['db'])) {
            if (isset($_POST['dbc'])) {
                db_create();
            }
            if (isset($_GET['dropdb'])) {
                SQLDrop();
            }
            echo "<table style='margin: auto; text-align: center;'>\n            <tr><td>Database</td><td>Table count</td><td>Download</td><td>Drop</td></tr>";
            $all_your_base = mysql_list_dbs($conn);
            while ($your_base = mysql_fetch_assoc($all_your_base)) {
                $tbl = mysql_query("SHOW TABLES FROM {$your_base['Database']}");
                $tbl_count = mysql_num_rows($tbl);
                echo "<tr><td><a href='{$self}?act=sqledit&db={$your_base['Database']}'>{$your_base['Database']}</td><td>{$tbl_count}</td><td><a href='{$self}?act=download&db={$your_base['Database']}'>Download</a></td><td><a href='{$self}?act=sqledit&dropdb={$your_base['Database']}'>Drop</a></td></tr>";
            }
            echo "</table></br><center><form action='{$self}?act=sqledit' method='post'>New database name: <input type='text' value='new_database' name='db_name'><input type='submit' style='border: none;' value='[ Create Database ]' name='dbc'></form></center></br>";
        } elseif (isset($_GET['db']) && !isset($_GET['tbl'])) {
            if (isset($_POST['tblc'])) {
                table_create();
            }
            if (isset($_GET['droptbl'])) {
                SQLDrop();
            }
            echo "<table style='margin: auto; text-align: center;'>\n            <tr><td>Table</td><td>Column count</td><td>Dump</td><td>Drop</td></tr>";
            $tables = mysql_query("SHOW TABLES FROM {$_GET['db']}");
            while ($tblc = mysql_fetch_array($tables)) {
                $fCount = mysql_query("SHOW COLUMNS FROM {$_GET['db']}.{$tblc['0']}");
                $fc = mysql_num_rows($fCount);
                echo "<tr><td><a href='{$self}?act=sqledit&db={$_GET['db']}&tbl={$tblc['0']}'>{$tblc['0']}</a></td><td>{$fc}</td><td><a href='{$self}?act=download&db={$_GET['db']}&tbl={$tblc['0']}'>Dump</td><td><a href='{$self}?act=sqledit&db={$_GET['db']}&droptbl={$tblc['0']}'>Drop</a></td></tr>";
            }
            echo "</table></br><center><form action='{$self}?act=sqledit&db={$_GET['db']}' method='post'>Create new table: <input type='text' value='new_table' name='table_name'><input type='hidden' value='{$_GET['db']}' name='db_current'> <input type='submit' style='border: none;' value='[ Create Table ]' name='tblc'></form></center>";
        } elseif (isset($_GET['field']) && isset($_POST['sqlsave'])) {
            $discard_values = mysql_query("SELECT * FROM {$_GET['db']}.{$_GET['tbl']} WHERE {$_GET['field']}='{$_GET['v']}'");
            $values = mysql_fetch_assoc($discard_values);
            $keys = array_keys($values);
            $values = array();
            foreach ($_POST as $k => $v) {
                if (in_array($k, $keys)) {
                    $values[] = $v;
                }
            }
            $query = "UPDATE {$_GET['db']}.{$_GET['tbl']} SET ";
            for ($y = 0; $y < count($values); $y++) {
                if ($y == count($values) - 1) {
                    $query .= "{$keys[$y]}='{$values[$y]}' ";
                } else {
                    $query .= "{$keys[$y]}='{$values[$y]}', ";
                }
            }
            $query .= "WHERE {$_GET['field']} = '{$_GET['v']}'";
            $try = mysql_query($query) or die(mysql_error());
            echo "<center>Table updated!<br>";
            echo "<a href='{$self}?act=sqledit&db={$_GET['db']}&tbl={$_GET['tbl']}'>Go back</a><br><br>";
        } elseif (isset($_GET['field']) && isset($_GET['v']) && !isset($_GET['del'])) {
            echo "<center><form action='{$self}?act=sqledit&db={$_GET['db']}&tbl={$_GET['tbl']}&field={$_GET['field']}&v={$_GET['v']}' method='post'>";
            $sql_fields = array();
            $fields = mysql_query("SHOW COLUMNS FROM {$_GET['db']}.{$_GET['tbl']}");
            while ($field = mysql_fetch_assoc($fields)) {
                $sql_fields[] = $field['Field'];
            }
            $data = mysql_query("SELECT * FROM {$_GET['db']}.{$_GET['tbl']} WHERE {$_GET['field']}='{$_GET['v']}'");
            $d_piece = mysql_fetch_assoc($data);
            for ($m = 0; $m < count($sql_fields); $m++) {
                $point = $sql_fields[$m];
                echo "{$point}: <input type='text' value='{$d_piece[$point]}' name='{$sql_fields[$m]}'></br>";
            }
            echo "<input type='submit' value='Save' name='sqlsave'></form></center>";
        } elseif (isset($_GET['db']) && isset($_GET['tbl'])) {
            if (isset($_GET['insert'])) {
                SQLInsert();
            }
            if (isset($_GET['field']) && isset($_GET['v']) && isset($_GET['del'])) {
                echo "<center>";
                if (@mysql_query("DELETE FROM {$_GET['db']}.{$_GET['tbl']} WHERE {$_GET['field']}={$_GET['v']}")) {
                    echo "Row deleted</br>";
                } else {
                    echo "Failed to delete row</br>";
                }
                echo "</center>";
            }
            echo "<center><a href='{$self}?act=sqledit&db={$_GET['db']}&tbl={$_GET['tbl']}&insert=1'>[Insert new row]</a></center>";
            echo "<table style='margin: auto; text-align: center;'><tr>";
            $cols = mysql_query("SHOW COLUMNS FROM {$_GET['db']}.{$_GET['tbl']}");
            $fields = array();
//.........这里部分代码省略.........
开发者ID:Theov,项目名称:webshells,代码行数:101,代码来源:shellzx.php

示例13: updateChannel

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function updateChannel($id)
 {
     $ch = SQLSelectOne("SELECT * FROM rss_channels WHERE ID='" . (int) $id . "'");
     $ch['LAST_UPDATE'] = date('Y-m-d H:i:s');
     $ch['NEXT_UPDATE'] = date('Y-m-d H:i:s', time() + $ch['UPDATE_EVERY'] * 60);
     SQLUpdate('rss_channels', $ch);
     /*
     $cch =curl_init();
     curl_setopt($cch, CURLOPT_URL, $ch['URL']);
     curl_setopt($cch, CURLOPT_HTTPHEADER, array("User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3"));
     curl_setopt($cch, CURLOPT_RETURNTRANSFER, true);
     $rssdata = curl_exec($cch);
     curl_close($cch);
     */
     $rssdata = getURL($ch['URL'], 0);
     $data = simplexml_load_string($rssdata);
     if ($data) {
         if (is_object($data->channel) && !empty($data->channel)) {
             foreach ($data->channel->item as $item) {
                 $rec = array();
                 $rec['CHANNEL_ID'] = $ch['ID'];
                 $parsedFull = 0;
                 if ($item->pubDate) {
                     $rec['ADDED'] = date('Y-m-d H:i:s', strtotime((string) $item->pubDate));
                 } else {
                     $rec['ADDED'] = date('Y-m-d H:i:s');
                 }
                 $rec['TITLE'] = $this->convertObjDataToStr($item->title);
                 $rec['BODY'] = $this->convertObjDataToStr($item->description);
                 $rec['URL'] = $this->convertObjDataToStr($item->link);
                 $rec['GUID'] = $rec['URL'];
                 $timestamp = strtotime($rec['ADDED']);
                 //print_r($rec);
                 //exit;
                 $tmp = SQLSelectOne("SELECT ID FROM rss_items WHERE GUID='" . DBSafe($rec['GUID']) . "'");
                 if (!$tmp['ID']) {
                     $rec['ID'] = SQLInsert('rss_items', $rec);
                     if ($ch['SCRIPT_ID']) {
                         $params = $rec;
                         $params['CHANNEL_TITLE'] = $ch['TITLE'];
                         $params['TM'] = $timestamp;
                         $params['PASSED'] = time() - $timestamp;
                         runScript($ch['SCRIPT_ID'], $params);
                     }
                 }
             }
         }
     }
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:56,代码来源:rss_channels.class.php

示例14: MessageStatus

    function MessageStatus( &$pMessage, $Status ) {
    global $skype, $CurrentUser, $archivechats;
    global $pt;

    $myhandle = $CurrentUser->Handle;

    $cmeUnknown = -1;
    $cmeCreatedChatWith = 0;
    $cmeAddedMembers = 2;
    $cmeSetTopic = 3;
    $cmeSaid = 4;
    $cmeLeft = 5;

    if ($pMessage->Type == $cmeSetTopic) {
      //skype_SetTopic($pMessage);      
    } else if ($pMessage->Type == $cmeAddedMembers) {
      //skype_add_member($pMessage);      
    } else if ($pMessage->Type == $cmeSaid || $pMessage->Type == $cmeUnknown) { 
      if ($Status == 0 || $Status == 2) {
//        print "\n$pMessage->body $Status $pMessage->type";

        if ($pMessage->FromHandle <> $CurrentUser->Handle ) {

          echo $pMessage->FromHandle.": ".convert_cyr_string($pMessage->Body, 'w', 'd')."\n";
      
          if ( substr(strtolower($pMessage->Body),0,4) == 'ping' ) {
            $skype->Chat($pMessage->ChatName)->SendMessage("pong");
          }

          $user=SQLSelectOne("SELECT ID FROM users WHERE SKYPE LIKE '".$pMessage->FromHandle."'");
          if (!$user['ID']) {
           $user=SQLSelectOne("SELECT ID FROM users ORDER BY ID");
          }
          $user_id=$user['ID'];


          $qrys=explode(' '.DEVIDER.' ', iconv('WINDOWS-1251', 'UTF-8', $pMessage->Body));
          $total=count($qrys);
          for($i=0;$i<$total;$i++) {
           $room_id=0;
           $rec=array();
           $rec['ROOM_ID']=(int)$room_id;
           $rec['MEMBER_ID']=$user_id;
           $rec['MESSAGE']=htmlspecialchars($qrys[$i]);
           $rec['ADDED']=date('Y-m-d H:i:s');
           SQLInsert('shouts', $rec);
           $pt->checkAllPatterns();
           getObject("ThisComputer")->raiseEvent("commandReceived", array("command"=>$qrys[$i]));
          }

        
        }
      }
    }
        }
开发者ID:novozhenets,项目名称:majordomo,代码行数:55,代码来源:skypebot.php

示例15: clone_webvar

 /**
 * Title
 *
 * Description
 *
 * @access public
 */
 function clone_webvar($id)
 {
     $rec = SQLSelectOne("SELECT * FROM webvars WHERE ID='" . (int) $id . "'");
     $rec['TITLE'] .= ' (copy)';
     unset($rec['ID']);
     $rec['LOG'] = '';
     $rec['LATEST_VALUE'] = '';
     $rec['ID'] = SQLInsert('webvars', $rec);
     $this->redirect("?view_mode=edit_webvars&id=" . $rec['ID']);
 }
开发者ID:cdkisa,项目名称:majordomo,代码行数:17,代码来源:webvars.class.php


注:本文中的SQLInsert函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。