Vbulletin Auto registration script

1)Create a file with desired name (let it be vb_register.php) with the following code

function qpc_post($varname){
return trim(stripslashes((get_magic_quotes_gpc()) ? $_POST[$varname] : addslashes($_POST[$varname])));
}

define(‘THIS_SCRIPT’, ‘vb_register.php’);

require_once(‘./global.php’);
require_once(‘./includes/class_dm.php’);
require_once(‘./includes/class_dm_user.php’);

$userdm = new vB_DataManager_User($vbulletin, ERRTYPE_ARRAY);

$userdm->set(‘username’, qpc_post(‘username’));
$userdm->set(’email’, qpc_post(’email’));
$userdm->set(‘password’, qpc_post(‘password’));
$userdm->set(‘usergroupid’,qpc_post(‘usergroupid’));
$userdm->set(‘ipaddress’, qpc_post(‘ipaddress’));
$userdm->set(‘referrerid’, qpc_post(‘referrername’));
$userdm->set(‘timezoneoffset’, qpc_post(‘timezoneoffset’));
$userdm->set_bitfield(‘options’, ‘adminemail’, intval(qpc_post(‘adminemail’)));
$userdm->set_bitfield(‘options’, ‘showemail’, intval(qpc_post(‘showemail’)));
$firstname=qpc_post(‘firstname’);
$lastname=qpc_post(‘lastname’);
$dst_setting = intval(qpc_post(‘dst’));
switch ($dst_setting)
{
case 0:
case 1:
$userdm->set_bitfield(‘options’, ‘dstonoff’, $dst_setting);
break;
case 2:
$userdm->set_bitfield(‘options’, ‘dstauto’, 1);
break;
}

#If there are errors (eMail not set, eMail banned, Username taken, etc.) you can check for errors using
if (count($userdm->errors)) {
for($i=0; $ierrors); $i++) {
print “ERROR{$i}:{$userdm->errors[$i]}n”;
}
} else {
# If everything is OK
$newuserid = $userdm->save();
echo “1”;
}

2)Upload the file to the server where the vBulletin is installed

3)Paste the below given code , immediately after the code that register a user in the main site .
$url=”http://www.example.com/forum/vb_register.php”;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, “username=$mem_username&email=$mem_email&password=$mem_password&usergroupid=2”);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
$store = curl_exec ($ch);
curl_close ($ch);

// http://www.example.com/forum/ is the location where vbulletin is installed

Share

how to migrate magento from one server to another server ?

Follow the below given instructions

1) Back up the files in the server

2) Export the Databse

3) Move the files to the new server

4) Import the databse to the new server

5) Edit the database details . please update the file “app/etc/local.xml”, with the latest Database details

6) Modify the table core_config_data (Replace old server name with new one).

7) Delete the files in “var/session” and “/var/cache”

Share

WordPress widget to display content on specified pages

Follow the steps given below to use this widget
  • Paste code on a file and save it inside folder
  • Place this folder in /wp-content/plugins/
  • Activate it using the menu plugins
  • Drag the widget to the sidebar
  • Fill the form and save the values .
  • The content you entered will be displayed on given pages(based on the page value)
  • If no value is entered for the field page url , it will show up on all pages


Share

bloginfo function and its parameters

name = Testpilot .
description = Just another WordPress blog .
admin_email = admin@example .
url = http://example/home .
wpurl = http://example/home/wp .
stylesheet_directory = http://example/home/wp/wp-content/themes/child-theme .
stylesheet_url = http://example/home/wp/wp-content/themes/child-theme/style.css .
template_directory = http://example/home/wp/wp-content/themes/parent-theme .
template_url = http://example/home/wp/wp-content/themes/parent-theme .
atom_url = http://example/home/feed/atom .
rss2_url = http://example/home/feed .
rss_url = http://example/home/feed/rss .
pingback_url = http://example/home/wp/xmlrpc.php .
rdf_url = http://example/home/feed/rdf .
comments_atom_url = http://example/home/comments/feed/atom .
comments_rss2_url = http://example/home/comments/feed .
charset = UTF-8 .
html_type = text/html .
language = en-US .
text_direction = ltr .
version = 2.9.2 .
Share

Beginners' Guide , PHP Programmer , Zend Certified Engineer , Magento Certified Developer