Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2004, 10:10 PM
alfaowner alfaowner is offline
 
Join Date: Jul 2003
Location: London
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default SQL Statement request - Easy if you know how! ;)

hi, could anyone help me write a sql code to do the following:

Every hour, I wish to ask cron to run my /forum/admincp/includes/cron/postnuke.php Inside theis file I put:

PHP Code:
<?php 
//connect to database 
mysql_connect("localhost""my db username""myPW"); 
mysql_select_db("my db name"); 
//empty pn userdb and fill it with fresh userdata 
$query=mysql_query("delete from nuke_users"); 
$query=mysql_query("INSERT INTO nuke_users (uid,uname,email,url,user_sig,pass,user_icq) select userid,username,email,homepage,signature,password,icq from user"); 
$query=mysql_query("update nuke_users set umode='nested', theme='ExtraLite',timezone_offset='14.0'"); 

mysql_close(); 
?>
It connects every hour and updates my post nuke with all the current users and edited passwords etc... However, i cannot quite get it to work with VB3, what if anythink do i need to change? ANy ideas welcomed!

It connects to the DB and deletes all my post nuke users, but nothing else.

Thanks again!
Reply With Quote
  #2  
Old 07-25-2004, 10:16 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hmm ... wouldn't it be easier to modify PostNuke to verify accounts against your existing vB 3 user table?
Reply With Quote
  #3  
Old 07-25-2004, 10:24 PM
alfaowner alfaowner is offline
 
Join Date: Jul 2003
Location: London
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
Hmm ... wouldn't it be easier to modify PostNuke to verify accounts against your existing vB 3 user table?
Hey, would it? I suppose going by your post, yes.... But is that hard, do you know how to?

Ive been playing with this for 5 hours now Would you help me with some guidance? or could anyone else commment or advise this? i seache dthis forum but to no avail
Reply With Quote
  #4  
Old 07-26-2004, 12:24 AM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I agree with KirbyDE... once your member list gets large that'll become one intensive script.

It's hard to say how difficult it would be to make postnuke use your vb database, but it would be the better way to go.
Reply With Quote
  #5  
Old 07-26-2004, 12:35 AM
alfaowner alfaowner is offline
 
Join Date: Jul 2003
Location: London
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

well, maximum 10,000 ever members i suppose, so not too bad
Reply With Quote
  #6  
Old 07-26-2004, 12:38 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll take a look into it within the next few days and keep you posted.
Reply With Quote
  #7  
Old 07-26-2004, 12:39 AM
alfaowner alfaowner is offline
 
Join Date: Jul 2003
Location: London
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would this work?

<FONT size=2>
PHP Code:
<?php 
//connect to database 
mysql_connect("localhost""DBUSENAME""DBPASS"); 
mysql_select_db("DBNAME");
 
mysql_query("DROP TABLE IF EXISTS ".$user_prefix."_users"); 
echo 
"<p>Table ".$user_prefix."_users deleted!</p><br>"
mysql_query("CREATE TABLE ".$user_prefix."_users ( uid int(11) NOT NULL auto_increment, name varchar(60) NOT NULL default '', uname varchar(25) NOT NULL default '', email varchar(255) NOT NULL default '', femail varchar(255) NOT NULL default '', url varchar(255) NOT NULL default '', user_avatar varchar(30) default NULL, user_regdate varchar(20) NOT NULL default '', user_icq varchar(15) default NULL, user_occ varchar(100) default NULL, user_from varchar(100) default NULL, user_intrest varchar(150) default NULL, user_sig varchar(255) default NULL, user_viewemail tinyint(2) default NULL, user_theme int(3) default NULL, user_aim varchar(18) default NULL, user_yim varchar(25) default NULL, user_msnm varchar(25) default NULL, pass varchar(40) NOT NULL default '', storynum tinyint(4) NOT NULL default '10', umode varchar(10) NOT NULL default '', uorder tinyint(1) NOT NULL default '0', thold tinyint(1) NOT NULL default '0', noscore tinyint(1) NOT NULL default '0', bio tinytext NOT NULL, ublockon tinyint(1) NOT NULL default '0', ublock tinytext NOT NULL, theme varchar(255) NOT NULL default '', commentmax int(11) NOT NULL default '4096', counter int(11) NOT NULL default '0', newsletter int(1) NOT NULL default '0', user_posts int(10) NOT NULL default '0', user_attachsig int(2) NOT NULL default '0', user_rank int(10) NOT NULL default '0', user_level int(10) NOT NULL default '1', PRIMARY KEY (uid) )");
 
echo 
"<p>Table ".$user_prefix."_users created!</p><br>"
$result mysql_query("SELECT * FROM user userid"); 
$all mysql_num_rows($result); 
echo 
"<p>You have total $all users in your vb user table.<br>Now, we'll transfer them into nuke's $user_prefix_users table</p><br>";
 
$query=mysql_query("INSERT INTO ".$user_prefix."_users (uid,uname,email,url,pass,user_icq,user_aim,user_yim) select userid,username,email,homepage,password,icq,aim,yahoo from user");
 
?>
Reply With Quote
  #8  
Old 07-26-2004, 02:08 AM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't believe you can do an insert like that... I believe you'd have to insert each member separately.

replacing
Code:
$query=mysql_query("INSERT INTO ".$user_prefix."_users (uid,uname,email,url,pass,user_icq,user_aim,user_yim) select userid,username,email,homepage,password,icq,aim,yahoo from user");
with

Code:
while($user = mysql_fetch_array($result))
{
  $query=mysql_query("INSERT INTO ".$user_prefix."_users (uid,uname,email,url,pass,user_icq,user_aim,user_yim) VALUES ('$user[userid]', '$user[username]', '$user[email]', '$user[url]', '$user[password]', '$user[icq]', '$user[aim]', '$user[yahoo]'");
}
but with 10k users, that equals 10k queries every time this runs...
Reply With Quote
  #9  
Old 07-26-2004, 06:15 PM
alfaowner alfaowner is offline
 
Join Date: Jul 2003
Location: London
Posts: 201
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmm, well, i so love the hacked postnuke ive made, but i cannot bear to have it and require two seperate logins, its madness.
Reply With Quote
  #10  
Old 07-26-2004, 06:30 PM
Modin Modin is offline
 
Join Date: Jun 2004
Posts: 162
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it shouldn't be too difficult to make postnuke use your vbulletin login. I haven't had time to try it yet... will soon
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:09 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06733 seconds
  • Memory Usage 2,269KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete