Subscribe Hacks v1.0

2023-08-24 09:15:41 浏览数 (1)

第一步:在/templates/{THEME}/addcomments.tpl中,将用户名、邮箱写为“必填”参数

复制代码

代码语言:javascript复制
<input id="name" name="name" type="text" placeholder="用户名*" required >
第二步:接下来,/engine/modules/addcomments.php文件中查找:

复制代码

代码语言:javascript复制
if ( $config['mail_comments'] OR $config['allow_subscribe'] ) {
在上面添加:

复制代码

代码语言:javascript复制
$guest_email = $mail;
接着查找:

复制代码

代码语言:javascript复制
if ($config['allow_subscribe'] AND $is_logged AND $_POST['allow_subscribe'] AND $user_group[$member_id['user_group']]['allow_subscribe']) {

			$found_subscribe = $db->super_query( "SELECT COUNT(*) as count FROM " . PREFIX . "_subscribe WHERE news_id='{$post_id}' AND user_id='{$member_id['user_id']}'" );

			if( !$found_subscribe['count'] ) {

				$s_hash = md5( random_bytes(32) );

				$db->query( "INSERT INTO " . PREFIX . "_subscribe (user_id, name, email, news_id, hash) values ('{$member_id['user_id']}', '{$member_id['name']}', '{$member_id['email']}', '{$post_id}', '{$s_hash}')" );

			}

		}

0 人点赞