Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Register your account to receive email notifications when new services and mods are added.


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

AuthorTopic: [Mccodes V1] The Wall  (Read 728 times)

BlackVengeance

  • Basic Member
  • *
  • Reputation Power: 18
  • BlackVengeance has no influence.
  • Offline Offline
  • Posts: 22
    • View Profile
[Mccodes V1] The Wall
« on: February 16, 2011, 12:01:39 PM »
Well this is kind of a social networking feature inspired by facebooks wall. Its pretty simple just something where users can post and comment nothing special just gives them something else to do and its pretty fun. Still working on adding a few things to it ill update it as i add stuff. Hope you enjoy!

SQL:
Code: [Select]
CREATE TABLE IF NOT EXISTS `wall` (
`wallID` int(11) NOT NULL AUTO_INCREMENT,
`wallUSERID` int(11) NOT NULL DEFAULT '0',
`wallTIME` int(11) NOT NULL DEFAULT '0',
`wallTEXT` longtext NOT NULL,
PRIMARY KEY (`wallID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;




CREATE TABLE IF NOT EXISTS `wallcomments` (
`wcID` int(11) NOT NULL AUTO_INCREMENT,
`wcWALL` int(11) NOT NULL DEFAULT '0',
`wcUSERID` int(11) NOT NULL DEFAULT '0',
`wcTIME` int(11) NOT NULL DEFAULT '0',
`wcTEXT` longtext NOT NULL,
PRIMARY KEY (`wcID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;


thewall.php

Code: [Select]
<?php
session_start
();
require 
"global_func.php";
if(
$_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require 
"header.php";
$h = new headers;
$h->startheaders();
include 
"mysql.php";
global 
$c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['credits'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
switch(
$_GET['action'])
{


case 
'post':
wall_post();
break;

case 
'dopost':
wall_dopost();
break;

case 
'comments':
wall_comments();
break;

case 
'addcomments':
wall_addcomments();
break;

case 
'delete':
wall_delete();
break;

case 
'addcommentsub':
wall_addcommentsub();
break;
default:
wall_home();
break;
}

function 
wall_home()
{
global 
$ir,$c,$userid,$h;
$wall=mysql_query("SELECT * FROM wall",$c) or die(mysql_error());
print 
"<table width=100% class=forumline>
<th colspan=4>The Wall</th><tr>
<td colspan=2 align=center><a href=thewall.php?action=post>Make A Post</a></td><tr>
<th width=30%>Poster</th><th width=70%>Post</th><th>Action</th><tr>"
;
while(
$wa=mysql_fetch_array($wall))
{
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
$wazz=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$wa['wallID']}",$c) or die(mysql_error());
$num=mysql_num_rows($wazz);
print
"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td>{$wa['wallTEXT']}</td><tr>"
;
print
"<td></td><td><a href=thewall.php?action=comments&wallid={$wa['wallID']}>View Comments ($num)</a></td>";
if(
$wa['wallUSERID'] == $userid || $ir['user_level'] != 1)
{
print
"<td width=40%><a href=thewall.php?action=delete&post={$wa['wallID']}>Delete Post</a></td>";
}
print
"</tr>

<td><hr></td><td><hr></td><td><hr></td></tr>"
;
}
print
"</table>";
}

function 
wall_post()
{

global 
$ir,$c,$userid,$h;


print
"<table width=100% class=forumline>
<th>Making A Post</th><tr>
<td align=center>
<form action=thewall.php?action=dopost method=post>
<textarea name=post cols=40 rows=10></textarea><br>
<input type=submit value=Post></form></td></table>"
;


}


function 
wall_dopost()
{

global 
$ir,$c,$userid,$h;


print
"<table width=100% class=forumline>
<th>Making A Post</th><tr>
<td align=center>
Your have Posted on the wall!</td></table>"
;
mysql_query("INSERT INTO wall VALUES('','$userid',unix_timestamp(),'{$_POST['post']}');",$c);

}

function 
wall_comments()
{

global 
$ir,$c,$userid,$h;
$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['wallid']}",$c);
$wa=mysql_fetch_array($wall);
$wac=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$_GET['wallid']}",$c);
print 
"<table width=100% class=forumline>";
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
print
"<th colspan=2><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}'s</a> Wall Post</th><tr>
<td align=center colspan=2>{$wa['wallTEXT']}</td><tr>
<th colspan=2>The Wall Comments</th><tr>
<th colspan=2><a href=thewall.php?action=addcomments&wallid={$_GET['wallid']}>Add A Comment</a></th><tr>
<th width=30%>Poster</th><th width=70%>Post</th><tr>"
;
while(
$wc=mysql_fetch_array($wac))
{
$user=mysql_query("SELECT * FROM users where userid={$wc['wcUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
print
"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td align=center>{$wc['wcTEXT']}</td><tr>
<td><hr></td><td><hr></td></tr>"
;
}
print
"</table>";
}
function 
wall_addcomments()
{

global 
$ir,$c,$userid,$h;


print
"<table width=100% class=forumline>
<th>Adding A Comment</th><tr>
<td align=center>
<form action=thewall.php?action=addcommentsub&wallid={$_GET['wallid']} method=post>
<textarea name=post cols=40 rows=10></textarea><br>
<input type=submit value=Post></form></td></table>"
;


}


function 
wall_addcommentsub()
{

global 
$ir,$c,$userid,$h;


print
"<table width=100% class=forumline>
<th>Comment Added</th><tr>
<td align=center>
Your have a comment on the wall post!</td></table>"
;
$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['wallid']}",$c);
$wa=mysql_fetch_array($wall);
event_add($wa['wallUSERID'],"You have a new comment on your wall post!",$c,'wallpost');
mysql_query("INSERT INTO wallcomments VALUES('','{$_GET['wallid']}','$userid',unix_timestamp(),'{$_POST['post']}');",$c);

}
function 
wall_delete()
{

global 
$ir,$c,$userid,$h;

$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['post']}",$c);
$wa=mysql_fetch_array($wall);
if(
$wa['wallUSERID'] != $userid || $ir['user_level'] == 1)
{
die(
"This is not your post to delete!");
}
print
"<table width=100% class=forumline>
<th>Delete Post</th><tr>
<td align=center>
Your have deleted the post!</td></table>"
;
mysql_query("DELETE FROM wall WHERE wallID={$_GET['post']}",$c);
mysql_query("DELETE FROM wallcomments WHERE wcWALL={$_GET['post']}",$c);


}
$h->endpage();
?>
Logged

Dusty

  • Basic Member
  • *
  • Reputation Power: 21
  • Dusty has no influence.
  • Offline Offline
  • Posts: 39
  • TRD Computer Repair
    • Yahoo Instant Messenger - peewee986
    • View Profile
    • WWW
Re: [Mccodes V1] The Wall
« Reply #1 on: February 19, 2011, 01:02:53 AM »
Has any one tried this yet.   Would love to see some working screen shots.  Just to see looks on the page. 
Logged
TRD Computer Repair Services
www.trdcomputer.com

iseeyou94056

  • Basic Member
  • *
  • Reputation Power: 1
  • iseeyou94056 has no influence.
  • Offline Offline
  • Posts: 2
    • View Profile
Re: [Mccodes V1] The Wall
« Reply #2 on: February 22, 2011, 12:26:31 PM »
this would be better if this went on the top or bottom of users profile and if it worked more like the one on myspace or facebook this isnt all that good
Logged

dominion

  • Active Member
  • **
  • Reputation Power: 89
  • dominion barely matters.dominion barely matters.
  • Offline Offline
  • Posts: 129
    • View Profile
    • Email
Re: [Mccodes V1] The Wall
« Reply #3 on: February 22, 2011, 01:27:54 PM »
this would be better if this went on the top or bottom of users profile and if it worked more like the one on myspace or facebook this isnt all that good
Then edit it...
Logged

Radical360.co.tv

  • Basic Member
  • *
  • Reputation Power: 0
  • Radical360.co.tv has no influence.
  • Offline Offline
  • Posts: 1
    • View Profile
    • Email
Re: [Mccodes V1] The Wall
« Reply #4 on: July 29, 2011, 08:06:46 AM »
<?php
session_start();
require "global_func.php";
if($_SESSION['loggedin']==0) { header("Location: login.php");exit; }
$userid=$_SESSION['userid'];
require "header.php";
$h = new headers;
$h->startheaders();
include "mysql.php";
global $c;
$is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error());
$ir=mysql_fetch_array($is);
check_level();
$fm=money_formatter($ir['money']);
$cm=money_formatter($ir['credits'],'');
$lv=date('F j, Y, g:i a',$ir['laston']);
$h->userdata($ir,$lv,$fm,$cm);
$h->menuarea();
switch($_GET['action'])
{


case 'post':
wall_post();
break;

case 'dopost':
wall_dopost();
break;

case 'comments':
wall_comments();
break;

case 'addcomments':
wall_addcomments();
break;

case 'delete':
wall_delete();
break;

case 'addcommentsub':
wall_addcommentsub();
break;
default:
wall_home();
break;
}

function wall_home()
{
global $ir,$c,$userid,$h;
$wall=mysql_query("SELECT * FROM wall",$c) or die(mysql_error());
print "<table width=100% class=forumline>
<th colspan=4>The Wall</th><tr>
<td colspan=2 align=center><a href=thewall.php?action=post>Make A Post</a></td><tr>
<th width=30%>Poster</th><th width=70%>Post</th><th>Action</th><tr>";
while($wa=mysql_fetch_array($wall))
{
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
$wazz=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$wa['wallID']}",$c) or die(mysql_error());
$num=mysql_num_rows($wazz);
print"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td>{$wa['wallTEXT']}</td><tr>";
print"<td></td><td><a href=thewall.php?action=comments&wallid={$wa['wallID']}>View Comments ($num)</a></td>";
if($wa['wallUSERID'] == $userid || $ir['user_level'] != 1)
{
print"<td width=40%><a href=thewall.php?action=delete&post={$wa['wallID']}>Delete Post</a></td>";
}
print"</tr>

<td><hr></td><td><hr></td><td><hr></td></tr>";
}
print"</table>";
}

function wall_post()
{

global $ir,$c,$userid,$h;


print"<table width=100% class=forumline>
<th>Making A Post</th><tr>
<td align=center>
<form action=thewall.php?action=dopost method=post>
<textarea name=post cols=40 rows=10></textarea><br>
<input type=submit value=Post></form></td></table>";


}


function wall_dopost()
{

global $ir,$c,$userid,$h;


print"<table width=100% class=forumline>
<th>Making A Post</th><tr>
<td align=center>
Your have Posted on the wall!</td></table>";
mysql_query("INSERT INTO wall VALUES('','$userid',unix_timestamp(),'{$_POST['post']}');",$c);

}

function wall_comments()
{

global $ir,$c,$userid,$h;
$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['wallid']}",$c);
$wa=mysql_fetch_array($wall);
$wac=mysql_query("SELECT * FROM wallcomments WHERE wcWALL={$_GET['wallid']}",$c);
print "<table width=100% class=forumline>";
$user=mysql_query("SELECT * FROM users where userid={$wa['wallUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
print"<th colspan=2><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}'s</a> Wall Post</th><tr>
<td align=center colspan=2>{$wa['wallTEXT']}</td><tr>
<th colspan=2>The Wall Comments</th><tr>
<th colspan=2><a href=thewall.php?action=addcomments&wallid={$_GET['wallid']}>Add A Comment</a></th><tr>
<th width=30%>Poster</th><th width=70%>Post</th><tr>";
while($wc=mysql_fetch_array($wac))
{
$user=mysql_query("SELECT * FROM users where userid={$wc['wcUSERID']}",$c) or die(mysql_error());
$wu=mysql_fetch_array($user);
print"<td><a href=viewuser.php?u={$wu['userid']}>{$wu['username']}</a></td>
<td align=center>{$wc['wcTEXT']}</td><tr>
<td><hr></td><td><hr></td></tr>";
}
print"</table>";
}
function wall_addcomments()
{

global $ir,$c,$userid,$h;


print"<table width=100% class=forumline>
<th>Adding A Comment</th><tr>
<td align=center>
<form action=thewall.php?action=addcommentsub&wallid={$_GET['wallid']} method=post>
<textarea name=post cols=40 rows=10></textarea><br>
<input type=submit value=Post></form></td></table>";


}


function wall_addcommentsub()
{

global $ir,$c,$userid,$h;


print"<table width=100% class=forumline>
<th>Comment Added</th><tr>
<td align=center>
Your have a comment on the wall post!</td></table>";
$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['wallid']}",$c);
$wa=mysql_fetch_array($wall);
event_add($wa['wallUSERID'],"You have a new comment on your wall post!",$c,'wallpost');
mysql_query("INSERT INTO wallcomments VALUES('','{$_GET['wallid']}','$userid',unix_timestamp(),'{$_POST['post']}');",$c);

}
function wall_delete()
{

global $ir,$c,$userid,$h;

$wall=mysql_query("SELECT * FROM wall WHERE wallID={$_GET['post']}",$c);
$wa=mysql_fetch_array($wall);
if($wa['wallUSERID'] != $userid || $ir['user_level'] == 1)
{
die("This is not your post to delete!");
}
print"<table width=100% class=forumline>
<th>Delete Post</th><tr>
<td align=center>
Your have deleted the post!</td></table>";
mysql_query("DELETE FROM wall WHERE wallID={$_GET['post']}",$c);
mysql_query("DELETE FROM wallcomments WHERE wcWALL={$_GET['post']}",$c);


}
$h->endpage();
?>
Logged

Arson

  • Global Moderator
  • Basic Member
  • *****
  • Reputation Power: 98
  • Arson barely matters.Arson barely matters.
  • Offline Offline
  • Posts: 74
    • View Profile
Re: [Mccodes V1] The Wall
« Reply #5 on: September 14, 2011, 03:49:43 AM »
Nice mod BlackVengeance


@Radical, have you seen the [ code ] tags?
Logged
List of the Best Text Games on the Interwebs!
If you own a game, you need to list it on BestTextGames.com
 


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