vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Requests/Questions (Unpaid) (https://vborg.vbsupport.ru/forumdisplay.php?f=112)
-   -   Main Site Page Login/Private Message Hack Request (https://vborg.vbsupport.ru/showthread.php?t=41937)

Mithan 08-05-2002 03:05 PM

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?

Logician 08-05-2002 04:54 PM

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..

Mithan 08-05-2002 05:18 PM

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?

Logician 08-05-2002 06:44 PM

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>';


?>


Mithan 08-05-2002 06:54 PM

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 :)

Logician 08-05-2002 07:04 PM

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..

Mithan 08-05-2002 07:39 PM

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).

Logician 08-05-2002 08:02 PM

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..

Mithan 08-05-2002 08:24 PM

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 :)

Logician 08-05-2002 08:30 PM

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>";


All times are GMT. The time now is 05:28 AM.

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.01281 seconds
  • Memory Usage 1,790KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (7)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete