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


PHP htmlsanitize函数代码示例

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


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

示例1: htmlsanitize

        default:
            // Just print out a smilie.
            ?>
		<td align="center" bgcolor="<?php 
            echo $CFG['style']['table']['cella'];
            ?>
" class="small">
			<div class="medium"><?php 
            echo htmlsanitize($strTitle);
            ?>
</div>
			<div style="padding: 5px;"><table cellpadding="2" cellspacing="0" border="0" height="35" style="vertical-align: middle"><tr><td style="vertical-align: middle"><img src="<?php 
            echo "{$CFG['paths']['smilies']}{$strFilename}";
            ?>
" alt="" /></td><td style="vertical-align: middle"><b><?php 
            echo htmlsanitize($strCode);
            ?>
</b></td></tr></table></div>
			[<a href="admincp.php?section=smilies&amp;action=edit&amp;smilieid=<?php 
            echo $iSmilieID;
            ?>
">Edit</a>] [<a href="admincp.php?section=smilies&amp;action=remove&amp;smilieid=<?php 
            echo $iSmilieID;
            ?>
">Remove</a>]
		</td>
<?php 
            break;
    }
    // Update the position.
    if ($i != $iRowLength) {
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:smilies.tpl.php

示例2: foreach

<tr>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium"><b>Usergroup</b></td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
">
		<select name="usergroupid">
<?php 
foreach ($aGroup as $iGroupID => $temp) {
    if ($iGroupID == $iUsergroupID) {
        $strSelected = ' selected="selected"';
    }
    $strUsergroup = htmlsanitize($aGroup[$iGroupID]['groupname']);
    echo "\t\t\t<option value=\"{$iGroupID}\"{$strSelected}>{$strUsergroup}</option>\n";
    unset($strSelected);
}
?>
		</select>
	</td>
</tr>

</table>

<div style="text-align: center;"><br /><input type="submit" name="submit" value="Add User" accesskey="s" /></div>
</form>

<?php 
// Footer
开发者ID:OvBB,项目名称:v1.0,代码行数:31,代码来源:addusergroupuser.tpl.php

示例3: foreach

	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium"><b>Parent Forum</b></td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
">
		<select name="parent">
			<option value="0">None (new category)</option>
<?php 
foreach ($aForums as $iForumID => $strForumName) {
    if ($aForum['parent'] == $iForumID) {
        $strSelected = 'selected="selected"';
    }
    $strForumName = htmlsanitize($strForumName);
    echo "\t\t\t<option value=\"{$iForumID}\"{$strSelected}>{$strForumName}</option>\n";
}
?>
		</select>
	</td>
</tr>

</table>

<div style="text-align: center;"><br /><input type="submit" name="submit" value="Add Forum" accesskey="s" /></div>
</form>

<?php 
// Footer
require "./skins/{$CFG['skin']}/footer.tpl.php";
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:addforum.tpl.php

示例4: htmlsanitize

" onchange="javascript:update(this);" /> <input id="link_a_preview" style="border: black solid 1px; background-color: <?php 
echo $aStyles['link_a'];
?>
;" type="text" size="10" disabled="disabled" /></td>
</tr>

<tr>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium"><b>Hover Link Color</b></td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium"><input type="text" name="link_h" size="10" value="<?php 
echo htmlsanitize($aStyles['link_h']);
?>
" onchange="javascript:update(this);" /> <input id="link_h_preview" style="border: black solid 1px; background-color: <?php 
echo $aStyles['link_h'];
?>
;" type="text" size="10" disabled="disabled" /></td>
</tr>

</table>

<div style="text-align: center;"><br /><input type="submit" name="submit" value="Save Changes" accesskey="s" /></div>
</form>

<?php 
// Footer
require "./skins/{$CFG['skin']}/footer.tpl.php";
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:style.tpl.php

示例5: htmlsanitize

<?php

// Header
$strPageTitle = ' :: Admin Control Panel :. Remove Smilie';
require "./skins/{$CFG['skin']}/header.tpl.php";
?>

<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
<tr>
	<td align="left" valign="top"><a href="index.php"><img src="images/ovbb.png" align="middle" border="0" alt="<?php 
echo htmlsanitize($CFG['general']['name']);
?>
 :: Powered by OvBB" /></a></td>
	<td width="100%" align="left" valign="top" class="medium"><b><a href="index.php"><?php 
echo htmlsanitize($CFG['general']['name']);
?>
</a> &gt; <a href="admincp.php">Admin Control Panel</a> &gt; <a href="admincp.php?section=smilies">Smilies</a> &gt; Remove Smilie</b></td>
</tr>
</table><br />

<?php 
// Admin CP menu.
PrintCPMenu();
?>

<br />

<form action="admincp.php" method="post">
<input type="hidden" name="section" value="smilies" />
<input type="hidden" name="action" value="remove" />
<input type="hidden" name="smilieid" value="<?php 
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:removesmilie.tpl.php

示例6: htmlsanitize

"><input type="text" name="title" size="35" maxlength="255" value="<?php 
echo htmlsanitize($aSkin['title']);
?>
" /></td>
</tr>

<tr>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium">
		<b>Skin Folder</b>
		<div class="smaller">This is the folder containing the skin/template files (located in &quot;<b>skins/</b>&quot;).</div>
	</td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
"><input type="text" name="folder" size="35" maxlength="255" value="<?php 
echo htmlsanitize($aSkin['folder']);
?>
" /></td>
</tr>

</table>

<div style="text-align: center;"><br /><input type="submit" name="submit" value="Add Skin" accesskey="s" /></div>
</form>

<?php 
// Footer
require "./skins/{$CFG['skin']}/footer.tpl.php";
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:addskin.tpl.php

示例7: htmlsanitize

	<td valign="top" bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium" nowrap="nowrap">
		<b>Message</b>
		<div class="smaller"><br />
			Note by using this form,<br />
			your e-mail address will<br />
			become available to the<br />
			person you are contacting.
		</div>
	</td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
">
		<textarea name="body" cols="50" rows="10"><?php 
echo htmlsanitize($aMessageInfo[BODY]);
?>
</textarea>
	</td>
</tr>

</table><br />

<div style="text-align: center;"><input type="submit" name="submit" value="Send E-Mail" accesskey="s" /></div>
</form><br />

<?php 
// Footer.
require "./skins/{$CFG['skin']}/footer.tpl.php";
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:mailuser.tpl.php

示例8: SendMessage

function SendMessage()
{
    global $CFG, $dbConn;
    // Get the values from the user.
    $strRecipient = $dbConn->sanitize($_REQUEST['recipient']);
    $strSubject = $_REQUEST['subject'];
    $iPostIcon = (int) $_REQUEST['icon'];
    $strMessage = $_REQUEST['message'];
    $bDisableSmilies = (int) (bool) $_REQUEST['dsmilies'];
    $bTracking = (int) (bool) $_REQUEST['track'];
    // Recipient
    $dbConn->query("SELECT id, enablepms, rejectpms, ignorelist FROM citizen WHERE username='{$strRecipient}'");
    list($iRecipientID, $bEnablePMs, $bRejectPMs, $aIgnoreList) = $dbConn->getresult();
    $aIgnoreList = (array) explode(',', $aIgnoreList);
    // Does the user exist?
    if ($iRecipientID === NULL) {
        $aError[] = 'The user you specified does not exist.';
    } else {
        if ($iRecipientID == $_SESSION['userid']) {
            $aError[] = 'You cannot send private messages to yourself.';
        } else {
            if (!$bEnablePMs) {
                $aError[] = htmlsanitize("The message cannot be sent because {$strRecipient} has private messages disabled.");
            } else {
                if ($bRejectPMs && in_array($_SESSION['userid'], $aIgnoreList)) {
                    $aError[] = 'The user you specified does not accept private messages from members on their Ignore list.';
                }
            }
        }
    }
    // Subject
    if (trim($strSubject) == '') {
        // They either put in only whitespace or nothing at all.
        $aError[] = 'You must specify a subject.';
    } else {
        if (strlen($strSubject) > $CFG['maxlen']['subject']) {
            // The subject they specified is too long.
            $aError[] = "The subject you specified is longer than {$CFG['maxlen']['subject']} characters.";
        }
    }
    $strSubject = $dbConn->sanitize($strSubject);
    // Icon
    if ($iPostIcon < 0 || $iPostIcon > 14) {
        // They don't know what icon they want. We'll give them none.
        $iPostIcon = 0;
    }
    // Message
    if (trim($strMessage) == '') {
        // They either put in only whitespace or nothing at all.
        $aError[] = 'You must specify a message.';
    } else {
        if (strlen($strMessage) > $CFG['maxlen']['messagebody']) {
            // The message they specified is too long.
            $aError[] = "The message you specified is longer than {$CFG['maxlen']['messagebody']} characters.";
        }
    }
    if ($_REQUEST['parseemails']) {
        $strMessage = ParseEMails($strMessage);
    }
    $strMessage = $dbConn->sanitize($strMessage);
    // If there was an error, let's return it.
    if (is_array($aError)) {
        return $aError;
    }
    // Add the message to the database.
    $dbConn->query("INSERT INTO pm(ownerid, datetime, author, recipient, subject, body, parent, ipaddress, icon, dsmilies, beenread, tracking) VALUES({$iRecipientID}, {$CFG['globaltime']}, {$_SESSION['userid']}, {$iRecipientID}, '{$strSubject}', '{$strMessage}', 0, {$_SESSION['userip']}, {$iPostIcon}, {$bDisableSmilies}, 0, {$bTracking})");
    // Did they want to save a copy?
    if ($_REQUEST['savecopy']) {
        // Yes, so do so.
        $dbConn->query("INSERT INTO pm(ownerid, datetime, author, recipient, subject, body, parent, ipaddress, icon, dsmilies, beenread) VALUES({$_SESSION['userid']}, {$CFG['globaltime']}, {$_SESSION['userid']}, {$iRecipientID}, '{$strSubject}', '{$strMessage}', 1, {$_SESSION['userip']}, {$iPostIcon}, {$bDisableSmilies}, 0)");
    }
    // Was this message a reply to another one?
    if ($_REQUEST['action'] == 'reply') {
        // Yes, mark the original message as been replied.
        $iMessageID = (int) $_REQUEST['id'];
        $dbConn->query("UPDATE pm SET replied=1 WHERE id={$iMessageID} AND ownerid={$_SESSION['userid']}");
    }
    // Render the page.
    Msg("<b>Your message has been successfully sent.</b><br /><br /><span class=\"smaller\">You should be redirected momentarily. Click <a href=\"private.php\">here</a> if you do not want to wait any longer or if you are not redirected.</span>", 'private.php');
}
开发者ID:OvBB,项目名称:v1.0,代码行数:80,代码来源:private.php

示例9: foreach

            echo ' <img src="images/sort_asc.png" style="vertical-align: middle;" alt="Ascending" />';
        } else {
            echo ' <img src="images/sort_desc.png" style="vertical-align: middle;" alt="Descending" />';
        }
    }
    ?>
</td>
		</tr></table>
	</td>
</tr>
<?php 
    // Display the members.
    foreach ($aMembers as $iMemberID => $aMember) {
        // Do some value preparation.
        $aMember[USERNAME] = htmlsanitize($aMember[USERNAME]);
        $aMember[WEBSITE] = htmlsanitize($aMember[WEBSITE]);
        $aMember[ONLINE] = $aMember[ONLINE] ? 'online' : 'offline';
        // Set the color.
        $strColor = $strColor == $CFG['style']['table']['cella'] ? $CFG['style']['table']['cellb'] : $CFG['style']['table']['cella'];
        ?>
<tr>
	<td bgcolor="<?php 
        echo $strColor;
        ?>
" width="40%" align="left" valign="middle" colspan="2">
	<table cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td align="center" valign="middle"><img src="images/<?php 
        if ($aMember[ONLINE] == 'offline') {
            echo 'in';
        }
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:memberlist.tpl.php

示例10: SmilieTable

echo $CFG['style']['table']['cellb'];
?>
" class="small" style="border-width: 1px; border-style: inset"><b>Smilies</b></td>
			</tr>
<?php 
// Display the Smilie table.
SmilieTable($aSmilies);
?>
		</table>
	</td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cellb'];
?>
">
		<textarea name="message" cols="70" rows="20"><?php 
echo htmlsanitize($aEventInfo['body']);
?>
</textarea>
		<div class="smaller">[<a href="#" onclick="javascript:alert('The maximum permitted length is <?php 
echo $CFG['maxlen']['messagebody'];
?>
 characters.\n\nYour event information is '+document.theform.message.value.length+' characters long.');">Check length.</a>]</div>
	</td>
</tr>

<tr>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium" nowrap="nowrap"><b>Options</b></td>
	<td bgcolor="<?php 
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:addevent.tpl.php

示例11: SmilieTable

echo $CFG['style']['table']['cellb'];
?>
" class="small" style="border-width: 1px; border-style: inset"><b>Smilies</b></td>
			</tr>
<?php 
// Display the Smilie table.
SmilieTable($aSmilies);
?>
		</table>
	</td>
	<td bgcolor="<?php 
echo $CFG['style']['table']['cellb'];
?>
">
		<textarea name="message" cols="70" rows="20"><?php 
echo htmlsanitize($strMessage);
?>
</textarea>
		<div class="smaller">[<a href="#" onclick="javascript:alert('The maximum permitted length is <?php 
echo $CFG['maxlen']['messagebody'];
?>
 characters.\n\nYour message is '+document.theform.message.value.length+' characters long.');">Check message length.</a>]</div>
	</td>
</tr>

<tr>
	<td valign="top" bgcolor="<?php 
echo $CFG['style']['table']['cella'];
?>
" class="medium" nowrap="nowrap"><b>Options</b></td>
	<td bgcolor="<?php 
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:newmessage.tpl.php

示例12: SavePost

function SavePost($aPostInfo)
{
    global $CFG, $dbConn, $iRootID, $aAttachments, $aPostIcons;
    $iPostID = $aPostInfo['id'];
    $iThreadID = $aPostInfo['parent'];
    // Initiate some variables.
    $aToDelete = array();
    $iAddedAttachments = 0;
    $iRemovedAttachments = 0;
    // Grab the info. specified by the user.
    $strSubject = $_REQUEST['subject'];
    $strThreadDesc = $_REQUEST['description'];
    $iPostIcon = (int) $_REQUEST['icon'];
    $strBody = $_REQUEST['message'];
    $bParseURLs = (bool) $_REQUEST['parseurls'];
    $bParseEMails = (bool) $_REQUEST['parseemails'];
    $bDisableSmilies = (int) (bool) $_REQUEST['dsmilies'];
    $aDeleteAttachments = $_REQUEST['deleteattach'];
    // Subject
    if (trim($strSubject) == '' && $iPostID == $iRootID) {
        // This post is the thread root, and they either put in only whitespace or nothing at all.
        $aError[] = 'You must specify a subject.';
    } else {
        if (strlen($strSubject) > $CFG['maxlen']['subject']) {
            // The subject they specified is too long.
            $aError[] = "The subject you specified is longer than {$CFG['maxlen']['subject']} characters.";
        }
    }
    $strCleanSubject = $dbConn->sanitize($strSubject);
    // Description
    if (strlen($strThreadDesc) > $CFG['maxlen']['desc']) {
        // The description they specified is too long.
        $aError[] = "The description you specified is longer than {$CFG['maxlen']['desc']} characters.";
    }
    $strThreadDesc = $dbConn->sanitize($strThreadDesc);
    // Icon
    if ($iPostIcon < 0 || $iPostIcon > count($aPostIcons) - 1) {
        // They don't know what icon they want. We'll give them none.
        $iPostIcon = 0;
    }
    // Body
    if (trim($strBody) == '') {
        // They either put in only whitespace or nothing at all.
        $aError[] = 'You must specify a message.';
    } else {
        if (strlen($strBody) > $CFG['maxlen']['messagebody']) {
            // The body they specified is too long.
            $aError[] = "The message you specified is longer than {$CFG['maxlen']['messagebody']} characters.";
        }
    }
    $strCleanBody = $dbConn->sanitize($strBody);
    // Attachment
    if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] != UPLOAD_ERR_NO_FILE) {
        // What is the problem?
        switch ($_FILES['attachment']['error']) {
            // Upload was successful?
            case UPLOAD_ERR_OK:
                // Is it bigger than the allowable maximum?
                if ($_FILES['attachment']['size'] > $CFG['uploads']['maxsize']) {
                    $aError[] = "The attachment you uploaded is too large. The maximum allowable filesize is {$CFG['uploads']['maxsize']} bytes.";
                }
                // Is it an invalid filetype?
                if (!isset($CFG['uploads']['oktypes'][strtolower(substr(strrchr($_FILES['attachment']['name'], '.'), 1))])) {
                    $aError[] = 'The file you uploaded is an invalid type of attachment. Valid types are: ' . htmlsanitize(implode(', ', array_keys($CFG['uploads']['oktypes']))) . '.';
                }
                // If there are no errors, grab the data from the temporary file.
                if (!is_array($aError)) {
                    $strAttachmentName = $dbConn->sanitize($_FILES['attachment']['name']);
                    if ($fileUploaded = fopen($_FILES['attachment']['tmp_name'], 'rb')) {
                        $blobAttachment = $dbConn->sanitize(fread($fileUploaded, 65536), TRUE);
                    } else {
                        $aError[] = 'There was a problem while reading the attachment. If this problem persists, please contact the Webmaster.';
                    }
                }
                break;
                // File is too big?
            // File is too big?
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                $aError[] = "The attachment you uploaded is too large. The maximum allowable filesize is {$CFG['uploads']['maxsize']} bytes.";
                break;
                // File was partially uploaded?
            // File was partially uploaded?
            case UPLOAD_ERR_PARTIAL:
                $aError[] = 'The attachment was only partially uploaded.';
                break;
                // WTF happened?
            // WTF happened?
            default:
                $aError[] = 'There was an error while uploading the attachment.';
                break;
        }
    }
    // If there was an error, let's return it.
    if ($aError) {
        return $aError;
    }
    // Update the post's record.
    $dbConn->query("UPDATE post SET datetime_edited={$CFG['globaltime']}, title='{$strCleanSubject}', body='{$strCleanBody}', icon={$iPostIcon}, dsmilies={$bDisableSmilies} WHERE id={$iPostID}");
    // Was this post the thread root?
//.........这里部分代码省略.........
开发者ID:OvBB,项目名称:v1.0,代码行数:101,代码来源:editpost.php

示例13: foreach

" cellpadding="5" cellspacing="1" border="0" align="center">

<tr class="section">
	<td align="center" class="small">Extension</td>
	<td align="center" class="small">Icon</td>
	<td align="center" class="small">MIME Type</td>
	<td align="center" class="small" colspan="2">Actions</td>
</tr>

<?php 
foreach ($CFG['uploads']['oktypes'] as $strExtension => $aType) {
    // Sanitize the file type's information.
    $strExtA = htmlsanitize($strExtension);
    $strExtB = urlencode($strExtension);
    $strIcon = urlencode($aType[0]);
    $strMIME = htmlsanitize($aType[1]);
    // Display the information.
    echo "<tr>\n";
    echo "\t<td align=\"center\" bgcolor=\"{$CFG['style']['table']['cellb']}\">{$strExtA}</td>\n";
    echo "\t<td align=\"center\" bgcolor=\"{$CFG['style']['table']['cellb']}\"><img src=\"images/attach/{$strIcon}\" alt=\"\" /></td>\n";
    echo "\t<td align=\"center\" bgcolor=\"{$CFG['style']['table']['cellb']}\">{$strMIME}</td>\n";
    echo "\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=attachments&amp;action=edit&amp;type={$strExtB}\">Edit</a></td>\n";
    echo "\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=attachments&amp;action=remove&amp;type={$strExtB}\">Remove</a></td>\n";
    echo "</tr>\n";
}
?>

<tr class="section"><td align="center" class="smaller" colspan="5"><a class="section" href="admincp.php?section=attachments&amp;action=add">Add New File Type</a></td></tr>

</table>
</td></tr>
开发者ID:OvBB,项目名称:v1.0,代码行数:31,代码来源:attachments.tpl.php

示例14: SubmitPost

function SubmitPost()
{
    global $CFG, $dbConn, $aPostIcons, $iThreadID, $iForumID;
    // Get the values from the user.
    $strSubject = $_REQUEST['subject'];
    $iPostIcon = (int) $_REQUEST['icon'];
    $strMessage = $_REQUEST['message'];
    $bParseEMails = (int) (bool) $_REQUEST['parseemails'];
    $bDisableSmilies = (int) (bool) $_REQUEST['dsmilies'];
    // Floodcheck
    if (!$_SESSION['permissions']['cbypassflood'] && $_SESSION['lastpost'] + $CFG['floodcheck'] > $CFG['globaltime']) {
        Msg("Sorry! The administrator has specified that users can only post one message every {$CFG['floodcheck']} seconds.", '', 'justify');
    }
    // Subject
    if (strlen($strSubject) > $CFG['maxlen']['subject']) {
        // The subject they specified is too long.
        $aError[] = "The subject you specified is longer than {$CFG['maxlen']['subject']} characters.";
    }
    $strCleanSubject = $dbConn->sanitize($strSubject);
    // Icon
    if ($iPostIcon < 0 || $iPostIcon > count($aPostIcons) - 1) {
        // They don't know what icon they want. We'll give them none.
        $iPostIcon = 0;
    }
    // Message
    if (trim($strMessage) == '') {
        // They either put in only whitespace or nothing at all.
        $aError[] = 'You must specify a message.';
    } else {
        if (strlen($strMessage) > $CFG['maxlen']['messagebody']) {
            // The message they specified is too long.
            $aError[] = "The message you specified is longer than {$CFG['maxlen']['messagebody']} characters.";
        }
    }
    if ($bParseEMails) {
        $strMessage = ParseEMails($strMessage);
    }
    $strCleanMessage = $dbConn->sanitize($strMessage);
    // Attachment
    if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] != UPLOAD_ERR_NO_FILE) {
        // What is the problem?
        switch ($_FILES['attachment']['error']) {
            // Upload was successful?
            case UPLOAD_ERR_OK:
                // Is it bigger than 100KB?
                if ($_FILES['attachment']['size'] > $CFG['uploads']['maxsize']) {
                    $aError[] = "The attachment you uploaded is too large. The maximum allowable filesize is {$CFG['uploads']['maxsize']} bytes.";
                }
                // Is it an invalid filetype?
                if (!isset($CFG['uploads']['oktypes'][strtolower(substr(strrchr($_FILES['attachment']['name'], '.'), 1))])) {
                    $aError[] = 'The file you uploaded is an invalid type of attachment. Valid types are: ' . htmlsanitize(implode(', ', array_keys($CFG['uploads']['oktypes']))) . '.';
                }
                // If there are no errors, grab the data from the temporary file.
                if (!is_array($aError)) {
                    $strAttachmentName = $dbConn->sanitize($_FILES['attachment']['name']);
                    if ($fileUploaded = fopen($_FILES['attachment']['tmp_name'], 'rb')) {
                        $blobAttachment = $dbConn->sanitize(fread($fileUploaded, 65536), TRUE);
                    } else {
                        $aError[] = 'There was a problem while reading the attachment. If this problem persists, please contact the Webmaster.';
                    }
                }
                break;
                // File is too big?
            // File is too big?
            case UPLOAD_ERR_INI_SIZE:
            case UPLOAD_ERR_FORM_SIZE:
                $aError[] = "The attachment you uploaded is too large. The maximum allowable filesize is {$CFG['uploads']['maxsize']} bytes.";
                break;
                // File was partially uploaded?
            // File was partially uploaded?
            case UPLOAD_ERR_PARTIAL:
                $aError[] = 'The attachment was only partially uploaded.';
                break;
                // WTF happened?
            // WTF happened?
            default:
                $aError[] = 'There was an error while uploading the attachment.';
                break;
        }
    }
    // If there was an error, let's return it.
    if (is_array($aError)) {
        return $aError;
    }
    // First we obviously need the post in the post table.
    $dbConn->query("INSERT INTO post(author, datetime_posted, title, body, parent, ipaddress, icon, dsmilies) VALUES({$_SESSION['userid']}, {$CFG['globaltime']}, '{$strCleanSubject}', '{$strCleanMessage}', {$iThreadID}, {$_SESSION['userip']}, {$iPostIcon}, {$bDisableSmilies})");
    // Before we continue, get the ID of the post we just created.
    $iPostID = $dbConn->getinsertid('post');
    // Second, we need to update record of the thread we are posting to.
    $dbConn->query("UPDATE thread SET lpost={$CFG['globaltime']}, lposter={$_SESSION['userid']}, postcount=postcount+1 WHERE id={$iThreadID}");
    // Get the post count of the thread we replied to, so we can figure the last page.
    $dbConn->query("SELECT postcount FROM thread WHERE id={$iThreadID}");
    list($iPostCount) = $dbConn->getresult();
    // Third, we need to update the record of the forum that contains the thread we are posting to.
    $dbConn->query("UPDATE board SET postcount=postcount+1, lpost={$CFG['globaltime']}, lposter={$_SESSION['userid']}, lthread={$iThreadID}, lthreadpcount={$iPostCount} WHERE id={$iForumID}");
    // Fourth, we need to update the poster's postcount.
    $dbConn->query("UPDATE citizen SET postcount=postcount+1 WHERE id={$_SESSION['userid']}");
    // And finally, we need to store the attachment, if there is one.
    if ($fileUploaded) {
        // Insert the first chunk of the file.
//.........这里部分代码省略.........
开发者ID:spookdogg,项目名称:v1.0,代码行数:101,代码来源:newreply.php

示例15: foreach

	<td align="center" class="small">Order</td>
	<td align="center" class="small" colspan="2">Actions</td>
</tr>

<?php 
foreach ($aCategory as $iCategoryID => $temp) {
    $aCategory[$iCategoryID][NAME] = htmlsanitize($aCategory[$iCategoryID][NAME]);
    echo "\t<tr>\n";
    echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><b><a href=\"forumdisplay.php?forumid={$iCategoryID}\">{$aCategory[$iCategoryID][NAME]}</a></b></td>\n";
    echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><input type=\"text\" name=\"forumid[{$iCategoryID}]\" size=\"5\" value=\"{$aCategory[$iCategoryID][DISPORDER]}\" /></td>\n";
    echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=forums&amp;action=edit&amp;forumid={$iCategoryID}\">Edit</a></td>\n";
    echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=forums&amp;action=remove&amp;forumid={$iCategoryID}\">Remove</a></td>\n";
    echo "\t</tr>\n";
    foreach ($aForum as $iForumID => $temp) {
        if ($aForum[$iForumID][PARENT] == $iCategoryID) {
            $aForum[$iForumID][NAME] = htmlsanitize($aForum[$iForumID][NAME]);
            echo "\t<tr>\n";
            echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\">&nbsp;&nbsp;&nbsp;-- <b><a href=\"forumdisplay.php?forumid={$iForumID}\">{$aForum[$iForumID][NAME]}</a></b></td>\n";
            echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><input type=\"text\" name=\"forumid[{$iForumID}]\" size=\"5\" value=\"{$aForum[$iForumID][DISPORDER]}\" /></td>\n";
            echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=forums&amp;action=edit&amp;forumid={$iForumID}\">Edit</a></td>\n";
            echo "\t\t<td bgcolor=\"{$CFG['style']['table']['cellb']}\"><a href=\"admincp.php?section=forums&amp;action=remove&amp;forumid={$iForumID}\">Remove</a></td>\n";
            echo "\t</tr>\n";
        }
    }
}
?>

<tr class="section"><td align="center" class="smaller" colspan="4"><a class="section" href="admincp.php?section=forums&amp;action=add">Add New Forum</a></td></tr>

</table>
</td></tr>
开发者ID:spookdogg,项目名称:v1.0,代码行数:31,代码来源:forums.tpl.php


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