collapse

* Simple Portal Archived Forum

This is an Archive Forum.

The content in this forum may be out-of-date or have been superseded by newer information, and links in forum pages to other sites may not work.
This forum contains archives for future reference.

Visit our thread at Simple Machines Forum for current support.

SMF 2.1 users: EhPortal is a ported version of Simple Portal specifically designed for the SMF 2.1 branch.
Please visit web-develop.ca to download EhPortal and for its support.

* User Info

 
 
Welcome, Guest. Please login or register.

* Who's Online

  • Dot Guests: 634
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Shoutbox

Refresh History
  • Shoutbox is not for support!
  • {OCS}MasterSeal: Yup, Still adore SP
    April 21, 2019, 07:08:06 PM
  • {OCS}MasterSeal: STILL love SP :)
    November 24, 2018, 05:05:50 AM
  • ♦ Ninja ZX-10RR ♦: <3 aegersz
    September 13, 2018, 03:36:09 PM
  • aegersz: I STILL <3 LOVE SimplePortal
    September 13, 2018, 07:11:39 AM
  • aegersz: o LOVE you guys - Simple Portal rocks !
    May 09, 2018, 05:18:59 AM
  • Chen Zhen: our apologies for the site being down.. please read server issues topic
    March 22, 2018, 05:32:38 AM
  • {OCS}MasterSeal: LOL PLEASE forget I just posted that. I found the answer in my own dang post back in 2015. lol sorry!
    July 04, 2017, 10:47:55 PM
  • {OCS}MasterSeal: I know this SB isnt' for support, but I just have a general question. Who would I contact to find out where SP stores its block info? Is it DB driven or files? I searched the site but came up with nothing. probably my fault any insight is appreciated.
    July 04, 2017, 10:43:36 PM
  • ♦ Ninja ZX-10RR ♦: Excuse me but what does Simpleportal have to deal with that?
    February 05, 2017, 08:21:14 PM
  • WhiteEagle: of course IMHO that site appears to be dead :(
    February 04, 2017, 01:08:05 PM
  • WhiteEagle: If I can get that, then I'll use it for that site...
    February 04, 2017, 01:07:35 PM
  • WhiteEagle: decided to not use SMF for any projects, unless I can get a copy of the premium version of the fanfiction archive plugin
    February 04, 2017, 01:06:54 PM
  • expertdecisions: cloudflare
    January 28, 2017, 08:01:47 AM
  • aegersz: SM release 2.0.13 !
    January 12, 2017, 06:00:13 AM
  • raffo: Tks Emanuele, even if I didn't understand the fix :D
    November 07, 2016, 02:01:20 AM
  • emanuele: [link]
    November 01, 2016, 12:43:50 PM
  • emanuele: raffo: the English support board is a good place. ;)
    November 01, 2016, 12:43:38 PM
  • raffo: Where can I find the fix for the shoutbox?
    November 01, 2016, 05:06:09 AM
  • {OCS}MasterSeal: To the SP team, I make a point to come here and thank you as much as possible for your work.  so again, THANK YOU!
    October 28, 2016, 10:38:05 AM
  • emanuele: That's indeed funny, the limit is present only in the patch and not the full install.
    October 22, 2016, 06:14:58 PM

* Recent Posts

Adding Forums Button to Nav bar by jirapon
[August 01, 2019, 09:07:12 AM]


Re: Board Icons by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 04:03:41 PM]


MOVED: Czech translation???? by ♦ Ninja ZX-10RR ♦
[July 30, 2019, 03:04:51 PM]


Board Icons by jirapon
[July 30, 2019, 07:28:44 AM]


Re: Thankyou Simpleportal, by ♦ Ninja ZX-10RR ♦
[July 29, 2019, 09:41:29 AM]

Blocks speak! Do you have an interest in getting more blocks - or even making your own? The Blocks Board is for you!

Author Topic: Posts Member Block  (Read 3183 times)

0 Members and 1 Guest are viewing this topic.

Offline Nabil

  • Full Member
  • ***
  • Posts: 110
  • SMF Version: 1.1.7
  • SP Version: 2.2.1
Posts Member Block
« on: January 06, 2009, 11:03:19 AM »
This is a Simple Block that would display Member information & Avatar according to the Number of posts (which you can specify ) , The Display of the Block is based on Time Distance which you can specify as well.

you need the following Codes for:
1.Block Code
2.MemBlockAdmin.php
(needed for the Settings)
3.memBlock.php (this php file will be Created Automatically after you run MemBlockAdmin.php )

in the MemBlockAdmin.php you can choose
1.Default (this Choice will let a Member to be displayed daily at 00:00 O'clock)
2.your own Time Distance (Starting immediatley and the display will change according to the Time distance you choose) this means 1,2,3,4 Minutes , 1,2,3,4 Days and 1,2,3,4 Weeks

the MemBlockAdmin.php is password protected , because you will need to load it within your root directory like : www.yourdomain.xxx/MemBlockAdmin.php I mean the directory where your forum is Located, you can see at the top of the Code in  MemBlockAdmin.php the place where you can replace 'username' , 'password' with your own user name and password , the Member block will display infos like :

AVATAR IMAGE
Name
groupe(for example :Administrator ,Moderator ,etc.)
Post-Group(for example: newbie)
***** (stars)
Online State (as image)
Gender (if givin)
Last Active
Date Registered
Date of Birth (if givin)
Location (if givin)
Posts


How to Create MemBlockAdmin.php
Simply make an empty php file and include the Code below of  MemBlockAdmin.php

after running MemBlockAdmin.php make sure that memBlock.php is created

here are the Codes :

MemBlockAdmin.php :
Code: [Select]
<?php
/// Checking the Submit Button
$send11=$_REQUEST['submit'];
if (
$send11==''){
// Define your username and password
$username "user";
$password "password";

if (
$_POST['txtUsername'] != $username || $_POST['txtPassword'] != $password) {

?>


<h1>Login</h1>

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <p><label for="txtUsername">Username:</label>
    <br /><input type="text" title="Enter your Username" name="txtUsername" /></p>

    <p><label for="txtpassword">Password:</label>
    <br /><input type="password" title="Enter your password" name="txtPassword" /></p>

    <p><input type="submit" name="Submit" value="Login" /></p>

</form>

<?php

}
else {

?>

<form name="form" method="post" action="MemBlockAdmin.php">
<b>A Member will be Selected (choose one): </b><br><br>
<b>Default</b> = Every day at 00:00 <input type="checkbox" name="default11"><br><br>
<b> Or After</b>&nbsp;&nbsp;

<select name='period'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>

</select>&nbsp;&nbsp;
<select name='wemi11'>
<option value="60">Minute/s</option>
<option value="86400">Day/s</option>
<option value="604800">Week/s</option>
</select>&nbsp; (a Member will be displayed Now , The next one will be displayed after the specified Time und so on)<br>
<br><font color='red'><b>Note : If you choose Default other selections will not effect </b></font><br><br>
<b>First</b><input type="radio" name="set11" value="first11" >&nbsp;&nbsp;<b>Continue</b>
<input type="radio" name="set11" value="continue" checked>( First means the first Member with the minimum Posts, Continue means the Next one )<br><br>

<input type='submit' width="50" name="submit" value="Submit"><br>
<?php

}
} else { 
$set11=$_REQUEST['set11']; //do you want to start from the Beginning or Contiue? 
if ($set11=='first11'){$start11=0; } elseif (file_exists("memBlock.php"))
{
$data11=file_get_contents("memBlock.php");
list(
$max111,$extr111,$start11)=explode("|",$data11); // we dont need max111 & extr111 but start11 to continue
} else { $start11=0; }

$date11=date(U); // this is the Current Date Including Time
$default11=$_REQUEST['default11'];
if (
$default11==''){
$period11=$_REQUEST['period']; // 1 , 2 , 3 or 4
$wemi11=$_REQUEST['wemi11']; // minute , day or week
$extr11=$period11*$wemi11;
$maxt11=$date11+$extr11// The Time after which the next Member is Displayed

$fp11=fopen("memBlock.php","w+") or die("cannot open file");
$pcontent11="$maxt11|$extr11|$start11";
fputs($fp11,$pcontent11); // a document with Time and start position
echo "<br>".'Your Settings have been Saved Successfully';
} else {
$extr11=86400;
$date2=date(U); // CURRENT DATE & TIME
$thedate=date("Y-m-d",time()); // Just the date Today in another Form
$date11explode('-'$thedate);

// How many Seconds from 1970 until Today at 00:00
$time11 mktime(000$date11[1], $date11[2], $date11[0]);
$maxt11=$time11+86400// Plus One Day in Seconds
$fp11=fopen("memBlock.php","w+") or die("cannot open file");
$pcontent11="$maxt11|$extr11|$start11";
fputs($fp11,$pcontent11); // a document with Time and start position
echo "<br>".'Your Settings have been Saved Successfully';
////////

}
?>




Block Code (php Block): (at the Top of this Code you can Specify the Minimum Number of the Posts required)
Code: [Select]
<?php
$date11
=date(U); // this is the Current Date Including Time
//////////// CHOOSE THE MINIMUM NUMBER OF POSTS REQUIRED /////////////////
$minpost11=1;
///////////////////////////////////////////////////////////////////////////

global $settings;
////////// FINDING HOW MANY Members in the Forum //////////////////
$query mysql_query("SELECT * FROM smf_members"); 
$numberOfMembers=mysql_num_rows($query); 

//////////// check out The max Time and the Start Position ///
$data11=file_get_contents("memBlock.php");
list(
$max11,$extr11,$start11)=explode("|",$data11);
if (
$date11>$max11){$start11+=1$dateplus11=$date11+$extr11;
if (
$start11>=$numberOfMembers){$start11=0; };
}
//////////////////////////////////////////////////////////////


$endp11=$numberOfMembers-$start11;


/////////// LOOK for member with minpost11 starting from $start11 ////////////
$ask=mysql_query("SELECT * FROM smf_members LIMIT $start11,$endp11");
$i11=-1;
while (
$row mysql_fetch_array($askMYSQL_ASSOC) ){
$i11+=1// Counter for the position
$post1=$row[posts]; // How Many Posts
if ($post1>=$minpost11){ 
if (
$date11>$max11){
$start11+=$i11// The Final position
$fp11=fopen("memBlock.php","w");
$pcontent11="$dateplus11|$extr11|$start11";
fputs($fp11,$pcontent11); // a document with Time and start position
}
break; 
}
};

$idmember1=$row[ID_MEMBER]; // Member ID
$memberName1=$row[memberName]; // Member Name
$group1=$row[ID_GROUP]; // Member Group ID
$avatarin=$row[avatar];

$postgroup1=$row[ID_POST_GROUP]; // Post Group
$gender1=$row[gender];
$lastlogin1=$row[lastLogin]; 
if (
$lastlogin1!=0){ $datelog1=date("d.M.Y H:i",$lastlogin1); } 
else {
$datelog1=''
};
$dateReg1=$row[dateRegistered]; $dateform =date("d.M.Y H:i",$dateReg1);
$birthdate1=$row[birthdate]; if ($birthdate1=='0001-01-01'){$birthdate1=''; };
$location1=$row[location];


if (
$group1!='0'){
$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$group1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$groupName1=$row[groupName]; // Group Name
$star1=$row[stars]; // How many Stars
};

$ask=mysql_query("SELECT groupName, stars FROM smf_membergroups WHERE ID_GROUP='$postgroup1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$postgroup2=$row[groupName];
if (
$star1==''){$star1=$row[stars]; };

// is the Member Online //////////////
$query mysql_query("SELECT * FROM smf_log_online"); 
$numberOfRows=mysql_num_rows($query); 
$imagepath1=$settings['images_url'];
if (
$numberOfRows>0){
$ask=mysql_query("SELECT ip FROM smf_log_online WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$conline1=$row[ip]; 
};
/////////// how many Stars ////////////////////
$imagepath1=$settings['images_url'];
list(
$ngif,$gifn)=explode("#",$star1);
//////////////////////////////////////////////

///////////// Get The Avatar /////////////
if ($avatarin==''){
$ask=mysql_query("SELECT filename, ID_ATTACH FROM smf_attachments WHERE ID_MEMBER='$idmember1'");
$row mysql_fetch_array($askMYSQL_ASSOC);
$avatar1=$row[filename]; $idattach1=$row[ID_ATTACH];
}
///////////// displaying the infos //////////////// 
echo "<div align='center'>";
if (
$avatarin!=''){
$checkavatar1=preg_match('/http:\/\//',$avatarin);
if (
$checkavatar1){ 
echo 
"<img src='$avatarin' border='0' style='margin:5px'><br>";
} else {
echo 
"<img src='avatars/$avatarin' border='0' style='margin:5px'><br>";
}
};
if (
$avatar1!=''){
echo 
"<img src='index.php?action=dlattach;attach=$idattach1;type=avatar' border='0' style='margin:5px'><br>";
};
echo 
"<b>$memberName1</b>"."<br>";
if (
$groupName1!='') { echo "<b>$groupName1</b><br>"; };
echo 
"<b>$postgroup2</b><br>";
echo 
"<div style='margin:5px'>";
for (
$i=0$i<$ngif$i+=1){
echo 
"<img src='$imagepath1/$gifn' border='0'>";
};
echo 
"</div>";
if (
$conline1!=''){
echo 
"<img src='$imagepath1/useron.gif' border='0' style='margin:5px'><br>"; } else {
echo 
"<img src='$imagepath1/useroff.gif' border='0' style='margin:5px'><br>";
}


//if ($gender!=''){ echo "<b>Gender:</b> ".$gender1."<br>"; };
if ($gender1!=0){ 
if (
$gender1==1){$gender1="<img src='$imagepath1/Male.gif' border='0'>"; } 
else { 
$gender1="<img src='$imagepath1/Female.gif' border='0'>"; }
echo 
"<b>Gender:</b> ".$gender1."<br>"
                 }; 
/// End gender1
if ($datelog1==''){ $datelog1='Never'; };
echo 
"<b>Last Active:</b><br>".$datelog1."<br>"
echo 
"<b>Date Registered:</b><br>".$dateform."<br>";
if (
$birthdate1!='') { echo "<b>Date of Birth:</b><br>".$birthdate1."<br>"; };
if (
$location1!='') { echo "<b>Location:</b><br>".$location1."<br>"; };
echo 
"<b>Posts:</b> ".$post1."<br>";


echo 
"</div>";


?>




« Last Edit: January 10, 2009, 09:35:01 AM by Nabil »

Offline jeff80mcmillan

  • Just Registered
  • Posts: 1
  • SMF Version: None
  • SP Version: None
Re: Posts Member Block
« Reply #1 on: February 27, 2010, 05:48:18 AM »
Your "How to Create MemBlockAdmin.php" code was really helpful to me. Thanks ..  8)
Jeff - Collector of Unique united cutlery knives