php Joomla的批量会话插入器!用您自己的数据库详细信息替换数据库连接详细信

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Joomla的批量会话插入器!用您自己的数据库详细信息替换数据库连接详细信相关的知识,希望对你有一定的参考价值。

<?php

// Simple script to insert lots of sessions to Joomla _session table.

$limit 		= 20000;

// Database connection using mysqli
$dbname		= 'j33jq';
$dbuser		= 'root';
$dbpass 	= 'root';
$dbhost 	= 'localhost';
$dbprefix	= 'j_';

$sessionId	= '48cmj6tmbc4gq33m7vubsod4bc';

$db 	= mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);

// clean out old test data
$db->query("DELETE FROM " . $dbprefix . "session wHERE session_id LIKE 'xx33xx33xx%'");

for ($x = 0; $x <= $limit; $x++) {
	$guest = rand(0, 1);
	if ($guest == 0)
	{
		$clientid = rand(0, 1);
	}
	else
	{
		$clientid = 0;
	}
	$userid 	= 1000 + rand(1, 999999);
	$username = $guest ? 'username' .  $x : "";
	// This value isn't meaningful for this test
	$data = 'joomla|s:736:"TzoydfgNDghofiyjS6mu95v6b3w4Wt34xhXdFfgJdlZ2lzdHJ5XFJlZ2lzdHJ5IjozOntzOjc6IgAqAGRhdGEiO086ODoic3RkQ2xhc3MiOjE6e3M6OToiX19kZWZhdWx0IjtPOjg6InN0ZENsYXNzIjo0OntzOjc6InNlc3Npb24iO086ODoic3RkQ2xhc3MiOjI6e3M6NzoiY291bnRlciI7aToxO3M6NToidGltZXIiO086ODoic3RkQ2xhc3MiOjM6e3M6NToic3RhcnQiO2k6MTUzOTMzNjY1ODtzOjQ6Imxhc3QiO2k6MTUzOTMzNjY1ODtzOjM6Im5vdyI7aToxNTM5MzM2NjU4O319czo4OiJyZWdpc3RyeSI7TzoyNDoiSm9vbWxhXFJlZ2lzdHJ5XFJlZ2lzdHJ5IjozOntzOjc6IgAqAGRhdGEiO086ODoic3RkQ2xhc3MiOjA6e31zOjE0OiIAKgBpbml0aWFsaXplZCI7YjowO3M6OToic2VwYXJhdG9yIjtzOjE6Ii4iO31zOjQ6InVzZXIiO086MjA6Ikpvb21sYVxDTVNcVXNlclxVc2VyIjoxOntzOjI6ImlkIjtpOjA7fXM6MTM6ImNoZWNrc2VjdXJpdHkiO2k6MTt9fXM6MTQ6IgAqAGl235434uaXRpYWxpemVkIjtiOjA7czo5OiJzZXB4fghcmF0b3IiO3M6MToiLiI7fQ=="';

	$date = new DateTime("- " . rand(0, 10000) . " seconds");
	$session_id = "xx33xx33xx" . base64_encode($sessionId . "some extra stuff to make the session id different" . $x);

	$query 	= "INSERT INTO " . $dbprefix . "session (session_id, client_id, guest, time, data, userid, username)
	VALUES ('$session_id', $clientid, 0, " . $date->getTimestamp() . ", '" . $data . "', $userid, $clientid)";

	// Run insert
	if ($db->query($query)) {

	} else {
		echo 'Query failed<br>';
		echo $query . " <br>";
		echo mysqli_error($db);
		die;
	}
}

以上是关于php Joomla的批量会话插入器!用您自己的数据库详细信息替换数据库连接详细信的主要内容,如果未能解决你的问题,请参考以下文章

Joomla批量密码重置!

Joomla 3.3 会话和安全图像验证码

在Joomla上获取错误:无法读取会话数据和应用程序实例化错误

php session.php 错误 Joomla

回复:Joomla/PHP/Java/AJAX

如何只选择特定的选择器声明的 css