View Full Version : Attempting an Invision Power Board Hack for WWM
tenjuna 04-07-2005, 11:20 AM if this is not the appropriate place for me to post questions regarding my attempt to integrate Messenger with Invision Power Board, then please feel free to slap me with a large trout.
otherwise, I am basing my hack off of your PHPBB one, and my first question is:
in Sub Globals, you have a line "if ($ARGV[0] eq 'phpbbgateway')"...where is this value coming from?
my first reaction was that is some kind of cookie value. if so, is that the name of the cookie? I am guessing that $ARGV is an array that breaks up each line of the cookie into [n] values. I am not a hardcore programmer, so I am guessing on most of this.
if you are not interested in helping me create this, please let me know now so I am not wasting either of our time.
thanks
$ARGV in all of our scripts is an array of whatever was in the GET string.
For example:
http://www.yoursite.com/somescript.cgi?get1&get2
$ARGV[0] would be "get1", $ARGV[1] would be "get2".
tenjuna 04-07-2005, 03:31 PM oh sweet, that helps a lot...now I can continue.
thank you sir.
tenjuna 04-08-2005, 04:02 PM using the code in PHPBB as a start, I employed the same changes into the IPB code. I made the changes necessary in the code to use the correct session id table entries and member table entries in my database.
I had some difficulty with sessions IDs since I am using a cookie, but I was finally able to find another way to pass it along.
however, I seem to be stuck, so I have a question:
when I use:
http://mail.cainscorner.com/cgi-bin/messenger/messenger.cgi?ipbgateway&888fd560617cde3eacb4ac39fd635ccb
or something similar, it just goes to the Messenger login screen. not sure what is actually supposed to happen at this point, so no idea if it is broken or not.
I guess what I am asking for is: what happens when this link is clicked on PHPBB? assuming it's not working, but not real sure what to do about it.
understand you have no idea what I am doing, but hoping you may be able to clue me in a little bit.
have followed the PHPBB hack instructions pretty much to the letter (relatively speaking), with the exception of having used ipb in place of phpbb everywhere, and changed the mysql queries to use the correct database tables.
Ok, when the gateway is called like the link you have above, basically in the PHPBB version, it validates the user, then sends them to the &Main_Menu sub. If you are getting the login page, then the user is either not validated, or you did not send them to that routine.
If Invision is not using SID's in it's validation, you should perhaps take a look at the VBulletin hack which uses cookies. The only thing really totally different in the VB hack is the MD5 encryption which VB uses, so you need the Digest::MD5 module (included in the hack). Not sure if invision uses MD5 or not to encrypt passwords.
tenjuna 04-08-2005, 06:08 PM actually it does use MD5, so I will check that out.
another tidbit I just noticed: if I try to login the regular way now, it just goes back to the login screen with no error.
so obviously I have jacked something up somewhere...but at least I can try to get some momentum again.
thanks
tenjuna 04-08-2005, 06:39 PM yeah no matter what I do, it just goes to the login screen with no error.
even when I try to interrupt the script with:
if ($ARGV[0] eq 'ipbgateway') {
print "OK";
exit;
}
else{
print "NOT OK";
exit;
}
and thats before Globals even gets called in the Initialize sub...so obviously I messed something up.
I am going to start over.
It needs to be done AFTER the sub initialize because the $ARGV array is created at that point.
tenjuna 04-08-2005, 07:07 PM yes, I had inserted that code after the array.
in fact I have tried using this code in a few places I thought it would get called, and no matter what I do it always goes to the login.
it's one of those nifty things where you have to keep inserting little break loops until you find out where it's not happy.
I am self-taught on how to use perl and php, but whenever I have problems like this I just keep eliminating subs until I find the one that isn't happy.
I am sure it's something simple, I just have to find out where.
Just make sure you put the code in before it goes to the Routine_Caller sub.
tenjuna 04-11-2005, 11:17 AM ok, I have at least found out where I am stuck at, if not the why.
the repeated callback to the login screen is at:
### Routes Routine
sub Routine_Caller {
%commandhash = Command_Hash();
if ($commandhash{$ARGV[0]}) { $rtrt = $commandhash{$ARGV[0]}; $rtrt =~ s/ //gm; chomp($rtrt); goto (&$rtrt); exit; }
elsif ($commandhash{$form{'action'}}) { $rtrt = $commandhash{$form{'action'}}; $rtrt =~ s/ //gm; chomp($rtrt); goto (&$rtrt); exit; }
else { &Login; }
}
so it looks as though I am making it through the validation...question is, now what? it is not immediately obvious to me what this sub does.
can you explain a little what this does? maybe I am not passing something to it that it needs.
tenjuna 04-11-2005, 11:55 AM actually now that I have looked at it some more, I am not convinced that I am making it through validation.
it seems to me that if I was it would just go to the Main Menu, or at least that's what it looks like in the Globals sub.
so if I am making it to Routine Caller, I am not in fact logged in, which means my validation is not happening.
am I on the right track with that statement?
tenjuna 04-11-2005, 12:24 PM I am thoroughly confused, so I am going to explain a bit here, and see if you can see something I am missing:
Intitialize calls Global before the ARGV array is called, but Global calls that array (thats a point of confusion for me, but anyway).
Then, Global calls Validate_IPB, and passes the session id to it.
Validate_IPB does some database comparisons, then is supposed to set up a registration for that user (it does not). If this didn't work, it would go to teh Login sub right then and there. I tried to break it here, but it continues to go to the Login anyway, so that tells me the validation works.
However,
After the OK is returned (assuning it is since it doesnt break at validation), it eventually goes to Routine Caller, and if no command is hashed, it goes to Login there.
Based on my process of elimination, I have found that the else Login(); at the end of Routine Caller is actually what is happening.
Which makes no sense to me at all.
If the validation were not working, wouldn't it break way before Routine Caller? I cannot seem to make Validate_IPB break even when I put in a bad session ID.
I wish you had the time to take a look at this for me...barring that, can you think of anything I am missing?
The board uses MD5, and I have checked all of the database calls in Validate_IPB manually to make sure they are set up properly.
I am already bald, otherwise I would be tearing my hair out.
tenjuna 04-11-2005, 01:21 PM SWEET! I figured it out.
to make it really simple I put in a die; command at different points in the code to find out where things were flowing, and what I found was a bug in the PHPBB hack and a bug of my own.
as I described earlier, Global was being called before the ARGV array had even been set up, so there was no way possible for 'ipbgateway' to have been seen, so the whole validation part was never happening. I moved the ARGV array setup before Global and all the sudden I was seeing something different.
then, I went through all of the code I wrote during last week's "fun", and found a typo.
now it all works. joy.
at this point I will tighten up the code, and upload the zip and link it here.
it is totally up to you if you want to let is stay linked or take a look, whatever. my goal is simply to be helpful.
tenjuna 04-11-2005, 02:09 PM ugh...guess I am not done yet.
what I am seeing now is the second time you try to use it it just goes to the login screen again. and when you try to login it just says Username does not exist, even though it is in the database.
I did notice that the username in the database is user@domain1 domain2 domain3 domain4 so I am guessing something is not working properly when you have multiple domains.
so my current question is:
for a non-hacked messenger, what is the normal procedure for a user when the messenger has multiple domains installed? does the user get an address for every domain, or just the one they chose?
in my case I would like an address automatically created for every domain.
make any sense?
Actually it only registers to the domain that they choose. The Messenger basically considers the domain name as part of the username, this is why most of these integration hacks do not work with multiple domains.
tenjuna 04-11-2005, 02:27 PM aha! that explains it then.
so, I either need to have them choose a domain at first login, or set up a loop to create a new account for every domain.
hmm, not a very appealing choice either way.
maybe it makes more sense just to have them choose a domain, since there really isn't a need for them to have 17 different e-mail addresses right off the bat.
The best option would be to just stick with one domain, because even if you do a loop, they would have to login separately for each address to read email addresses to them at those domains.
tenjuna 04-11-2005, 06:49 PM agreed.
I have set up a domain picker template and code, so that they can pick a single domain, which then creates the account, new e-mail, and all that.
however, I am stuck at the very end, where they should go to their Main Menu after registration.
it works great if you open a new browser window and click the e-mail link, it validates and goes straight to the Main Menu like it should.
however, it will not at the end of the initial registration, and I have been beating my head on the desk trying to figure out why.
what I did was grabbed the same code from the end of Global, and stuck it at the end of my new sub:
sub Proc_Pick {
my $u = $form{'USERNAME'};
my $ud = $form{'DOMAIN'};
my $up = $form{'PASSWORD'};
my $mid = $form{'USERNAME'};
my($cookie);
Content();
$results = Save_Reg($u,$up,$ud,$mid,$form{'QUESTION1'},$form{ 'QUESTION2'},$form{'QUESTION3'},$form{'QUESTION4'} ,$form{'QUESTION5'},$form{'QUESTION6'},$form{'QUES TION7'},$form{'QUESTION8'},$form{'QUESTION9'},$for m{'QUESTION10'});
if ($results eq "OK") {
Insert_Welcome_Message("$form{'USERNAME'}\@$form{'DOMAIN'}");
Update_Tier("$form{'USERNAME'}\@$form{'DOMAIN'}",$message{118});
my $cookie_value = Encrypt("$u|$up",$pub_key,$pub_key);
my $cookie = new CGI::Cookie(-name=>'name',-value=>$cookie_value);
print "Set-Cookie: $cookie\n";
&Main_Menu;
}
else { oops($message{11});
}
exit;
}
I am sure you can figure out what most of this does, so I will not explain every part of it.
Everything seems to work great all the way through Update_Tier, but after that I get a screen that has the Set-Cookie string printed at the top, and then a login screen, rather than the Main Menu.
any ideas? I am betting it is something really dumb.
as I said before, if I were to close the window, and open a new session and click my link to get me to e-mail, it all works great.
I think the problem is you are calling the Content() function before you set the cookie. Call it afterwords. The cookie must be set (or retrieved) before any other content is sent to the browser.
tenjuna 04-11-2005, 10:27 PM this is crazy...I have been trying every variation I know of to get this to finish, but each time I just get a different problem.
if I use this:
sub Proc_Pick {
my $u = $form{'USERNAME'};
my $ud = $form{'DOMAIN'};
my $up = $form{'PASSWORD'};
my $mid = $form{'USERNAME'};
my $ses = $form{'SES'};
my $name = "$form{'USERNAME'}\@$form{'DOMAIN'}";
my($cookie);
$results = Save_Reg($u,$up,$ud,$mid,$form{'QUESTION1'},$form{ 'QUESTION2'},$form{'QUESTION3'},$form{'QUESTION4'} ,$form{'QUESTION5'},$form{'QUESTION6'},$form{'QUES TION7'},$form{'QUESTION8'},$form{'QUESTION9'},$for m{'QUESTION10'});
if ($results eq "OK") {
Insert_Welcome_Message("$form{'USERNAME'}\@$form{'DOMAIN'}");
Update_Tier("$form{'USERNAME'}\@$form{'DOMAIN'}",$message{118});
my $cookie_value = Encrypt("$name|$up",$pub_key,$pub_key);
my $cookie = new CGI::Cookie(-name=>'name',-value=>$cookie_value);
print "Set-Cookie: $cookie\n";
&Main_Menu();
}
else { oops($message{11});
}
}
everything works, but instead of it going to &Main_Menu it just goes to a login screen.
funnily enough, if I type ?Main_Menu at the end of the URL, it works fine.
if I skip the cookie and go back to re-validation (as I said before opening a second screen worked fine) using:
sub Proc_Pick {
my $u = $form{'USERNAME'};
my $ud = $form{'DOMAIN'};
my $up = $form{'PASSWORD'};
my $mid = $form{'USERNAME'};
my $ses = $form{'SES'};
my $name = "$form{'USERNAME'}\@$form{'DOMAIN'}";
$results = Save_Reg($u,$up,$ud,$mid,$form{'QUESTION1'},$form{ 'QUESTION2'},$form{'QUESTION3'},$form{'QUESTION4'} ,$form{'QUESTION5'},$form{'QUESTION6'},$form{'QUES TION7'},$form{'QUESTION8'},$form{'QUESTION9'},$for m{'QUESTION10'});
if ($results eq "OK") {
Insert_Welcome_Message("$form{'USERNAME'}\@$form{'DOMAIN'}");
Update_Tier("$form{'USERNAME'}\@$form{'DOMAIN'}",$message{118});
my $q = new CGI;
print $q->header( -type=>'text/html' );
print $q->start_html();
print "<meta http-equiv=\"refresh\" content=\"0;URL=http://mail.cainscorner.com/cgi-bin/messenger/messenger.cgi?ipbgateway&".$ses.">";
print $q->end_html();
}
else { oops($message{11});
}
}
all it does is print the last lines out to the browser, instead of just doing a meta refresh like I want. I even tried a javascript and perl redirect variation on this, all of which would print out the URL I wanted the browser to actually go to.
could it be that we are doing a use CGI :escapeHTML in messenger.cgi? this I am completely clueless on, it's my only guess.
I am thisclose to being 100% done...I tested all the other parts and it all works flawlessly.
can you see anything?
It is going to the Main_Menu sub, the problem is, it cannot now retrieve the cookie because you already sent content so validating the user will not work, you have to set the $user and $pass values before it goes to the main_menu sub. For example:
$user = "$form{'USERNAME'}\@$form{'DOMAIN'}";
$pass = $form{'PASSWORD'};
tenjuna 04-11-2005, 11:31 PM wow...6 hours down the drain for something that simple.
*sigh*
anyway thank you, that did the trick.
since this is set up to handle multiple domains, I am not sure if it's going to be of any use to anyone.
I can put together a howto, but it would probably be simpler to just have people contact me.
what do you think jafo?
Which ever is easier for you. Probably be easier on you just to write it up and post it in the hacks section.
tenjuna 04-12-2005, 12:22 PM meh, may as well write it up, and make this effort worth something to someone. plus I am sure someone would like to use the multiple domain portion of it.
I have another question for you:
I am noticing that the catch-all fills up quite fast, and 15 minute processing isn't even enough. however, it is taking longer than 15 minutes to process the mail, so I am kinda stuck.
my question is, would making a new file that has just the Do_Mail sub be of any help to the processing? or maybe you know of some tricks to make this go faster?
I am going to triple the speed of the server this is running on, but I see this problem is going to haunt me, so I would like to be better prepared now.
You only process mail every 15 minutes? Normally people crontab it every minute.
tenjuna 04-14-2005, 11:52 AM I had some major problems that kept me from moving it up, but I put in 2 new servers in the last 48 hours, so I was able to up it to every 2 minutes.
things are running very smoothly now.
as soon as I can get my network stable again, I will be putting a howto together on this, it works great now.
I feel kinda dumb for how I was acting when I first came around, but now I am very happy with my purchase, and again thanks for your help.
Glad it all worked out! :)
tenjuna 04-14-2005, 02:01 PM I spoke too soon, now I am getting the Duplicate ID error.
I ran the fix already but its still coming up.
Is there any way to only get mail into the boxes by doing the cron job, and not have it try to process when people click their Inbox?
That seems to be when the problem comes up.
Can you post the code here that you used in the fix exactly how you put it into your messenger?
tenjuna 04-14-2005, 02:13 PM I don't understand...the fix involved a set of Alter Table SQL queries in functions.cgi.
I didn't fix anything in messenger.cgi.
My question was would it help if I just stopped messenger from doing a Do_mail when a user clicked the inbox.
tenjuna 04-14-2005, 02:15 PM edit: read next post...
tenjuna 04-14-2005, 02:16 PM ugh even with that on it is still doing it...weird that that the rror would start just now though.
The error is:
"There was an error with this operation: Unkown error DBI: Duplicate entry '<random_number>' for key 2 179"
It used to be key 1 until I ran the Duplicate ID fix, now its key 2.
This comes up on every cron I do now...
What code did you paste into functions.cgi and when..
tenjuna 04-14-2005, 02:23 PM I did it about a half hour ago, and I used the code from your first post:
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail DROP PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail ADD pri_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail_index DROP PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail_index ADD pri_iid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
tenjuna 04-14-2005, 02:27 PM just to be complete this is teh EXACT code that went into my file, just in case you have changed your first post recently:
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail DROP PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail ADD pri_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail_index DROP PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
$db->do("ALTER TABLE " . $settings{"dbsuff"} . "mail_index ADD pri_iid INT UNSIGNED AUTO_INCREMENT PRIMARY KEY") or &oops("$! DBI: $DBI::errstr");
tenjuna 04-14-2005, 02:29 PM I am moving over to the Dupicate thread with this, so we have a common thread with everyone else.
And you deleted this code after the first time you clicked create tables in the admin control panel?
tenjuna 04-14-2005, 02:32 PM I am going to reply to this in that other thread.
tenjuna 04-18-2005, 01:04 PM just to finish this, below will explain the changes made. having never done a hack before I may be following the wrong "hand-holding" procedure, but I am sure you can figure out what I am doing here. you can always e-mail me at cain@c2oc.com if you don't understand something.
I am using multiple domains, so the intent of the code is to allow a person to pick a domain to use with their user account. this is in place of the registration you would normally get with Messenger. as far as I know none of the other integration hacks allow you to pick from multiple domains, so anyone wanting to add this could steal this code and make it work fairly easily.
I have not yet made the code to let people change their domain later on, but I will add it here once I do.
after that to get into their mail, they click a link I placed next to their PM link, which passes their current session ID to Messenger. this is the ONLY way to get in, and I find it to be the most secure way to do this.
I am sure there are easier/better/smarter ways to do this, but the master programmer I am not.
anyway here is the code:
=====
open messenger.cgi
-----
find:
use HTML::Scrubber;
add after:
use Digest::MD5 qw(md5_hex);
-----
find:
### Main Mail Routine
replace entire do_mail sub with this:
### Main Mail Routine
sub Do_Mail {
my($message,$messages,$msgid,@pops,@temp_pops);
if ($_[0]) {
@pops = Get_POP($_[0]);
foreach $item(@pops) {
chomp($item);
@temp_pops = split(/\|\|/,$item);
$pop = Net::POP3->new( $temp_pops[1] , Timeout => 10 );
if (defined($pop)) {
defined ($pop->login($temp_pops[2], $temp_pops[3]));
$messages = $pop->list;
foreach $msgid (keys %$messages) { Do_Parse($msgid,$_[0],$temp_pops[4]); }
$pop->quit();
}
else {
$message .= "$message{58} $temp_pops[1] $! $@";
}
}
return $message;
}
else { print "POP already open, closing gracefully..\n"; exit; }
$pop = Net::POP3->new( $settings{"popserver"} , Timeout => 10 );
if (defined($pop)) {
defined ($pop->login($settings{"popuser"}, $settings{"poppass"}));
$messages = $pop->list;
foreach $msgid (keys %$messages) { Do_Parse($msgid); }
$pop->quit();
}
else {
open (FH,">$settings{\"basepath\"}/temp/data.cgi");
print FH "Popserver is not responding: $! and $@";
close FH;
}
}
-----
find:
### Register
sub Register {
&oops("You must set the setup variable to 0 before you can register.") unless ($settings{'setup'} == 0);
my (@domain_options);
Content();
@domains = Get_Domains($settings{"domains"});
foreach $item (@domains) { $item = Strip_Returns($item); push(@domain_options,"<option value=$item>$item</option>"); }
@register = Get_Template("$settings{\"basepath\"}/templates","register.htm");
foreach $item (@register) {
if ($item =~ /<!--HEADER-->/) { Header(); }
if ($item =~ /<!--FOOTER-->/) { Footer(); }
if ($_[0]) { $item =~ s/<!--ERROR-->/$_[11]/gm; }
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USERNAME-->/$_[0]/gm;
$item =~ s/<!--QUESTION1-->/$_[1]/gm;
$item =~ s/<!--QUESTION2-->/$_[2]/gm;
$item =~ s/<!--QUESTION3-->/$_[3]/gm;
$item =~ s/<!--QUESTION4-->/$_[4]/gm;
$item =~ s/<!--QUESTION5-->/$_[5]/gm;
$item =~ s/<!--QUESTION6-->/$_[6]/gm;
$item =~ s/<!--QUESTION7-->/$_[7]/gm;
$item =~ s/<!--QUESTION8-->/$_[8]/gm;
$item =~ s/<!--QUESTION9-->/$_[9]/gm;
$item =~ s/<!--QUESTION10-->/$_[10]/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--OPTIONS-->/@domain_options/gm;
print $item;
}
exit;
}
add after:
sub PickDomain {
&oops("You must set the setup variable to 0 before you can register.") unless ($settings{'setup'} == 0);
my (@domain_options);
my $user = $_[0];
my $password = $_[1];
my $ses = $_[2];
Content();
@domains = Get_Domains($settings{"domains"});
foreach $item (@domains) { $item = Strip_Returns($item); push(@domain_options,"<option value=$item>$item</option>"); }
@register = Get_Template("$settings{\"basepath\"}/templates","pick.htm");
foreach $item (@register) {
if ($item =~ /<!--HEADER-->/) { Header(); }
if ($item =~ /<!--FOOTER-->/) { Footer(); }
$item =~ s/<!--URL-->/$url/gm;
$item =~ s/<!--USER-->/$user/gm;
$item =~ s/<!--PASSWORD-->/$password/gm;
$item =~ s/<!--MID-->/$user/gm;
$item =~ s/<!--SES-->/$ses/gm;
$item =~ s/<!--QUESTION1-->/$_[1]/gm;
$item =~ s/<!--QUESTION2-->/$_[2]/gm;
$item =~ s/<!--QUESTION3-->/$_[3]/gm;
$item =~ s/<!--QUESTION4-->/$_[4]/gm;
$item =~ s/<!--QUESTION5-->/$_[5]/gm;
$item =~ s/<!--QUESTION6-->/$_[6]/gm;
$item =~ s/<!--QUESTION7-->/$_[7]/gm;
$item =~ s/<!--QUESTION8-->/$_[8]/gm;
$item =~ s/<!--QUESTION9-->/$_[9]/gm;
$item =~ s/<!--QUESTION10-->/$_[10]/gm;
$item =~ s/<!--ICON_PATH-->/$settings{"icon_path"}/gm;
$item =~ s/<!--OPTIONS-->/@domain_options/gm;
print $item;
}
exit;
}
-----
find:
### Process Registration
sub Proc_Register {
&oops("You must set the setup variable to 0 before you can register.") unless ($settings{'setup'} == 0);
my %users = Get_Banned_Usernames();
if (($form{'USERNAME'} !~ /\A[0-9A-Za-z\._]+\Z/) || ($form{'USERNAME'} eq "")) { Return_Reg_Error($message{6}); }
if ($users{lc($form{'USERNAME'})}) { oops($message{102}); }
elsif (Valid_Domain($form{'DOMAIN'}) ne "OK") { Return_Reg_Error($message{10}); }
elsif (User_Exists("$form{'USERNAME'}\@$form{'DOMAIN'}") eq "OK") { Return_Reg_Error($message{9}); }
elsif ($form{'PASSWORD'} ne $form{'PASSWORD2'}) { Return_Reg_Error($message{4}); }
elsif ($form{'PASSWORD'} eq "") { Return_Reg_Error($message{5}); }
elsif ($form{'QUESTION1'} eq "") { Return_Reg_Error($message{7}); }
elsif ($form{'QUESTION2'} eq "") { Return_Reg_Error($message{8}); }
else {
Content();
$results = Save_Reg($form{'USERNAME'},$form{'PASSWORD'},$form {'DOMAIN'},$form{'QUESTION1'},$form{'QUESTION2'},$ form{'QUESTION3'},$form{'QUESTION4'},$form{'QUESTI ON5'},$form{'QUESTION6'},$form{'QUESTION7'},$form{ 'QUESTION8'},$form{'QUESTION9'},$form{'QUESTION10' });
if ($results eq "OK") {
Insert_Welcome_Message("$form{'USERNAME'}\@$form{'DOMAIN'}");
Update_Tier("$form{'USERNAME'}\@$form{'DOMAIN'}",$message{118});
&Login($message{120});
}
else { oops($message{11}); }
}
exit;
}
add after:
sub Proc_Pick {
my $u = $form{'USERNAME'};
my $ud = $form{'DOMAIN'};
my $up = $form{'PASSWORD'};
my $mid = $form{'USERNAME'};
my $ses = $form{'SES'};
my $name = "$form{'USERNAME'}\@$form{'DOMAIN'}";
my($cookie);
$results = Save_Reg($u,$up,$ud,$mid,$form{'QUESTION1'},$form{ 'QUESTION2'},$form{'QUESTION3'},$form{'QUESTION4'} ,$form{'QUESTION5'},$form{'QUESTION6'},$form{'QUES TION7'},$form{'QUESTION8'},$form{'QUESTION9'},$for m{'QUESTION10'});
if ($results eq "OK") {
Insert_Welcome_Message("$form{'USERNAME'}\@$form{'DOMAIN'}");
Update_Tier("$form{'USERNAME'}\@$form{'DOMAIN'}",$message{118});
my $cookie_value = Encrypt("$name|$up",$pub_key,$pub_key);
my $cookie = new CGI::Cookie(-name=>'name',-value=>$cookie_value);
print "Set-Cookie: $cookie\n";
$user = "$form{'USERNAME'}\@$form{'DOMAIN'}";
$pass = $form{'PASSWORD'};
&Main_Menu();
}
else { oops($message{11});
}
}
-----
upload messenger.cgi
-----
continued next post
tenjuna 04-18-2005, 01:16 PM create new file templates/pick.htm
add this to that new file:
<HTML><HEAD><TITLE>WWM6 Registration| by WWC</TITLE>
<META content="World Wide Messenger, CGI Scripts In Perl." name=description>
<META content="World Wide Messenger, world wide creations, World Wide Creations, Perl Scripts, perl scripts, Pearl, cgi, CGI, classifieds, World Wide Classifieds, scripts, Script, guestbook, Alumni, AlumniPro, list manager, boonville, Boonville, <a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a>/><a href=http://www.worldwidecreations.com/<a href=http://www.worldwidecreations.com/hosting/>hosting</a>/><a href=http://www.worldwidecreations.com/hosting/>hosting</a></a></a></a></a></a>, cgi, CGI, weather, websites, worldwideweb, help, development, boonville online, Hudson Online, advertise, Advertise, Advertising, advertising, advert, Advert, E-commerce, anything, yahoo, Yahoo, hotbot, Hotbot, HotBot, lycos, Lycos, alta vista, Alta Vista, business, Business," name=keywords>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META http-equiv=Content-Language content=en-us>
<script language="JavaScript">
<!--- Hide from old browsers
function cancel() {
window.location="<!--URL-->?Login";
}
// --->
</script>
</HEAD>
<body bgcolor=FFFFFF background="/icon/light-pastel-blue.gif">
<br><br>
<center>
<table width=400 height=400 cellpadding=0 cellspacing=0 border=1 BORDERCOLORLIGHT="#000000">
<form method=post action=<!--URL-->>
<input type=hidden name=action value=Proc_Pick>
<input type=hidden name=PASSWORD value="<!--PASSWORD-->">
<input type=hidden name=MID value="<!--MID-->">
<input type=hidden name=SES value="<!--SES-->">
<!-- Please note, you can have up 10 questions in this form. (2 are already included in this form and are required). You can label these questions whatever you wish, however the field names for the question must be QUESTION#. For example, if you wanted to add another question (form field) to this form the field name would be QUESTION3. These will be saved to the database as the same name as the field name except the column name will of course be in lower case -->
<tr height=81>
<td bgcolor="#000000">
<p align=center><img src="http://www.dtrades.org/style_images/Mactasti-955/logo.jpg"></p>
</td>
</tr>
<tr height=15>
<td bgcolor="#000000" background="/icon/box_mtl_ctr.gif" width=100% height=15 align=center>
<img src="/icon/spacer.gif" height=15 width=1 align=center><B><font size=2 face="arial"><!--ERROR--></font></B>
</td>
</tr>
<tr>
<td bgcolor=#9999CC valign=top>
<DIV ALIGN="center"> <CENTER>
<table width="70%">
<tr>
<td align="center" ><br><font size=2 face=arial color=white><strong>select the address you want.<br>you only get one chance at this, so choose wisely!</strong></font></td>
</tr>
<tr>
<td align="center" nowrap><br><input readonly type=text name=USERNAME value="<!--USER-->"> <font size=2 face=arial color=white><strong>@</strong></font> <select name=DOMAIN><!--OPTIONS--></select></td>
</tr>
<tr>
<td align="center"><br><input type=submit value="Go"></td>
</tr>
</table>
</CENTER></DIV>
</td>
</tr>
</form>
</table>
</center>
<br><br>
</body>
</html>
-----
upload pick.htm
-----
open functions.cgi
find:
##### Count Mail Count
sub Count_Mail_Count {
my $db = &dbconnect;
my ($i);
my $stp=$db->prepare("SELECT count(*) FROM " . $settings{"dbsuff"} . "max_mail WHERE user = '$_[0]'") or &oops("$! Database Error DBI: $DBI::errstr");
$stp->execute() or &oops("$! Cannot connect to registration database DBI: $DBI::errstr");
($i) = $stp->fetchrow_array();
}
add after:
### Validate IPB User HACK
sub Validate_IPB {
if ($settings{'setup'} == 1) { $user = $settings{'admin'}; }
else {
my ($i,$results,$u,$up);
my $ses = $_[0];
my $ud = 'nodomain';
my $db = &dbconnect_ipb;
my $db2 = &dbconnect;
my $sth=$db->prepare("SELECT `member_id` FROM `" . $settings{"ipbsuffix"} . "sessions` WHERE `id` = '$_[0]'") or &oops("$! Database Error DBI: $DBI::errstr");
$sth->execute() or &oops("$! Cannot connect to registration database DBI: $DBI::errstr");
($i) = $sth->fetchrow_array();
if ($i) {
if ($i eq "-1") { &Login(); exit; }
my $stp=$db->prepare("SELECT `name`, `password` FROM `" . $settings{"ipbsuffix"} . "members` WHERE `id` = '$i'") or &oops("$! Database Error DBI: $DBI::errstr");
$stp->execute() or &oops("$! Cannot connect to registration database DBI: $DBI::errstr");
($u,$up) = $stp->fetchrow_array();
my $std=$db2->prepare("SELECT `domain` FROM `" . $settings{"dbsuff"} . "registration` WHERE `mid` = '$u'") or &oops("$! Database Error DBI: $DBI::errstr");
$std->execute() or &oops("$! Cannot connect to registration database DBI: $DBI::errstr");
($ud) = $std->fetchrow_array();
$user = "$u\@$ud";
$pass = $up;
if (User_Exists($user) eq "ERROR") {
PickDomain($u,$up,$ses);
}
else { $results = "OK"; }
}
else { &Login(); exit; }
}
}
### Connect to the IPB HACK
sub dbconnect_ipb {
my $db = DBI->connect("DBI:$settings{\"dbtype\"}:database=$settings{\"ipbname\"}:host=$settings{\"ipbhost\"}", $settings{"ipbuser"}, $settings{"ipbpass"}) or &oops("$! DBI: $DBI::errstr");
return $db;
}
-----
upload functions.cgi
-----
you will need to do this to your messenger database:
ALTER TABLE `mess_registration` ADD `mid` VARCHAR( 255 ) NOT NULL ;
-----
open setup.cgi
find:
smtp_server localhost
add after:
ipbhost xxx.xxx.xxx.xxx
ipbuser username
ipbpass password
ipbname board_database
ipbsuffix board_suffix
you can either update the correct settings now for your IPB MySQL settings, or do so in the Admin panel.
-----
upload setup.cgi
-----
continued on next post
tenjuna 04-18-2005, 01:18 PM you will need to add a few things to your IPB board code now.
-----
open IPB_Path/index.php
find:
//--------------------------------
// The rest :D
//--------------------------------
$ibforums->member = $sess->authorise();
$ibforums->skin = $std->load_skin();
$ibforums->lastclick = $sess->last_click;
$ibforums->location = $sess->location;
$ibforums->session_id = $sess->session_id;
list($ppu,$tpu) = explode( "&", $ibforums->member['view_prefs'] );
$ibforums->vars['display_max_topics'] = ($tpu > 0) ? $tpu : $ibforums->vars['display_max_topics'];
$ibforums->vars['display_max_posts'] = ($ppu > 0) ? $ppu : $ibforums->vars['display_max_posts'];
add after:
//--------------------------------
// Set up e-mail path
//--------------------------------
$ibforums->email_url = $ibforums->session_id;
-----
upload index.php
-----
open IPB_Path/Skins/sx/skin_global.php
find:
function Member_bar($msg, $ad_link, $mod_link, $val_link) {
global $ibforums;
return <<<EOF
<table width="100%" id="userlinks" cellspacing="4">
<tr>
<td><strong>{$ibforums->lang['logged_in_as']} <a href='{$ibforums->base_url}showuser={$ibforums->member['id']}'>{$ibforums->member['name']}</a></strong> ( <a href='{$ibforums->base_url}act=Login&CODE=03'>{$ibforums->lang['log_out']}</a>$ad_link $mod_link $val_link )</td>
<td align='right'>
<b><a href='{$ibforums->base_url}act=UserCP&CODE=00' title='{$ibforums->lang['cp_tool_tip']}'>{$ibforums->lang['your_cp']}</a></b> · <a href='{$ibforums->base_url}act=Msg&CODE=01'>{$msg[TEXT]}</a> · <a href='{$ibforums->base_url}act=Search&CODE=getnew'>{$ibforums->lang['view_new_posts']}</a> · <a href='javascript:buddy_pop();' title='{$ibforums->lang['bb_tool_tip']}'>{$ibforums->lang['l_qb']}</a></td>
</tr>
</table>
EOF;
}
replace with:
function Member_bar($msg, $ad_link, $mod_link, $val_link) {
global $ibforums;
return <<<EOF
<table width="100%" id="userlinks" cellspacing="4">
<tr>
<td><strong>{$ibforums->lang['logged_in_as']} <a href='{$ibforums->base_url}showuser={$ibforums->member['id']}'>{$ibforums->member['name']}</a></strong> ( <a href='{$ibforums->base_url}act=Login&CODE=03'>{$ibforums->lang['log_out']}</a>$ad_link $mod_link $val_link )</td>
<td align='right'>
<b><a href='{$ibforums->base_url}act=UserCP&CODE=00' title='{$ibforums->lang['cp_tool_tip']}'>{$ibforums->lang['your_cp']}</a></b> · <a href='{$ibforums->base_url}act=Msg&CODE=01'>{$msg[TEXT]}</a> · <a href='http://mail.c2oc.com/cgi-bin/messenger/messenger.cgi?ipbgateway&$ibforums->email_url'>{$msg[MAIL]}</a>
· <a href='{$ibforums->base_url}act=Search&CODE=getnew'>{$ibforums->lang['view_new_posts']}</a> · <a href='javascript:buddy_pop();' title='{$ibforums->lang['bb_tool_tip']}'>{$ibforums->lang['l_qb']}</a></td>
</tr>
</table>
EOF;
}
-----
upload skin_global.php
-----
open IPB_Path/lang/en/
find:
msg_new => "%s New Messages",
add after:
mail_link => "Check Your E-mail",
-----
upload lang_global.php
-----
open IPB_Path/sources/functions.php
find:
//---------------------------------------
// Build the members bar
//---------------------------------------
if ($ibforums->member['id'] == 0)
{
$output_array['MEMBER_BAR'] = $skin_universal->Guest_bar();
}
else
{
$pm_js = "";
if ( ($ibforums->member['g_max_messages'] > 0) and ($ibforums->member['msg_total'] >= $ibforums->member['g_max_messages']) )
{
$msg_data['TEXT'] = $ibforums->lang['msg_full'];
}
else
{
$ibforums->member['new_msg'] = $ibforums->member['new_msg'] == "" ? 0 : $ibforums->member['new_msg'];
$msg_data['TEXT'] = sprintf( $ibforums->lang['msg_new'], $ibforums->member['new_msg']);
}
add after:
$msg_data['MAIL'] = sprintf( $ibforums->lang['mail_link'], $ibforums->member['mail_link']);
-----
upload finctions.php
=====
I am pretty sure that's it...if someone has a problem please feel free to smack me with a large trout, then e-mail me at cain@c2oc.com
tenjuna 04-18-2005, 01:38 PM Jafo, any idea how I could make it so when someone changes their password on IPB that it would change on Messenger as well?
I am completely baffled on this, any help would be appreciated.
past that the only thing I have left to figure out is how to let people change their domain. not sure if I want to do this or not though.
My guess? Hack IPB to also change the pass in the Messenger database at the same time? I would imagine it would just have to connect to the Messsenger database, find the username and change the password (non md5 encrypted of course).
tenjuna 04-20-2005, 12:33 PM hmm, that probably would be the best way to go about it. this would also apply for username changes as well, so I will have to get cracking on that.
I am using md5 all the way around, so I will just keep going that way.
|
|