View Full Version : Integrated Forum V 2.0 -Released!- *Old Version*
Bloodrun
05-20-2009, 07:27 AM
Forum Add-On Includes:
Forum Index
Thread Index
Ability to create threads/forums
Ability to post/read them
Have to be logged in to view the forum/post
A better layout style ability.
A better post preview.
Anyone who can view the ACP can Lock/Edit/Delete Threads and Posts
The ability to earn points per thread/reply.
Increase post count per post.
Forum Groups such as (Super Moderator, Moderator)
A full admin.php control/edit file for the forum.
The ability to hide forums to certain members.
The ability to assign a mod/super mod to a forum.
An advanced delete/create function.
Forum descriptions.
Last Post by feature.
Signature feature.
The bolded ones are the newly added features. Once I finish with the touch ups, I will post the instructions on how to install it.
Now, a quick question, do you think that I should release an old Premium Member Forum Modification each time I upgrade?
Like maybe, Every 2 upgrades?
Forum Add-On Will Include:
Parent Forum feature.
Anything else I can think of..
Bloodrun
05-23-2009, 01:02 PM
Forum Preview:
[attachment=188]
Forum Album, just in case the files don't work (http://s678.photobucket.com/albums/vv147/Avariced/)
Now some things that I am currently trying to get to work:
Parent Forums
Subcribed Thread/Forum Update
Editing of Forum
And a better Important Thread feature.
For some reason the Parent Forums and Important Thread feature, are hard for me to figure out =/
Bloodrun
05-28-2009, 03:28 PM
The actual release:
This update has a lot of updates, I suggest replaced your old pages with the new ones.
The current pages you should replace, are:
Account.php
accountpost.php
admin.php
admpost.php
register.php
messages.php
This release will mix in a couple of my other modifications, such as Custom Profile, Enhanced PM, and Warning/Report.
The sql is pretty straight forward, but the hardest one will be the 'adopts_users' table because you will have to manually insert the new options.
There are alot of files for this release, so I am zipping them in a folder.
The zip file, is organized so you know which part is which.
In the 'Profile Add-On' folder, there is a text file, that contains the sets that you have to insert into your 'adopts_users' table.
the css.php file within that folder needs to go into your inc directory
Update! For those of you who have downloaded the file (which was one) the accountpost.php file has been updated, I suggest you replace it with the new one!
The functions.php file in the zip is out of date, please use the extra one provided.
[attachment=205][attachment=206]
Saphira
05-29-2009, 12:14 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Bloodrun
05-29-2009, 12:56 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Make sure you have a parent forum first, or else it wont show.
Saphira
05-29-2009, 01:10 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Make sure you have a parent forum first, or else it wont show.
Aha, I see. All working now. Now all I need to figure out is how to get your profile add on to work with my template. http://stumbleinn.net/forum/images/smilies/Scratch-Head.gif
Bloodrun
05-29-2009, 01:18 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Make sure you have a parent forum first, or else it wont show.
Aha, I see. All working now. Now all I need to figure out is how to get your profile add on to work with my template. http://stumbleinn.net/forum/images/smilies/Scratch-Head.gif
I gave that modification a new template just for that very reason.
Saphira
05-29-2009, 01:45 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Make sure you have a parent forum first, or else it wont show.
Aha, I see. All working now. Now all I need to figure out is how to get your profile add on to work with my template. http://stumbleinn.net/forum/images/smilies/Scratch-Head.gif
I gave that modification a new template just for that very reason.
I don't understand it. I have all the files in the right places. I even changed my default style.css to style1.css, so I could upload yours. But the page has no style at all. White background, black text, everything aligned left.
Bloodrun
05-29-2009, 01:48 AM
Installing this to a test site now. I'll post a review after. :D[hr]
Hmm. When I add a new forum through the ACP, it's not showing on main_forum2.php.
Make sure you have a parent forum first, or else it wont show.
Aha, I see. All working now. Now all I need to figure out is how to get your profile add on to work with my template. http://stumbleinn.net/forum/images/smilies/Scratch-Head.gif
I gave that modification a new template just for that very reason.
I don't understand it. I have all the files in the right places. I even changed my default style.css to style1.css, so I could upload yours. But the page has no style at all. White background, black text, everything aligned left.
silly you gotta put the code in your profile, becuase it's a "Custom Profile Mod" duh =P
rosepose
05-29-2009, 09:47 AM
*raises hand* I have a question! The pet bits are strangely absent from profile2.php, how would I put them in?
Bloodrun
05-29-2009, 01:27 PM
*raises hand* I have a question! The pet bits are strangely absent from profile2.php, how would I put them in?
oh, lol I forgot I took those out, thats rather simple actually, just add this:
near the stat's section:
add this right after all the Instant messaging info
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '".$user."'";
$result = mysql_query($query);
$numpets = mysql_numrows($result);
// Show the user's profile page...
Then add this right at the end of the $article_content
<b>Number Of Pets Owned:</b> ".$numpets."<br><br>
<b><u>".$usersname."'s Pets:</u></b><br><br>";
if($numpets > 0){
$i=0;
while ($i < $numpets) {
$aid=@mysql_result($result,$i,"aid");
$image = getcurrentimage($aid);
$article_content = $article_content."<a href='levelup.php?id=".$aid."'><img src='".$image."' border='0'></a>";
$i++;
}
}
else{
$article_content = $article_content."This user currently does not have any pets.";
}
}
else{
// User doesn't seem to exist, oh noes!
$article_title = "User Does Not Exist";
$article_content = "Sorry, but we could not find a user in the system with the name ".$user.".
Please make sure you have the username right. The user's account may also have been deleted by the system admin.";
}
rosepose
05-29-2009, 03:38 PM
Erm....
Parse error: syntax error, unexpected '<' in /home/solaeria/public_html/alearith/profile2.php on line 403
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/default/usertemp.html";
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
// This page handles user profiles and shows the site members...
$user = $_GET["user"];
$user = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $user);
$user = secure($user);
$page = $_GET["page"];
$page = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $page);
$page = secure($page);
if($user != ""){
// We have specified a specific user who we are showing a profile for...
// See if the user exists...
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$i=0;
while ($i < 1) {
$usersname=@mysql_result($result,$i,"username");
$usersgroup=@mysql_result($result,$i,"usergroup");
$website=@mysql_result($result,$i,"website");
$aim=@mysql_result($result,$i,"aim");
$yahoo=@mysql_result($result,$i,"yahoo");
$msn=@mysql_result($result,$i,"msn");
$ame=@mysql_result($result,$i,"ame");
$membersince=@mysql_result($result,$i,"membersince");
$location=@mysql_result($result,$i,"location");
$age=@mysql_result($result,$i,"age");
$occupation=@mysql_result($result,$i,"occupation");
$interests=@mysql_result($result,$i,"interests");
$profilepic=@mysql_result($result,$i,"profilepic");
$displayquote=@mysql_result($result,$i,"displayquote");
$usercss=@mysql_result($result,$i,"usercss");
$status=@mysql_result($result,$i,"status");
if($website == ""){
$website = "No Website Information Given";
}
else{
$website = "<a href='".$website."' target='_blank'>".$website."</a>";
}
if($msn == ""){
$msn = "No MSN Information Given";
}
if($ame == ""){
$ame = "This user is a nobody! (Didn't enter any info)";
}
if($aim == ""){
$aim = "No AIM Information Given";
}
if($yahoo == ""){
$yahoo = "No YIM Information Given";
}
if($age == ""){
$yahoo = "No Information Given";
}
if($occupation == ""){
$yahoo = "No Information Given";
}
if($interests == ""){
$yahoo = "No Information Given";
}
if($location == ""){
$yahoo = "No Information Given";
}
$i++;
}
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '".$user."'";
$result = mysql_query($query);
$numpets = mysql_numrows($result);
// Show the user's profile page...
if($status == "yes") {
$userdisp = "Online Status: <b>Online!</b>";
}
elseif($status == "") {
$userdisp = "Online Status: <b>Offline!</b>";
}
if($numpets > 0){
$i=0;
while ($i < $numpets) {
$aid=@mysql_result($result,$i,"aid");
$image = getcurrentimage($aid);
$article_content = $article_content."<a href='levelup.php?id=".$aid."'><img src='".$image."' border='0'></a>";
$i++;
}
}
else{
$article_content = $article_content."This user currently does not have any pets.";
}
$article_title = "<center><br><br><br><br><table><tr><td id=welcome width=600 valign=top style='background-color:#fff; border:1px solid #e9e9e9; padding:10px 10px 10px;'>
<div class=font><div class=header1>".$usersname."'s Profile:</div>";
$displaypic = "<img src='".$profilepic."'>";
$display_quote = "".$displayquote."<br>".$userdisp."<br>";
$aboutme = " <div class=header3>About Me:</div><br> ".$ame."<br> <div class=header3>Interests:</div><br> ".$interests."<br></td></tr>";
$article_content = "
<tr><td id=welcome width=600 valign=top style='background-color:#fff; border:1px solid #e9e9e9; padding:10px 10px 10px;'><div class=header3><div class=font><u>".$lang_basic_info."".$usersname.":</u></div></a><br><br>
<img src='templates/icons/web.gif'> ".$website."<br>
<img src='templates/icons/aim.gif'> ".$aim."<br>
<img src='templates/icons/msn.gif'> ".$msn."<br>
<img src='templates/icons/yahoo.gif'> ".$yahoo."<br>
<img src='templates/icons/title.gif'> <a href='messages.php?act=newpm&user=".$usersname."'>Send ".$usersname." a Private Message</a><br><br></div></td></tr>";
$article_stats = "<div class=font><td id=welcome width=600 valign=top style='background-color:#ffffff; border:1px solid #e9e9e9; padding:10px 10px 10px;'><div class=font>
<div class=header3><u>".$usersname."'s Stats:</div></u></a><br><br>
<div class=header3>Member Since:</div> ".$membersince."<br><br>
<b>Number Of Pets Owned:</b> ".$numpets."<br><br>
<b><u>".$usersname."'s Pets:</u></b><br><br>";
if($numpets > 0){
$i=0;
while ($i < $numpets) {
$aid=@mysql_result($result,$i,"aid");
$image = getcurrentimage($aid);
$article_content = $article_content."<a href='levelup.php?id=".$aid."'><img src='".$image."' border='0'></a>";
$i++;
}
}
else{
$article_content = $article_content."This user currently does not have any pets.";
}
}
else{
// User doesn't seem to exist, oh noes!
$article_title = "User Does Not Exist";
$article_content = "Sorry, but we could not find a user in the system with the name ".$user.".
Please make sure you have the username right. The user's account may also have been deleted by the system admin.";
} </div>";
$article_about = "
<div class=font>
<div class=header3><u>About ".$usersname.":</div></u></a><br><br>
<div class=header3>Location:</div> ".$location."<br>
<div class=header3>Age:</div> ".$age."<br>
<div class=header3>Occupation:</div> ".$occupation."<br>
<br><br>
</div></td>
";
}
}
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':DISPLAYPIC:',$displaypic,$template);
$template = replace(':DISPLAYQUOTE:',$display_quote,$template) ;
$template = replace(':ARTICLESTATS:',$article_stats,$template) ;
$template = replace(':ARTICLEABOUT:',$article_about,$template) ;
$template = replace(':ARTICLEABOUTME:',$aboutme,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':USERCSS:',$usercss,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
That's my profile2.php.
Bloodrun
05-29-2009, 05:12 PM
Erm....
Parse error: syntax error, unexpected '<' in /home/solaeria/public_html/alearith/profile2.php on line 403
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/default/usertemp.html";
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
// This page handles user profiles and shows the site members...
$user = $_GET["user"];
$user = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $user);
$user = secure($user);
$page = $_GET["page"];
$page = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $page);
$page = secure($page);
if($user != ""){
// We have specified a specific user who we are showing a profile for...
// See if the user exists...
$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$i=0;
while ($i < 1) {
$usersname=@mysql_result($result,$i,"username");
$usersgroup=@mysql_result($result,$i,"usergroup");
$website=@mysql_result($result,$i,"website");
$aim=@mysql_result($result,$i,"aim");
$yahoo=@mysql_result($result,$i,"yahoo");
$msn=@mysql_result($result,$i,"msn");
$ame=@mysql_result($result,$i,"ame");
$membersince=@mysql_result($result,$i,"membersince");
$location=@mysql_result($result,$i,"location");
$age=@mysql_result($result,$i,"age");
$occupation=@mysql_result($result,$i,"occupation");
$interests=@mysql_result($result,$i,"interests");
$profilepic=@mysql_result($result,$i,"profilepic");
$displayquote=@mysql_result($result,$i,"displayquote");
$usercss=@mysql_result($result,$i,"usercss");
$status=@mysql_result($result,$i,"status");
if($website == ""){
$website = "No Website Information Given";
}
else{
$website = "<a href='".$website."' target='_blank'>".$website."</a>";
}
if($msn == ""){
$msn = "No MSN Information Given";
}
if($ame == ""){
$ame = "This user is a nobody! (Didn't enter any info)";
}
if($aim == ""){
$aim = "No AIM Information Given";
}
if($yahoo == ""){
$yahoo = "No YIM Information Given";
}
if($age == ""){
$yahoo = "No Information Given";
}
if($occupation == ""){
$yahoo = "No Information Given";
}
if($interests == ""){
$yahoo = "No Information Given";
}
if($location == ""){
$yahoo = "No Information Given";
}
$i++;
}
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner = '".$user."'";
$result = mysql_query($query);
$numpets = mysql_numrows($result);
// Show the user's profile page...
if($status == "yes") {
$userdisp = "Online Status: <b>Online!</b>";
}
elseif($status == "") {
$userdisp = "Online Status: <b>Offline!</b>";
}
if($numpets > 0){
$i=0;
while ($i < $numpets) {
$aid=@mysql_result($result,$i,"aid");
$image = getcurrentimage($aid);
$article_content = $article_content."<a href='levelup.php?id=".$aid."'><img src='".$image."' border='0'></a>";
$i++;
}
}
else{
$article_content = $article_content."This user currently does not have any pets.";
}
$article_title = "<center><br><br><br><br><table><tr><td id=welcome width=600 valign=top style='background-color:#fff; border:1px solid #e9e9e9; padding:10px 10px 10px;'>
<div class=font><div class=header1>".$usersname."'s Profile:</div>";
$displaypic = "<img src='".$profilepic."'>";
$display_quote = "".$displayquote."<br>".$userdisp."<br>";
$aboutme = " <div class=header3>About Me:</div><br> ".$ame."<br> <div class=header3>Interests:</div><br> ".$interests."<br></td></tr>";
$article_content = "
<tr><td id=welcome width=600 valign=top style='background-color:#fff; border:1px solid #e9e9e9; padding:10px 10px 10px;'><div class=header3><div class=font><u>".$lang_basic_info."".$usersname.":</u></div></a><br><br>
<img src='templates/icons/web.gif'> ".$website."<br>
<img src='templates/icons/aim.gif'> ".$aim."<br>
<img src='templates/icons/msn.gif'> ".$msn."<br>
<img src='templates/icons/yahoo.gif'> ".$yahoo."<br>
<img src='templates/icons/title.gif'> <a href='messages.php?act=newpm&user=".$usersname."'>Send ".$usersname." a Private Message</a><br><br></div></td></tr>";
$article_stats = "<div class=font><td id=welcome width=600 valign=top style='background-color:#ffffff; border:1px solid #e9e9e9; padding:10px 10px 10px;'><div class=font>
<div class=header3><u>".$usersname."'s Stats:</div></u></a><br><br>
<div class=header3>Member Since:</div> ".$membersince."<br><br>
<b>Number Of Pets Owned:</b> ".$numpets."<br><br>
<b><u>".$usersname."'s Pets:</u></b><br><br>";
if($numpets > 0){
$i=0;
while ($i < $numpets) {
$aid=@mysql_result($result,$i,"aid");
$image = getcurrentimage($aid);
$article_content = $article_content."<a href='levelup.php?id=".$aid."'><img src='".$image."' border='0'></a>";
$i++;
}
}
else{
$article_content = $article_content."This user currently does not have any pets.";
}
}
else{
// User doesn't seem to exist, oh noes!
$article_title = "User Does Not Exist";
$article_content = "Sorry, but we could not find a user in the system with the name ".$user.".
Please make sure you have the username right. The user's account may also have been deleted by the system admin.";
} </div>";
$article_about = "
<div class=font>
<div class=header3><u>About ".$usersname.":</div></u></a><br><br>
<div class=header3>Location:</div> ".$location."<br>
<div class=header3>Age:</div> ".$age."<br>
<div class=header3>Occupation:</div> ".$occupation."<br>
<br><br>
</div></td>
";
}
}
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':DISPLAYPIC:',$displaypic,$template);
$template = replace(':DISPLAYQUOTE:',$display_quote,$template) ;
$template = replace(':ARTICLESTATS:',$article_stats,$template) ;
$template = replace(':ARTICLEABOUT:',$article_about,$template) ;
$template = replace(':ARTICLEABOUTME:',$aboutme,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':USERCSS:',$usercss,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
That's my profile2.php.
Um.. is there a reason why your using div's in the code? I haven't tested it with divs...
rosepose
05-29-2009, 05:14 PM
So that the profile is more customizeable and so that it looks a bit like our existing layout :3
Saphira
05-30-2009, 01:43 PM
Hmm, is it possible to implement this -without- the custom profile mod? It's a good mod, but most of the users of my site are around the 12-14 usergroup, and none of them will know enough HTML to edit the page. Heh.
Bloodrun
05-30-2009, 01:47 PM
Hmm, is it possible to implement this -without- the custom profile mod? It's a good mod, but most of the users of my site are around the 12-14 usergroup, and none of them will know enough HTML to edit the page. Heh.
yeah, all you have to do, is keep your original profile.php file, and just change all the links to the profile back to 'profile.php'.
Saphira
05-30-2009, 02:05 PM
Okay, awesome! I thought I'd be playing with bits of code for hours... haha
Bloodrun
05-30-2009, 02:06 PM
Okay, awesome! I thought I'd be playing with bits of code for hours... haha
Not today =P
When I try to make a new forum it doesn't show up, I do have a parent forum for it though. I think I may have missed a SQL query, I can't find it for the life of me though x__X
Bloodrun
06-18-2009, 02:10 PM
When I try to make a new forum it doesn't show up, I do have a parent forum for it though. I think I may have missed a SQL query, I can't find it for the life of me though x__X
hmm
Did you put everything in the folder on your server?
Are you given an error at any time?
If you look in your MySql database, does it say there is a forum?
Fireballchad
09-08-2009, 07:48 PM
Ok, well this thread is really old but I am stuck. How do I get the signature to allow html? So people can post there "adopt" in this forum. I wouldn't assume its harder then getting BBCode working, is it just filtering out html somewhere? There is a lot of files so I might of missed it somewhere but i've been trying to do this for a bit now.
BMR777
09-09-2009, 01:11 PM
Well, I haven't looked thoroughly at the forum mod code, however to secure the data before entering it into the database the secure() function is used, at least I am assuming that is the case. That also strips out HTML though. In the forum mod you can safely replace instances of secure() with instances of mysql_real_escape_string() to enable HTML while still filtering malicious SQL statements. :)
Bloodrun
09-09-2009, 03:46 PM
Well, I haven't looked thoroughly at the forum mod code, however to secure the data before entering it into the database the secure() function is used, at least I am assuming that is the case. That also strips out HTML though. In the forum mod you can safely replace instances of secure() with instances of mysql_real_escape_string() to enable HTML while still filtering malicious SQL statements. :)
The mysql_real_escape_string() should work, if not it's because this version has the same kink the first has.
The next version, number 3 I believe, The one I was suppose to make and release last month, has that fixed. I just currently have no computer and one 32 gig Flash Drive with everything on it. You can see where my delima lies.
I apologize for not being to help and release anything else.
Fireballchad
09-09-2009, 10:25 PM
Thanks guys that worked for the most part.
The next version, number 3 I believe, The one I was suppose to make and release last month, has that fixed. I just currently have no computer and one 32 gig Flash Drive with everything on it. You can see where my delima lies.
I apologize for not being to help and release anything else.
No worries ive been there before, you have done tons of stuff for this site. :D
I ended up adding the bbcode.php in between
$signature = $_POST["signature"];
$signature = mysql_real_escape_string($signature);
Located in accountpost.php
to make it change bbcode to html so the forum could read it :D
Bloodrun
09-11-2009, 11:24 AM
Thanks guys that worked for the most part.
The next version, number 3 I believe, The one I was suppose to make and release last month, has that fixed. I just currently have no computer and one 32 gig Flash Drive with everything on it. You can see where my delima lies.
I apologize for not being to help and release anything else.
No worries ive been there before, you have done tons of stuff for this site. :D
I ended up adding the bbcode.php in between
$signature = $_POST["signature"];
$signature = mysql_real_escape_string($signature);
Located in accountpost.php
to make it change bbcode to html so the forum could read it :D
Good to hear, now if only I remember to look back on this post the next I go to update the code, it should be just fine for the next release.
gabeki
10-20-2009, 09:45 AM
hi, can you help me? :P
I installed this script in my site, and it works pretty well but it will only have 1 parent forum...
when I create another nothing changes, even if I create foruns inside it...
and the parents and foruns are being inserted in the database, so I guess it's a problem of showing and not of inserting...
here's the code where it's supposed to show all parents
$table = $table."
<table width='95%' border='1' align='center' cellpadding='3' cellspacing='1' class='forum'>";
$query = "SELECT * FROM parent_forum ORDER BY pid ASC";
$result = mysql_query($query);
$num3 = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num3) {
$pid=@mysql_result($result,$i,"pid");
$ptopic=@mysql_result($result,$i,"topic");
$ptopic = stripslashes($ptopic);
$table = $table."
<tr>
<td width='100%' class='forum'><img src='images/iconforum.png'> <b>".$ptopic."</b></td>
</tr>
</table>
<table width='95%' border='1' align='center' cellpadding='3' cellspacing='1' class='forum'>
<tr>
<td width='55%' class='forum2' align='center'><strong>Fórum</strong></td>
<td width='10%' class='forum2' align='center'><strong>Tópicos</strong></td>
<td width='10%' class='forum2' align='center'><strong>Posts</strong></td>
<td width='20%' class='forum2' align='center'><strong>Último Post</strong></td>
</tr>";
$query = "SELECT * FROM forum Where pid='".$pid."'";
$result = mysql_query($query);
$num2 = mysql_numrows($result);
$i=0;
while ($i < $num2) {
$fid=@mysql_result($result,$i,"fid");
$topic=@mysql_result($result,$i,"topic");
$desc=@mysql_result($result,$i,"desc");
$posts=@mysql_result($result,$i,"posts");
$threads=@mysql_result($result,$i,"threads");
$lby=@mysql_result($result,$i,"lby");
$ldatetime=@mysql_result($result,$i,"ldatetime");
$ltopic=@mysql_result($result,$i,"ltopic");
$lid=@mysql_result($result,$i,"lid");
$topic = stripslashes($topic);
$ltopic = stripslashes($ltopic);
$desc = stripslashes($desc);
if($ltopic == ""){
$lpost = "<i>Nunca</i>";
}
else{
$lpost = "<a href='view_topic.php?id=".$lid."'>".$ltopic."</a> por: <a href='perfil.php?user=".$lby."'>".$lby."</a><br>".$ldatetime;
}
$table = $table."
<tr>
<td class='trow'><a href='main_forum.php?fid=".$fid."'>".$topic."</a><BR><i>".$desc."</i></td>
<td align='center' class='trow'>".$threads."</td>
<td align='center' class='trow'>".$posts."</td>
<td align='center' class='trow'>".$lpost."</td>
</tr>";
$i++;
}
$i++;
}
$table = $table."
</table><br>";
and here's the link http://www.maplepet.co.cc/main_forum2.php
ty from now. :D
Bloodrun
10-20-2009, 11:46 AM
hi, can you help me? :P
I installed this script in my site, and it works pretty well but it will only have 1 parent forum...
when I create another nothing changes, even if I create foruns inside it...
and the parents and foruns are being inserted in the database, so I guess it's a problem of showing and not of inserting...
here's the code where it's supposed to show all parents
$table = $table."
<table width='95%' border='1' align='center' cellpadding='3' cellspacing='1' class='forum'>";
$query = "SELECT * FROM parent_forum ORDER BY pid ASC";
$result = mysql_query($query);
$num3 = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num3) {
$pid=@mysql_result($result,$i,"pid");
$ptopic=@mysql_result($result,$i,"topic");
$ptopic = stripslashes($ptopic);
$table = $table."
<tr>
<td width='100%' class='forum'><img src='images/iconforum.png'> <b>".$ptopic."</b></td>
</tr>
</table>
<table width='95%' border='1' align='center' cellpadding='3' cellspacing='1' class='forum'>
<tr>
<td width='55%' class='forum2' align='center'><strong>Fórum</strong></td>
<td width='10%' class='forum2' align='center'><strong>Tópicos</strong></td>
<td width='10%' class='forum2' align='center'><strong>Posts</strong></td>
<td width='20%' class='forum2' align='center'><strong>Último Post</strong></td>
</tr>";
$query = "SELECT * FROM forum Where pid='".$pid."'";
$result = mysql_query($query);
$num2 = mysql_numrows($result);
$i=0;
while ($i < $num2) {
$fid=@mysql_result($result,$i,"fid");
$topic=@mysql_result($result,$i,"topic");
$desc=@mysql_result($result,$i,"desc");
$posts=@mysql_result($result,$i,"posts");
$threads=@mysql_result($result,$i,"threads");
$lby=@mysql_result($result,$i,"lby");
$ldatetime=@mysql_result($result,$i,"ldatetime");
$ltopic=@mysql_result($result,$i,"ltopic");
$lid=@mysql_result($result,$i,"lid");
$topic = stripslashes($topic);
$ltopic = stripslashes($ltopic);
$desc = stripslashes($desc);
if($ltopic == ""){
$lpost = "<i>Nunca</i>";
}
else{
$lpost = "<a href='view_topic.php?id=".$lid."'>".$ltopic."</a> por: <a href='perfil.php?user=".$lby."'>".$lby."</a><br>".$ldatetime;
}
$table = $table."
<tr>
<td class='trow'><a href='main_forum.php?fid=".$fid."'>".$topic."</a><BR><i>".$desc."</i></td>
<td align='center' class='trow'>".$threads."</td>
<td align='center' class='trow'>".$posts."</td>
<td align='center' class='trow'>".$lpost."</td>
</tr>";
$i++;
}
$i++;
}
$table = $table."
</table><br>";
and here's the link http://www.maplepet.co.cc/main_forum2.php
ty from now. :D
That was something, a feat, that took me up until now to solve. It is solved for the next release, I can't help you fix it now, because it wont work with the current version you have.
Bloodrun
11-02-2009, 12:20 AM
I have decided to release this old version to the Free Public. All the problems have been dealt with and answered already. If you have a problem that hasn't been answered you may post it here.
Please don't make me regret releasing this old version.
I cant seem to find the link to create a parent forum.
EDIT: Fix it, for got to upload functions.php.
Bloodrun
11-03-2009, 05:16 PM
I cant seem to find the link to create a parent forum.
EDIT: Fix it, for got to upload functions.php.
Lol. Just a note, the parent forum feature does not work with this Version.
I've got it up and working, but when you click on a forum nothing appears...
My site: http://www.pokefarm.2x.nu/poke/main_forum2.php
Bloodrun
11-05-2009, 05:42 PM
I've got it up and working, but when you click on a forum nothing appears...
My site: http://www.pokefarm.2x.nu/poke/main_forum2.php
Well you didn't install it right. Post your main_forum.php file here so I can take a look at it.
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/default/forumtemp.html";
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
$links = getlinks();
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
// This page handles user profiles and shows the site members...
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msg = "
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#F9AE00' class='ftable'>
<td>
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#FECF61'>
<tr>
<td><center>You have a new message(s): <a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br></center></td>
</tr>
</table>
</table><br>";
}
$table = "".$msg."<br>".$article_content."";
$status2 = "".grabanysetting("status")."";
$reason2 = "".grabanysetting("reason")."";
if($status2 == "1") {
$article_content = "
<table>
<table width='100%' border='1'>
<tr>
<td width='100' align='center'><strong>Your Administrator has turned the board offline. If your administrator has listed a reason, it is given below:</strong></td>
</tr>
<tr>
<td width='100' align='center'><strong>".$reason2."</strong></td>
</tr></table></table><br>";
}
else {
$fid=$_GET['fid'];
$query = "SELECT * FROM forum_question WHERE fid='".$fid."' ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
$id=@mysql_result($result,$i,"id");
$impid=@mysql_result($result,$i,"impid");
if($id == ""){
$not = "<tr><td class='trow' colspan='7'>There are currently no threads in this forum. If you would like to make a thread click the 'Create New Topic' button.</td></tr>";
}
if($impid == "1"){
$imp = "<td width='10%' align='center' class='tr'><strong>Important Thread</strong></td>";
}
else{
$imp = "<td width='10%' align='center' class='tr'><strong>Important Thread</strong></td>";
}
$query = "SELECT * FROM forum WHERE fid='".$fid."'";
$result = mysql_query($query);
$topic=@mysql_result($result,$i,"topic");
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$tab = "<td width='10%' align='center' class='tr'><strong>Status</strong></td>";
}
$article_title = "<a href='main_forum2.php'>4U Forum</a> / ".$topic."";
$table = $table."
<table width='90%' border='0' align='center' cellpadding='3' cellspacing='1' class='ftable'>
<tr>
<td width='100%' class='thead'>".$topic."</td>
</tr>
</table>
<table width='90%' border='0' align='center' cellpadding='3' cellspacing='1' class='ftable'>
<tr>
<td width='43%' align='center' class='tr'><strong>Topic</strong></td>
".$imp."
<td width='15%' align='center' class='tr'><strong>Views</strong></td>
<td width='13%' align='center' class='tr'><strong>Replies</strong></td>
<td width='13%' align='center' class='tr'><strong>Date/Time</strong></td>
<td width='40%' class='tr' align='center'><strong>Last Post</strong></td>
".$tab."
</tr>
".$not."";
$fid=$_GET['fid'];
$query = "SELECT * FROM forum_question WHERE fid='".$fid."' ORDER BY id DESC";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$id=@mysql_result($result,$i,"id");
$impid=@mysql_result($result,$i,"impid");
$name=@mysql_result($result,$i,"name");
$topic=@mysql_result($result,$i,"topic");
$view=@mysql_result($result,$i,"view");
$reply=@mysql_result($result,$i,"reply");
$datetime=@mysql_result($result,$i,"datetime");
$status=@mysql_result($result,$i,"status");
$lby=@mysql_result($result,$i,"lby");
$ltopic=@mysql_result($result,$i,"ltopic");
$lname=@mysql_result($result,$i,"lname");
$ldatetime=@mysql_result($result,$i,"ldatetime");
$topic = stripslashes($topic);
$ltopic = stripslashes($ltopic);
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$tab2 = "<td align='center' class='trow'>".$status."</td>";
}
if($status == "Open"){
$tname = "".$topic."";
}
else if($status == "Locked"){
$tname = "<s>".$topic."</s>";
}
if($impid == "1"){
$imp2 = "<td align='center' bgcolor='#FECF61'>Important Thread</td>";
}
else{
$imp2 = "<td align='center' class='trow'>Normal Thread</td>";
}
if($ltopic == ""){
$lpost = "<i>Never</i>";
}
else{
$lpost = "".$ldatetime."<br>by: <a href='profile2.php?user=".$lby."'>".$lby."</a>";
}
$table = $table."
<tr>
<td class='trow'><a href='view_topic.php?id=".$id."'>".$tname."</a><BR><strong>Created by:</strong><a href='profile2.php?user=".$name."'>".$name."</a></td>
".$imp2."
<td align='center' class='trow'>".$view."</td>
<td align='center' class='trow'>".$reply."</td>
<td align='center' class='trow'>".$datetime."</td>
<td align='center' class='trow'>".$lpost."</td>
".$tab2."
</tr>
";
$i++;
}
if($isloggedin == "yes"){
$create = "<a href='create_topic.php?fid=".$fid."'><strong>Create New Topic</strong> </a>";
}
else{
$create = "<br>";
}
$table = $table."
<tr>
<td colspan='7' align='right' class='tr'><a href='accountpost.php?act=changesettings&more=".$fid."'>Subscribe to this Forum</a> | ".$create."</td>
</tr></table>
";
}
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':TABLE:',$table,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
Bloodrun
11-05-2009, 06:16 PM
Okay that's not the problem. Because now you can view the forums. But when I click to see a thread I get an internal service error. Paste your view_topic.php thread here.
<?php
// ************************************************** ********************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// ************************************************** ********************
// Wake the sleeping giant
// ************************************************** ********************
// Basic Configuration Info
// ************************************************** ********************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/forumtemp.html";
// ************************************************** ********************
// Define our top links by calling getlinks()
// ************************************************** ********************
$links = getlinks();
// ************************************************** ********************
// Define our ads by calling getads()
// ************************************************** ********************
$ads = getads("any");
// ************************************************** ********************
// Grab any dynamic article content from the content table
// ************************************************** ********************
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// ************************************************** ********************
// Grab any settings that we will need for the current page from the DB
// ************************************************** ********************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// ************************************************** ********************
// Check and see if the user is logged in to the site
// ************************************************** ********************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// ************************************************** ********************
// End Prepwork - Output the page to the user
// ************************************************** ********************
// This page handles user profiles and shows the site members...
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msg = "
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#F9AE00' class='ftable'>
<td>
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#FECF61'>
<tr>
<td><center>You have a new message(s): <a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br></center></td>
</tr>
</table>
</table><br>";
}
$table = "".$msg."<br>".$article_content."";
$status2 = "".grabanysetting("status")."";
$reason2 = "".grabanysetting("reason")."";
if($status2 == "1") {
$article_content = "
<table>
<table width='100%' border='1'>
<tr>
<td width='100' align='center'><strong>Your Administrator has turned the board offline. If your administrator has listed a reason, it is given below:</strong></td>
</tr>
<tr>
<td width='100' align='center'><strong>".$reason2."</strong></td>
</tr></table></table><br>";
}
else {
$id=$_GET['id'];
$query = "SELECT * FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$fid=@mysql_result($result,$i,"fid");
$tname=@mysql_result($result,$i,"name");
$tname = stripslashes($name);
$query = "SELECT * FROM forum WHERE fid='".$fid."'";
$result = mysql_query($query);
$topic=@mysql_result($result,$i,"topic");
$ftopic = "".$topic."";
// get value of id that sent from address bar
$fid=$_GET['fid'];
$id=$_GET['id'];
$query = "SELECT * FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$topic=@mysql_result($result,$i,"topic");
$fid=@mysql_result($result,$i,"fid");
$id=@mysql_result($result,$i,"id");
$detail=@mysql_result($result,$i,"detail");
$name=@mysql_result($result,$i,"name");
$datetime=@mysql_result($result,$i,"datetime");
$status=@mysql_result($result,$i,"status");
$topic = stripslashes($topic);
$detail = stripslashes($detail);
$name = stripslashes($name);
$name = "".$name."";
$fid = "".$fid."";
$signature = getsignature($name);
$postbar = getpostbar($name);
if($loggedinname != "$name"){
}
else if($loggedinname == "$name"){
$edit = "<a href='editpost.php?do=edit&id=".$id."&fid=".$fid."'>Edit Post</a>";
}
if($isloggedin == "yes"){
$treport = " | <a href='editpost.php?do=reportthread&id=".$id."'>Report Post</a>";
$pm = " | <a href='messages.php?act=newpm&user=".$name."'>Send ".$name." a Private Message</a>";
}
else{
$treport = "";
$pm = "";
}
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$edit2 = " | <a href='editpost.php?do=delete&id=".$id."&fid=".$fid."'>Delete Post</a>";
$status2 = "
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>
<form name='form1' method='post' action='update_thread.php'>
<select name='status' id='status'>
<option value='none' selected>No Selection</option>
<option value='Locked'>Lock Thread</option>
<option value='Open'>Open Thread</option>
<option value='1'>Stick Thread</option>
<option value='2'>Un-Stick Thread</option>
</select>
<input name='fid' type='hidden' id='fid' value='".$fid."'>
<input name='id' type='hidden' id='id' value='".$id."'>
<input type='submit' name='Submit' value='Submit'>
</form>
</td>
</tr>
</table><br>";
}
$article_title = "<a href='main_forum2.php'>4U Forum</a> / <a href='main_forum.php?fid=".$fid."'>".$ftopic."</a> / ".$topic."";
$table = $table."
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='thead' width='100%'><strong>Date/time : </strong>".$datetime."<center><strong>".$topic."</strong></center></td>
</tr>
</table>
<td class='tr'><table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='trow'><center><a href='profile2.php?user=".$name."'><strong>".$name."</strong></a></center><br><center>".$postbar."</center></td>
<td class='trow' valign='top' width='100%'>
".$detail."".$signature."</td>
</tr>
</table></td>
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>".$edit."".$edit2."".$treport."".$pm."</td>
</tr>
</table><br>
";
$id=$_GET['id'];
$query = "SELECT * FROM forum_answer WHERE question_id='".$id."' ORDER BY a_id ASC";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$a_name=@mysql_result($result,$i,"a_name");
$a_answer=@mysql_result($result,$i,"a_answer");
$a_id=@mysql_result($result,$i,"a_id");
$a_datetime=@mysql_result($result,$i,"a_datetime");
$a_answer = stripslashes($a_answer);
$name = "".$a_name."";
$signature = getsignature($name);
$postbar = getpostbar($name);
if($isloggedin == "yes"){
$preport = " | <a href='editpost.php?do=reportpost&id=".$id."&a_id=".$a_id."'>Report Post</a>";
$apm = " | <a href='messages.php?act=newpm&user=".$a_name."'>Send ".$a_name." a Private Message</a>";
}
else{
$preport = "";
$apm = "";
}
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$edit = "<a href='editpost.php?do=editreply&fid=".$fid."&question_id=".$id."&a_id=".$a_id."'>Edit Post</a>";
$edit2 = " | <a href='editpost.php?do=deletereply&fid=".$fid."&question_id=".$id."&a_id=".$a_id."'>Delete Post</a>";
}
$table = $table."
<table border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'><strong>Date/time : </strong>".$a_datetime."</td>
<td class='tr' width='20%'><center><strong>ID</strong>:".$a_id."</center></td>
</tr>
</table>
<td class='tr'><table border='0' cellpadding='3' cellspacing='1' bordercolor='1' class='ftable2a'>
<tr>
<td class='trow'><center><a href='profile2.php?user=".$a_name."'><strong>".$a_name."</strong></a>".$postbar."</td>
<td class='trow' valign='top' width='100%'>
".$a_answer."".$signature."</td>
</tr>
</table></td>
<table border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>".$edit."".$edit2."".$preport."".$apm."</td>
</tr>
</table><br>
";
$i++;
}
$i++;
}
$query = "SELECT view FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$view=@mysql_result($result,"view");
// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$query = "INSERT INTO forum_question(view) VALUES('".$view."') WHERE id='".$id."'";
$result = mysql_query($query);
}
// count more value
$addview=$view+1;
$query = "UPDATE forum_question SET view='".$addview."' WHERE id='".$id."'";
$result = mysql_query($query);
if($status == "Locked" or $isloggedin != "yes"){
$post = "";
}
else if($status == "Open" or $isloggedin == "yes"){
$post = "
<BR>
<form name='form1' method='post' action='add_answer.php'>
<td>
<table width='100%' border='0' cellpadding='0' cellspacing='0' class='ftable2a'>
<tr>
<td class='trow'><input name='a_name' type='hidden' id='a_name' value='".$loggedinname."' />
<center><strong>Reply:</strong></center>
<center><textarea name='a_answer' cols='45' rows='3' id='a_answer'></textarea></center>
<input name='name' type='hidden' value='".$name."'>
<input name='pam' type='hidden' value='5'>
<input name='a_topic' type='hidden' value='".$topic."'>
<input name='dip' type='hidden' value='1'>
<input name='id' type='hidden' value='".$id."'>
<input name='fid' type='hidden' value='".$fid."'>
<center><input type='submit' name='Submit' value='Submit'> <input type='reset' name='Submit2' value='Reset'></center></td>
</tr>
</table>
</td>
</form>
";
}
$table = $table."
".$status2."
".$post."
";
}
// ************************************************** ********************
// Begin Template Definition
// ************************************************** ********************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template) ;
$template = replace(':ARTICLECONTENT:',$article_content,$templ ate);
$template = replace(':TABLE:',$table,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// ************************************************** ********************
// End Template Definition
// ************************************************** ********************
?>
And thanks for your help by the way :)
Bloodrun
11-05-2009, 06:45 PM
This doesn't make sense. I can view the view_topic.php page, but as soon as I specify a thread it gives me he internal error..
Did you edit anythig in the view_topic.php file?
Bloodrun
11-05-2009, 07:18 PM
No....
That's incredibly strange... It doesn't make since becuase it was being used before just fine. :?
Hmm, it uses functions.php right? Well maybe there was something wrong with that file.
Bloodrun
11-06-2009, 04:33 PM
Hmm, it uses functions.php right? Well maybe there was something wrong with that file.
functions.pgp doesn't control that file..
Wait, paste your functions.php here so I can look at it.
<?php
// File ID: functions.php
// Purpose: Provides basic sitewide functions
//Connect to the database first
connect();
//This function simply connects us to the database
function connect(){
include("config.php");
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to MySQL');
mysql_select_db($dbname);
}
//This function performs security checks on all incoming form data
function secure($data){
if(is_array($data)){
die("Hacking Attempt!");
}
//MySQL Real Escape String
$data = mysql_real_escape_string($data);
//Strip HTML tags
$data = strip_tags($data, '');
return $data;
}
function getsitecontent($page){
include("config.php");
$query = "SELECT * FROM ".$prefix."content WHERE page = '$page'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$title=@mysql_result($result,$i,"title");
$content=@mysql_result($result,$i,"content");
$title = stripslashes($title);
$content = stripslashes($content);
$i++;
}
$value[content] = $content;
$value[title] = $title;
return $value;
}
//This function replaces template values
function replace($old,$new,$template)
{
$template = str_replace($old, $new, $template);
return $template;
}
function logincheck(){
include("config.php");
//Function to determine if user is logged in.
//Set up our login info...
$username = "";
$password = "";
//Check for cookie
if (isset($_COOKIE['auser']) and isset($_COOKIE['apass'])){
$username = $_COOKIE['auser'];
$password = $_COOKIE['apass'];
$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$username = secure($username);
$password = secure($password);
//Run login operation
$query = "SELECT * FROM ".$prefix."users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['auser'])){
$past = time() - 10;
setcookie("auser",$username,$past);
}
if (isset($_COOKIE['apass'])){
$past = time() - 10;
setcookie("apass",$password,$past);
}
$isloggedin = "no";
}
}
else
{
//User is not logged in
$isloggedin = "no";
}
//Return our user data
$userdata[loginstatus] = $isloggedin;
$userdata[username] = $username;
return $userdata;
}
function grabanysetting($where){
include("config.php");
$query = "SELECT * FROM ".$prefix."settings WHERE name = '".$where."'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$value=@mysql_result($result,$i,"value");
$value = stripslashes($value);
$i++;
}
return $value;
}
function getlinks(){
include("config.php");
//This function gets the links for the top bar from the database
/*
$links = "<li><a href='index.php'>Home</a></li>
<li><a href='adopt.php'>Adopt</a></li>
<li><a href='myadopts.php'>My Adopts</a></li>
<li><a href='account.php'>My Account</a></li>
<li><a href='messages.php'>Message Center</a></li>
<li><a href='trade.php'>Trade Adopts</a></li>
<li><a href='featured.php'>Popular</a></li>";
*/
// We will be getting our links from the database...
$links = "";
$query = "SELECT * FROM ".$prefix."links ORDER BY id ASC";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$linktext=@mysql_result($result,$i,"linktext");
$linkurl=@mysql_result($result,$i,"linkurl");
$linktext = stripslashes($linktext);
$links = $links." <li><a href='".$linkurl."'>".$linktext."</a></li> ";
$i++;
}
return $links;
}
function getsidebar(){
include("config.php");
//This function determines what shows in the side bar of the template
//This will most likely be either a login prompt, quick account access, or something else
//First we see if we are logged in or not
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$msgctr = "<a href='messages.php'>Visit Message Center</a><br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center <b>(".$num.")</b></a>";
}
$sidebar = "
<h1>Quick Search:</h1><br>
<form>
<input type='text' id='txt1' size='30' onkeyup='showResult(this.value)' />
<div id='livesearch'></div>
</form>
<h1>Welcome Back ".$loggedinname."</h1>
<a href='profile.php?user=".$loggedinname."'>Profile</a>
<a href='account.php?act=changesettings'>Settings</a>
<a href='account.php'>My Account</a>
<a href='messages.php'>Private Messages <b>(".$num.")</b></a>
<a href='profile.php'>Members</a>
<a href='admin.php'>Admin CP</a>
<a href='logout.php'>Log Out</a>";
}
else{
$sidebar = "<h1>Welcome Guest</h1><a href='login.php'>Login</a><a href='register.php'>Register</a><a href='forgotpass.php'>Forgot Password?</a>";
}
return $sidebar;
}
function gettopbar(){
include("config.php");
//This function determines what shows in the top bar of the template
//This will most likely be either a login prompt, quick account access, or something else
//First we see if we are logged in or not
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$msgctr = "<a href='messages.php'>Visit Message Center</a><br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center <b>(".$num.")</b></a>";
}
$topbar = "<table cellpadding='0px' cellspacing='0px' width='100%' border='0px' background='http://omploader.org/vMXBvaA'>
<tr>
<td background='http://omploader.org/vMXBvaA'>
Welcome Back <a href='profile.php?user=$loggedinname'>$loggedinname</a>!
</td>
<td>
<center><b>News:</b>Look for more updates!</center>
</td>
<td><div align='right'>
<a href='profile.php?user=$loggedinname'><img src='http://i39.tinypic.com/10d9pah.jpg' border='0px solid #777777'></a>
<a href='myadopts.php'><img src='http://nsider.com/forums/style_images/rank_prefixes/Pokeball.png' border='0'></a>
<a href='account.php?act=changesettings'><img src='http://i43.tinypic.com/34t1tah.png' border='0'></a>
<a href='messages.php'><img src='http://i39.tinypic.com/293yjwy.png' border='0'></a>
<a href='adopt.php'><img src='http://i40.tinypic.com/2501bi9.png' border='0'></a>
<a href='promo.php'><img src='http://i40.tinypic.com/6em70g.png' border='0' alt='Enter Promo Code'></a>
<a href='profile.php'><img src='http://i43.tinypic.com/2h2l9fk.jpg' border='0'></a>
<a href='logout.php'><img src='http://i43.tinypic.com/25ujqzs.png' border='0'></a></div>
</td>
<td width='7%'>
<div id='itronclock' align='right'></div>
</td>
</tr>
</table>";
}
else{
$topbar = "<table cellpadding='0px' cellspacing='0px' width='100%' border='0px' background='http://omploader.org/vMXBvaA'>
<tr>
<td background='http://omploader.org/vMXBvaA'>
Welcome guest! <a href='login.php'>login</a> <a href='register.php'>register</a> <a href='forgotpass.php'>forgot your password?</a>
</td>
<td><div align='right'>
<a href='login.php'><img src='http://i43.tinypic.com/voa1br.png' border='0'></a>
<a href='register.php'><img src='http://i43.tinypic.com/91fcs3.png' border='0'></a>
<a href='forgotpass.php'><img src='http://i44.tinypic.com/2igyo2x.png' border='0'></a></div>
</td>
</tr>
</table>";
}
return $topbar;
}
function dologin($username, $password){
//This function logs a user in...
include("config.php");
$query = "SELECT * FROM ".$prefix."users WHERE username = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$status = "success";
//If the cookie already exists for some reason, delete it
if (isset($_COOKIE['auser']) and isset($_COOKIE['apass'])){
$past = time() - 10;
setcookie("auser",$username,$past);
setcookie("apass",$password,$past);
}
// Set the cookie
$Month = 2592000 + time();
setcookie("auser",$username,$Month);
setcookie("apass",$password,$Month);
}
else{
$status = "error";
}
return $status;
}
function getgroup(){
//This function gets the numerical usergroup ID of a user, or returns 0 if is a guest
include("config.php");
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$group=@mysql_result($result,$i,"usergroup");
$i++;
}
return $group;
}
else{
return 0;
}
}
function cancp($usergroup){
include("config.php");
//This function determines if a usergroup is allowed to access the Admin CP
$query = "SELECT * FROM ".$prefix."groups WHERE gid = '$usergroup'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$cancp=@mysql_result($result,$i,"cancp");
$i++;
}
if($cancp == "" or $usergroup == 0){
$cancp = "no";
}
return $cancp;
}
function getadmlinks(){
include("config.php");
//This function shows special links to the site admin
$links = "<li><a href='index.php'>Home</a></li>
<li><a href='admin.php?set=adopts'>Change Adoptables</a></li>
<li><a href='admin.php?set=content'>Change Content</a></li>
<li><a href='admin.php?set=manageforum'>Manage Forum</a></li>
<li><a href='admin.php?set=users'>Change Users</a></li>
<li><a href='admin.php?set=settings'>Site Settings</a></li>
<li><a href='admin.php?set=ads'>Manage Ads</a></li>";
return $links;
}
function cando($usergroup, $do){
include("config.php");
//This function determines if a usergroup is allowed to do a specific task
$query = "SELECT * FROM ".$prefix."groups WHERE gid = '$usergroup'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$cando=@mysql_result($result,$i,$do);
$i++;
}
if($cando == "" or $usergroup == 0){
$cando = "no";
}
return $cando;
}
function canadopt($aid, $cond, $promocode){
include("config.php");
// This function determines if a user can adopt a specific adoptable...
$canadopt = "yes"; // The default status is that we CAN adopt, unless proven false...
// The first thing we check is that we are logged in
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin != "yes" and $cond != "showing"){
$canadopt = "no";
}
// Now we check if our usergroup has permission to adopt the adoptable...
$group = getgroup();
$dbcanadpt = cando($group, "canadopt");
if($dbcanadpt != "yes" and $cond != "showing"){
$canadopt = "no";
}
// We need to pull a lot of junk from the database for these next few checks
$query = "SELECT * FROM ".$prefix."adoptables WHERE id='$aid'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$whenisavail=@mysql_result($result,$i,"whenisavail");
$correctpromocode=@mysql_result($result,$i,"promocode");
$freqcond=@mysql_result($result,$i,"freqcond");
$number=@mysql_result($result,$i,"number");
$date=@mysql_result($result,$i,"date");
$datecond=@mysql_result($result,$i,"datecond");
$adoptscond=@mysql_result($result,$i,"adoptscond");
$morethannumberen=@mysql_result($result,$i,"moreless");
$morethannumber=@mysql_result($result,$i,"morelessnum");
$usergroupsen=@mysql_result($result,$i,"levelgrle");
$usergroupid=@mysql_result($result,$i,"grlelevel");
$type=@mysql_result($result,$i,"type");
$i++;
}
// Now we check if the adoptable requires a promo code and if the promo code submitted is correct...
if($whenisavail == "promo" and $promocode != $correctpromocode){
// A promo code is required but the submitted promo code is not the correct code
$canadopt = "no";
}
// Now we check those three conditions we have in the Admin CP
// If ANY of them fails, this check fails!
if($whenisavail == "conditions"){
// If we have a restriction on the number of times this can be adopted...
if($freqcond == "enabled"){
// We have a frequency based condition
// Select from the database and determine how many times this adoptable type has been adopted
$num = 0;
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > $number){
// Not Available
$canadopt = "no";
}
} // End the frequency condition IF statement
// Begin the date restriction check
$today = date('Y-m-d');
if($datecond == "enabled" and $date != $today){
$canadopt = "no";
}
// We are checking to see how many of this adoptable a user owns
// If they own more than the specifed number, they cannot adopt...
if($morethannumberen == "enabled"){
$num = 0;
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > $morethannumber){
$canadopt = "no";
}
} // End morethannumberen check
// Check if the user is of a specified usergroup...
if($usergroupsen == "enabled"){
$ourgid = getgroup();
// If the two numbers do not match, do not allow the adoption...
if($ourgid != $usergroupid){
$canadopt = "no";
}
}
} // End the is there conditions if statement
return $canadopt;
}
function getaltstatus($parentid, $childid, $childlevel){
include("config.php");
// This function determines if we will use alternate images...
// All this does is give us a yes or no
// This does NOT actually assign the alternate images in the DB.....
$altstatus = "no";
$run = "no";
// First we need to see if this adoptable type has alternate images enabled...
$query = "SELECT * FROM ".$prefix."adoptables WHERE id='$parentid'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$alternates=@mysql_result($result,$i,"alternates");
$altoutlevel=@mysql_result($result,$i,"altoutlevel");
$altchance=@mysql_result($result,$i,"altchance");
$i++;
}
// If alternate images are enabled, we must run some checks to see if we use them...
if($alternates == "enabled"){
// Let's see if the level we are on is the level that requires alternates
// If we're not on a level that requires to check alternates, why bother?
if($childlevel == $altoutlevel){
$run = "yes";
}
}
if($run == "yes"){
// This is where we actually determine if we use alternate images...
$randnum = rand(1, $altchance);
if($randnum == 1){
$altstatus = "yes"; // If we pull a 1 as the random number, we use the alternate images :)
}
}
return $altstatus;
}
function getcurrentimage($id){
// This function determines which image we should use for a given adoptable...
include("config.php"); // This is so we can use the table prefix
$image = "";
// First we select the adoptable from the database and get some basic information...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$type=@mysql_result($result,$i,"type");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$imageurl=@mysql_result($result,$i,"imageurl");
$usealternates=@mysql_result($result,$i,"usealternates");
$i++;
}
if($imageurl != ""){
// If we are using a custom image for this adoptable, use that
$image = $imageurl;
}
else{
// We have to dig this up ourselves...
// Check if we are using an egg image or a level image...
if($currentlevel == 0 or $currentlevel == "0"){
// Let's see what the egg image is...
$query = "SELECT * FROM ".$prefix."adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$eggimage=@mysql_result($result,$i,"eggimage");
$i++;
}
$image = $eggimage; // Set the image URL equal to the egg image...
}
else{
// We have to find out what level we are using...
// Then we can choose the appropriate image for what we are using...
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$primaryimage=@mysql_result($result,$i,"primaryimage");
$alternateimage=@mysql_result($result,$i,"alternateimage");
$i++;
}
// If alternate images are enabled and an alternate image exists, use it
if($usealternates == "yes" and $alternateimage != ""){
$image = $alternateimage; // Use the alternate image
}
else{
$image = $primaryimage; // Set the image equal to the primary image for the level
}
}
}
if($type == "" or $image == ""){
// We did not settle on an image, so we show an error image...
$image = "http://www.".$domain."".$scriptpath."/templates/icons/delete.gif";
}
return $image;
}
function getcurrentlevel($id){
// This function gets the current level of an adoptable...
include("config.php");
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$currentlevel=@mysql_result($result,$i,"currentlevel");
$i++;
}
if($currentlevel == ""){
$currentlevel = "error"; // If the adoptable does not have a current level or does not exist, we return an error...
}
// Return the level
return $currentlevel;
}
function getnextlevelexists($type, $currentlevel){
include("config.php");
// This function determines if a higher level exists for an adopt, or if it is at max level.
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel > '$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$exists = "false";
if($num > 0){
$exists = "true"; // A higher level exists
}
return $exists;
}
function convertidtotype($id){
// This function takes in an adoptable's ID and returns the type of adoptable it is...
include("config.php");
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$type=@mysql_result($result,$i,"type");
$i++;
}
if($type == ""){
$type = "error";
}
return $type;
}
function converttypetoparentid($type){
// This function takes in an adoptable type and returns the ID of the parent
include("config.php");
$query = "SELECT * FROM ".$prefix."adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$id=@mysql_result($result,$i,"id");
$i++;
}
if($id == ""){
$id = "error";
}
return $id;
}
function reward($id, $type, $currentlevel, $owner){
include("config.php");
// This function determines if we are giving the user a reward or not...
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$rewarduser=@mysql_result($result,$i,"rewarduser");
$promocode=@mysql_result($result,$i,"promocode");
$i++;
}
if($rewarduser == "yes" and $promocode != ""){
// We are sending out a reward...
$mtitle = "You have received a reward!";
$mtext = "Congratulations! You have received a reward because one of your adoptables leveled up and the site admin has chosen to reward you for this.<br><br>
<b><u>Your reward is the following promo code:</u></b> ".$promocode."<br><br>
You may use this promo code on the <a href='promo.php?promocode=".$promocode."'>Promo Code Page</a> to receive a special exclusive or limited edition adoptable!<br><br>
Congratulations on your reward!";
$mtext = mysql_real_escape_string($mtext);
$date = date('Y-m-d');
$query = "INSERT INTO ".$prefix."messages VALUES ('', 'SYSTEM', '$owner','unread','$date','$mtitle', '$mtext')";
mysql_query($query);
// Now we check if we are sending out an email to the user alerting them of the message...
$query = "SELECT * FROM ".$prefix."users WHERE username='".$owner."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$newmessagenotify=@mysql_result($result,$i,"newmessagenotify");
$email=@mysql_result($result,$i,"email");
$i++;
}
if($newmessagenotify == 1){
// We are sending this user an email about the new message...
$systememail = grabanysetting("systememail");
$headers = "From: ".$systememail."";
$site_name = grabanysetting("sitename");
$message = "Hello ".$owner.";\n\nYou have received a new Private Message from SYSTEM at ".$site_name." with the title ".$mtitle.".\n
You can read this message at: http://www.".$domain."".$scriptpath."/messages.php\n
Thank You. The ".$site_name." team.";
mail($email, $site_name." - You Have Received a Reward", $message, $headers);
}
}
return $rewardstatus;
}
function getadmimages(){
include("config.php");
$formcontent = "";
$query = "SELECT * FROM ".$prefix."filesmap";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$wwwpath=@mysql_result($result,$i,"wwwpath");
$friendlyname=@mysql_result($result,$i,"friendlyname");
$formcontent = $formcontent."<option value='".$wwwpath."'>".$friendlyname."</option>";
$i++;
}
return $formcontent;
}
function deleteuser($user){
include("config.php");
//This function deletes a user from the system...
$user = secure($user);
$query = "DELETE FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$query = "DELETE FROM ".$prefix."owned_adoptables WHERE owner = '".$user."'";
$result = mysql_query($query);
}
function getads($page){
// Function to display site advertisements
include("config.php");
if($page == "any"){
$page = "";
}
$query = "SELECT * FROM ".$prefix."ads WHERE page = '".$page."' and status = 'active' ORDER BY RAND() LIMIT 1";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
if($num > 0){
//Loop out code
$i=0;
while ($i < 1) {
$value=@mysql_result($result,$i,"text");
$value = stripslashes($value);
$aid=@mysql_result($result,$i,"id");
$actualimpressions=@mysql_result($result,$i,"actualimpressions");
$impressions=@mysql_result($result,$i,"impressions");
$i++;
}
if($impressions == ""){
$impressions = 0;
}
$actualimpressions = $actualimpressions + 1;
//Update the impressions count
$query = "UPDATE ".$prefix."ads SET actualimpressions='".$actualimpressions."' WHERE id='".$aid."'";
mysql_query($query);
//Check that ad is not over max impressions...
if ($actualimpressions >= $impressions and $impressions != 0){
$query = "UPDATE ".$prefix."ads SET status='inactive' WHERE id='".$aid."'";
mysql_query($query);
}
}
else{
$value = "";
}
return $value;
}
?>
Bloodrun
11-06-2009, 05:41 PM
<?php
// File ID: functions.php
// Purpose: Provides basic sitewide functions
//Connect to the database first
connect();
//This function simply connects us to the database
function connect(){
include("config.php");
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to MySQL');
mysql_select_db($dbname);
}
//This function performs security checks on all incoming form data
function secure($data){
if(is_array($data)){
die("Hacking Attempt!");
}
//MySQL Real Escape String
$data = mysql_real_escape_string($data);
//Strip HTML tags
$data = strip_tags($data, '');
return $data;
}
function getsitecontent($page){
include("config.php");
$query = "SELECT * FROM ".$prefix."content WHERE page = '$page'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$title=@mysql_result($result,$i,"title");
$content=@mysql_result($result,$i,"content");
$title = stripslashes($title);
$content = stripslashes($content);
$i++;
}
$value[content] = $content;
$value[title] = $title;
return $value;
}
//This function replaces template values
function replace($old,$new,$template)
{
$template = str_replace($old, $new, $template);
return $template;
}
function logincheck(){
include("config.php");
//Function to determine if user is logged in.
//Set up our login info...
$username = "";
$password = "";
//Check for cookie
if (isset($_COOKIE['auser']) and isset($_COOKIE['apass'])){
$username = $_COOKIE['auser'];
$password = $_COOKIE['apass'];
$username = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $username);
$username = secure($username);
$password = secure($password);
//Run login operation
$query = "SELECT * FROM ".$prefix."users WHERE username = '$username'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$isloggedin = "yes";
}
else{
if (isset($_COOKIE['auser'])){
$past = time() - 10;
setcookie("auser",$username,$past);
}
if (isset($_COOKIE['apass'])){
$past = time() - 10;
setcookie("apass",$password,$past);
}
$isloggedin = "no";
}
}
else
{
//User is not logged in
$isloggedin = "no";
}
//Return our user data
$userdata[loginstatus] = $isloggedin;
$userdata[username] = $username;
return $userdata;
}
function grabanysetting($where){
include("config.php");
$query = "SELECT * FROM ".$prefix."settings WHERE name = '".$where."'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$value=@mysql_result($result,$i,"value");
$value = stripslashes($value);
$i++;
}
return $value;
}
function getlinks(){
include("config.php");
//This function gets the links for the top bar from the database
/*
$links = "<li><a href='index.php'>Home</a></li>
<li><a href='adopt.php'>Adopt</a></li>
<li><a href='myadopts.php'>My Adopts</a></li>
<li><a href='account.php'>My Account</a></li>
<li><a href='messages.php'>Message Center</a></li>
<li><a href='trade.php'>Trade Adopts</a></li>
<li><a href='featured.php'>Popular</a></li>";
*/
// We will be getting our links from the database...
$links = "";
$query = "SELECT * FROM ".$prefix."links ORDER BY id ASC";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$linktext=@mysql_result($result,$i,"linktext");
$linkurl=@mysql_result($result,$i,"linkurl");
$linktext = stripslashes($linktext);
$links = $links." <li><a href='".$linkurl."'>".$linktext."</a></li> ";
$i++;
}
return $links;
}
function getsidebar(){
include("config.php");
//This function determines what shows in the side bar of the template
//This will most likely be either a login prompt, quick account access, or something else
//First we see if we are logged in or not
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$msgctr = "<a href='messages.php'>Visit Message Center</a><br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center <b>(".$num.")</b></a>";
}
$sidebar = "
<h1>Quick Search:</h1><br>
<form>
<input type='text' id='txt1' size='30' onkeyup='showResult(this.value)' />
<div id='livesearch'></div>
</form>
<h1>Welcome Back ".$loggedinname."</h1>
<a href='profile.php?user=".$loggedinname."'>Profile</a>
<a href='account.php?act=changesettings'>Settings</a>
<a href='account.php'>My Account</a>
<a href='messages.php'>Private Messages <b>(".$num.")</b></a>
<a href='profile.php'>Members</a>
<a href='admin.php'>Admin CP</a>
<a href='logout.php'>Log Out</a>";
}
else{
$sidebar = "<h1>Welcome Guest</h1><a href='login.php'>Login</a><a href='register.php'>Register</a><a href='forgotpass.php'>Forgot Password?</a>";
}
return $sidebar;
}
function gettopbar(){
include("config.php");
//This function determines what shows in the top bar of the template
//This will most likely be either a login prompt, quick account access, or something else
//First we see if we are logged in or not
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$msgctr = "<a href='messages.php'>Visit Message Center</a><br>";
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msgctr = "<a href='messages.php'>Visit Message Center <b>(".$num.")</b></a>";
}
$topbar = "<table cellpadding='0px' cellspacing='0px' width='100%' border='0px' background='http://omploader.org/vMXBvaA'>
<tr>
<td background='http://omploader.org/vMXBvaA'>
Welcome Back <a href='profile.php?user=$loggedinname'>$loggedinname</a>!
</td>
<td>
<center><b>News:</b>Look for more updates!</center>
</td>
<td><div align='right'>
<a href='profile.php?user=$loggedinname'><img src='http://i39.tinypic.com/10d9pah.jpg' border='0px solid #777777'></a>
<a href='myadopts.php'><img src='http://nsider.com/forums/style_images/rank_prefixes/Pokeball.png' border='0'></a>
<a href='account.php?act=changesettings'><img src='http://i43.tinypic.com/34t1tah.png' border='0'></a>
<a href='messages.php'><img src='http://i39.tinypic.com/293yjwy.png' border='0'></a>
<a href='adopt.php'><img src='http://i40.tinypic.com/2501bi9.png' border='0'></a>
<a href='promo.php'><img src='http://i40.tinypic.com/6em70g.png' border='0' alt='Enter Promo Code'></a>
<a href='profile.php'><img src='http://i43.tinypic.com/2h2l9fk.jpg' border='0'></a>
<a href='logout.php'><img src='http://i43.tinypic.com/25ujqzs.png' border='0'></a></div>
</td>
<td width='7%'>
<div id='itronclock' align='right'></div>
</td>
</tr>
</table>";
}
else{
$topbar = "<table cellpadding='0px' cellspacing='0px' width='100%' border='0px' background='http://omploader.org/vMXBvaA'>
<tr>
<td background='http://omploader.org/vMXBvaA'>
Welcome guest! <a href='login.php'>login</a> <a href='register.php'>register</a> <a href='forgotpass.php'>forgot your password?</a>
</td>
<td><div align='right'>
<a href='login.php'><img src='http://i43.tinypic.com/voa1br.png' border='0'></a>
<a href='register.php'><img src='http://i43.tinypic.com/91fcs3.png' border='0'></a>
<a href='forgotpass.php'><img src='http://i44.tinypic.com/2igyo2x.png' border='0'></a></div>
</td>
</tr>
</table>";
}
return $topbar;
}
function dologin($username, $password){
//This function logs a user in...
include("config.php");
$query = "SELECT * FROM ".$prefix."users WHERE username = '$username'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$luser=@mysql_result($result,$i,"username");
$lpass=@mysql_result($result,$i,"password");
$i++;
}
if($username == $luser and $password == $lpass){
$status = "success";
//If the cookie already exists for some reason, delete it
if (isset($_COOKIE['auser']) and isset($_COOKIE['apass'])){
$past = time() - 10;
setcookie("auser",$username,$past);
setcookie("apass",$password,$past);
}
// Set the cookie
$Month = 2592000 + time();
setcookie("auser",$username,$Month);
setcookie("apass",$password,$Month);
}
else{
$status = "error";
}
return $status;
}
function getgroup(){
//This function gets the numerical usergroup ID of a user, or returns 0 if is a guest
include("config.php");
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin == "yes"){
$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$group=@mysql_result($result,$i,"usergroup");
$i++;
}
return $group;
}
else{
return 0;
}
}
function cancp($usergroup){
include("config.php");
//This function determines if a usergroup is allowed to access the Admin CP
$query = "SELECT * FROM ".$prefix."groups WHERE gid = '$usergroup'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$cancp=@mysql_result($result,$i,"cancp");
$i++;
}
if($cancp == "" or $usergroup == 0){
$cancp = "no";
}
return $cancp;
}
function getadmlinks(){
include("config.php");
//This function shows special links to the site admin
$links = "<li><a href='index.php'>Home</a></li>
<li><a href='admin.php?set=adopts'>Change Adoptables</a></li>
<li><a href='admin.php?set=content'>Change Content</a></li>
<li><a href='admin.php?set=manageforum'>Manage Forum</a></li>
<li><a href='admin.php?set=users'>Change Users</a></li>
<li><a href='admin.php?set=settings'>Site Settings</a></li>
<li><a href='admin.php?set=ads'>Manage Ads</a></li>";
return $links;
}
function cando($usergroup, $do){
include("config.php");
//This function determines if a usergroup is allowed to do a specific task
$query = "SELECT * FROM ".$prefix."groups WHERE gid = '$usergroup'";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$cando=@mysql_result($result,$i,$do);
$i++;
}
if($cando == "" or $usergroup == 0){
$cando = "no";
}
return $cando;
}
function canadopt($aid, $cond, $promocode){
include("config.php");
// This function determines if a user can adopt a specific adoptable...
$canadopt = "yes"; // The default status is that we CAN adopt, unless proven false...
// The first thing we check is that we are logged in
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
if($isloggedin != "yes" and $cond != "showing"){
$canadopt = "no";
}
// Now we check if our usergroup has permission to adopt the adoptable...
$group = getgroup();
$dbcanadpt = cando($group, "canadopt");
if($dbcanadpt != "yes" and $cond != "showing"){
$canadopt = "no";
}
// We need to pull a lot of junk from the database for these next few checks
$query = "SELECT * FROM ".$prefix."adoptables WHERE id='$aid'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$whenisavail=@mysql_result($result,$i,"whenisavail");
$correctpromocode=@mysql_result($result,$i,"promocode");
$freqcond=@mysql_result($result,$i,"freqcond");
$number=@mysql_result($result,$i,"number");
$date=@mysql_result($result,$i,"date");
$datecond=@mysql_result($result,$i,"datecond");
$adoptscond=@mysql_result($result,$i,"adoptscond");
$morethannumberen=@mysql_result($result,$i,"moreless");
$morethannumber=@mysql_result($result,$i,"morelessnum");
$usergroupsen=@mysql_result($result,$i,"levelgrle");
$usergroupid=@mysql_result($result,$i,"grlelevel");
$type=@mysql_result($result,$i,"type");
$i++;
}
// Now we check if the adoptable requires a promo code and if the promo code submitted is correct...
if($whenisavail == "promo" and $promocode != $correctpromocode){
// A promo code is required but the submitted promo code is not the correct code
$canadopt = "no";
}
// Now we check those three conditions we have in the Admin CP
// If ANY of them fails, this check fails!
if($whenisavail == "conditions"){
// If we have a restriction on the number of times this can be adopted...
if($freqcond == "enabled"){
// We have a frequency based condition
// Select from the database and determine how many times this adoptable type has been adopted
$num = 0;
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > $number){
// Not Available
$canadopt = "no";
}
} // End the frequency condition IF statement
// Begin the date restriction check
$today = date('Y-m-d');
if($datecond == "enabled" and $date != $today){
$canadopt = "no";
}
// We are checking to see how many of this adoptable a user owns
// If they own more than the specifed number, they cannot adopt...
if($morethannumberen == "enabled"){
$num = 0;
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE owner='$loggedinname' and type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > $morethannumber){
$canadopt = "no";
}
} // End morethannumberen check
// Check if the user is of a specified usergroup...
if($usergroupsen == "enabled"){
$ourgid = getgroup();
// If the two numbers do not match, do not allow the adoption...
if($ourgid != $usergroupid){
$canadopt = "no";
}
}
} // End the is there conditions if statement
return $canadopt;
}
function getaltstatus($parentid, $childid, $childlevel){
include("config.php");
// This function determines if we will use alternate images...
// All this does is give us a yes or no
// This does NOT actually assign the alternate images in the DB.....
$altstatus = "no";
$run = "no";
// First we need to see if this adoptable type has alternate images enabled...
$query = "SELECT * FROM ".$prefix."adoptables WHERE id='$parentid'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$alternates=@mysql_result($result,$i,"alternates");
$altoutlevel=@mysql_result($result,$i,"altoutlevel");
$altchance=@mysql_result($result,$i,"altchance");
$i++;
}
// If alternate images are enabled, we must run some checks to see if we use them...
if($alternates == "enabled"){
// Let's see if the level we are on is the level that requires alternates
// If we're not on a level that requires to check alternates, why bother?
if($childlevel == $altoutlevel){
$run = "yes";
}
}
if($run == "yes"){
// This is where we actually determine if we use alternate images...
$randnum = rand(1, $altchance);
if($randnum == 1){
$altstatus = "yes"; // If we pull a 1 as the random number, we use the alternate images :)
}
}
return $altstatus;
}
function getcurrentimage($id){
// This function determines which image we should use for a given adoptable...
include("config.php"); // This is so we can use the table prefix
$image = "";
// First we select the adoptable from the database and get some basic information...
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$type=@mysql_result($result,$i,"type");
$currentlevel=@mysql_result($result,$i,"currentlevel");
$imageurl=@mysql_result($result,$i,"imageurl");
$usealternates=@mysql_result($result,$i,"usealternates");
$i++;
}
if($imageurl != ""){
// If we are using a custom image for this adoptable, use that
$image = $imageurl;
}
else{
// We have to dig this up ourselves...
// Check if we are using an egg image or a level image...
if($currentlevel == 0 or $currentlevel == "0"){
// Let's see what the egg image is...
$query = "SELECT * FROM ".$prefix."adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$eggimage=@mysql_result($result,$i,"eggimage");
$i++;
}
$image = $eggimage; // Set the image URL equal to the egg image...
}
else{
// We have to find out what level we are using...
// Then we can choose the appropriate image for what we are using...
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$primaryimage=@mysql_result($result,$i,"primaryimage");
$alternateimage=@mysql_result($result,$i,"alternateimage");
$i++;
}
// If alternate images are enabled and an alternate image exists, use it
if($usealternates == "yes" and $alternateimage != ""){
$image = $alternateimage; // Use the alternate image
}
else{
$image = $primaryimage; // Set the image equal to the primary image for the level
}
}
}
if($type == "" or $image == ""){
// We did not settle on an image, so we show an error image...
$image = "http://www.".$domain."".$scriptpath."/templates/icons/delete.gif";
}
return $image;
}
function getcurrentlevel($id){
// This function gets the current level of an adoptable...
include("config.php");
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$currentlevel=@mysql_result($result,$i,"currentlevel");
$i++;
}
if($currentlevel == ""){
$currentlevel = "error"; // If the adoptable does not have a current level or does not exist, we return an error...
}
// Return the level
return $currentlevel;
}
function getnextlevelexists($type, $currentlevel){
include("config.php");
// This function determines if a higher level exists for an adopt, or if it is at max level.
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel > '$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$exists = "false";
if($num > 0){
$exists = "true"; // A higher level exists
}
return $exists;
}
function convertidtotype($id){
// This function takes in an adoptable's ID and returns the type of adoptable it is...
include("config.php");
$query = "SELECT * FROM ".$prefix."owned_adoptables WHERE aid='$id'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$type=@mysql_result($result,$i,"type");
$i++;
}
if($type == ""){
$type = "error";
}
return $type;
}
function converttypetoparentid($type){
// This function takes in an adoptable type and returns the ID of the parent
include("config.php");
$query = "SELECT * FROM ".$prefix."adoptables WHERE type='$type'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$id=@mysql_result($result,$i,"id");
$i++;
}
if($id == ""){
$id = "error";
}
return $id;
}
function reward($id, $type, $currentlevel, $owner){
include("config.php");
// This function determines if we are giving the user a reward or not...
$query = "SELECT * FROM ".$prefix."levels WHERE adoptiename='$type' and thisislevel='$currentlevel'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$rewarduser=@mysql_result($result,$i,"rewarduser");
$promocode=@mysql_result($result,$i,"promocode");
$i++;
}
if($rewarduser == "yes" and $promocode != ""){
// We are sending out a reward...
$mtitle = "You have received a reward!";
$mtext = "Congratulations! You have received a reward because one of your adoptables leveled up and the site admin has chosen to reward you for this.<br><br>
<b><u>Your reward is the following promo code:</u></b> ".$promocode."<br><br>
You may use this promo code on the <a href='promo.php?promocode=".$promocode."'>Promo Code Page</a> to receive a special exclusive or limited edition adoptable!<br><br>
Congratulations on your reward!";
$mtext = mysql_real_escape_string($mtext);
$date = date('Y-m-d');
$query = "INSERT INTO ".$prefix."messages VALUES ('', 'SYSTEM', '$owner','unread','$date','$mtitle', '$mtext')";
mysql_query($query);
// Now we check if we are sending out an email to the user alerting them of the message...
$query = "SELECT * FROM ".$prefix."users WHERE username='".$owner."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < 1) {
$newmessagenotify=@mysql_result($result,$i,"newmessagenotify");
$email=@mysql_result($result,$i,"email");
$i++;
}
if($newmessagenotify == 1){
// We are sending this user an email about the new message...
$systememail = grabanysetting("systememail");
$headers = "From: ".$systememail."";
$site_name = grabanysetting("sitename");
$message = "Hello ".$owner.";\n\nYou have received a new Private Message from SYSTEM at ".$site_name." with the title ".$mtitle.".\n
You can read this message at: http://www.".$domain."".$scriptpath."/messages.php\n
Thank You. The ".$site_name." team.";
mail($email, $site_name." - You Have Received a Reward", $message, $headers);
}
}
return $rewardstatus;
}
function getadmimages(){
include("config.php");
$formcontent = "";
$query = "SELECT * FROM ".$prefix."filesmap";
$result = mysql_query($query);
$num = mysql_numrows($result);
//Loop out code
$i=0;
while ($i < $num) {
$wwwpath=@mysql_result($result,$i,"wwwpath");
$friendlyname=@mysql_result($result,$i,"friendlyname");
$formcontent = $formcontent."<option value='".$wwwpath."'>".$friendlyname."</option>";
$i++;
}
return $formcontent;
}
function deleteuser($user){
include("config.php");
//This function deletes a user from the system...
$user = secure($user);
$query = "DELETE FROM ".$prefix."users WHERE username = '".$user."'";
$result = mysql_query($query);
$query = "DELETE FROM ".$prefix."owned_adoptables WHERE owner = '".$user."'";
$result = mysql_query($query);
}
function getads($page){
// Function to display site advertisements
include("config.php");
if($page == "any"){
$page = "";
}
$query = "SELECT * FROM ".$prefix."ads WHERE page = '".$page."' and status = 'active' ORDER BY RAND() LIMIT 1";
$result = @mysql_query($query);
$num = @mysql_numrows($result);
if($num > 0){
//Loop out code
$i=0;
while ($i < 1) {
$value=@mysql_result($result,$i,"text");
$value = stripslashes($value);
$aid=@mysql_result($result,$i,"id");
$actualimpressions=@mysql_result($result,$i,"actualimpressions");
$impressions=@mysql_result($result,$i,"impressions");
$i++;
}
if($impressions == ""){
$impressions = 0;
}
$actualimpressions = $actualimpressions + 1;
//Update the impressions count
$query = "UPDATE ".$prefix."ads SET actualimpressions='".$actualimpressions."' WHERE id='".$aid."'";
mysql_query($query);
//Check that ad is not over max impressions...
if ($actualimpressions >= $impressions and $impressions != 0){
$query = "UPDATE ".$prefix."ads SET status='inactive' WHERE id='".$aid."'";
mysql_query($query);
}
}
else{
$value = "";
}
return $value;
}
?>
Do you have the original functions.php file from the download? Because you are missng the postbar function.
Okay, I fixed that problem, but when I try to subscribe to a forum it says:
Access Denied
Direct access to this file is not allowed.
And sorry for double posting.
Bloodrun
11-08-2009, 01:26 PM
Okay, I fixed that problem, but when I try to subscribe to a forum it says:
Access Denied
Direct access to this file is not allowed.
And sorry for double posting.
It's alright. You can just delete or comment out the Subscribe to forum as it doesn't work in this Version.
Quillink
01-20-2010, 06:55 AM
Please re-attach these files, the downloads not working. I guess the attachments were lost in the server transfer?
I've finally got around to installing this, can't wait!
EDIT: Just saw V3 in the premium member section some 3 hours after this post. Good thing this one was down otherwise I'd have a lot more work to do..!
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.