Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Apr 2004
Posts: 2
Lurker
Lurker
Offline
Joined: Apr 2004
Posts: 2
I'm running a small 6.42 board internal to my company. One of my users has approached me with the following:

"Can we use the message board to post Crystal Reports (web-based) to a forum?" and "Can this be done automatically?"

Most of the people needing to see these reports are registered on the message board already and the message board will allow me to restrict who can/cannot see the reports - i.e. Only HR people can see the reports in the HR forum, IT can only see the reports in the IT forum, etc.

I would expect that the reports (web-pages, jpgs, etc.) would be produced every night and loaded to one or more directories on the system. A script would then run and add a message(?) to the appropriate forum for that report.

Sound doable? Anyone already done this?

Thanks,
Tom

Sponsored Links
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
Absolutely.

I have an "Application Page" that is external to the forum files, it requires the main.inc.php page, grabs data off the Application page, and drops it in my specified format into an "Administration" forum that only certain people can see.

When you go into the forum, it appears as a new post.

So aye, quite doable and rather easy. You could have a cron job run that grabs the report, uploads it to a directory you specify with a given name, and then takes that name and inputs it into the {image} tags in a new post.

That way when a user who has access to that forum checks, a new post is there displaying the image of the report.

Or however you want to set it up

Joined: Apr 2004
Posts: 2
Lurker
Lurker
Offline
Joined: Apr 2004
Posts: 2
Thank you, Medar.

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Hey Medar, do you have a write-up on how to do that for us Nu-b's

Joined: May 2001
Posts: 550
Code Monkey
Code Monkey
Offline
Joined: May 2001
Posts: 550
Baically you rewrite the addpost.php script a bit and fill the subject and the body with whatever data you want.

Sponsored Links
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
Aye, but let me explain one or two things about this snippet that may turn your head a bit.

1. I am a php n00b that knows just enough to get me in trouble, there is probably a cleaner and easier way to do this! In fact I did this years ago, so there is definitely a cleaner way, heh.

2. This is an Application to join a gaming group, so the posting icons and comments below are tailored to that. You can tailor this to your liking as well - pretty easy stuff.

[:"red"]

// ------------------------------------------------------------------
// Require the library
require ("/path/to/main.inc.php");

$userob = new user;
$user = $userob -> authenticate();
$username = $user['U_Username'];
$html = new html;

// ------------------------------------------------------------------
// Get the date

$date = $html -> get_date();

// ------------------------------------------------------------------
// Format the input fields passed from your form.
// The form is on a previous page that SUBMITS to this page.

$fname_q = addslashes($firstname);
$lname_q = addslashes($lastname);
$age_q = addslashes($age);
$email_q = addslashes($email);
$icq_q = addslashes($icq);
$ssbname_q = addslashes($ssbname);
$referral_q = addslashes($referral);
$guilded_q = addslashes($guilded);
$pastguilds_q = addslashes($pastguilds);
$games_q = addslashes($games);
$pastgames_q = addslashes($pastgames);
$comments_q = addslashes($comments);

// ------------------------------------------------------------------
// Select proper game icon
// This is custom for Medar, you can assign any posting icon you desire, or delete it.

if ($games_q == 'DAOC') {
$gimage = "daoc.gif";}
elseif ($games_q == 'WOW') {
$gimage = "wow.gif";}
elseif ($games_q == 'SWG') {
$gimage = "swg.gif";}
else {
$gimage = "poll.gif";
}

// ------------------------------------------------------------------
// Insert the external information into a post
// This can be cleaned up, it submits the information into a post using forum keyword 'adminboard'.
// You will have to either make sure to add any additional fields you
// have in your w3t_Posts table, or change this to use complete inserts.

$app = "INSERT INTO w3t_Posts VALUES ('adminboard','','','','$date','$date','1.1.1.1','$games_q Application from $firstname_q $lastname_q ($ssbname_q)','Name: $fname_q $lname_q<br />Age: $age_q<br />Email: <a href=mailto:$email_q>$email_q</a><br />ICQ#: $icq_q<br />Proposed SSB name: $ssbname_q<br />Referred here by: $referral_q<br />Been guilded?: $guilded_q<br />If so, past guilds: $pastguilds_q<br />Game applying to: $games_q<br />Past gaming experience: $pastgames_q<br /><br />Comments: $comments_q<br /><br />The application should be commented on, accepted, or denied here.',' ','','','O','yes','','$gimage','y','','','','',1,'markup',' ','',9,'','',' ','','','','','','','','','')";

$result = MYSQL_QUERY($app);

// ------------------------------------------------------------------
// Now we need to find out what the number of the post we entered was
// Unchanged Threads code snippet

$query = "SELECT MAX(B_Number)
FROM w3t_Posts
WHERE B_PosterID=9
";
$sth = $dbh -> do_query($query);
list ($Mnumber) = $dbh -> fetch_array($sth);

// ------------------------------------------------------------------
// we need to set main to the number
// Unchanged Threads code snippet

$query = "UPDATE w3t_Posts
SET B_Main = '$Mnumber'
WHERE B_Number = '$Mnumber'
";

$dbh -> do_query($query);

// ------------------------------------------------------------------
// If main isn't set then this is a new thread
// Unchanged Threads code snippet

$Board_q = addslashes($Board);

$query = "UPDATE w3t_Boards
SET Bo_Total = Bo_Total + 1, Bo_Threads = Bo_Threads + 1, Bo_Last = $date, Bo_Posterid = 9, Bo_LastNumber = '$Mnumber', Bo_LastMain = '$Mnumber' WHERE Bo_Keyword = 'admin'
";
$dbh -> do_query($query);
[/]


The output comes across as a New Post in my "Administration" board looking like this:

[]
Post Title:
DAOC Application from Bob Jones (Githjoe)

Post Content:
Name: Bob Jones
Age: 38
Email: [][email protected][/]
ICQ#:
Proposed SSB name: Githjoe
Referred here by: Vhex
Been guilded?: Yes
If so, past guilds: Covetous Crew in UO
Game applying to: DAOC
Past gaming experience: UO, EQ, NWN

Comments: I love to game like everyone else....I like to help and build characters, and would love to be accepted as a probationary recruit.

The application should be commented on, accepted, or denied here. [/]

Really should be easy to set up, anyone could use the above as an example and build on it.

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Nice.
If I wanted it to go to a different forum, whould I just change the instance of the forum keywords?

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
You got it. I have not tried that, but that is exactly what you would do. Just set the "adminboard" forum keyword to whatever keyword you would like to use, and the above will dump a new "post" in that board instead.

You could run this a few times on a few different pages - OR you could set a drop-down box with values equal to your keywords - and let people select exactly which forum will have the information dumped into.

Good stuff!

Joined: Sep 2003
Posts: 803
Coder
Coder
Offline
Joined: Sep 2003
Posts: 803
Tried it on a test board and it was perfect.... you can do alot with that little piece of code there

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
Yap! It has worked great for me for a couple of years now, and over time I have only had to edit the number of '', I have in there, heh.

For the originator of this post, he could set up a cron using this code and have it add each report to the specified forum every night.

I am about as integrated as I can get for now with Threads. I had debated trying out vb3 for a new site due to the cost of the licenses, but have been a Threads user for years, so I am trying to justify the ease of hacking Threads with the cost of competitor products.

Still love adding stuff to Threads either way.

Sponsored Links

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
isaac
isaac
California
Posts: 1,157
Joined: July 2001
Forum Statistics
Forums63
Topics37,575
Posts293,931
Members13,823
Most Online6,139
Sep 21st, 2024
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,834
Greg Hard 4,625
Top Posters(30 Days)
Gizmo 1
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2025 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.1
(Snapshot build 20240918)