通过使用 SSI.php,我正在访问用户的论坛列表。假设我在我的论坛 user1、user2、user3 中有 3 个注册用户
require('SSI.php');
global $context, $settings, $options, $scripturl, $txt;
file_get_contents($context);
$username = $context['user']['name'];
在我的 php 代码中,我使用这些用户名通过 api url 获取信息。
$api = "hxxps://apiurl/?account_id=$username";
$json = file_get_contents($api);
$array = json_decode($json, true);
在这里,我正在从 api 检索一些数据。
$data1 = $array[data1];
$data2 = $array[data2];
现在我正在为简单机器论坛中特定组的每个成员单独执行以下任务。
include 'config.php';
$query = mysql_query("SELECT username FROM table1 WHERE username=$username", $con);
if (mysql_num_rows($query) != 0){
mysql_query("INSERT INTO my inset query)") or die (mysql_error());
echo "User's New Record added<br> ";
}
我的问题是如何通过给它一个包含所有用户名的数组列表来自动更新所有成员记录,以及如何创建这个特定的 php 文件每 24 小时后自动运行的玉米作业。我正在使用 mysql 我在 mysql 周围看到过并不安全,但由于我只是初学者,请忽略我的错误,我试图了解基础知识。