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


PHP Sql_fetch_array函数代码示例

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


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

示例1: fill

function fill($prefix, $listid)
{
    global $server_name, $tables, $table_prefix;
    # check for not too many
    $domain = getConfig('domain');
    $res = Sql_query("select count(*) from {$tables['user']}");
    $row = Sql_fetch_row($res);
    if ($row[0] > 50000) {
        error('Hmm, I think 50 thousand users is quite enough for a test<br/>This machine does need to do other things you know.');
        print '<script language="Javascript" type="text/javascript"> document.forms[0].output.value="Done. Now there are ' . $row[0] . ' users in the database";</script>' . "\n";
        return 0;
    }
    # fill the database with "users" who have any combination of attribute values
    $attributes = array();
    $res = Sql_query("select * from {$tables['attribute']} where type = \"select\" or type = \"checkbox\" or type=\"radio\"");
    $num_attributes = Sql_Affected_rows();
    $total_attr = 0;
    $total_val = 0;
    while ($row = Sql_fetch_array($res)) {
        array_push($attributes, $row['id']);
        ++$total_attr;
        $values[$row['id']] = array();
        $res2 = Sql_query("select * from {$table_prefix}" . 'listattr_' . $row['tablename']);
        while ($row2 = Sql_fetch_array($res2)) {
            array_push($values[$row['id']], $row2['id']);
            ++$total_val;
        }
    }
    $total = $total_attr * $total_val;
    if (!$total) {
        Fatal_Error('Can only do stress test when some attributes exist');
        return 0;
    }
    for ($i = 0; $i < $total; ++$i) {
        $data = array();
        reset($attributes);
        while (list($key, $val) = each($attributes)) {
            $data[$val] = current($values[$val]);
            if (!$data[$val]) {
                reset($values[$val]);
                $data[$val] = current($values[$val]);
            }
            next($values[$val]);
        }
        $query = sprintf('insert into %s (email,entered,confirmed) values("testuser%s",now(),1)', $tables['user'], $prefix . '-' . $i . '@' . $domain);
        $result = Sql_query($query, 0);
        $userid = Sql_insert_id();
        if ($userid) {
            $result = Sql_query("replace into {$tables['listuser']} (userid,listid,entered) values({$userid},{$listid},now())");
            reset($data);
            while (list($key, $val) = each($data)) {
                if ($key && $val) {
                    Sql_query("replace into {$tables['user_attribute']} (attributeid,userid,value) values(" . $key . ",{$userid}," . $val . ')');
                }
            }
        }
    }
    return 1;
}
开发者ID:gillima,项目名称:phplist3,代码行数:59,代码来源:stresstest.php

示例2: Sql_exec

$res_outbound = Sql_exec($cn, $qry_outbound);
$data = array();
$data1 = array();
$data2 = array();
$i = 0;
while ($row_inbound = Sql_fetch_array($res_inbound)) {
    $j = 0;
    $data[$i][$j++] = Sql_Result($row_inbound, "ep_type");
    $data[$i][$j++] = Sql_Result($row_inbound, "ip_address");
    $data[$i][$j++] = Sql_Result($row_inbound, "port");
    $data[$i][$j++] = Sql_Result($row_inbound, "user_name");
    $data[$i][$j++] = Sql_Result($row_inbound, "password");
    $i++;
}
$i = 0;
while ($row_outbound = Sql_fetch_array($res_outbound)) {
    $j = 0;
    $data1[$i][$j++] = Sql_Result($row_outbound, "ip_address");
    $data1[$i][$j++] = Sql_Result($row_outbound, "port");
    $data1[$i][$j++] = Sql_Result($row_outbound, "auth");
    $i++;
}
$i = 0;
$j = 0;
$data2[$i][$j++] = $soft_ano_max;
$data2[$i][$j++] = $soft_ano_min;
$data2[$i][$j++] = $soft_bno_max;
$data2[$i][$j++] = $soft_bno_min;
$new_array = array();
$ii = 0;
$d = 0;
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:add_soft_dial_plan.php

示例3: htmlspecialchars

">
            <?php 
echo $GLOBALS['I18N']->get('Find an admin');
?>
: <input type=text name="find"
                                                                         value="<?php 
echo htmlspecialchars($find);
?>
"
                                                                         size="40"><input type="submit"
                                                                                          value="<?php 
echo $GLOBALS['I18N']->get('Go');
?>
">
            </form></td>
    </tr>
</table>
<?php 
$ls = new WebblerListing($GLOBALS['I18N']->get('Administrators'));
$ls->usePanel($paging);
while ($admin = Sql_fetch_array($result)) {
    $delete_url = sprintf("<a href=\"javascript:deleteRec('%s');\">" . $GLOBALS['I18N']->get('del') . '</a>', PageURL2('admins', 'Delete', "start={$start}&amp;delete=" . $admin['id']));
    $ls->addElement($admin['loginname'], PageUrl2('admin', $GLOBALS['I18N']->get('Show'), "start={$start}&amp;id=" . $admin['id'] . $remember_find));
    if (!$external && $admin['id'] != $_SESSION['logindetails']['id']) {
        $ls->addColumn($admin['loginname'], $GLOBALS['I18N']->get('Del'), $delete_url);
    }
}
print $ls->display();
print '<br/><hr/>';
print PageLinkButton('admin', $GLOBALS['I18N']->get('Add a new administrator'), "start={$start}" . $remember_find);
print '<p class="button">' . PageLink2('importadmin', $GLOBALS['I18N']->get('Import list of admins')) . '</p>';
开发者ID:gillima,项目名称:phplist3,代码行数:31,代码来源:admins.php

示例4: htmlspecialchars

 <textarea name="footer" cols="65" rows="5">' . htmlspecialchars($messagedata['footer']) . '</textarea></div>';
  $forwardcontent .= '<div class="field"><label for="forwardfooter">' . $GLOBALS['I18N']->get('forwardfooter') . Help('forwardfooter') . '</label>' . '
  <textarea name="forwardfooter" cols="65" rows="5">' . htmlspecialchars($messagedata['forwardfooter']) . '</textarea></div>';
  if (ALLOW_ATTACHMENTS) {
      // If we have a message id saved, we want to query the attachments that are associated with this
      // message and display that (and allow deletion of!)
      $att_content = '<div class="field"><label for="attach">' . $GLOBALS['I18N']->get('Add attachments to your campaign') . Help('attachments') . '</label>';
      $att_content .= '<div class="info">
    ' . $GLOBALS['I18N']->get('The upload has the following limits set by the server') . ':<br/>
    ' . $GLOBALS['I18N']->get('Maximum size of total data being sent to the server') . ': ' . ini_get('post_max_size') . '<br/>
    ' . $GLOBALS['I18N']->get('Maximum size of each individual file') . ': ' . ini_get('upload_max_filesize') . '</div>';
      if ($id) {
          $result = Sql_Query(sprintf('Select Att.id, Att.filename, Att.remotefile, Att.mimetype, Att.description, Att.size, MsgAtt.id linkid' . ' from %s Att, %s MsgAtt where Att.id = MsgAtt.attachmentid and MsgAtt.messageid = %d', $tables['attachment'], $tables['message_attachment'], $id));
          $ls = new WebblerListing($GLOBALS['I18N']->get('Current Attachments'));
          $totalSize = 0;
          while ($row = Sql_fetch_array($result)) {
              $ls->addElement($row['id']);
              $ls->addColumn($row['id'], $GLOBALS['I18N']->get('filename'), $row['remotefile']);
              $ls->addColumn($row['id'], $GLOBALS['I18N']->get('desc'), $row['description']);
              $ls->addColumn($row['id'], $GLOBALS['I18N']->get('size'), formatBytes($row['size']));
              $totalSize += $row['size'];
              $phys_file = $GLOBALS['attachment_repository'] . '/' . $row['filename'];
              if (is_file($phys_file) && filesize($phys_file)) {
                  $ls->addColumn($row['id'], $GLOBALS['I18N']->get('file'), $GLOBALS['img_tick']);
              } else {
                  $ls->addColumn($row['id'], $GLOBALS['I18N']->get('file'), $GLOBALS['img_cross']);
              }
              $ls->addColumn($row['id'], $GLOBALS['I18N']->get('del'), sprintf('<input type="checkbox" name="deleteattachments[]" value="%s"/>', $row['linkid']));
          }
          $ls->addButton(s('Delete checked'), 'javascript:document.sendmessageform.submit()');
          $att_content .= '<div>' . $ls->display() . '</div>';
开发者ID:hktang,项目名称:phplist3,代码行数:31,代码来源:send_core.php

示例5: deleteItem

function deleteItem($table, $attributeid, $delete)
{
    global $tables, $replace;
    # delete the index in delete
    $valreq = Sql_Fetch_Row_query("select name from {$table} where id = {$delete}");
    $val = $valreq[0];
    # check dependencies
    $dependencies = array();
    $result = Sql_query("select distinct userid from {$tables['user_attribute']} where\n  attributeid = {$attributeid} and value = {$delete}");
    while ($row = Sql_fetch_array($result)) {
        array_push($dependencies, $row["userid"]);
    }
    if (sizeof($dependencies) == 0) {
        $result = Sql_query("delete from {$table} where id = {$delete}");
    } else {
        if ($replace) {
            $result = Sql_Query("update {$tables['user_attribute']} set value = {$replace} where value = {$delete}");
            $result = Sql_query("delete from {$table} where id = {$delete}");
        } else {
            ?>
    Cannot delete <b><?php 
            echo $val;
            ?>
</b><br />
    The Following record(s) are dependent on this value<br />
    Update the record(s) to not use this attribute value and try again<p>
    <?php 
            for ($i = 0; $i < sizeof($dependencies); $i++) {
                print PageLink2("user", "User " . $dependencies[$i], "id={$dependencies[$i]}") . "<br />\n";
                if ($i > 10) {
                    print "* Too many to list, total dependencies:\n " . sizeof($dependencies) . "<br /><br />";
                    giveAlternative($table, $delete, $attributeid);
                    return 0;
                }
            }
            print "</p><br />";
            giveAlternative($table, $delete, $attributeid);
        }
    }
    return 1;
}
开发者ID:radicaldesigns,项目名称:amp,代码行数:41,代码来源:editattributes.php

示例6: list

   # split personal in first and last name
   list($importuser["firstname"], $importuser["lastname"]) = explode(" ", $importuser["personal"], 2);
   $x++;
   if ($x % 25 == 0) {
       print $x . "/{$num} " . $GLOBALS['I18N']->get('done') . "<br/>";
       flush();
   }
   # check for full email
   if ($_POST["onlyfull"] != "yes" || $_POST["onlyfull"] == "yes" && strpos($importuser["personal"], "@") === false && strlen($importuser["email"]) > 4) {
       $new = 0;
       $result = Sql_query(sprintf('SELECT id,uniqid FROM %s
 WHERE email = "%s"', $tables["user"], $importuser["email"]));
       if (Sql_affected_rows()) {
           // Email exist, remember some values to add them to the lists
           $count_exist++;
           $user = Sql_fetch_array($result);
           $userid = $user["id"];
           $uniqid = $user["uniqid"];
           Sql_Query(sprintf('update %s set htmlemail = %d where id = %d', $tables["user"], $_POST["markhtml"] ? "1" : "0", $userid));
       } else {
           // Email does not exist
           $new = 1;
           // Create unique number
           mt_srand((double) microtime() * 1000000);
           $randval = mt_rand();
           $uniqid = getUniqid();
           $query = sprintf('INSERT INTO %s (email,entered,confirmed,uniqid,htmlemail)
    values("%s",current_timestamp,%d,"%s",%d)', $tables["user"], $importuser["email"], $_POST["notify"] != "yes", $uniqid, $_POST["markhtml"] ? "1" : "0");
           $result = Sql_query($query);
           $userid = Sql_Insert_Id($tables['user'], 'id');
           $count_email_add++;
开发者ID:dehvCurtis,项目名称:phplist,代码行数:31,代码来源:import3.php

示例7: ListofLists

function ListofLists($current, $fieldname, $subselect)
{
    ## @@TODO, this is slow on more than 150 lists. We should add caching or optimise
    $GLOBALS['systemTimer']->interval();
    $categoryhtml = array();
    ## add a hidden field, so that all checkboxes can be unchecked while keeping the field in POST to process it
    # $categoryhtml['unselect'] = '<input type="hidden" name="'.$fieldname.'[unselect]" value="1" />';
    $categoryhtml['selected'] = '';
    $categoryhtml['all'] = '
  <li><input type="hidden" name="' . $fieldname . '[unselect]" value="-1" /><input type="checkbox" name="' . $fieldname . '[all]"';
    if (!empty($current['all'])) {
        $categoryhtml['all'] .= 'checked';
    }
    $categoryhtml['all'] .= ' />' . s('All Lists') . '</li>';
    $categoryhtml['all'] .= '<li><input type="checkbox" name="' . $fieldname . '[allactive]"';
    if (!empty($current['allactive'])) {
        $categoryhtml['all'] .= 'checked="checked"';
    }
    $categoryhtml['all'] .= ' />' . s('All Public Lists') . '</li>';
    ## need a better way to suppress this
    if ($_GET['page'] != 'send') {
        $categoryhtml['all'] .= '<li>' . PageLinkDialog('addlist', s('Add a list')) . '</li>';
    }
    $result = Sql_query('select * from ' . $GLOBALS['tables']['list'] . $subselect . ' order by category, name');
    $numLists = Sql_Affected_Rows();
    while ($list = Sql_fetch_array($result)) {
        if (empty($list['category'])) {
            if ($numLists < 5) {
                ## for a small number of lists, add them to the @ tab
                $list['category'] = 'all';
            } else {
                $list['category'] = s('Uncategorised');
            }
        }
        if (!isset($categoryhtml[$list['category']])) {
            $categoryhtml[$list['category']] = '';
        }
        if (isset($current[$list['id']]) && $current[$list['id']]) {
            $list['category'] = 'selected';
        }
        $categoryhtml[$list['category']] .= sprintf('<li><input type="checkbox" name="' . $fieldname . '[%d]" value="%d" ', $list['id'], $list['id']);
        # check whether this message has been marked to send to a list (when editing)
        if (isset($current[$list['id']]) && $current[$list['id']]) {
            $categoryhtml[$list['category']] .= 'checked';
        }
        $categoryhtml[$list['category']] .= ' />' . htmlspecialchars(stripslashes($list['name']));
        if ($list['active']) {
            $categoryhtml[$list['category']] .= ' <span class="activelist">' . s('Public list') . '</span>';
        } else {
            $categoryhtml[$list['category']] .= ' <span class="inactivelist">' . s('Private list') . '</span>';
        }
        if (!empty($list['description'])) {
            $desc = nl2br(stripslashes($list['description']));
            $categoryhtml[$list['category']] .= "<br />{$desc}";
        }
        $categoryhtml[$list['category']] .= '</li>';
        $some = 1;
    }
    if (empty($categoryhtml['selected'])) {
        unset($categoryhtml['selected']);
    }
    #  file_put_contents('/tmp/timer.log','ListOfLists '.$GLOBALS['systemTimer']->interval(). "\n",FILE_APPEND);
    return $categoryhtml;
}
开发者ID:gillima,项目名称:phplist3,代码行数:64,代码来源:connect.php

示例8: Sql_Query

             Sql_Query(sprintf('update %s set email = "%s" where email = "%s"', $tables["user"], "duplicate{$c} " . $user["systemvalues"]["email"], $user["systemvalues"]["email"]));
             addUserHistory("duplicate{$c} " . $user["systemvalues"]["email"], "Duplication clash ", ' User marked duplicate email after clash with imported record');
         } else {
             if ($_SESSION["show_warnings"]) {
                 print Warn($GLOBALS['I18N']->get('Duplicate Email') . ' ' . $user["systemvalues"]["email"] . $GLOBALS['I18N']->get(' user imported as ') . '&quot;' . $GLOBALS['I18N']->get('duplicate') . "{$c} " . $user["systemvalues"]["email"] . "&quot;");
             }
             $user["systemvalues"]["email"] = $GLOBALS['I18N']->get('duplicate') . "{$c} " . $user["systemvalues"]["email"];
         }
     }
 } else {
     dbg('Importing on email ' . $user["systemvalues"]["email"]);
     $result = Sql_query(sprintf('select id,uniqid from %s where email = "%s"', $tables["user"], $user["systemvalues"]["email"]));
     # print "<br/>Using email for matching: ".$user["systemvalues"]["email"];
     $count["emailmatch"]++;
     $exists = Sql_Affected_Rows();
     $existing_user = Sql_fetch_array($result);
 }
 if ($exists) {
     // User exist, remember some values to add them to the lists
     $count["exist"]++;
     $userid = $existing_user["id"];
     $uniqid = $existing_user["uniqid"];
 } else {
     // user does not exist
     $new = 1;
     // Create unique number
     mt_srand((double) microtime() * 1000000);
     $randval = mt_rand();
     # this is very time consuming when importing loads of users as it does a lookup
     # needs speeding up if possible
     $uniqid = getUniqid();
开发者ID:Gerberus,项目名称:phplist3,代码行数:31,代码来源:import2.php

示例9: connectDB

<?php

/**
 * Created by PhpStorm.
 * User: Danial
 * Date: 5/10/2015
 * Time: 3:02 PM
 */
require_once "../lib/common.php";
$cn = connectDB();
$qry = "SELECT `id`,`interface_name` \n\t\tFROM `tbl_interface` \n\t\tWHERE `bridge`='no' AND `is_active`='active' \n\t\tORDER BY `interface_name` ASC";
$res = Sql_exec($cn, $qry);
$interface_options = "";
while ($dt = Sql_fetch_array($res)) {
    $full_name = "";
    $name_parts = "";
    $interface_name = "";
    $full_name = trim($dt['interface_name']);
    $name_parts = explode("-", $full_name);
    $interface_name = $name_parts[1];
    $interface_options .= '<option value="' . $full_name . '">' . $interface_name . '</option>';
}
ClosedDBConnection($cn);
echo $interface_options;
开发者ID:Allvee,项目名称:Softswitch,代码行数:24,代码来源:get_bridge_options.php

示例10: deleteItem

function deleteItem($table, $attributeid, $delete)
{
    global $tables, $replace;
    # delete the index in delete
    $valreq = Sql_Fetch_Row_query("select name from {$table} where id = {$delete}");
    $val = $valreq[0];
    # check dependencies
    $dependencies = array();
    $result = Sql_query("select distinct userid from {$tables['user_attribute']} where\n  attributeid = {$attributeid} and value = {$delete}");
    while ($row = Sql_fetch_array($result)) {
        array_push($dependencies, $row["userid"]);
    }
    if (sizeof($dependencies) == 0) {
        $result = Sql_query("delete from {$table} where id = {$delete}");
    } else {
        if ($replace) {
            $result = Sql_Query("update {$tables['user_attribute']} set value = {$replace} where value = {$delete}");
            $result = Sql_query("delete from {$table} where id = {$delete}");
        } else {
            print $GLOBALS["I18N"]->get("cannotdelete");
            print " <b>{$val}</b><br />";
            print $GLOBALS["I18N"]->get("dependentrecords") . '<p></p>';
            for ($i = 0; $i < sizeof($dependencies); $i++) {
                print PageLink2("user", $GLOBALS["I18N"]->get("user") . " " . $dependencies[$i], "id={$dependencies[$i]}") . "<br />\n";
                if ($i > 10) {
                    print $GLOBALS['I18N']->get('TooManyToList') . "\n " . sizeof($dependencies) . "<br /><br />";
                    giveAlternative($table, $delete, $attributeid);
                    return 0;
                }
            }
            print "</p><br />";
            giveAlternative($table, $delete, $attributeid);
        }
    }
    return 1;
}
开发者ID:alancohen,项目名称:alancohenexperience-com,代码行数:36,代码来源:editattributes.php

示例11: sendEmail

function sendEmail($messageid, $email, $hash, $htmlpref = 0, $rssitems = array(), $forwardedby = array())
{
    global $strThisLink, $PoweredByImage, $PoweredByText, $cached, $website;
    if ($email == "") {
        return 0;
    }
    #0013076: different content when forwarding 'to a friend'
    if (FORWARD_ALTERNATIVE_CONTENT) {
        $forwardContent = sizeof($forwardedby) > 0;
        $messagedata = loadMessageData($messageid);
    } else {
        $forwardContent = 0;
    }
    if (empty($cached[$messageid])) {
        $domain = getConfig("domain");
        $message = Sql_query("select * from {$GLOBALS["tables"]["message"]} where id = {$messageid}");
        $cached[$messageid] = array();
        $message = Sql_fetch_array($message);
        if (ereg("([^ ]+@[^ ]+)", $message["fromfield"], $regs)) {
            # if there is an email in the from, rewrite it as "name <email>"
            $message["fromfield"] = ereg_replace($regs[0], "", $message["fromfield"]);
            $cached[$messageid]["fromemail"] = $regs[0];
            # if the email has < and > take them out here
            $cached[$messageid]["fromemail"] = ereg_replace("<", "", $cached[$messageid]["fromemail"]);
            $cached[$messageid]["fromemail"] = ereg_replace(">", "", $cached[$messageid]["fromemail"]);
            # make sure there are no quotes around the name
            $cached[$messageid]["fromname"] = ereg_replace('"', "", ltrim(rtrim($message["fromfield"])));
        } elseif (ereg(" ", $message["fromfield"], $regs)) {
            # if there is a space, we need to add the email
            $cached[$messageid]["fromname"] = $message["fromfield"];
            $cached[$messageid]["fromemail"] = "listmaster@{$domain}";
        } else {
            $cached[$messageid]["fromemail"] = $message["fromfield"] . "@{$domain}";
            ## makes more sense not to add the domain to the word, but the help says it does
            ## so let's keep it for now
            $cached[$messageid]["fromname"] = $message["fromfield"] . "@{$domain}";
        }
        # erase double spacing
        while (ereg("  ", $cached[$messageid]["fromname"])) {
            $cached[$messageid]["fromname"] = eregi_replace("  ", " ", $cached[$messageid]["fromname"]);
        }
        ## this has weird effects when used with only one word, so take it out for now
        #    $cached[$messageid]["fromname"] = eregi_replace("@","",$cached[$messageid]["fromname"]);
        $cached[$messageid]["fromname"] = trim($cached[$messageid]["fromname"]);
        $cached[$messageid]["to"] = $message["tofield"];
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["subject"] = $forwardContent ? stripslashes($messagedata["forwardsubject"]) : $message["subject"];
        $cached[$messageid]["replyto"] = $message["replyto"];
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["content"] = $forwardContent ? stripslashes($messagedata["forwardmessage"]) : $message["message"];
        if (USE_MANUAL_TEXT_PART && !$forwardContent) {
            $cached[$messageid]["textcontent"] = $message["textmessage"];
        } else {
            $cached[$messageid]["textcontent"] = '';
        }
        #0013076: different content when forwarding 'to a friend'
        $cached[$messageid]["footer"] = $forwardContent ? stripslashes($messagedata["forwardfooter"]) : $message["footer"];
        $cached[$messageid]["htmlformatted"] = $message["htmlformatted"];
        $cached[$messageid]["sendformat"] = $message["sendformat"];
        if ($message["template"]) {
            $req = Sql_Fetch_Row_Query("select template from {$GLOBALS["tables"]["template"]} where id = {$message["template"]}");
            $cached[$messageid]["template"] = stripslashes($req[0]);
            $cached[$messageid]["templateid"] = $message["template"];
            #   dbg("TEMPLATE: ".$req[0]);
        } else {
            $cached[$messageid]["template"] = '';
            $cached[$messageid]["templateid"] = 0;
        }
        ## @@ put this here, so it can become editable per email sent out at a later stage
        $cached[$messageid]["html_charset"] = getConfig("html_charset");
        ## @@ need to check on validity of charset
        if (!$cached[$messageid]["html_charset"]) {
            $cached[$messageid]["html_charset"] = 'iso-8859-1';
        }
        $cached[$messageid]["text_charset"] = getConfig("text_charset");
        if (!$cached[$messageid]["text_charset"]) {
            $cached[$messageid]["text_charset"] = 'iso-8859-1';
        }
    }
    # else
    #  dbg("Using cached {$cached[$messageid]["fromemail"]}");
    if (VERBOSE) {
        output($GLOBALS['I18N']->get('sendingmessage') . ' ' . $messageid . ' ' . $GLOBALS['I18N']->get('withsubject') . ' ' . $cached[$messageid]["subject"] . ' ' . $GLOBALS['I18N']->get('to') . ' ' . $email);
    }
    # erase any placeholders that were not found
    #  $msg = ereg_replace("\[[A-Z ]+\]","",$msg);
    #0011857: forward to friend, retain attributes
    if ($hash == 'forwarded' && defined('KEEPFORWARDERATTRIBUTES') && KEEPFORWARDERATTRIBUTES) {
        $user_att_values = getUserAttributeValues($forwardedby['email']);
    } else {
        $user_att_values = getUserAttributeValues($email);
    }
    $userdata = Sql_Fetch_Assoc_Query(sprintf('select * from %s where email = "%s"', $GLOBALS["tables"]["user"], $email));
    $url = getConfig("unsubscribeurl");
    $sep = ereg('\\?', $url) ? '&' : '?';
    $html["unsubscribe"] = sprintf('<a href="%s%suid=%s">%s</a>', $url, $sep, $hash, $strThisLink);
    $text["unsubscribe"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    $html["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    $text["unsubscribeurl"] = sprintf('%s%suid=%s', $url, $sep, $hash);
    #0013076: Blacklisting posibility for unknown users
//.........这里部分代码省略.........
开发者ID:kvervo,项目名称:phplist-aiesec,代码行数:101,代码来源:sendemaillib.php

示例12: array

} else {
    $content .= '<tr><td colspan="2"><h4>' . $GLOBALS['I18N']->get('This campaign has been sent to subscribers, who are member of the following lists') . ':</h4></td></tr>';
}
$lists_done = array();
$result = Sql_Query(sprintf('select l.name, l.id from %s lm, %s l where lm.messageid = %d and lm.listid = l.id', $tables['listmessage'], $tables['list'], $id));
if (!Sql_Affected_Rows()) {
    $content .= '<tr><td colspan="2">' . $GLOBALS['I18N']->get('None yet') . '</td></tr>';
}
while ($lst = Sql_fetch_array($result)) {
    array_push($lists_done, $lst['id']);
    $content .= sprintf('<tr><td><!--%d--></td><td>%s</td></tr>', $lst['id'], stripslashes($lst['name']));
}
if ($msgdata['excludelist']) {
    $content .= '<tr><td colspan="2"><h4>' . $GLOBALS['I18N']->get('Except when they were also member of these lists') . ':</h4></td></tr>';
    $result = Sql_Query(sprintf('select l.name, l.id from %s l where id in (%s)', $tables['list'], join(',', $msgdata['excludelist'])));
    while ($lst = Sql_fetch_array($result)) {
        $content .= sprintf('<tr><td><!--%d--></td><td>%s</td></tr>', $lst['id'], stripslashes($lst['name']));
    }
}
$content .= '</table>';
$panel = new UIPanel(htmlspecialchars($campaignTitle), $content);
print $panel->display();
?>

<a name="resend"></a><p class="information"><?php 
echo s('Send this campaign to another list');
?>
:</p>
<?php 
echo formStart(' class="messageResend" ');
?>
开发者ID:narareddy,项目名称:phplist3,代码行数:31,代码来源:message.php

示例13: header

header("Content-Disposition: attachment; filename=\"{$filename}\"");
header("Content-Type: application/vnd.ms-excel");
$user_id = $_SESSION['USER_ID'];
//	$server_id = $_GET['action_id'];
$action_id = $_GET['action_id'];
$arr = explode("S", $action_id);
$server_id = $arr[1];
$arr[0] = str_replace('D', '-', $arr[0]);
$arr[0] = str_replace('T', ' ', $arr[0]);
$time_stamp = str_replace('C', ':', $arr[0]);
// 	$qry = "SELECT `msisdn` FROM `tbl_obd_dnd_list` WHERE `user_id`='".$user_id."' AND `server_id` ='".$server_id."'";
$qry = "SELECT `msisdn` FROM `tbl_obd_white_list` WHERE `server_id` ='" . $server_id . "' AND `time_stamp`='" . $time_stamp . "'";
$count = 0;
try {
    $data = Sql_exec($cn, $qry);
    while ($dt = Sql_fetch_array($data)) {
        $arr = array();
        $arr[0] = $dt[0];
        $v_arr[$count] = $arr;
        $count++;
    }
} catch (Exception $e) {
    $is_error = 1;
    array_push($err_field, $qry);
}
ClosedDBConnection($cn);
//$fp = fopen('php://output', 'w');
if ($v_arr != null && $v_arr != "") {
    foreach ($v_arr as $row) {
        echo implode("\t", $row) . "\r\n";
        //fputcsv($fp, array_values($row));
开发者ID:Allvee,项目名称:Softswitch,代码行数:31,代码来源:downloadWhite.php

示例14: loadUser

function loadUser($loginname = '')
{
    if (!Sql_Table_exists('user')) {
        return;
    }
    initialiseUserSession();
    if (!$loginname) {
        if ($_SESSION['userloggedin'] != '' && $_SESSION['username'] != '') {
            $loginname = $_SESSION['username'];
        } else {
            return '';
        }
    }
    $att_req = Sql_Query(sprintf('select attribute.id,
    %s.name,%s.type,
    %s.value,%s.tablename from %s,%s,%s
    where %s.userid = %s.id and %s.email = "%s" and %s.id = %s.attributeid', 'attribute', 'attribute', 'user_attribute', 'attribute', 'user', 'user_attribute', 'attribute', 'user_attribute', 'user', 'user', addslashes($loginname), 'attribute', 'user_attribute'));
    while ($att = Sql_fetch_array($att_req)) {
        #   if (!defined($_SESSION["userdata"]["attribute".$att["id"]])) {
        $_SESSION['userdata']['attribute' . $att['id']] = array('name' => $att['name'], 'value' => $att['value'], 'type' => $att['type'], 'attid' => $att['id'], 'displayvalue' => $att['value']);
        switch ($att['type']) {
            case 'textline':
            case 'hidden':
                $_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = $att['value'];
                break;
            case 'creditcardno':
                $_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = obscureCreditCard($att['value']);
                break;
            case 'select':
                $_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = AttributeValue($att['tablename'], $att['value']);
                break;
            case 'date':
                $_SESSION['userdata']['attribute' . $att['id']]['displayvalue'] = formatDate($att['value']);
                break;
        }
        #    }
    }
    $d_req = Sql_Fetch_Array_Query("select * from user where email = \"{$loginname}\"");
    $_SESSION['userid'] = $d_req['id'];
    foreach (array('email', 'disabled', 'confirmed', 'htmlemail', 'uniqid', 'password', 'foreignkey') as $field) {
        #   if (!defined($_SESSION["userdata"][$field])) {
        $_SESSION['userdata'][$field] = array('name' => $field, 'value' => $d_req[$field], 'type' => 'static', 'displayvalue' => $d_req[$field]);
        #     }
    }
    $_SESSION['usergroups'] = userGroups($loginname);
    if (is_array($GLOBALS['config']['usergreeting'])) {
        $_SESSION['usergreeting'] = '';
        foreach ($GLOBALS['config']['usergreeting'] as $att) {
            $_SESSION['usergreeting'] .= $_SESSION['userdata'][$att]['displayvalue'] . ' ';
        }
        $_SESSION['usergreeting'] = rtrim($_SESSION['usergreeting']);
    }
    dbg('done loading user');
    return 1;
}
开发者ID:gillima,项目名称:phplist3,代码行数:55,代码来源:userlib.php

示例15: confirmPage

function confirmPage($id)
{
    global $tables, $envelope;
    if (!$_GET['uid']) {
        FileNotFound();
    }
    $req = Sql_Query(sprintf('select * from %s where uniqid = "%s"', $tables['user'], sql_escape($_GET['uid'])));
    $userdata = Sql_Fetch_Array($req);
    if ($userdata['id']) {
        $html = '<ul>';
        $lists = '';
        $currently = Sql_Fetch_Assoc_Query("select confirmed from {$tables['user']} where id = " . $userdata['id']);
        $blacklisted = isBlackListed($userdata['email']);
        foreach ($GLOBALS['plugins'] as $pluginname => $plugin) {
            $plugin->subscriberConfirmation($id, $userdata);
        }
        Sql_Query("update {$tables['user']} set confirmed = 1,blacklisted = 0, optedin = 1 where id = " . $userdata['id']);
        $subscriptions = array();
        $req = Sql_Query(sprintf('select list.id,name,description from %s list, %s listuser where listuser.userid = %d and listuser.listid = list.id and list.active', $tables['list'], $tables['listuser'], $userdata['id']));
        if (!Sql_Affected_Rows()) {
            $lists = "\n * " . $GLOBALS['strNoLists'];
            $html .= '<li>' . $GLOBALS['strNoLists'] . '</li>';
        }
        while ($row = Sql_fetch_array($req)) {
            array_push($subscriptions, $row['id']);
            $lists .= "\n *" . stripslashes($row['name']);
            $html .= '<li class="list">' . stripslashes($row['name']) . '<div class="listdescription">' . stripslashes($row['description']) . '</div></li>';
        }
        $html .= '</ul>';
        if ($blacklisted) {
            unBlackList($userdata['id']);
            addUserHistory($userdata['email'], 'Confirmation', s('Subscriber removed from Blacklist for manual confirmation of subscription'));
        }
        if (empty($_SESSION['subscriberConfirmed'])) {
            $_SESSION['subscriberConfirmed'] = array();
        }
        ## 17513 - don't process confirmation if the subscriber is already confirmed
        if (empty($currently['confirmed']) && empty($_SESSION['subscriberConfirmed'][$userdata['email']])) {
            addUserHistory($userdata['email'], 'Confirmation', "Lists: {$lists}");
            $confirmationmessage = str_ireplace('[LISTS]', $lists, getUserConfig("confirmationmessage:{$id}", $userdata['id']));
            if (!TEST) {
                sendMail($userdata['email'], getConfig("confirmationsubject:{$id}"), $confirmationmessage, system_messageheaders(), $envelope);
                $adminmessage = $userdata['email'] . ' has confirmed their subscription';
                if ($blacklisted) {
                    $adminmessage .= "\n\n" . s('Subscriber has been removed from blacklist');
                }
                sendAdminCopy('List confirmation', $adminmessage, $subscriptions);
                addSubscriberStatistics('confirmation', 1);
            }
        } else {
            $html = $GLOBALS['strAlreadyConfirmed'];
        }
        $_SESSION['subscriberConfirmed'][$userdata['email']] = time();
        $info = $GLOBALS['strConfirmInfo'];
    } else {
        logEvent('Request for confirmation for invalid user ID: ' . substr($_GET['uid'], 0, 150));
        $html = 'Error: ' . $GLOBALS['strUserNotFound'];
        $info = $GLOBALS['strConfirmFailInfo'];
    }
    $res = '<title>' . $GLOBALS['strConfirmTitle'] . '</title>';
    $res .= $GLOBALS['pagedata']['header'];
    $res .= '<h3>' . $info . '</h3>';
    $res .= $html;
    $res .= '<p>' . $GLOBALS['PoweredBy'] . '</p>';
    $res .= $GLOBALS['pagedata']['footer'];
    return $res;
}
开发者ID:gillima,项目名称:phplist3,代码行数:67,代码来源:index.php


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