検索
ホームページバックエンド開発PHPチュートリアル機関車 discuz6.1 完璧に収集された php インターフェイス ファイル_PHP チュートリアル

機関車 discuz6.1 完璧に収集された php インターフェイス ファイル_PHP チュートリアル

Jul 21, 2016 pm 03:44 PM
php改訂完璧インターフェース書類コメントプログラムコレクション

PS: 元のファイルへの変更は比較的大きく、プログラム内のコメントはすでに非常に詳細であるため、ここでは詳しく説明しません。

コードをコピーします コードは次のとおりです:

// header('Content-Type:text/html;charset=UTF-8');
//if(function_exists("mb_convert_encoding")){
// $tmp = checkAndTranslate("使用する前に、ファイルをフォーラムのルート ディレクトリに直接アップロードしてください", 0);
// header('Content-Type: text/html;charset=UTF-8');
// print($tmp);
/ /}else{
// print("NO");
//}
// exit("this.line=".__line__);
/*
ファイル名:locoyonline_for_discuz610.php
※使用前に変更してくださいファイルをフォーラムのルート ディレクトリに直接アップロードします
*このファイルは GBK でエンコードされています
*処理後にデータベースにインポートされるエンコードは次のとおりです:
*文字を置換する必要がある場合は、コピーして置換する必要があります。 .txt を同じディレクトリにコピーします
*/
//グローバル変数を処理します
//foreach($_POST as $key => $value){
//$$key = $value; .' = '.$value.'n ');
//}
//exit('end-0');
// 1 .cdb_threads
// 2.cdb_rewardlog // ok 報奨金記録テーブル
// 3.cdb_mythreads
// 4.cdb_posts
// 5.cdb_tags _update
// 6.cdb_threadtags
// 7.cdb_forums _update
// 8 .cdb_members _update ok 報奨金リストを変更します
// 完了です !
$user_list = file('./makeuser/username.txt');
// ランダムに投稿するユーザーのリストを登録する必要があります
// バッチについてユーザー名の登録については、Discuz 6.0 以降のユーザーのバッチ登録を参照してください。 Replyusers = implode("|",$user_list);
// 返信の処理形式
function trimAndCurl($str){
$str = preg_replace('/ns{5,}/','', $str , 1 );
$str = トリム($str);
return $str;
関数 checkAndTranslate($mess, $if_replace = 'GBK', $out_char_type ='UTF-8'){
//if replace
if($if_replace){
$mess =curlAndReplace($mess);
//if 中国語 GBK
if('/[x80- xff]./', $mess) ){
$mess = mb_convert_encoding($mess, $out_char_type, $in_char_type);
}
return addlashes($mess)
}
functioncurlAndReplace($message){
$replace_list = file('./makeuser/replace.txt');
foreach($replace_list as $item){
$item = preg_replace("/s+/","||",$item); ("||",$item);
$tmp = ' '
$message = str_replace($items[0],$tmp,$message); str_replace($items[1],$items[0],$message);
$message = str_replace($tmp,$items[1],$message);
return $message(' CURSCRIPT', 'post');
require_once './include/common.inc.php'
require_once './include/post.func.php'; _DTYPE = $checkoption = $optionlist = array();
if( $typeid) {
threadtype_checkoption();
require_once DISCUZ_ROOT.'./include/discuzcode.func.php';
$navigation = $navtitle = $ thread = '';
//ここに新しく追加されたコードがあります
if ( $lid "locoy" )
{
//die (検証パスワードエラー);
//これはコード追加、終了、
//rq204,Q285576545,2008.7.29
$navigation = "» $forum[名前] $navigation";
$navtitle = $navtitle.strip_tags($forum['name ']).' - ';
if($forum[' type'] == 'sub') {
$query = $db->query("SELECT name, fid FROM {$tablepre}forums WHERE fid= '$forum[fup]'");
$fup = $ db->fetch_array($query);
$navigation = "» $navigation";
$navtitle = $navtitle.strip_tags($fup['name']).' - ';
}
$special = 空($special) || !is_numeric($special) || $special 6? 0 : 整数($special);
$allowpostattach = !empty($forum['allowpostattach']) || (!$forum['postattachperm'] && $allowpostattach) || ($forum['postattachperm'] && forumperm($forum['postattachperm']));
$attachextensions = $forum['attachextensions'] ? $forum['attachextensions'] : $attachextensions;
$enctype = $allowpostattach ? 'enctype="multipart/form-data"' : '';
$maxattachsize_kb = $maxattachsize / 1000;
$postcredits = $forum['postcredits'] ? $forum['postcredits'] : $creditspolicy['post'];
$replycredits = $forum['replycredits'] ? $forum['replycredits'] : $creditspolicy['reply'];
$digestcredits = $forum['digestcredits'] ? $forum['digestcredits'] : $creditspolicy['digest'];
$postattachcredits = $forum['postattachcredits'] ? $forum['postattachcredits'] : $creditspolicy['postattach'];
$maxprice = isset($extcredits[$creditstrans]) ? $maxprice : 0;
$extra = rawurlencode($extra);
$blogcheck = 空($isblog) && 空($addtoblog) ? '' : 'checked="チェック済み"';
$notifycheck = 空($emailnotify) ? '' : 'checked="チェック済み"';
$stickcheck = 空($sticktopic) ? '' : 'checked="チェック済み"';
$digestcheck = empty($addtodigest) ? '' : 'checked="チェック済み"';
$subject = isset($subject) ? dhtmlspecialchars(センサー(trim($subject))) : '';
$message = isset($message) ?検閲者(トリム($message)) : '';
$readperm = isset($readperm) ? intval($readperm) : 0;
$price = isset($price) ? intval($price) : 0;
$urloffcheck = $usesigcheck = $smileyoffcheck = $codeoffcheck = $htmloncheck = $emailcheck = '';
$seccodecheck = ($seccodestatus & 4) && (!$seccodedata['minposts'] || $posts $secqaacheck = $secqaa['status'][2] && (!$secqaa['minposts'] || $posts if($iscircle = $supe['status'] && $supe['circlestatus'] && $forum['status'] == 2) {
unset($forum['threadtypes']);
}
$allowpostpoll = $allowpost && $allowpostpoll && ($forum['allowpostspecial'] & 1);
$allowposttrade = $allowpost && $allowposttrade && ($forum['allowpostspecial'] & 2);
$allowpostreward = $allowpost && $allowpostreward && ($forum['allowpostspecial'] & 4) && isset($extcredits[$creditstrans]);
$allowpostactivity = $allowpost && $allowpostactivity && ($forum['allowpostspecial'] & 8);
$allowpostdebate = $allowpost && $allowpostdebate && ($forum['allowpostspecial'] & 16);
$allowpostvideo = $allowpost && $allowpostvideo && ($forum['allowpostspecial'] & 32) && $videoopen;
$allowanonymous = $forum['allowanonymous'] || $許可匿名 ? 1:0;
$editorid = 'ポストエディター';
$editoroptions = str_pad(decbin($editoroptions), 2, 0, STR_PAD_LEFT);
$editormode = $editormode == 2 ? $editoroptions{0} : $editormode;
$allowswitcheditor = $editoroptions{1};
$advanceeditor = $special ? 0:1;
$previewdisplay = !empty($previewpost) ? '' : 'なし';
if($action == 'newthread') {
//复制newthread.inc.php
$discuz_action = 11;
if(empty($forum['fid']) || $forum['type'] == 'group') {
exit('未选择版块または版块不可発行帖');
}
$isblog = 空($isblog) ? '' : 'はい';
if($subject == '' || $message == '') {
exit('标题または内容は空');
}
if($post_invalid = checkpost()) {
exit('标题または内容超过発行帖制限');
}
if($allowpostattach && is_array($_FILES['attach'])) {
foreach($_FILES['attach']['name'] as $attachname) {
if($attachname != '') {
check lowerlimit($postattachcredits);
休憩;
}
}
}
$typeid = isset($typeid) && isset($forum['threadtypes']['types'][$typeid]) ? $typeid : 0;
$iconid = !empty($iconid) && isset($_DCACHE['icons'][$iconid]) ? $iconid : 0;
$displayorder = $modnewthreads ? -2 : (($forum['ismoderator'] && !empty($sticktopic)) ? 1 : 0);
$digest = ($forum['ismoderator'] && !empty($addtodigest)) ? 1:0;
$blog = $allowuseblog && $forum['allowshare'] && !empty($addtoblog) ? 1:0;
$readperm = $allowsetreadperm ? $readperm : 0;
$isanonymous = $isanonymous && $allowanonymous ? 1:0;
$price = intval($price);
$price = $maxprice && !$special ? ($price //echo $typeid.','.','.','
if(!$typeid && $forum['threadtypes']['required'] && !$special) {
// exit('未充填写主题分类');
}
$discuz_user=$_POST['ユーザー名'];
$discuz_user = checkAndTranslate($discuz_user, 0);
$sql_tmp = "SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'";
$query =$db->query($sql_tmp);
if ($rs=$db->fetch_row($query)){
list($discuz_uid,$discuz_pw, $discuz_secques ) =$rs;
}
else
{
// exit('存在しないユーザー名'.$discuz_user);
exit('存在しない用户名'.$sql_tmp);
}
//var_dump($_POST);exit('
this.line='.__line__);
$messages =explode("|||",$message);
//必要かどうかベストアンサーのコメントを削除するには
//$messages = array_merge(array_slice($messages, 0, 2), array_slice($messages, 3));
$mc = count($messages); mc -1 ; $discuz_user : '';
$moderated = $displayorder > 1 : 0; ) ? 1 : 0;
$subscribed = !empty($emailnotify) && $discuz_uid ? 1 : 0;
$supe['ステータス'] && $forum['supe_pushsetting'] ['ステータス'] == 1 && ! $modnewthreads : '0';
$sgidadd1 = $sgidadd2 = ''; ";
}
/*データの前処理*/
//$price = mt_rand(3,10);
$price = 0;
$views = mt_rand(30,256);
$timestamp = mt_rand(strtotime('2008- 12- 25') ,strtotime('2008-12-29'));
$tagstatus = ""
//解決済み:
//$price =
//$ Closed = 1;
//未解決:
$closed = 0;
$db->query("INSERT INTO {$tablepre}threads (fid、readperm、price、iconid、typeid、author、authorid、subject、dateline、 lastpost、lastposter、displayorder、ダイジェスト、ブログ、添付ファイル、購読済み、モデレート、supe_pushstatus $sgidadd1 ,special ,closed ,views)
VALUES ('$fid', '$readperm', '$price', '$iconid', ' $typeid', '$author', '$discuz_uid', '".checkAndTranslate($subject)."', '$timestamp', '$timestamp', '$author', '$displayorder', '$digest' , '$blog', '$attachment', '$subscribed', '$moderated', '$supe_pushstatus' $sgidadd2 ,0 ,$closed ,$views )");
$tid = $db->insert_id( );
// 報酬ログを作成します !
$db->query("INSERT INTO {$tablepre}rewardlog (tid,authorid,netamount,dateline) VALUES ('$tid', '$discuz_uid', '$price') , '0')");
// メンバーのログを更新しています !
//if マイナスクレジット ?
//$db->query("UPDATE {$tablepre}members SET Posts=posts+1,credits=credits+$ Price,lastpost='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' ");
$db->query("UPDATE {$tablepre}メンバー SET Posts=posts+1,lastpost ='".$_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' ");
if($subscribed) {
$db->query("REPLACE INTO {$tablepre} サブスクリプション (uid, tid, lastpost, lastnotify)
VALUES ('$discuz_uid', '$tid', '$timestamp', '$timestamp')", 'UNBUFFERED');
}
$db->query("REPLACE INTO { $tablepre}mythreads (uid, tid, dateline,special) VALUES ('$discuz_uid', '$tid', '$timestamp', '0')", 'UNBUFFERED');
if($moderated) {
updatemodlog ($tid, ($displayorder > 0 ? 'STK' : 'DIG'));
updatemodworks(($displayorder > 0 ? 'STK' : 'DIG'), 1); ['threadtypes']['special'][$typeid] && $optiondata && is_array($optiondata)) {
foreach($optiondata as $optionid => $value) {
$db->query("INSERT INTO {$tablepre}typeoptionvars (typeid, tid, optionid, value, Expiration)
VALUES ('$typeid', '$tid', '$optionid', '$value', '".($typeexpiration ? $timestamp + $typeexpiration : 0)."')");
}
}
$bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));
$smileyoff = checksmilies($message, !empty($smileyoff));
$parseurloff = !empty($parseurloff);
//$htmlon = binding(($tagstatus && !empty($tagoff) ? 1 : 0).($allowhtml && !empty($htmlon) ? 1 : 0) );
$htmlon = 1;
$pinvisible = $modnewthreads ? -2 : 0;
$db->query("INSERT INTO {$tablepre}posts (fid, tid, first, authorid, subject, dateline) 、メッセージ、useip、不可視、匿名、useig、htmlon、bbcodeoff、smileyoff、parseurloff、attachment)
VALUES ('$fid', '$tid', '1', '$discuz_user', '$discuz_uid', '$ subject'、'$timestamp'、'".checkAndTranslate($messages[0])."'、'$onlineip'、'$pinvisible'、'$isanonymous'、'$usesig'、'$htmlon'、'$ bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
$pid = $db->insert_id();
if($tagstatus && $tags != '') {
$タグ = str_replace(array(chr(0xa1).chr(0xa1), chr(0xa1).chr(0x40), chr(0xe3).chr(0x80).chr(0x80)), ' ', $tags); $tagarray = array_unique(explode(' ', センサー($tags)));
$tagcount = 0;
foreach($tagname) {
$tagname = トリム($tagname); /^([x7f-xff_-]|w){3,20}$/', $tagname)) {
$query = $db->query("SELECT クローズ FROM {$tablepre}tags WHERE tagname=' ".checkAndTranslate($tagname, 0)."'");
if($db->num_rows($query)) {
if(!$tagstatus = $db->result($query, 0)) {
$db->query("UPDATE {$tablepre}tags SET total=total+1 WHERE tagname='".checkAndTranslate($tagname, 0)."'", 'UNBUFFERED'); {
$db->query("INSERT INTO {$tablepre}tags (tagname, Closed, total)
VALUES ('".checkAndTranslate($tagname, 0)."', 0, 1)", 'UNBUFFERED' );
$tagstatus = 0;
}
if(!$tagstatus) {
$db->query("INSERT {$tablepre}threadtags (tagname, tid) VALUES ('".checkAndTranslate($tagname, 0)."', $tid)", 'UNBUFFERED');
}
$tagcount++;
if($tagcount > 4) {
unset ($tagarray);
break;
}
}
}
$tradeaid = 0;
$searcharray = $replacearray = array(); key => $attach) {
$db->query("INSERT INTO {$tablepre}添付ファイル (tid、pid、dateline、readperm、価格、ファイル名、説明、ファイルタイプ、ファイルサイズ、添付ファイル、ダウンロード、isimage、uid) 、親指、リモート)
VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[name]', '$attach [説明]'、'$attach[タイプ]'、'$attach[サイズ]'、'$attach[添付ファイル]'、'0'、'$attach[isimage]'、'$attach[uid]'、' $attach[thumb]', '$attach[remote]')");
$searcharray[] = '[local]'.$localid[$key].'[/local]';
$pregarray[] = '/[localimg=(d{1,3}),(d{1,3})]'.$localid[$key].'[/localimg]/is';
$replacearray[] = '[attach] ]'.$db->insert_id().'[/attach]'
}
$message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message));
$db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate($message, 0)."' WHERE pid='$pid'");
updatecredits($discuz_uid, $postattachcredits, count($attachments));
}
if($iscircle && $sgid) {
supe_dbconnect();
$query = $supe['db']->query("UPDATE {$supe[tablepre]}groups SET lastpost='$timestamp' WHERE gid='$sgid'", 'SILENT');
}
if($modnewthreads) {
$db->query("UPDATE {$tablepre}フォーラム SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED');
} else {
if($digest) {
foreach($digestcredits as $id => $addcredits) {
$postcredits[$id] = (isset($postcredits[$id]) ? $postcredits[$id] ] : 0) + $addcredits;
}
}
updatepostcredits('+', $discuz_uid, $postcredits);
$subject = str_replace("t", ' ', $subject);
$lastpost = "$tidt".checkAndTranslate($subject)."t$timestampt$author";
$db->query("UPDATE {$tablepre}フォーラム SET lastpost='$lastpost', thread=threads+1, Posts=posts+1, todayposts=todayposts+1 WHERE fid='$fid'", 'バッファリングされていません');
if($forum['type'] == 'sub') {
$db->query("UPDATE {$tablepre}フォーラム SET lastpost='$lastpost' WHERE fid='$forum[fup]'" 、「バッファリングされていない」);
}
}
echo("成功発行表主题|".$tid);
}
if($replycount)
{
//开開始布回复
$discuz_action = 12;
require_once DISCUZ_ROOT.'./include/forum.func.php';
print_r($replyuser);
$replyusers =explode("|",$replyusers);
$reusercount = count($replyusers);
for($re=1;$re{
$index = mt_rand(1,$reusercount-1);
while( in_array( $index ,$post_arr ) || $replyusers[$index] ==$_POST['username'] ){
$index = mt_rand(1,$reusercount-1);
}
$post_arr[] = $index;
$discuz_user = $replyusers[$index];
$discuz_user = checkAndTranslate($discuz_user, 0);
$query =$db->query("SELECT uid,password,secques FROM {$tablepre}members m WHERE m.username like '%$discuz_user%'");
if ($rs=$db->fetch_row($query)){
list($discuz_uid,$discuz_pw, $discuz_secques ) =$rs;
}
else
{
echo('存在しないユーザー名'.$discuz_user);
続けてください。
}
$attachnum = 0;
if($allowpostattach && !empty($_FILES['attach']) && is_array($_FILES['attach'])) {
foreach($_FILES['attach']['name'] as $attachname) {
if($attachname != '') {
$attachnum ++;
}
}
$attachnum && check lowerlimit($postattachcredits, $attachnum);
} else {
$_FILES = array();
}
$attachments = $attachnum ? Attach_upload() : array();
$attachment = 空($attachments) ? 0:1;
$subscribed = $thread['subscribed'] && $timestamp - $thread['lastpost'] $newsubscribed = !empty($emailnotify) && $discuz_uid;
if($subscribed && !$modnewreplies) {
$db->query("UPDATE {$tablepre}subscriptions SET lastpost='$timestamp' WHERE tid='$tid' AND uid'$discuz_uid'" 、「バッファリングされていない」);
}
if($newsubscribed) {
$db->query("{$tablepre} サブスクリプション (uid, tid, lastpost, lastnotify)
VALUES ('$discuz_uid', '$tid', '". ($modnewreplies ? $thread['lastpost'] : $timestamp)."', '$timestamp')", 'UNBUFFERED');
}
$bbcodeoff = checkbbcodes($message, !empty($bbcodeoff));
$smileyoff = checksmilies($message, !empty($smileyoff));
$parseurloff = !empty($parseurloff);
// $htmlon = $allowhtml && !empty($htmlon) ? 1:0;
$htmlon = 1;
$usesig = !empty($usesig) ? 1:0;
$isanonymous = $allowanonymous && !empty($isanonymous)? 1:0;
//$discuz_user = checkAndTranslate($discuz_user, 0);
$author = empty($isanonymous) ? $discuz_user : '';
$pinvisible = $modnewreplies ? -2:0;
$rand_time = mt_rand(150,3600);
$timestamp = $timestamp + $rand_time;
$db->query("INSERT INTO {$tablepre}投稿 (fid、tid、最初、作成者、authorid、件名、日付変更線、メッセージ、useip、非表示、匿名、usesig、htmlon、bbcodeoff、smileyoff、parseurloff、添付ファイル)
VALUES ('$fid', '$tid', ' 0', '$discuz_user', '$discuz_uid', '', '$timestamp', '".trimAndCurl($messages[$re])."', '$onlineip', '$pinvisible', '$isanonymous ', '$usesig', '$htmlon', '$bbcodeoff', '$smileyoff', '$parseurloff', '$attachment')");
$pid = $db->insert_id();
/ / 報酬ログを更新しています
$db->query("UPDATE {$tablepre}rewardlog SET Answererid='$discuz_uid',dateline='$timestamp' WHERE tid='$tid'");
// メンバー ログを更新しています !
if($re == 1){
//追加积分问题
$db->query("UPDATE {$tablepre}メンバー SETposts=posts+1,credits=credits+$price,lastpost='".$ _SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' ");
}else{
$db->query("UPDATE {$tablepre}members SET Posts=posts+1,lastpost='". $_SERVER['REQUEST_TIME']."' WHERE uid ='$discuz_uid' ");
}
$db->query("REPLACE INTO {$tablepre}myposts (uid、tid、pid、position、dateline、special) ) VALUES ('$discuz_uid', '$tid', '$pid', '".($thread['replies'] + 1)."', '$timestamp', '0')", 'UNBUFFERED' );
$tradeaid = 0;
if($attachment) {
$searcharray = $pregarray = $replacearray = array();
foreach($attachments as $key => $attach) {
$db->query("INSERT INTO {$tablepre}添付ファイル (tid、pid、dateline、readperm、価格、ファイル名、説明、ファイルタイプ、ファイルサイズ、添付ファイル、ダウンロード、isimage、uid、サム、リモート)
VALUES ('$tid', '$pid', '$timestamp', '$attach[perm]', '$attach[price]', '$attach[ name]'、'$attach[説明]'、'$attach[タイプ]'、'$attach[サイズ]'、'$attach[添付ファイル]'、'0'、'$attach[isimage]'、'$ attach[uid]', '$attach[thumb]', '$attach[remote]')");
$searcharray[] = '[ローカル]'.$localid[$key].'[/local]';
$pregarray[] = '/[localimg=(d{1,3}),(d{1,3})]'.$localid[$key].'[/localimg]/is';
$insertid = $db->insert_id();
$replacearray[] = '[attach]'.$insertid.'[/attach]';
}
if(!empty($trade) && $thread['special'] == 2 && !empty($_FILES['tradeattach']['tmp_name'][0])) {
$tradeaid = $insertid ;
}
$message = str_replace($searcharray, $replacearray, preg_replace($pregarray, $replacearray, $message));
$db->query("UPDATE {$tablepre}posts SET message='".checkAndTranslate($message)."' WHERE pid='$pid'");
updatecredits($discuz_uid, $postattachcredits, count($attachments));
}
if($modnewreplies) {
$db->query("UPDATE {$tablepre}フォーラム SET todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED');
if($newsubscribed) {
$db->query("UPDATE {$tablepre}threads SET subscribed='1' WHERE tid='$tid'", 'UNBUFFERED');
}
} else {
$db->query("UPDATE {$tablepre}threads SET lastposter='$author', lastpost='$timestamp', replies=replies+1 ".($attachment ? ',attachment ='1'' : '').",subscribed='".($subscribed || $newsubscribed ? 1 : 0)."' WHERE tid='$tid'", 'UNBUFFERED');
updatepostcredits('+', $discuz_uid, $replycredits);
$lastpost = "$thread[tid]t".checkAndTranslate($thread['subject'])."t$timestampt$author";
$db->query("UPDATE {$tablepre}フォーラム SET lastpost='$lastpost'、posts=posts+1、todayposts=todayposts+1 WHERE fid='$fid'", 'UNBUFFERED');
if($forum['type'] == 'sub') {
$db->query("UPDATE {$tablepre}フォーラム SET lastpost='$lastpost' WHERE fid='$forum[fup]'" 、「バッファリングされていない」);
}
}
エコー「成功回复」;
}
}
//exit('実行 end.this.line='.__line__);

www.bkjia.comtru​​ehttp://www.bkjia.com/PHPjc/320478.html技術記事 PS: 翻訳ファイルの変更は、プログラム中のコメントでかなり詳しく検討されていますが、ここではあまり説明されていません。 ); //if(ふ...
声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
PHPセッションを失敗させる可能性のあるいくつかの一般的な問題は何ですか?PHPセッションを失敗させる可能性のあるいくつかの一般的な問題は何ですか?Apr 25, 2025 am 12:16 AM

PHPSESSIONの障害の理由には、構成エラー、Cookieの問題、セッションの有効期限が含まれます。 1。構成エラー:正しいセッションをチェックして設定します。save_path。 2.Cookieの問題:Cookieが正しく設定されていることを確認してください。 3.セッションの有効期限:セッションを調整してください。GC_MAXLIFETIME値はセッション時間を延長します。

PHPでセッション関連の問題をどのようにデバッグしますか?PHPでセッション関連の問題をどのようにデバッグしますか?Apr 25, 2025 am 12:12 AM

PHPでセッションの問題をデバッグする方法は次のとおりです。1。セッションが正しく開始されるかどうかを確認します。 2.セッションIDの配信を確認します。 3.セッションデータのストレージと読み取りを確認します。 4.サーバーの構成を確認します。セッションIDとデータを出力し、セッションファイルのコンテンツを表示するなど、セッション関連の問題を効果的に診断して解決できます。

session_start()が複数回呼び出されるとどうなりますか?session_start()が複数回呼び出されるとどうなりますか?Apr 25, 2025 am 12:06 AM

session_start()への複数の呼び出しにより、警告メッセージと可能なデータ上書きが行われます。 1)PHPは警告を発し、セッションが開始されたことを促します。 2)セッションデータの予期しない上書きを引き起こす可能性があります。 3)session_status()を使用してセッションステータスを確認して、繰り返しの呼び出しを避けます。

PHPでセッションのライフタイムをどのように構成しますか?PHPでセッションのライフタイムをどのように構成しますか?Apr 25, 2025 am 12:05 AM

PHPでのセッションライフサイクルの構成は、session.gc_maxlifetimeとsession.cookie_lifetimeを設定することで達成できます。 1)session.gc_maxlifetimeサーバー側のセッションデータのサバイバル時間を制御します。 0に設定すると、ブラウザが閉じているとCookieが期限切れになります。

セッションを保存するためにデータベースを使用することの利点は何ですか?セッションを保存するためにデータベースを使用することの利点は何ですか?Apr 24, 2025 am 12:16 AM

データベースストレージセッションを使用することの主な利点には、持続性、スケーラビリティ、セキュリティが含まれます。 1。永続性:サーバーが再起動しても、セッションデータは変更されないままになります。 2。スケーラビリティ:分散システムに適用され、セッションデータが複数のサーバー間で同期されるようにします。 3。セキュリティ:データベースは、機密情報を保護するための暗号化されたストレージを提供します。

PHPでカスタムセッション処理をどのように実装しますか?PHPでカスタムセッション処理をどのように実装しますか?Apr 24, 2025 am 12:16 AM

PHPでのカスタムセッション処理の実装は、SessionHandlerInterfaceインターフェイスを実装することで実行できます。具体的な手順には、次のものが含まれます。1)CussentsessionHandlerなどのSessionHandlerInterfaceを実装するクラスの作成。 2)セッションデータのライフサイクルとストレージ方法を定義するためのインターフェイス(オープン、クローズ、読み取り、書き込み、破壊、GCなど)の書き換え方法。 3)PHPスクリプトでカスタムセッションプロセッサを登録し、セッションを開始します。これにより、データをMySQLやRedisなどのメディアに保存して、パフォーマンス、セキュリティ、スケーラビリティを改善できます。

セッションIDとは何ですか?セッションIDとは何ですか?Apr 24, 2025 am 12:13 AM

SessionIDは、ユーザーセッションのステータスを追跡するためにWebアプリケーションで使用されるメカニズムです。 1.ユーザーとサーバー間の複数のインタラクション中にユーザーのID情報を維持するために使用されるランダムに生成された文字列です。 2。サーバーは、ユーザーの複数のリクエストでこれらの要求を識別および関連付けるのに役立つCookieまたはURLパラメーターを介してクライアントに生成および送信します。 3.生成は通常、ランダムアルゴリズムを使用して、一意性と予測不可能性を確保します。 4.実際の開発では、Redisなどのメモリ内データベースを使用してセッションデータを保存してパフォーマンスとセキュリティを改善できます。

ステートレス環境(APIなど)でセッションをどのように処理しますか?ステートレス環境(APIなど)でセッションをどのように処理しますか?Apr 24, 2025 am 12:12 AM

APIなどのステートレス環境でのセッションの管理は、JWTまたはCookieを使用して達成できます。 1。JWTは、無国籍とスケーラビリティに適していますが、ビッグデータに関してはサイズが大きいです。 2.cookiesはより伝統的で実装が簡単ですが、セキュリティを確保するために慎重に構成する必要があります。

See all articles

ホットAIツール

Undresser.AI Undress

Undresser.AI Undress

リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover

AI Clothes Remover

写真から衣服を削除するオンライン AI ツール。

Undress AI Tool

Undress AI Tool

脱衣画像を無料で

Clothoff.io

Clothoff.io

AI衣類リムーバー

Video Face Swap

Video Face Swap

完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

ホットツール

Dreamweaver Mac版

Dreamweaver Mac版

ビジュアル Web 開発ツール

VSCode Windows 64 ビットのダウンロード

VSCode Windows 64 ビットのダウンロード

Microsoft によって発売された無料で強力な IDE エディター

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser は、オンライン試験を安全に受験するための安全なブラウザ環境です。このソフトウェアは、あらゆるコンピュータを安全なワークステーションに変えます。あらゆるユーティリティへのアクセスを制御し、学生が無許可のリソースを使用するのを防ぎます。

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール