Jump to content
MakeWebGames

Too much?


The Coder

Recommended Posts

I need a modification made for MCCodes V2, its quite simple...I think. If you don't want to do it, fair enough.

I basically need a modification where members can see what other players have been upto.

For e.g

Last seen: Viewing IDHERE Profile

and so on.

Thanks in advance.

This is really simple. Add a new field into the users table (or you could create another table so you're not clogging up the users table). Then create a function which updates that field when a user completes that action.

Then whenever someone is viewing a page/completing an action you want to be viewed by other players called the function with the string you want displayed.

Link to comment
Share on other sites

CREATE TABLE IF NOT EXISTS `whos_where` (
 `Id` int(5) unsigned NOT NULL AUTO_INCREMENT,
 `Pagetext` varchar(255) NOT NULL,
 `Userentry` int(5) unsigned NOT NULL,
 `Collatenow` tinyint(1) unsigned NOT NULL,
 PRIMARY KEY (`Id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

 

function Gather_Info($Do, $Perm=0) {
global $db, $ir, $h, $c;
$Select = $db->query("SELECT `Id` FROM `whos_where` WHERE `Userentry`=".$ir['userid']);
if (!$db->num_rows($Select)) {
 return $db->query("INSERT INTO `whos_where` (`Userentry`) VALUES (".$ir['userid'].")");
} else {
 return $db->query("UPDATE `whos_where` SET `Pagetext`='".$Do."', `Collatenow`=".$Perm." WHERE `Userentry`=".$ir['userid']);
}
}

 

Then on each page add

example for profile page

Gather_Info('Viewing. '.{$r['username']}.' Profile Page');

Not tested but should be ok

Link to comment
Share on other sites

CREATE TABLE IF NOT EXISTS `whos_where` (
 `Id` int(5) unsigned NOT NULL AUTO_INCREMENT,
 `Pagetext` varchar(255) NOT NULL,
 `Userentry` int(5) unsigned NOT NULL,
 `Collatenow` tinyint(1) unsigned NOT NULL,
 PRIMARY KEY (`Id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1;

 

function Gather_Info($Do, $Perm=0) {
global $db, $ir, $h, $c;
$Select = $db->query("SELECT `Id` FROM `whos_where` WHERE `Userentry`=".$ir['userid']);
if (!$db->num_rows($Select)) {
 return $db->query("INSERT INTO `whos_where` (`Userentry`) VALUES (".$ir['userid'].")");
} else {
 return $db->query("UPDATE `whos_where` SET `Pagetext`='".$Do."', `Collatenow`=".$Perm." WHERE `Userentry`=".$ir['userid']);
}
}

 

Then on each page add

example for profile page

Gather_Info('Viewing. '.{$r['username']}.' Profile Page');

Not tested but should be ok

That naming, though.

Tsk, tsk.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...