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


PHP squery函数代码示例

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


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

示例1: do_upload

function do_upload($tid)
{
    global $nick;
    if ($_FILES['attachment-file']['size'] < 1) {
        return "File size is too small!";
    }
    $file_name = $_FILES['attachment-file']['name'];
    $file_ext = strtolower(substr($file_name, -4));
    if ($file_ext != ".jpg" && $file_ext != ".png" && $file_ext != ".pdf" && $file_ext != ".log" && $file_ext != ".txt") {
        return "You can only upload jpg/png/pdf/log/txt files!";
    }
    $file_type = $_FILES['attachment-file']['type'];
    $file_size = $_FILES['attachment-file']['size'];
    $file_desc = "Attachment by " . $nick;
    if (!is_numeric($file_size)) {
        safe_die("Error! Invalid number in file size!");
    }
    $query = squery("INSERT INTO karnaf_files(tid,file_name,file_type,file_desc,file_size,lastupd_time) VALUES(%d,'%s','%s','%s',%d,%d)", $tid, $file_name, $file_type, $file_desc, $file_size, time());
    if (!$query) {
        return "SQL Error! Query failed on do_upload() function: " . mysql_error();
    }
    $id = sql_insert_id();
    $fn = KARNAF_UPLOAD_PATH . "/" . $tid;
    if (!file_exists($fn)) {
        if (!mkdir($fn)) {
            return "Can't create attachment directory!";
        }
    }
    $fn .= "/" . $id . $file_ext;
    if (!copy($_FILES['attachment-file']['tmp_name'], $fn)) {
        return "Couldn't create attachment file!";
    }
    return "";
}
开发者ID:nirn,项目名称:karnaf,代码行数:34,代码来源:view.php

示例2: squery

?>
"></td>
</tr>
<tr>
<td>Body:</td>
<td><textarea rows="8" cols="78" name="body" id="body"><?php 
echo $r_body;
?>
</textarea></td>
</tr>
<tr>
<td>Group:</td>
<td>
<select name="group">
<?php 
$query = squery("SELECT id,name FROM groups WHERE iskarnaf=1 ORDER BY name");
while ($result = sql_fetch_array($query)) {
    ?>
<option value="<?php 
    echo $result['id'];
    ?>
"<?php 
    if ($result['name'] == $r_group) {
        echo " SELECTED";
    }
    ?>
><?php 
    echo $result['name'];
    ?>
</option>
<?php 
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:mng_templates.php

示例3: squery

        if ($result['status'] != "0") {
            $autostatus = "The ticket isn't closed.";
        } else {
            $autostatus = "The ticket has been re-opened.";
            $email_update_str = "The ticket has been re-opened.";
            squery("INSERT INTO karnaf_actions(tid,action,a_by_u,a_by_g,a_time,a_type,is_private) VALUES(%d,'The ticket has been re-opened.','%s','%s',%d,1,%d)", $id, $nick, $group, time() + 1, $is_private);
            squery("UPDATE karnaf_tickets SET status=1,lastupd_time=%d WHERE id=%d", time(), $id);
        }
    }
    $autoload = 4;
}
/* Send SMS */
if (isset($_POST['sms_account'])) {
    if (send_sms($_POST['sms_account'], $_POST['sms_to'], $_POST['sms_body'])) {
        squery("INSERT INTO karnaf_actions(tid,action,a_by_u,a_by_g,a_time,a_type,is_private) VALUES(%d,'%s','%s','%s',%d,1,%d)", $id, "Sent SMS to " . $_POST['sms_to'], $nick, $group, time(), $is_private);
        squery("UPDATE karnaf_tickets SET lastupd_time=%d WHERE id=%d", time(), $id);
        $autostatus = "The SMS has been sent.";
        if ($is_private != 1) {
            $email_update_str = "Sent SMS to " . $_POST['sms_to'];
        }
    } else {
        $autostatus = "Error! Could not send SMS!";
    }
    $autoload = 9;
}
if (isset($email_update_str) && !empty($email_update_str)) {
    if ((!isset($is_private) || $is_private != "1") && (!isset($_POST['no_userupd']) || $_POST['no_userupd'] != "on")) {
        if ($result['memo_upd'] == "1") {
            send_memo($result['unick'], "Your ticket #" . $result['id'] . " has been updated. For more information visit: " . KARNAF_URL . "/view.php?id=" . $result['id'] . "&code=" . $result['randcode']);
        }
        if ($result['email_upd'] == "1") {
开发者ID:vik0803,项目名称:karnaf,代码行数:31,代码来源:edit.php

示例4: squery

<td>Ticket Subject</td>
<td>
<span id="Ticket_Subject">
<select name="cat3" id="cat3" disabled>
<option value="0">--Select--</option>
</select>
</span>
</td>
</tr>
<tr>
<td>Priority:</td>
<td>
<select name="upriority">
<?php 
    $upriority = 0;
    $query = squery("SELECT priority_id,priority_name FROM karnaf_priorities ORDER BY priority_id");
    while ($result = sql_fetch_array($query)) {
        ?>
<option value="<?php 
        echo $result['priority_id'];
        ?>
"<?php 
        if ($result['priority_id'] == $upriority) {
            echo " SELECTED";
        }
        ?>
><?php 
        echo $result['priority_name'];
        ?>
</option>
<?php 
开发者ID:vik0803,项目名称:karnaf,代码行数:31,代码来源:new.php

示例5: Copyright

<?php

##################################################################
# Karnaf HelpDesk System - Copyright (C) 2001-2015 Kobi Shmueli. #
# See the LICENSE file for more information.                     #
##################################################################
require "../ktools.php";
$cat3_id = $_GET['id'];
$extra = "";
$query = squery("SELECT id,name,extra FROM karnaf_cat3 WHERE id=%d", $cat3_id);
if ($result = sql_fetch_array($query)) {
    $extra = $result['extra'];
}
sql_free_result($query);
if (!empty($extra)) {
    ?>
<table width="100%" border="1">
<tr class="Karnaf_Head2"><td colspan="2">Extra Information</td></tr>
<?php 
    $i = 0;
    foreach (split(',', $extra) as $row) {
        $i++;
        ?>
<tr>
<td><?php 
        echo $row;
        ?>
:</td>
<td><input name="ext<?php 
        echo $i;
        ?>
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:karnaf_ext.php

示例6: squery

</table>
</td></tr>
<tr class="Karnaf_Head2">
<td colspan="2" align="center">Add new action</td>
</tr>
<tr>
<td colspan="2">
<textarea rows="8" style="width:99%" name="action_text" id="action_text"></textarea><br>
<?php 
    if (IsGroupMember("dalnet-aob") || IsKarnafAdminSession()) {
        ?>
Action on behalf of:
<select name="onbehalf_g">
<option value="">---</option>
<?php 
        $query2 = squery("SELECT id,name,gdesc FROM groups ORDER BY name");
        while ($result2 = sql_fetch_array($query2)) {
            if (!IsGroupMember($result2['name']) || $result2['name'] != KARNAF_ADMINS_GROUP && $result2['name'] != "dalnet-aob" && $result2['name'] != "dalnet-sra" && $result2['name'] != $result['rep_g']) {
                continue;
            }
            ?>
<option value="<?php 
            echo $result2['name'];
            ?>
"><?php 
            echo $result2['name'];
            ?>
</option>
<?php 
        }
        sql_free_result($query2);
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:edit_actions.php

示例7: Add_ItemRed

Add_ItemRed("Check User", "check_user.php");
if (IsKarnafAdminSession()) {
    Add_Itemx("Edit types", "mng_cat.php?table=cat1");
    Add_Itemx("Edit catagories", "mng_cat.php?table=cat2");
    Add_Itemx("Edit subjects", "mng_cat.php?table=cat3");
    Add_Itemx("Edit templates", "mng_templates.php");
    Add_Itemx("View Logs", "mng_viewlogs.php");
    Add_Itemx("Edit SQL", "mng_editsql.php");
    Add_Itemx("Stats", "stats.php");
    Add_Item("Logout", "logout.php");
}
?>
<tr><td>
<br>
<u>Tickets:</u>
<br>
<?php 
$tickets = 0;
$query = squery("SELECT count(*) FROM karnaf_tickets");
if ($result = sql_fetch_array($query)) {
    $tickets = $result[0];
}
sql_free_result($query);
echo $tickets;
?>
</td></tr>
</table>
</body>
</html>
<?php 
require_once "karnaf_footer.php";
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:menu.php

示例8: Copyright

<?php

##################################################################
# Karnaf HelpDesk System - Copyright (C) 2001-2015 Kobi Shmueli. #
# See the LICENSE file for more information.                     #
##################################################################
require "../ktools.php";
check_auth();
$query = squery("SELECT g.name,t.body FROM (karnaf_templates AS t LEFT JOIN groups AS g ON g.id=t.group_id) WHERE t.id=%d", $_GET['id']);
while ($result = sql_fetch_array($query)) {
    if (!IsGroupMember($result['name']) && !IsKarnafAdminSession()) {
        continue;
    }
    echo $result['body'];
}
sql_free_result($query);
require_once "karnaf_footer.php";
开发者ID:nirn,项目名称:karnaf,代码行数:17,代码来源:karnaf_templates.php

示例9: Wild

<tr>
<td>Action:</td>
<td>
<input name="action" type="text">
<input name="action_check" type="radio" value="=" checked>Exact
<input name="action_check" type="radio" value="like">SQL Wild (% is a wildchar)
<input name="action_check" type="radio" value="has">Contains
</td>
</tr>
<tr>
<td>Log type:</td>
<td>
<select name="logtype">
<option value="">---</option>
<?php 
    $query = squery("SELECT logtype FROM ws_logs WHERE logtype NOT LIKE '%s' GROUP BY logtype ORDER BY logtype", "%.php?id=%");
    while ($result = sql_fetch_array($query)) {
        ?>
<option value="<?php 
        echo $result['logtype'];
        ?>
"><?php 
        echo $result['logtype'];
        ?>
</option>
<?php 
    }
    sql_free_result($query);
    ?>
</select>
</td>
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:mng_viewlogs.php

示例10: squery

/* Search tickets that are waiting for user reply for more than a week... */
$query = squery("SELECT id,rep_g,unick,uemail FROM karnaf_tickets WHERE status=2 AND lastupd_time<%d", time()-604800);
while($result = sql_fetch_array($query)) {
  $sender = $result['unick'];
  if($sender == "Guest" && !empty($result['uemail'])) $sender = $result['uemail'];
  echo "Ticket #".$result['id']." from ".$sender." is being automatically closed. ".KARNAF_URL."/view.php?id=".$result['id']."\n";
  squery("INSERT INTO karnaf_actions(tid,is_private,a_type,action,a_time,a_by_u,a_by_g) VALUES(%d,0,1,'%s',%d,'%s','%s')",
         $result['id'], "Ticket has been automatically closed due to being waiting for user reply for a week.", time(), "System", $result['rep_g']);
  squery("UPDATE karnaf_tickets SET close_time=%d,status=0 WHERE id=%d", time(), $result['id']);
}
sql_free_result($query);

/* Search for tickets that are *open* and waiting for an oper-reply for more than a week... */
$query = squery("SELECT id,rep_g,unick,uemail FROM karnaf_tickets WHERE status=1 AND (lastupd_time<%d OR (open_time<%d AND lastupd_time is NULL AND rep_g='')) AND priority>=0 AND priority<20",
                time()-604800, time()-604800);
while($result = sql_fetch_array($query)) {
  $sender = $result['unick'];
  if($sender == "Guest" && !empty($result['uemail'])) $sender = $result['uemail'];
  echo "-".$result['rep_g']."- Ticket #".$result['id']." from ".$sender." is now getting higher priority. ".KARNAF_URL."/edit.php?id=".$result['id']."\n";
  squery("INSERT INTO karnaf_actions(tid,is_private,a_type,action,a_time,a_by_u,a_by_g) VALUES(%d,0,1,'%s',%d,'%s','%s')",
         $result['id'], "System priority increased to High", time(), "System", $result['rep_g']);
  squery("UPDATE karnaf_tickets SET priority=20 WHERE id=%d", $result['id']);
  #squery("INSERT INTO karnaf_memo_queue(tonick,memo) VALUES('%s','*Warning* Priority for ticket #%s has been increased to High. For more information visit: XXX/edit.php?id=%s')", $sender);
  #squery("INSERT INTO karnaf_actions(tid,is_private,a_type,action,a_time,a_by_u,a_by_g) VALUES(%d,0,1,'%s',%d,'%s','%s')", $result['id'],
  #       "Team leader was notified by MemoServ", time()+1, "System", $result['rep_g']);
}
sql_free_result($query);

require_once("../contentpage_ftr.php");
?>
开发者ID:kbuley,项目名称:karnaf,代码行数:30,代码来源:scheduler.php

示例11: RandomNumber

    ?>
</td>
<td>E-Mail</td>
<td>Assigned to</td>
</tr>
<?php 
    $cnt = 0;
    $unick = $result['unick'];
    $uemail = $result['uemail'];
    if ($unick == "Guest") {
        $unick .= RandomNumber(5);
    }
    if (empty($uemail)) {
        $uemail = "Guest" . RandomNumber(5) . "@" . MY_DOMAIN;
    }
    $query2 = squery("SELECT id,status,unick,uemail,rep_g FROM karnaf_tickets WHERE id!=%d AND status!=0 AND (unick='%s' OR uemail='%s')", $id, $unick, $uemail);
    while ($result2 = sql_fetch_array($query2)) {
        $cnt++;
        ?>
<tr>
<td><a href="edit.php?id=<?php 
        echo $result2['id'];
        ?>
"><?php 
        echo $result2['id'];
        ?>
</a></td>
<td><?php 
        echo $result2['unick'];
        ?>
</td>
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:edit_userinfo.php

示例12: squery

if (isset($_GET['code']) && !empty($_GET['code'])) {
    $randcode = $_GET['code'];
} else {
    $randcode = 0;
}
$query = squery("SELECT unick,randcode,open_time FROM karnaf_tickets WHERE id=%d", $id);
if ($result = sql_fetch_array($query)) {
    if (!IsKarnafOperSession() && $randcode != $result['randcode'] && ($nick != $result['unick'] || $nick == "Guest" || $a_regtime > (int) $result['open_time'])) {
        AccessDenied("You must provide the ticket verification code to view this page.");
    }
    if (isset($_GET['download'])) {
        $download = $_GET['download'];
    } else {
        $download = 0;
    }
    $query2 = squery("SELECT file_name,file_type,file_size FROM karnaf_files WHERE id=%d AND tid=%d", $download, $id);
    if (!$query2) {
        safe_die("Error: can't find file!");
    }
    $result2 = sql_fetch_array($query2);
    if (!$result2) {
        safe_die("Error: can't find file!");
    }
    if ((int) $result2['file_size'] != 0) {
        header("Content-length: " . $result2['file_size']);
    }
    header("Content-type: " . $result2['file_type']);
    $file_ext = strtolower(substr($result2['file_name'], -4));
    if ($file_ext != ".jpg" && $file_ext != ".png") {
        header("Content-Disposition: attachment; filename=" . $result2['file_name']);
    }
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:download.php

示例13: Copyright

<?php

##################################################################
# Karnaf HelpDesk System - Copyright (C) 2001-2015 Kobi Shmueli. #
# See the LICENSE file for more information.                     #
##################################################################
/* This is a script to send all the emails on the queue */
$override_magicquotes = 1;
require "../ktools.php";
function karnaf_email($mail_to, $mail_subject, $mail_body)
{
    /* Was only used for debugging:
          $mail_to = "kobi@macron.co.il";
      */
    mail($mail_to, $mail_subject, $mail_body, "From: " . MY_EMAIL . "\r\n" . "Reply-To: " . MY_EMAIL);
}
$query = squery("SELECT id,mail_to,mail_from,mail_subject,mail_body FROM mail_queue ORDER BY id");
while ($result = sql_fetch_array($query)) {
    echo "Sending #" . $result['id'] . " to " . $result['mail_to'] . "...\n";
    karnaf_email($result['mail_to'], $result['mail_subject'], $result['mail_body']);
    squery("DELETE FROM mail_queue WHERE id=%d", $result['id']);
}
sql_free_result($query);
echo "Done.\n";
require_once "../contentpage_ftr.php";
开发者ID:nirn,项目名称:karnaf,代码行数:25,代码来源:mailqueue.php

示例14: squery

                $query2 = squery(0, $row[2]);
                while ($result2 = sql_fetch_array($query2)) {
                    $selects[$row[0]][] = array($result2[0], $result2[1]);
                }
                sql_free_result($query2);
            }
            $row = $row[0];
        }
        echo "<th>{$row}</th>";
    }
    ?>
</tr>
<?php 
    $curcol = "col2";
    $cnt = 0;
    $query = squery(0, "SELECT " . $sql_id . "," . merge_array($sql_rows) . " FROM {$sql_table} ORDER BY " . $sql_id);
    if ($query) {
        while ($result = sql_fetch_array($query)) {
            $cnt++;
            if ($curcol == "col1") {
                $curcol = "col2";
            } else {
                $curcol = "col1";
            }
            ?>
<tr>
<?php 
            foreach ($sql_rows as $row) {
                if (is_array($row)) {
                    if ($row[1] == "password") {
                        $text = "*";
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:mng_editsql.php

示例15: showtime

    return showtime($unixTimestamp);
}
if (isset($_GET['tid']) && is_numeric($_GET['tid'])) {
    $tid = $_GET['tid'];
} else {
    $tid = "";
}
if (isset($_GET['uuser'])) {
    $uuser = $_GET['uuser'];
}
if (isset($_POST['uuser'])) {
    $uuser = $_POST['uuser'];
}
if (isset($uuser)) {
    add_log("karnaf_check_user", $uuser);
    $query = squery("SELECT type,host,user,pass,ou,filter FROM karnaf_ldap_accounts WHERE active=1");
    while ($result = sql_fetch_array($query)) {
        $type = (int) $result['type'];
        if ($type == 0) {
            $ldapserver = "ldap://" . $result['host'];
        } else {
            if ($type == 1) {
                $ldapserver = "ldaps://" . $result['host'];
            } else {
                continue;
            }
        }
        $ldap = ldap_connect($ldapserver);
        ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
        ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
        if ($bind = @ldap_bind($ldap, $result['user'], $result['pass'])) {
开发者ID:nirn,项目名称:karnaf,代码行数:31,代码来源:check_user.php


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