Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
blith
Client


Joined: Jul 18, 2003
Posts: 977

PostPosted: Thu Dec 23, 2004 11:04 am Reply with quote

looks there. Sad So here goes.
I need to change all my user_regdate to unix time. I have over 32,000 members so this is going to be fun. What I would like to do is change them by SQL command where if x then change to y. Can someone help me out with the commands? Thank you.

[edit]Over 33,000 members now...[/edit]
 
View user's profile Send private message Visit poster's website
blith
PostPosted: Thu Dec 23, 2004 1:21 pm Reply with quote

Raven, I assume the same can be done fot his that you showed me for user_level:
UPDATE SET WHERE statements?
 
blith
PostPosted: Wed Jan 05, 2005 8:06 am Reply with quote

Okay! I found the following which is supposed to work for converting standalone phpbb to nuke phpbb. Is there a way to reverse engineer this so that I could convert the reg_date (mmm dd, yyyy) that I have now to unixtime?
Code:
<?php 


require_once("mainfile.php");
global $user_prefix,$db;

$months = array("abc","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");

$result = $db->sql_query("SELECT user_id, username, user_regdate FROM ".$user_prefix."_users");

echo "Fetching information for ".$db->sql_numrows($result)." users...<br><br>";

while($row = $db->sql_fetchrow($result)) {
        $date = $row['user_regdate'];
        $tmp = explode(" ",$date);
        $day = substr($tmp[1],0,2);
        $month = $tmp[0];
        while($month_name = current($months)) {
                if($month_name == $month) {
                        $month = key($months);
                }
                next($months);
        }
        reset($months);
        $year = $tmp[2];
        $unixdate = mktime(0,0,0,$month,$day,$year);
        echo "Converting regdate for ".$row['username']."...";
        $result2 = $db->sql_query("UPDATE ".$user_prefix."_users SET user_regdate=".$unixdate." WHERE user_id=".$row['user_id']);
        if(!$result2) {
                echo "<font color=\"#ff0000\"><b>Error!</b></font><br>";
        }
        else {
                echo "<font color=\"#00ff00\"><b>Success!</b></font><br>";
        }
}

?>
 
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 17086

PostPosted: Wed Jan 05, 2005 2:01 pm Reply with quote

What's wrong with this answer Only registered users can see links on this board! Get registered or login! ?
 
View user's profile Send private message
blith
PostPosted: Wed Jan 05, 2005 3:40 pm Reply with quote

Raven wrote:
What's wrong with this answer Only registered users can see links on this board! Get registered or login! ?

I guess I forgot about that for one and two I don't completely understand it. I will continue in that thread. Please meet me down there... Smile
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©