hallo ich habe in den weiten des Internets endlich was gefunden wie ich meine postings unterschiedliche Dates gebe
hier der Quellcode
PHP
<?php
// Configuration //
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = ' ';
$dbname = ' ';
// Database Connection //
$conn = mysql_connect ($dbhost, $dbuser, $dbpass) or die ('Cannot connect to the database because: ' . mysql_error());
mysql_select_db ($dbname);
[COLOR=Red][B]if(isset($_POST['start'] {[/B][/COLOR]
ChangeDates();
}
function makeRandomDate($startDate,$endDate) {
return date("Y-m-d",strtotime("$startDate + ".rand(0,round((strtotime($endDate) - strtotime($startDate)) / (60 * 60 * 24)))." days"));
}
function ChangeDates() {
$results = mysql_query("SELECT id FROM wp_posts");
while($row = mysql_fetch_array($results)) {
list($id) = $row;
[COLOR=Black]$s_date = $_POST['start'];
$e_date = $_POST['end'];[/COLOR]
$newdate = makeRandomDate($s_date,$e_date);
$t1 = rand(0, 23);
$t2 = rand(1, 59);
$t3 = rand(1, 59);
if ($t1 < 10) { $t1 = "0".$t1; }
if ($t2 < 10) { $t2 = "0".$t2; }
if ($t3 < 10) { $t3 = "0".$t3; }
$newtime = " ".$t1 .":".$t2.":". $t3;
$newdategiven = $newdate . $newtime;
Post_Dates($newdategiven,$id);
}
}
function Post_Dates($date,$postid) {
$query = "UPDATE wp_posts SET post_date = '$date', post_date_gmt = '$date' WHERE id = '$postid'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xhmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Date Randomizer by Coder</title>
</head>
<body>
<table>
<form action="" method="post">
<tr>
<td>Start Date :</td><td><input type="text" name="start" id="start" value="" /></td>
</tr>
<tr>
<td>End Date :</td><td><input type="text" name="end" id="end" value="" /></td>
</tr>
<tr>
<td><input type="submit" value="Change" /></td>
</tr>
</form>
</table>
</body>
</html>
Alles anzeigen
Problem bei der Sache ist, der gibt mir ein Fehler aus
bei
kann ir jemand helfen ich weiß den Fehler nicht ? wäre großartig!
Quelle:http://www.blackhatteam.com/f51/get-wp-pos…izer-10245.html