View Single Post
  #5  
Old 10-08-2003, 03:05 AM
Clegg Clegg is offline
 
Join Date: Dec 2001
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey man I gotcha covered

this is NOT a hack as many people seem to think you are simply reading from the MYSQL DB data that VB3 has put there... So chill you damn nazi's

www.midwestlan.com almost everything on that site is tied to vb3 and not one VB3 file has been modified, all just custom PHP scripts and SQL calls. in the top right hand corner you can see a listing of coming events. heres my code for it:

PHP Code:
<?php 
include('./global.php'); 
$events $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title 
                           FROM event
                           WHERE calendarid = 1 AND dateline_from > UNIX_TIMESTAMP() AND userid = 1 

                           ORDER BY dateline_from LIMIT 4"
); 
if (
$DB_site->num_rows($events)) { 
echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
 "
;
    while (
$event $DB_site->fetch_array($events)) { 

$timestring=$event['dateline_from']; 
$dateevent=date("M j,Y",$timestring); 
    echo 
"
<tr>
 <td align=\"center\" width=\"80\" bgcolor=\"101010\"><font face=\"verdana, arial, helvetica\" size=\"1\" color=\"888888\">
$dateevent</font></td>
 <td align=\"center\" bgcolor=\"101010\" width=\"183\"><font face=\"verdana, arial, helvetica\" size=\"1\"><b><a href='http://www.midwestlan.com/forums/calendar.php?do=getinfo&e=
$event[eventid]&c=1'>$event[title]</a></b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr>
"

  }
//} 
} else { 
  echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#000000\"><font face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b>No Events Upcoming Currently</b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr> "
;

echo 
"</table>";
?>
Ive modified the events table in the SQL DB to add a few fields since I have a registration system I have integrated to it so that vb's calendar shows events that are coming up for other lans and my own. Lets break this down:

PHP Code:
$events $DB_site->query ("SELECT UNIX_TIMESTAMP() AS dateline, dateline_from, eventid, title 
                           FROM event
                           WHERE calendarid = 1 AND dateline_from > UNIX_TIMESTAMP() AND userid = 1 

                           ORDER BY dateline_from LIMIT 4"
); 
What this does is reads the eventid, title, dateline_from, from teh data base. and then validates its a public item (calendar id = 1) and that it happens before the current time. This also limits the ones that are displayed publicly to my user ID only. ( user ID 1) Because now the registration system posts public events, I dont want them showing. It then sorts them by the dateline_from so the soonest is listed first, and it limits that to 4 entries.

PHP Code:
if ($DB_site->num_rows($events)) { 
echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
 "
;
    while (
$event $DB_site->fetch_array($events)) { 

$timestring=$event['dateline_from']; 
$dateevent=date("M j,Y",$timestring); 
    echo 
"
<tr>
 <td align=\"center\" width=\"80\" bgcolor=\"101010\"><font face=\"verdana, arial, helvetica\" size=\"1\" color=\"888888\">
$dateevent</font></td>
 <td align=\"center\" bgcolor=\"101010\" width=\"183\"><font face=\"verdana, arial, helvetica\" size=\"1\"><b><a href='http://www.midwestlan.com/forums/calendar.php?do=getinfo&e=
$event[eventid]&c=1'>$event[title]</a></b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr>
"

  } 
This above essentially diplays the header and then all teh events, I am prettys ure you can make out what its doing.

PHP Code:
} else { 
  echo 
"<table border=\"0\" width=\"100%\" cellpadding=\"0\" cellspacing=\"1\" bordercolor=\"#353535\">
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#550000\"><font class=\"heading\" face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b><a href='http://www.midwestlan.com/forums/calendar.php?c=1&do=displaymonth'>Upcoming MWL Events</a></b></font></td>
</tr>
<tr>
<td COLSPAN=2 align=\"center\" width=\"100%\" bgcolor=\"#000000\"><font face=\"verdana, arial, helvetica\" size=\"1\"  color=\"FFFFFF\"><b>No Events Upcoming Currently</b></font></td>
</tr>
<tr>
  <td colspan=\"2\" bgcolor=\"666666\"></td>
</tr> "
;

echo 
"</table>"
and if there isnt any items to display it still shows the header and "No Events".

Works like a charm with Vb3. Enjoy!

Now all I need to do is find out how to use the parse bbcode function in vb3 for my site news... theres no formatting that I can access for post data like I used to be able to before in vb2... that was the whole reason I came snooping today
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01460 seconds
  • Memory Usage 1,817KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_php
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • 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
  • showpost_complete