users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','1','nickname')";
- $result = mysql_query($query);
+ $result = $wpdb->query($query);
if ($result==false) {
die ("ERROR: couldn't register an user!");
}
@@ -141,8 +138,8 @@ textarea,input,select {
$post_author=trim(addslashes($postinfo[1]));
// we'll check the author is registered, or if it's a deleted author
$sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
- $result = mysql_query($sql);
- if (!mysql_num_rows($result)) { // if deleted from GM, we register the author as a level 0 user in b2
+ $result = $wpdb->query($sql);
+ if (! $result) { // if deleted from GM, we register the author as a level 0 user in wp
$user_ip="127.0.0.1";
$user_domain="localhost";
$user_browser="server";
@@ -154,17 +151,15 @@ textarea,input,select {
$user_url=addslashes("");
$user_joindate=addslashes($user_joindate);
$query = "INSERT INTO $wpdb->users (user_login,user_pass,user_nickname,user_email,user_url,user_ip,user_domain,user_browser,user_registered,user_level,user_idmode) VALUES ('$user_login','$pass1','$user_nickname','$user_email','$user_url','$user_ip','$user_domain','$user_browser','$user_joindate','0','nickname')";
- $result = mysql_query($query);
+ $result = $wpdb->query($query);
if ($result==false) {
die ("ERROR: couldn't register an user!");
}
echo ": registered deleted user $user_login at level 0 ";
}
- $sql = "SELECT * FROM $wpdb->users WHERE user_login = '$post_author'";
- $result = mysql_query($sql);
- $myrow = mysql_fetch_array($result);
- $post_author_ID=$myrow[0];
+ $sql = "SELECT ID FROM $wpdb->users WHERE user_login = '$post_author'";
+ $post_author_ID = $wpdb->get_var($sql);
$post_title=gm2autobr($postinfo[2]);
$post_title=addslashes($post_title);
@@ -189,15 +184,13 @@ textarea,input,select {
$post_karma=$postinfo[12];
$query = "INSERT INTO $wpdb->posts (post_author,post_date,post_content,post_title) VALUES ('$post_author_ID','$post_date','$post_content','$post_title')";
- $result = mysql_query($query) or die(mysql_error());
+ $result = $wpdb->query($query);
if (!$result)
die ("Error in posting...");
- $sql2 = "SELECT * FROM $wpdb->posts ORDER BY ID DESC LIMIT 1";
- $result2 = mysql_query($sql2);
- $myrow2 = mysql_fetch_array($result2);
- $post_ID=$myrow2[0];
+ $query = "SELECT ID FROM $wpdb->posts ORDER BY ID DESC LIMIT 1";
+ $post_ID = $wpdb->get_var($query);
// Grab a default category.
$post_category = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories LIMIT 1");
@@ -238,7 +231,7 @@ textarea,input,select {
$comment_content=addslashes($commentinfo[12]);
$sql3 = "INSERT INTO $wpdb->comments (comment_post_ID,comment_author,comment_author_email,comment_author_url,comment_author_IP,comment_date,comment_content) VALUES ('$comment_post_ID','$comment_author','$comment_author_email','$comment_author_url','$comment_author_IP','$comment_date','$comment_content')";
- $result3 = mysql_query($sql3);
+ $result3 = $wpdb->query($sql3);
if (!$result3)
die ("There is an error with the database, it can't store your comment..");
}
@@ -254,7 +247,7 @@ textarea,input,select {
?>