YaBB Community and Support Forum
YaBB Home About YaBB Download YaBB YaBB Support Customize Your Forum Development Contribute to the Project
  Welcome, Guest. Please Login or Register


 
Page Index Toggle Pages: 1
Topic Tools
 
HTML or PHP Bridge ... (Read 6,710 times)
 Jan 8th, 2008 at 9:17pm
There are no actions to perform.  
Captain John 
Ex Member


None
HTML or PHP Bridge ...
MANY users have requested this ... (I am NOT a programmer) .. But here is a couple tries a few users have started, if someone will pick it up and run with it.

HTML PHP Welcome
You just need to use the yabb cookies and vars files.

create yabbuserfile.php

Code Select All
<?php
$username = $_REQUEST['Y2User-77511'];
$file = "/yabb/members/".$username.".vars";
$lines = file($file);
foreach ($lines as $line_num => $line)
{
htmlspecialchars($line) . "<br />\n";
$var = explode(",", $line);
$var[0] = eregi_replace("'", "", $var[0]);
$userinfo[$var[0]] = eregi_replace('"', '', $var[1]);
}
?> 




At the top of your index.php place:

Code Select All
<?
include 'yabbuserfile.php';
$realname = $userinfo['realname'];
?> 




Then after <body> in your index.php

Code Select All
<?
if ($realname) {
echo <<<EOF
<strong>$realname</strong> | <a href="/yabb/YaBB.pl?action=viewprofile;username=$username" rel="nofollow" rel="nofollow">Profile</a> | <a href="/yabb/YaBB.pl?action=get_cal;calshow=1">Event Calendar | <a href="/yabb/YaBB.pl?action=logout">Sign out</a><p>
EOF;
 } else {
echo <<<EOF
<strong>Welcome, Guest. Please <a href="/yabb/YaBB.pl?action=login">Login</a> or <a href="/yabb/YaBB.pl?action=register">Register</a>.</strong>
EOF;
 }
?> 




HTML for a YaBB Login

Code Select All
   <!-- Start of User Login -->
    <div id="userlogin">
  <div id="userlogin_header">
    <h2><span>User Login</span></h2>
  </div>
  <form action="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=login2" method="post">
    <div id="field_username"> <strong><span>Log in:</span></strong>
	<input type="text" name="username" />
    </div>
    <div id="field_password"> <strong><span>Password:</span></strong>
	<input type="password" name="passwrd" />
    </div>

<input type="hidden" name="cookielength" value="1" />

    <div id="button_enter">
	<input type="image" src="images/userlogin_enter.gif" alt="Enter" class="button" />
    </div>

	<input type="hidden" name="formsession" value="73899A95898F933E7090907E8287375C8486887F255037" /></form>
  <div id="userlogin_links"> <a href="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=register" id="register"><strong><span>Register >>></span></strong></a> <br />
    <a href="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=register" id="notregister"><strong><span>Not Registered Yet?</span></strong></a> </div>
    </div>
    <!-- End of User Login --> 



   OR see this thread here: http://www.boardmod.org/yabb/YaBB.pl?board=programming;action=display;num=118365...


These Need work and finalizing !
 
 
IP Logged  
 Reply #1 - Jan 8th, 2008 at 9:32pm
There are no actions to perform.  

James Bone 
Support Team
****
Offline
Posts: 2,256
Costa Blanca, Spain


None
Re: HTML or PHP Bridge ...
Looks good, will tidy the php code a bit but otherwise works!
 
...&&Do you need some YaBB friendly webhosting? Contact me by clicking here and i will hook you up!
WWW  
IP Logged  
 Reply #2 - Mar 5th, 2008 at 5:09am
There are no actions to perform.  

Divinity 
Full Member
***
Offline
Posts: 168


None
Re: HTML or PHP Bridge ...
OH OH OH OH

"Can you hear the excitement in my typeing?" lol

I think this is waht I'm looking for maybe?????

I just started searching for how to do this this morning, hopefully I don't have to recreate the wheel....

I added an php arcade and would like to integrate the two databases so they use the same members....

Is that what this does?

One other question....
I have never messed with php, my index.php page only has One line in it says "<?php require("Arcade.php"); ?>
(It's a php Arcade and arcade.php is a file but it doesn't have <body> anywhere in it.

I've tried opening index.php in, alleycode, flashMX, and crimson editor. Same line using all of them.

Any guesses what I might need to do?
 
...
 
IP Logged  
 Reply #3 - Apr 17th, 2008 at 5:05am
There are no actions to perform.  

ChiMoHe 
YaBB Newbie
*
Offline
Posts: 22
Trip2Blog


None
Re: HTML or PHP Bridge ...
Quote:
HTML for a YaBB Login

Code Select All
   <!-- Start of User Login -->
    <div id="userlogin">
  <div id="userlogin_header">
    <h2><span>User Login</span></h2>
  </div>
  <form action="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=login2" method="post">
    <div id="field_username"> <strong><span>Log in:</span></strong>
	<input type="text" name="username" />
    </div>
    <div id="field_password"> <strong><span>Password:</span></strong>
	<input type="password" name="passwrd" />
    </div>

<input type="hidden" name="cookielength" value="1" />

    <div id="button_enter">
	<input type="image" src="images/userlogin_enter.gif" alt="Enter" class="button" />
    </div>

	<input type="hidden" name="formsession" value="73899A95898F933E7090907E8287375C8486887F255037" /></form>
  <div id="userlogin_links"> <a href="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=register" id="register"><strong><span>Register >>></span></strong></a> <br />
    <a href="http://www.yourdomain.com/cgi-bin/yabb2/YaBB.pl?action=register" id="notregister"><strong><span>Not Registered Yet?</span></strong></a> </div>
    </div>
    <!-- End of User Login --> 



   OR see this thread here: http://www.boardmod.org/yabb/YaBB.pl?board=programming;action=display;num=118365...


These Need work and finalizing !


this line
Code Select All
	<input type="image" src="images/userlogin_enter.gif" alt="Enter" class="button" />
 



should be
Code Select All
	<input type="submit" src="images/userlogin_enter.gif" alt="Enter" class="button" />
 




HTML Code for YaBB2.2.1 Login
Code Select All
<!-- Start of User Login -->
  <div class="bordercolor" style="width: 700px; margin-bottom: 8px; margin-left: auto; margin-right: auto;">

<table cellpadding="4" cellspacing="1" border="0" width="100%" align="center">
  <tr>
    <td class="titlebg" colspan="2"><b>Login</b></td>
  </tr>
  <tr>
    <td class="windowbg2" colspan="2" valign="middle">

    <form action="http://www.yourdomain.com/yabb2/YaBB.pl?action=login2" method="post">
    <div style="clear: both; padding-top: 4px; margin-left: auto; margin-right: auto; width: 600px;">
	<span style="float: left; width: 50%; text-align: left; margin-bottom: 5px;">
	  Username or email address: <br />
	  <input type="text" name="username" size="30" maxlength="30" style="width: 285px;" tabindex="1" />
	</span>
	<span style="float: left; width: 25%; text-align: left; margin-bottom: 5px;">
	  Password:<br />
	  <input type="password" name="passwrd" size="15" maxlength="30" style="width: 110px;" tabindex="2" />
	</span>

	  <input type="hidden" name="cookielength" value="1" />

    </div>
    <div style="clear: both; margin-top: 5px; margin-left: auto; margin-right: auto; width: 370px;">
	<span style="float: left; width: 49%; margin-bottom: 5px;">
	  <input type="submit" value="Login" tabindex="5" accesskey="l" style="float: left; width: 175px;" class="button" />
	</span>
	<span style="float: left; width: 49%; margin-bottom: 5px;">
	  <input type="button" value="Forgot password?" style="float: right; width: 175px;" onclick="location.href='http://www.yourdomain.com/yabb2/YaBB.pl?action=reminder'" class="button" />
	</span>
	<br /><br />
    </div>
	  <input type="hidden" name="formsession" value="5A7C677E3C4C626169206D6163497B6B7D7A0E0" /></form>
    </td>
  </tr>
</table>
<!-- End of User Login --></div>

 

« Last Edit: Apr 17th, 2008 at 5:25am by ChiMoHe »  
WWW chimohe  
IP Logged  
 Reply #4 - Sep 27th, 2008 at 8:25am
There are no actions to perform.  

Doherty 
Full Member
***
Offline
Posts: 108
Petal, Ms


None
Re: HTML or PHP Bridge ...
Just wondering if there could be a html or php bridge for forum statistics and users online. I remember using that in a much older version of YaBB as it was a mod in boardmod many years ago. I would love to have that.
 
WWW  
IP Logged  
 Reply #5 - Sep 22nd, 2010 at 8:39pm
There are no actions to perform.  

coldnex 
YaBB Newbie
*
Offline
Posts: 6


YaBB 2.5
Re: HTML or PHP Bridge ...
Doherty wrote on Sep 27th, 2008 at 8:25am:
Just wondering if there could be a html or php bridge for forum statistics and users online. I remember using that in a much older version of YaBB as it was a mod in boardmod many years ago. I would love to have that.


I know this is a really old topic but to my understanding to show the users online simply add

Code Select All
<yabb onlineusers> 

 
 
IP Logged  
 Reply #6 - Sep 27th, 2011 at 3:10pm
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,862
Earth


YaBB 2.5
Re: HTML or PHP Bridge ...
Very old thread I know but...

I'm running YaBB 2.5AE and my 'static' web pages all use Perl-based Server-side includes.

So a Perl based user name reader (ala Capt. John's PHP one) for your static home page:

Code (Perl)Select All
#!/usr/bin/perl
# $Id: yabbuserfile $
# $Date: 4.21.11 $
# $HeadURL: shadolibrary.org $
# $Revision: 2011 $
# $Source: /yabbuserfile.pl $
##################################################################################
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
our $VERSION = 2.0;

print "Content-type: text/html\n\n" or croak 'cannot print line1';

my $username = cookie("Y2User-26598");
if(defined $username){
	my $file = qq{yabb2/Members/$username.vars};
	open my $FBOOK, '<', $file or croak '<strong>Welcome, Guest</strong>';
	my @fbook = <$FBOOK>;
	close $FBOOK or croak 'cannot close user file';
	foreach my $i (@fbook) {
		chomp $i;
    		my ( $ind, $realname ) = split /,/xsm,$i;
	    	$realname =~ s/"//gxsm; #";
    		if($ind eq q{'realname'}) {
			print qq{<strong>Hello $realname</strong> | <a href="cgi-bin/yabb2/YaBB.pl?action=viewprofile;username=$username" rel="nofollow" rel="nofollow">Profile</a><a href="cgi-bin/yabb2/YaBB.pl?action=logout" rel="nofollow">Sign out</a>};
 		}
	}
}
else {
	print q{<strong>Welcome, Guest. Please <a href="cgi-bin/yabb2/YaBB.pl?action=login">Login</a> or <a href="cgi-bin/yabb2/YaBB.pl?action=register">Register</a></strong>};
}

 



Note that this requires
Code Select All
use CGI::Carp qw(fatalsToBrowser) 



Needless to say, you'll need to adjust the urls to suit your usage.

Insert:
Code Select All
<!--#include virtual='cgi-bin/yabbuserfile.pl' --> 

in your home page code where you want the name to appear.
« Last Edit: Sep 27th, 2011 at 3:12pm by Dandello »  
WWW  
IP Logged  
 Reply #7 - Sep 28th, 2011 at 2:07am
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,862
Earth


YaBB 2.5
Re: HTML or PHP Bridge ...
We can now get the number of posts and topics, number of members and the name of the newest member.

Code (Perl)Select All
#!/usr/bin/perl
# $Id: yabboard $
# $Date: 9.26.11 $
# $HeadURL: shadolibrary.org $
# $Revision: 2011 $
# $Source: /yabboard.pl $
##################################################################################
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use List::Util qw(sum);
our $VERSION = 2.0;

print "Content-type: text/html\n\n" or croak 'cannot print line1';

my ( $memcount, $latestmember ) = membershipget();
chomp $latestmember;
my $totalm         = 0;
my $totalt         = 0;
my $lastposttime   = 0;
my $lastthreadtime = 0;

#{yabb lastpostlink} {yabb lastpostdate}
#{yabb recentposts}

my $file      = qq{yabb2/Members/$latestmember.vars};
my $realnamea = 'no name';
open my $FBOOK, '<', $file or croak '<strong>Welcome, Guest</strong>';
my @fbook = <$FBOOK>;
close $FBOOK or croak 'cannot close user file';
foreach my $i (@fbook) {
    chomp $i;
    my ( $ind, $realname ) = split /,/xsm, $i;
    $realname =~ s/"//gxsm;    #";
    if ( $ind eq q{'realname'} ) {
        $realnamea = $realname;
    }
}

my @aoa_t = ();
my @aoa_m = ();

#open and clean forum totals array
my $file_tot = q{yabb2/Boards/forum.totals};
open my $FTOT, '<', $file_tot or croak 'cannot open file_tot';
my @f_tot = <$FTOT>;
close $FTOT or croak 'cannot close forum_tot';

my @wlinks = ();
my %seen   = ();
foreach my $item (@f_tot) {
    if ( !$seen{$item} ) {
        $seen{$item} = 1;
        push @wlinks, $item;
    }
}

my $ln      = 0;
my $array_t = 0;
my $array_m = 0;

#get data from cleaned forum totals array
foreach my $j (@wlinks) {
    my (
        $brd,        $topic, $posts,      $timein, $lsposter,
        $ltdatetime, $xw,    $post_title, $xx,     $xy
    ) = split /[|]/xsm, $j;
    if (   $brd ne 'recycle'
        && $brd    ne 'spam'
        && $brd    ne 'prob'
        && $timein ne 'N/A' )
    {
        $array_t = $topic;
        $array_m = $posts;
    }
    else {
        $array_t = 0;
        $array_m = 0;
    }
    $aoa_t[$ln] = $array_t;
    $aoa_m[$ln] = $array_m;
    $ln++;
}

$totalt = sum(@aoa_t);
$totalm = sum(@aoa_m);

print
qq{<br /><span style='font-size:80%'>The Writers&#39; Guild contains a total of <b>$totalm Posts</b> within <b>$totalt Topics</b>.<br />We have a total of $memcount registered members.<br />The newest member is $realnamea.</span>}
  or croak 'cannot print totals';

sub membershipget {
    my $filea = q{yabb2/Members/members.ttl};
    open my $FILEMEMGET, '<', $filea or croak 'cannot open file';
    $_ = <$FILEMEMGET>;
    close $FILEMEMGET or croak 'cannot close file';
    return split /[|]/xsm, $_;
}
 



Again, the SSI code for getting the results of the script into your html page:
Code Select All
<!--#include virtual='cgi-bin/yabboard.pl' --> 



A couple notes - the paths are not derived from variables so you may need to alter them for your differences.

Code (Perl)Select All
    if (   $brd ne 'recycle'
        && $brd    ne 'spam'
        && $brd    ne 'prob'
        && $timein ne 'N/A' ) { 


tells the script not to grab totals from recycle or other board tallies that you probably don't want counted - on my set up I have spam and prob boards that are staff only. Trying to get this information out of the forum.master or forum.control files was just way more trouble than it was worth.

Have fun.  Cool
 
WWW  
IP Logged  
 Reply #8 - Sep 28th, 2011 at 2:52am
There are no actions to perform.  

Derek Barnstorm 
Support Team
YaBB Next Team
Development Team
Beta Testers
****
Offline
Posts: 1,269
United Kingdom


YaBB 2.5
Re: HTML or PHP Bridge ...
It's nice to see someone doing something creative with YaBB and sharing it. Smiley
 
 
IP Logged  
 Reply #9 - Sep 28th, 2011 at 5:08am
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,862
Earth


YaBB 2.5
Re: HTML or PHP Bridge ...
I don't see any way to do some of these things in PHP - but hey, I'm a Perl Monger from way back.  Grin

Next project, actually getting the newest post link squared away.
 
WWW  
IP Logged  
 Reply #10 - Sep 28th, 2011 at 4:32pm
There are no actions to perform.  

Dandello 
Global Moderator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 1,862
Earth


YaBB 2.5
Re: HTML or PHP Bridge ...
Okay - got it - including lastpost.
Check the required Perl modules to make sure you have them. A couple aren't standard on every server but are available through Cpan.

Code (Perl)Select All
#!/usr/bin/perl
# $Id: yabboard $
# $Date: 9.26.11 $
# $HeadURL: shadolibrary.org $
# $Revision: 2011 $
# $Source: /yabboard.pl $
##################################################################################
use strict;
use warnings;
use CGI::Carp qw(fatalsToBrowser);
use CGI qw(:standard);
use List::Util qw(sum);
use Time::localtime;
use Readonly;
our $VERSION = 2.0;

print "Content-type: text/html\n\n" or croak 'cannot print line1';

my ( $memcount, $latestmember ) = membershipget();
chomp $latestmember;
my $totalm         = 0;
my $totalt         = 0;
my $lastposttime   = 0;
my $lastthreadtime = 0;
Readonly my $YEAR => 1900;

my $file      = qq{yabb2/Members/$latestmember.vars};
my $realnamea = 'no name';
open my $FBOOK, '<', $file or croak '<strong>Welcome, Guest</strong>';
my @fbook = <$FBOOK>;
close $FBOOK or croak 'cannot close user file';
foreach my $i (@fbook) {
    chomp $i;
    my ( $ind, $realname ) = split /,/xsm, $i;
    $realname =~ s/"//gxsm;    #";
    if ( $ind eq q{'realname'} ) {
        $realnamea = $realname;
    }
}

my @aoa_t = ();
my @aoa_m = ();

#open and clean forum totals array
my $file_tot = q{yabb2/Boards/forum.totals};
open my $FTOT, '<', $file_tot or croak 'cannot open file_tot';
my @f_tot = <$FTOT>;
close $FTOT or croak 'cannot close forum_tot';

my @wlinks = ();
my %seen   = ();
foreach my $item (@f_tot) {
    if ( !$seen{$item} ) {
        $seen{$item} = 1;
        push @wlinks, $item;
    }
}

my $ln      = 0;
my $array_t = 0;
my $array_m = 0;

#get data from cleaned forum totals array
#F1|134|2482|1284563170|ka1bqp|1282061264|114|Re: FDK In Training|xx|0h
my @newfile = (0);
my $cn      = 0;
foreach my $k (@wlinks) {
    my (
        $brd,        $topic, $posts,      $timein, $lsposter,
        $ltdatetime, $xw,    $post_title, $xx,     $xy
    ) = split /[|]/xsm, $k;
    if (   $brd ne 'recycle'
        && $brd        ne 'spam'
        && $brd        ne 'prob'
        && $brd        ne 'F2'
        && $brd        ne 'T2'
        && $brd        ne 'ff8'
        && $brd        ne 'vent'
        && $timein     ne 'N/A'
        && $post_title ne q{} )
    {
        $newfile[$cn] = join q{|}, $timein, $brd, $topic, $posts, $lsposter,
          $xw, $post_title, $xx, $xy, $ltdatetime;
        $cn++;
    }
}

my @sorted = reverse sort @newfile;
foreach my $j (@sorted) {
    my (
        $timein, $brd,        $topic, $posts, $lsposter,
        $xw,     $post_title, $xx,    $xy,    $ltdatetime
    ) = split /[|]/xsm, $j;
    $array_t    = $topic;
    $array_m    = $posts;
    $aoa_t[$ln] = $array_t;
    $aoa_m[$ln] = $array_m;
    $ln++;
}
$totalt = sum(@aoa_t);
$totalm = sum(@aoa_m);

my $sort = $sorted[0];
my @newpost = split /[|]/xsm, $sort;

my $tm   = localtime $newpost[0];
my $year = $tm->year + $YEAR;
my $mont = $tm->mon;
my $dayt = $tm->mday;

my $sup = q{<sup>st</sup>};
if ( $dayt == 1 ) {
    $sup = q{<sup>st</sup>};
}
else {
    $sup = q{<sup>th</sup>};
}

my @months = qw(
  Jan Feb Mar Apr May Jun
  Jul Aug Sep Oct Nov Dec
);

print
qq{<br /><span style='font-size:80%'>The Writers&#39; Guild contains a total of <b>$totalm Posts</b> within <b>$totalt Topics</b>.<br />We have a total of $memcount registered members.<br />The most recent public post is: <a href='../cgi-bin/yabb2/YaBB.pl?num=$newpost[9]'>$newpost[6]</a> ($months[$mont] $dayt$sup, $year)<br />The newest member is $realnamea.</span>}
  or croak 'cannot print totals';

sub membershipget {
    my $filea = q{yabb2/Members/members.ttl};
    open my $FILEMEMGET, '<', $filea or croak 'cannot open file';
    $_ = <$FILEMEMGET>;
    close $FILEMEMGET or croak 'cannot close file';
    return split /[|]/xsm, $_;
}
 



The code can no doubt be cleaned up a bit. Again, this was written for my forum, so some things won't apply to yours.

To see it in action: http://www.shadolibrary.org/

 
WWW  
IP Logged  
 Reply #11 - Sep 28th, 2011 at 9:21pm
There are no actions to perform.  

JonB 
YaBB Administrator
YaBB Next Team
Operations Team
Beta Testers
Support Team
*****
Offline
Posts: 3,625
Land of the Blazing Sun!


None
Re: HTML or PHP Bridge ...
That's a cool site, Dandello.

Cool
 
I find your lack of faith disturbing.
jonbservergeek  
IP Logged  
Page Index Toggle Pages: 1
Topic Tools
 

Get Yet another Bulletin Board at SourceForge.net. Fast, secure and Free Open Source software downloads Support This Project BoardMod - YaBB features and templates YaBB Codex - support on installation and usage YaBB Toolbar for your browser

YaBB Facebook Group Page

Vulnerability Scanner

Valid RSS Valid XHTML Valid CSS Powered by Perl
YaBB Chat and Support Community » Powered by YaBB 3.0 Beta!
YaBB Forum Software © 2000-2011. All Rights Reserved.