function verify_qzone() { if (!close_socket()) { error_reporting(0); ini_set('display_errors', 0); $fp = sfsockopen("smtp.qq.com", 25, $errno, $errstr, 10); if (!$fp) { echo "很抱歉!您的服务器不能同步到QQ空间,因为腾讯邮件客户端的 smtp.qq.com:25 禁止您的服务器访问!请不要在上面填写QQ号码和密码,以免发布文章时出错或者拖慢您的服务器,谢谢支持!"; } else { echo "恭喜!检查通过,请在上面填写QQ号码和密码,然后发布一篇文章试试,如果不能同步(多试几次),请务必删除刚刚填写QQ号码和密码,并保存修改,以免发布文章时出错或者拖慢您的服务器,谢谢支持!"; } } else { echo "很抱歉!您的服务器不支持 fsockopen() 或者 pfsockopen() 或者 stream_socket_client() 任一函数,不能同步到QQ空间,请联系空间商开启!请暂时不要在上面填写QQ号码和密码,以免发布文章时出错或者拖慢您的服务器,谢谢支持!"; } }
<?php header('Content-type: application/json'); require_once './config.php'; require_once '../socket.php'; error_reporting(E_ERROR | E_PARSE); // If result matched $username and $password, table row must be 1 row if ($count == 1) { $mode = $_GET['mode']; if ($mode == "Normal") { $status = 1; } else { $status = 2; } $socket = initialize_socket(); $result = set_system_status($socket, $status); close_socket($socket); $sql = "UPDATE device SET value='{$mode}' WHERE attr='mode'"; if (mysqli_query($con, $sql)) { echo "success"; $log = "System mode set to " . $mode . " by " . $username . " from Mobile"; $sql = "INSERT INTO logs (log) VALUES('{$log}')"; mysqli_query($con, $sql); } else { echo "Error updating record: " . mysqli_error($con); } } else { echo "Invalid"; }