Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Have you purchased a mod and lost your copy? Just file a support ticket through your "My Mods" page.


This forum is now closed and has moved to a new location! Click here to find out why.

AuthorTopic: [MCCode] Blogs  (Read 2034 times)

Cronus

  • Administrator
  • Senior Member
  • *****
  • Reputation Power: 2901
  • Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!Cronus is awe-inspiring!
  • Offline Offline
  • Posts: 550
    • MSN Messenger - preston__08@hotmail.com
    • View Profile
    • WWW
[MCCode] Blogs
« on: February 06, 2009, 02:22:17 AM »
Blogs

Each user can post their own "blog".
Other users can also post their comments on the blog.
Very basic, but gives a slight sense of community.

The file is attached in .rar form.
You will need to be registered and logged in to access it.
« Last Edit: February 26, 2009, 01:40:52 PM by Cronus »
Logged
My msn is preston__08@hotmail.com if anyone is interested, I am online frequently.

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Blogs
« Reply #1 on: July 07, 2009, 03:00:55 PM »
Sorry about bringing up this old topic.
I wondered if anyone has this?
I like the idea, I converted it to work with V2 but am still having some trouble.
Can anyone help?
Logged

Twist3d Fat3

  • Basic Member
  • *
  • Reputation Power: 52
  • Twist3d Fat3 has no influence.
  • Offline Offline
  • Posts: 42
    • View Profile
Re: [MCCode] Blogs
« Reply #2 on: July 20, 2009, 01:36:19 AM »
I haven't made It work yet
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Blogs
« Reply #3 on: July 20, 2009, 07:19:13 AM »
Nor me, I was so close though
Logged

Voice4Vision

  • Basic Member
  • *
  • Reputation Power: 6
  • Voice4Vision has no influence.
  • Offline Offline
  • Posts: 8
    • View Profile
    • Email
Re: [MCCode] Blogs
« Reply #4 on: July 20, 2009, 01:38:01 PM »
Create blogs.php

Code: [Select]
<?php
/*-----------------------------------------------------
-- Mono Country v1.0 BETA
-- A product of DBS-entertainment
-- Copyright held 2005 by Dabomstew
-- INDEX.php
-----------------------------------------------------*/
include(DIRNAME(__FILE__) . '/globals.php');

switch(
$_GET['action'])
{
case 
"userblog":
userblog();
break;

case 
"postblog":
postblog();
break;

case 
"comment":
comment();
break;

case 
"submitcomment":
submitcomment();
break;

case 
'delete':
delete();
break;

default:
index();
break;
}

function 
index()
{
global 
$ir,$c,$userid,$h;
print
"<center><font size=3><a href=blogs.php?action=userblog&ID=$userid>Your Blogs</a></font></center></br></br>";
print
"<form action='blogs.php?action=postblog' method='post'>
<table width=75% border=2><tr><th colspan=2>Post New Blog</th></tr> <tr>
<td>Subject:</td> <td><input type='text' rows='1' cols='50' name='subject' value='{$_GET['ID']}' /></td></tr><tr>
<td>Main Text:</td>
<td><textarea rows=8 cols=50 name='blog'></textarea></td></tr><tr> <td colspan=2><center><input type='submit' value='Post Blog' /></center></td></tr></table></form>"
;
}
function 
postblog()
{
global 
$ir,$c,$userid,$h;
if(!
$_POST['blog'] || !$_POST['subject'])
{
die(
"You did not fill out the required fields");
}
$msg=str_replace(array("\n"),array("<br />"),htmlentities($_POST['blog']));
$subject=str_replace(array("\n"),array("<br />"),htmlentities($_POST['subject']));
mysql_query("INSERT INTO blogs VALUES ('',$userid,unix_timestamp(),'$subject','$msg')",$c) or die(mysql_error());
print
"Blog posted.";
}
function 
comment()
{
global 
$ir,$c,$userid,$h;
print
"<form action='blogs.php?action=submitcomment' method='post'>
<table width=75% border=2><tr><th colspan=2>Add Comment To Blog</th></tr> <tr>
<td>Blog To Comment:</td> <td><input type='text' name='blogid' value='{$_GET['ID']}' /></td></tr><tr>
<td>Comment:</td>
<td><textarea rows=5 cols=40 name='comment'></textarea></td></tr><tr> <td colspan=2><center><input type='submit' value='Post Comment' /></center></td></tr></table></form>"
;
}
function 
submitcomment()
{
global 
$ir,$c,$userid,$h;
if(!
$_POST['comment'] || !$_POST['blogid'])
{
die(
"You did not fill out the required fields");
}
$msg=str_replace(array("\n"),array("<br />"),htmlentities($_POST['comment']));
$to= (int) $_POST['blogid'];
mysql_query("INSERT INTO blogcomments VALUES ('',$to,$userid,unix_timestamp(),'$msg')",$c) or die(mysql_error());
print
"Comment posted.";
}
function 
delete()
{
global 
$ir,$c,$userid,$h;
$commentss=mysql_query("SELECT * FROM blogcomments WHERE bcmtID={$_GET['ID']}",$c);
$comment=mysql_fetch_array($commentss);
$comments=mysql_query("SELECT * FROM blogs WHERE blogID={$comment['bcmtBLOG']}",$c);
$blog=mysql_fetch_array($commentss);
if(
$blog['blogUSERID'] != $userid && $ir['user_level'] < 2)
{
die(
"You don't have the power to delete this comment.");
}
mysql_query("DELETE FROM blogcomments WHERE bcmtBLOG={$_GET['ID']} AND bcmtID={$_GET['comment']}",$c);
print
"Comment deleted.";
}
function 
userblog()
{
global 
$ir,$c,$userid,$h;
$blahj=mysql_query("SELECT * FROM users WHERE userid={$_GET['ID']}"$c);
$r=mysql_fetch_array($blahj);
print
"<table width=90% border=1><tr><th>{$r['username']}'s Blogs</th></tr></table>";
$blahd=mysql_query("SELECT * FROM blogs WHERE blogUSERID={$_GET['ID']} ORDER BY blogTIME DESC limit 5"$c);
while(
$blog=mysql_fetch_array($blahd))
{
$posted=date('F j, Y, g:i:s a',$blog['blogTIME']);
print
"<table width=90% border=1><tr><td width=30%><center><i>{$r['username']} [{$r['userid']}]</br>$posted</i></center></td><td><center><u><i>{$blog['blogSUBJECT']}</i></u></td></tr><tr><td colspan=2>{$blog['blogTEXT']}</td></tr></table><table width=90% border=1><tr><th colspan=2>Blog Comments <A href=blogs.php?action=comment&ID={$blog['blogID']}>[Add Comment]</a></th></tr>";
$blah=mysql_query("SELECT * FROM blogcomments WHERE bcmtBLOG={$blog['blogID']} ORDER BY bcmtTIME DESC limit 5"$c);
while(
$cmnt=mysql_fetch_array($blah))
{
$they=mysql_query("SELECT * FROM users WHERE userid={$cmnt['bcmtFROM']}",$c);
$them=mysql_fetch_array($they);
$sent=date('F j, Y, g:i:s a',$cmnt['bcmtTIME']);
print
"<tr><td width=25%><b>{$them['username']} [{$them['userid']}]</br></br></b>$sent</td><Td>{$cmnt['bcmtTEXT']}</td>";
if(
$ir['userid'] == $r['userid'] || $ir['user_level'] > 1)
{
print
"<td width=10%><a href=blogs.php?action=delete&ID={$blog['blogID']}&comment={$cmnt['bcmtID']}>Delete</a></td>";
}
print
"</tr>";
}
print
"</table></br></br>";
}
}
$h->endpage();
?>

Create siteblogs.php

Code: [Select]
$blahj=mysql_query("SELECT * FROM users WHERE userid={$_GET['ID']}", $c);
<?php
include(DIRNAME(__FILE__) . '/globals.php');
{
print
"
<table width=90% border=1>
<tr>
<th>Blogs</th>
</tr>
</table>
"
;
$blahd=mysql_query("SELECT * FROM blogs WHERE blogID>0 ORDER BY blogTIME DESC limit 20"$c);
while(
$blog=mysql_fetch_array($blahd))
{
$blahj=mysql_query("SELECT * FROM users WHERE userid={$blog['blogUSERID']}"$c);
$r=mysql_fetch_array($blahj);
$posted=date('F j, Y, g:i:s a',$blog['blogTIME']);
print
"
<table width=90% border=1>
<tr>
<td width=30%>
<center><i>{$r['username']} [{$r['userid']}]</br>$posted</i></center>
</td>
<td>
<center><u><i>{$blog['blogSUBJECT']}</i></u></center>
</td>
</tr>
<tr>
<td colspan=2>{$blog['blogTEXT']}</td>
</tr>
</table>
<table width=90% border=1>
<tr>
<th colspan=2>Blog Comments
<A href=blogs.php?action=comment&ID={$blog['blogID']}>[Add Comment]</a>
</th>
</tr>
"
;
$blah=mysql_query("SELECT * FROM blogcomments WHERE bcmtBLOG={$blog['blogID']} ORDER BY bcmtTIME DESC limit 5"$c);
while($cmnt=mysql_fetch_array($blah))
{
$they=mysql_query("SELECT * FROM users WHERE userid={$cmnt['bcmtFROM']}",$c);
$them=mysql_fetch_array($they);
$sent=date('F j, Y, g:i:s a',$cmnt['bcmtTIME']);
print
"
<tr>
<td width=25%><b>{$them['username']} [{$them['userid']}]</br></br></b>$sent</td>
<td>{$cmnt['bcmtTEXT']}</td>
"
;
if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1)
{
print
"
<td width=10%>
<a href=blogs.php?action=delete&ID={$blog['blogID']}&comment={$cmnt['bcmtID']}>Delete</a>
</td>
"
;
}
print
"
</tr>
"
;
}
print
"
</table></br></br>
"
;
}
}
$h->endpage();
?>

That should work, just make sure you add your links.

Let me know if you have problems.

Voice4Vision
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Blogs
« Reply #5 on: July 21, 2009, 06:04:03 AM »
That has worked but still get one little error at the top of my page.

$blahj=mysql_query("SELECT * FROM users WHERE userid={$_GET['ID']}", $c);
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/*****/public_html/siteblogs.php:2) in /home/*****/public_html/globals.php on line 6
Logged

Voice4Vision

  • Basic Member
  • *
  • Reputation Power: 6
  • Voice4Vision has no influence.
  • Offline Offline
  • Posts: 8
    • View Profile
    • Email
Re: [MCCode] Blogs
« Reply #6 on: July 21, 2009, 08:28:05 AM »
I am so terribly sorry, totally forgot one other alteration. This should work, if not, please let me know.

REPLACE siteblogs.php
Code: [Select]
<?php
include(DIRNAME(__FILE__) . '/globals.php');
{
print
"
<table width=90% border=1>
<tr>
<th>Blogs</th>
</tr>
</table>
"
;
$blahj=mysql_query("SELECT * FROM users WHERE userid={$_GET['ID']}"$c);
$blahd=mysql_query("SELECT * FROM blogs WHERE blogID>0 ORDER BY blogTIME DESC limit 20"$c);
while(
$blog=mysql_fetch_array($blahd))
{
$blahj=mysql_query("SELECT * FROM users WHERE userid={$blog['blogUSERID']}"$c);
$r=mysql_fetch_array($blahj);
$posted=date('F j, Y, g:i:s a',$blog['blogTIME']);
print
"
<table width=90% border=1>
<tr>
<td width=30%>
<center><i>{$r['username']} [{$r['userid']}]</br>$posted</i></center>
</td>
<td>
<center><u><i>{$blog['blogSUBJECT']}</i></u></center>
</td>
</tr>
<tr>
<td colspan=2>{$blog['blogTEXT']}</td>
</tr>
</table>
<table width=90% border=1>
<tr>
<th colspan=2>Blog Comments
<A href=blogs.php?action=comment&ID={$blog['blogID']}>[Add Comment]</a>
</th>
</tr>
"
;
$blah=mysql_query("SELECT * FROM blogcomments WHERE bcmtBLOG={$blog['blogID']} ORDER BY bcmtTIME DESC limit 5"$c);
while($cmnt=mysql_fetch_array($blah))
{
$they=mysql_query("SELECT * FROM users WHERE userid={$cmnt['bcmtFROM']}",$c);
$them=mysql_fetch_array($they);
$sent=date('F j, Y, g:i:s a',$cmnt['bcmtTIME']);
print
"
<tr>
<td width=25%><b>{$them['username']} [{$them['userid']}]</br></br></b>$sent</td>
<td>{$cmnt['bcmtTEXT']}</td>
"
;
if($ir['userid'] == $r['userid'] || $ir['user_level'] > 1)
{
print
"
<td width=10%>
<a href=blogs.php?action=delete&ID={$blog['blogID']}&comment={$cmnt['bcmtID']}>Delete</a>
</td>
"
;
}
print
"
</tr>
"
;
}
print
"
</table></br></br>
"
;
}
}
$h->endpage();
?>
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Blogs
« Reply #7 on: July 22, 2009, 06:18:11 AM »
Works sweet.
Thanks your a great help :)
Logged

Twist3d Fat3

  • Basic Member
  • *
  • Reputation Power: 52
  • Twist3d Fat3 has no influence.
  • Offline Offline
  • Posts: 42
    • View Profile
Re: [MCCode] Blogs
« Reply #8 on: July 24, 2009, 08:05:45 PM »
Fatal error: Call to a member function on a non-object in /home/unitedmo/public_html/midnight/blogs.php on line 93
Logged

Voice4Vision

  • Basic Member
  • *
  • Reputation Power: 6
  • Voice4Vision has no influence.
  • Offline Offline
  • Posts: 8
    • View Profile
    • Email
Re: [MCCode] Blogs
« Reply #9 on: July 24, 2009, 08:30:47 PM »
Sparks, what action are you performing to get that error?

I just created a blog, commented on it, and deleted the comments with no error on either the blogs.php and siteblogs.php
Also make sure that you copied and pasted the entire file. Alot of people miss the last character or whatever when copying.
Logged

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCCode] Blogs
« Reply #10 on: July 25, 2009, 01:09:37 PM »
Works fine for me too lol
Logged

zootycoon65

  • Basic Member
  • *
  • Reputation Power: 0
  • zootycoon65 has no influence.
  • Offline Offline
  • Posts: 2
    • View Profile
Re: [MCCode] Blogs
« Reply #11 on: November 20, 2009, 05:27:01 PM »
Blogs won't work for me it keeps saying: Table 'a8786681_flame.blogs' doesn't exist



Can Someone help?
Logged

Danny696

  • Senior Member
  • ****
  • Reputation Power: 317
  • Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.Danny696 is a force to reckon with.
  • Offline Offline
  • Posts: 540
    • View Profile
    • WWW
Re: [MCCode] Blogs
« Reply #12 on: November 21, 2009, 03:17:59 AM »
LOL, download the rar  file, unzip it, find a file called SQL, (thats was cronus norm calls them) go to phpmyadmin run the sql.
Logged
Project Choosen - 10%
Daniel - Hanson . Com

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 102
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCCode] Blogs
« Reply #13 on: February 24, 2010, 03:29:20 AM »
lmao, Follow the instructions Zooty? :P
Logged
Contact me
MakeWebGames.com
 


This forum is now closed and has moved to a new location! Click here to find out why.