Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)

Reply
 
Thread Tools Display Modes
  #1  
Old 08-05-2002, 03:05 PM
Mithan Mithan is offline
 
Join Date: Apr 2002
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Main Site Page Login/Private Message Hack Request

I was wondering if there is a way to just do a login/log off on the front page of my site, and have it show your Private Message (if any) hack?

I have seen a few remote login hacks, but none shows the Private Messages.

Is this possible?
Reply With Quote
  #2  
Old 08-05-2002, 04:54 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1- make it a php file (rename it as index.php)
2- add:

PHP Code:
<?php require('boardurl/global.php'); ?>
in the begining of this file..

3- before ?> part you can query the db to get pms

PHP Code:
if ($bbuserinfo[userid]>=1)
{
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' 'trim($bbuserinfo['ignorelist'])));
  }
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
  
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
  
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");

Now you can use variables ($unreadpm, $newpm, $allpm) to refer main page visitor's pms if he is a member..

Well this is basically the structure you need but a little bit PHP knowledge to apply will help a lot..
Reply With Quote
  #3  
Old 08-05-2002, 05:18 PM
Mithan Mithan is offline
 
Join Date: Apr 2002
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi and thanks for the quick reply, but maybe you can help me a little bit more.

First, my site is www.ac2hq.com

In the top navbar, near Skins, I was hoping to put the login, password info. That little area is a seperate little template php file called skins.php that gets called.

Anyways, I put this in that file but no luck.


PHP Code:
<?php
require('http://www.ac2hq.com/forum/global.php'); 

if (
$bbuserinfo[userid]>=1)
{
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' 'trim($bbuserinfo['ignorelist'])));
  }
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
  
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
  
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
}

echo 
"
$unreadpm $newpm $allpm
"
;

?>

Any idea what I did wrong?
Reply With Quote
  #4  
Old 08-05-2002, 06:44 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1- did u get a error message?
2- have you loaded the page after you logged-in to your board?

Let's test it, try this code and it will give you the clues:
PHP Code:
<?php
// enter your URL below. It's the URL relative to your host:
chdir('/home/www/forum/');
require(
'./global.php'); 

if (
$bbuserinfo[userid]>=1)
{
$ignoreusers="";
  if (
trim($bbuserinfo['ignorelist'])!="") {
    
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' 'trim($bbuserinfo['ignorelist'])));
  }
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
  
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
  
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
}

echo 
$unreadpm $newpm $allpm";

echo 
"<br>userid=".$bbuserinfo['userid'].'<br>';
echo 
"username=".$bbuserinfo['username'].'<br>';


?>
Reply With Quote
  #5  
Old 08-05-2002, 06:54 PM
Mithan Mithan is offline
 
Join Date: Apr 2002
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok this is what I get:

Array Array Array
userid=1
username=Mithan

Unlogged in people get:
userid=0
username=Unregistered



PS thanks again for the help
Reply With Quote
  #6  
Old 08-05-2002, 07:04 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

sorry my bad, replace line:

echo " $unreadpm $newpm $allpm";

AS:

PHP Code:
echo "Unread PMs=".$unreadpm['messages'].'<br>';
echo 
"New PMs=".$newpm['messages'].'<br>';
echo 
"All PMs".$allpm['messages'].'<br>'
it will display the pm numbers correctly..

As for login info you can add this code:
PHP Code:
if ($bbuserinfo[userid]>=1)
{
?>
Use here any HTML code that will be displayed to your members

<?php
}
else 
{
?>
Use here any HTML code that will be displayed to your non-members..
<?php
}
Hope this helps..
Reply With Quote
  #7  
Old 08-05-2002, 07:39 PM
Mithan Mithan is offline
 
Join Date: Apr 2002
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok that all seems to be working great. One last question, where can I find a Log in code that will work with this? (ie- allow you log in remotly).
Reply With Quote
  #8  
Old 08-05-2002, 08:02 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
<table border="0" bgcolor="#000000" cellpadding="4" cellspacing="1" align="center">
<
form action="http://wwww.yoursite.com/forum/member.php" method="post"><input type="hidden" name="s" value="1502242d035662dae7418a6042f8eb6e">
<
tr valign="top">
<
td bgcolor="#EEEEEE"><font face="verdana, arial, helvetica" size="2" ><b>Your User Name:</b></font></td>
<
td bgcolor="#EEEEEE"><font face="verdana, arial, helvetica" size="2" ><input type="text" class="bginput" name="username" size="25">      &nbsp;&nbsp;</font>
<
font face="verdana,arial,helvetica" size="1" ><a href="http://wwww.yoursite.com/forum/register.php?action=signup">Want to register?</a></font></td>
</
tr><tr valign="top">
<
td bgcolor="#FFFFFF"><font face="verdana, arial, helvetica" size="2" ><b>Your Password:</b></font></td>
<
td bgcolor="#FFFFFF"><font face="verdana, arial, helvetica" size="2" ><input type="password" class="bginput" name="password" value="" size="25">&nbsp;&nbsp;</font>
<
font face="verdana,arial,helvetica" size="1" ><a href="http://wwww.yoursite.com/forum/member.php?action=lostpw">Forgotten your password?</a></font></td></tr>
</
table
Enjoy..
Reply With Quote
  #9  
Old 08-05-2002, 08:24 PM
Mithan Mithan is offline
 
Join Date: Apr 2002
Posts: 96
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Actually I found that the table within vB worked...

Quote:
<table border="0" cellpadding="0" cellspacing="0">
<form action="http://www.ac2hq.com/forum/member.php" method="post">
<tr>
<td nowrap><smallfont><b>Not cookied?</b><br>Login with username and password:</smallfont></td>
</tr><tr>
<td nowrap><input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="action" value="login">
<input type="text" class="bginput" name="username" size="7">
<input type="password" class="bginput" name="password" size="7">
<input type="submit" class="bginput" value="Login!"></td>
</tr>
</form>
</table>

Now to just figure out the code to make that Private Message think clickable, so it takes you to your messages
Reply With Quote
  #10  
Old 08-05-2002, 08:30 PM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by Mithan
Now to just figure out the code to make that Private Message think clickable, so it takes you to your messages
$pmlink="http://www.yoururl.com/forum/private.php?s=".$session[sessionhash];

echo "<href=".$pmlink.">your PMs></a>";
Reply With Quote
Reply

Thread Tools
Display Modes

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 01:34 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05959 seconds
  • Memory Usage 2,305KB
  • 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
  • (7)bbcode_php
  • (2)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