Modification Out-Dated New one will be added.

Forum
Last Post
Threads / Messages

Bloodrun

I am, who I am.
Premium Member
Joined
Apr 20, 2009
Messages
532
Points
0
Age
33
Mysidian Dollar
15,756
So, I saw Rusnaks Adoptables site, and I instantly realized, that this was I needed to get my site off the ground.
So, what I did, was, I took The Adoptables, and completely changed everything, what I turned it into isn't an adoptables site, but, some of the things I added, will still be useful for those of you who use the Rusnak code for adoptables.
Such as, a Online Status (Online/Offline).
And, complete Profile Enhancement, (As Seen on Myspace ;) ) <-- I'm a little iffy about this one, for the reason is that it took me forever to figure out, because I learn as I go, and I don't know how to make a mod for it. So those with very little PHP/CSS/MySQL knowledge, would get very lost, unless I did a detailed step to step guide... actually all the features are this way.
So forgive me a head of time, but I can show you how to add the completely customizable Online/Offline feature, right now:

Go to your SQL Database, and INSERT at the end of the table, a SET call `status`:

`status` varchar(11) NOT NULL,

Example:
PHP:
CREATE TABLE IF NOT EXISTS `adopts_users` (
  `uid` int(11) NOT NULL auto_increment,
  `username` varchar(20) default NULL,
  `password` varchar(100) default NULL,
  `email` varchar(60) default NULL,
  `usergroup` int(11) default NULL,
  `newmessagenotify` varchar(10) default NULL,
  `membersince` varchar(20) default NULL,
  `isbanned` int(11) default NULL,
  `status` varchar(11) NOT NULL,
  PRIMARY KEY  (`uid`),
  UNIQUE KEY `username` (`username`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
Note: The above is an example, so you know where I am coming from.

Next:
Go to your login page, and where you see this:
PHP:
$loginform = "<form name='form1' method='post' action='login.php'>
  <p>Username: 
    <input name='username' type='text' id='username'>
</p>
  <p>Password: 
    <input name='password' type='password' id='password'>
</p>
  <p>
    <input type='submit' name='Submit' value='Submit'>
  </p>
  <p>Don't have an account?<br>
  <a href='register.php'>Register Free</a>  </p>
  <a href='forgotpass.php'>Forgot your password?  Click Here</a>
</form>";

Insert this:

<p>
<input name='status' type='hidden' id='status' value='yes'>
</p>

Anywhere above the Submit button.

Then:
Find this:
PHP:
if($username == $luser and $password == $lpass){
$article_title = "Login Successful!";
$article_content = "Welcome back ".$username.".  You are now logged in.  <a href='account.php'>Click Here to view or edit your account.</a>";

And put this after it:

PHP:
$status = $_POST["status"];
$status = secure($status);

$query = "UPDATE ".$prefix."users SET status='".$status."' WHERE username='".$luser."'";
mysql_query($query);

Now the next step, is a big one, and I am more then positive, it could have been done another way, but, at the risk of confusing people, I did it this way.

Go to your logout.php and duplicate it, and rename it lougout2.php.

Then, go back to your first logout.php, and delete (Make sure you duplicate the document first!) everything between this:

Code:
// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************

// This page logs a user out of the system...

And this:

PHP:
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file = $themeurl;

Then between those two, add the following:

PHP:
$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = @mysql_query($query);

$luser=@mysql_result($result,$i,"username");
$status=@mysql_result($result,$i,"status");

$logoutform = "<form name='form1' method='post' action='logout.php'>
  <p>Are you sure you want to Log Out? 
    <input name='status' type='hidden' id='status' value='no'>
</p>
  <p>
    <input type='submit' name='Submit' value='Yes'>    <input type='submit' name='Submit2' value='No' onclick='http://yoursite.com/account.php'>
  </p>


</form>";

$logoutform2 = "<form name='form1' method='post' action='logout2.php'>
  <p>Are you Really Really sure you want to Log Out? 
</p>
  <p>
    <input type='submit' name='Submit' value='Yes'  onclick='http://yoursite.com/logout2.php'>    <input type='submit' name='Submit2' value='No' onclick='http://yoursite.com/account.php'>
  </p>


</form>";

if($isloggedin == "yes") {
$article_title = $loggedinname;
$article_content = $logoutform;



$status = $_POST["status"];
$status = secure($status);

$query = "UPDATE ".$prefix."users SET status='".$status."' WHERE username='".$luser."'";
mysql_query($query);

$article_content = $logoutform2;
}
else {
$article_title = "You are already Logged Out!";
$article_content = "You need to <a href='http://yoursite.com/login.php'>log in</a>, to log out. ;)";
}

Make sure you change the yoursite.com to your address.

Then, go to your register.php file, and where it says:

//Grab the post data from the form
and
//Protect the database
add the following:

First for the grabbing, place this:
PHP:
$status = $_POST["status"];

Then, for the protecting, add this:
PHP:
$status = secure($status);

Then right below that group of text find where it says this:
PHP:
	$article_title = $regnew;
	$article_content = $regnewexplain."<br><form name='form1' method='post' action='register.php'>

And place this:
PHP:
  <p> 
    <input name='status' type='hidden' id='status' value='yes'>
</p>

Then where it says this:
PHP:
	//All checks are done, actually create the user's account on the database

	$date = date('Y-m-d');

	mysql_query("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1', '$email', '3', '1', '$date', '0',)");

Add:
'$status'
Right after the zero. Now keep in mind, I told you to place originally place the `status` option in your database, at the very end. So if you have more then my example, make sure you them counted as well, or you will always recieve this very nasty error:

"Something is Very, Very Wrong. Please Contact..."

Moving on, right below that, where it says:
PHP:
	$status = dologin($username, $pass1);

Add the variable $status after $pass1, so it looks like this:
PHP:
	$status = dologin($username, $pass1, $status);

Note, I just realized now, that there is already a $status variable within the register.php file, I didn't realize this before. But thankfully everything still works. Normally you don't want to have two of one variable, just to be on the safe side of things.

Okay, we are almost done.
Next, go to your profile.php file, and where it says this:
PHP:
	$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");

Add this to it:
Code:
	$status=@mysql_result($result,$i,"status");

Then, where it says this:

PHP:
	$ccstat = cancp($usersgroup);
	if($ccstat == "yes"){
	$userdisp = "<img src='templates/icons/star.gif'> ".$usersname."";
	}
	else{
	$userdisp = $usersname;
	}

Were going to replace all of that, with this:

PHP:
	if($status == "yes") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>Online!</b>";
	}
	elseif($status == "") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>Offline!</b>";
	}

Then where it says this:
Code:
	$article_title = $userdisp."'s Profile:";

Replace it with:
Code:
	$article_title = "$userdisp";

And, finally, we are done.
Now test it out, if you followed my instructions, word for word, it should work.

You will get something like this:
Bloodrun's Profile: Online Status: Online!

You can even customize it, so that the part that says Online!, is a picture.

Now, to wrap everything off, again I apologize for not being able to make this a mod, im just not that smart lol.
But, instead of boring you with an explanation on how everything works, ill just answer your questions as they come.

That is, if anyone ill find this interesting...
 
RE: Some very cool add-ons

Nice, but I'm still waiting for the upgrade so I can't use it...
 
RE: Some very cool add-ons

Ashje said:
Nice, but I'm still waiting for the upgrade so I can't use it...

Ahh, you haven't installed the upgrade yet?
 
RE: Some very cool add-ons

useful, useful... very useful!

I just needed this!

-bookmarking this page also!--
 
RE: Some very cool add-ons

Blue Icebox said:
useful, useful... very useful!

I just needed this!

-bookmarking this page also!--

Lol, glad I could help you. =)
 
RE: Some very cool add-ons

you should change all the [code ] to [php ] cause it has the syntax colors! :D
 
RE: Some very cool add-ons

Blue Icebox said:
you should change all the [code ] to [php ] cause it has the syntax colors! :D

Lol, I changed some, but not all.
 
RE: Some very cool add-ons

Update!

There is a slight problem with this code. And that is, if a person does not hit the log-out button, it will continue to say that the person is online. Until he/she logs in again, in which it will say he/she is offline, until the Next time they log on.

So a little diaphram to help you understand that:

First Login, (does not log off)
-Is Online.
Second Login (it doesnt matter if he/she logs off or not)
-Offline.
Third Login (has to log off so the cycle doesnt repeat)
-Is Online (when they are actually online)

Now there is a solution to this problem. But it isn't has "Professional" as the first.

If you don't want to go through all this work, to end up with this possible broken cycle, all you have to do insert the following, in your account.php, accountpost.php, and profile.php: Note: You will need the same Database entry as in the first one, so use that one.

account.php
Find where it says:
PHP:
$query = "SELECT * FROM ".$prefix."users WHERE username='$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

//Loop out code
$i=0;
while ($i < 1) {

And place the following:
Under the first group:
PHP:
$status=@mysql_result($result,$i,"status");
Under the second group:
PHP:
$status = stripslashes($status);

Then find where it says:
PHP:
<form name='form1' method='post' action='accountpost.php'>
  <p>".$box."
  Notify me via email when I receive a new message or reward code</p>
  <p><u>Publically Viewable Details: </u></p>

And place the following anywhere within that form:
PHP:
  <p>Status:
    <select name='status' id='status'>
<option value='none'>None</option>
<option value='online'>Online!</option>
<option value='offline'>Offline!</option>
<option value='busy'>Busy!</option>
<option value='away'>Away!</option>
</select>
</p>
Note: you can add more, I made it short so you can get the gist of it. You can also add pictures to each one. You can do pretty much anything with it.

accountpost.php
Find where it says:
PHP:
// We are changing the settings

$newmsgnotify = $_POST["newmsgnotify"];
$newmsgnotify = preg_replace("/[^a-zA-Z0-9@._-]/", "", $newmsgnotify);
$newmsgnotify = secure($newmsgnotify);

Then place this uner it:
PHP:
$status = $_POST["status"];
$status = secure($status);

Then find where it says:
PHP:
// Run update queries...

$query = "UPDATE ".$prefix."users SET newmessagenotify='".$newmsgnotify."' WHERE username='".$loggedinname."'";
mysql_query($query);

And place this under it:
PHP:
$query = "UPDATE ".$prefix."users SET status='".$status."' WHERE username='".$loggedinname."'";
mysql_query($query);

profile.php
Find where it says:
PHP:
	$query = "SELECT * FROM ".$prefix."users WHERE username = '".$user."'";
	$result = mysql_query($query);
	$num = mysql_numrows($result);

	if($num > 0){

	$i=0;
	while ($i < 1) {

Place this under it:
PHP:
	$status=@mysql_result($result,$i,"status");

Then find where it says:
PHP:
    $ccstat = cancp($usersgroup);
    if($ccstat == "yes"){
    $userdisp = "<img src='templates/icons/star.gif'> ".$usersname."";
    }
    else{
    $userdisp = $usersname;
    }
And place this
PHP:
	if($status == "none") {
	$userdisp = "".$usersname."'s Profile:";
	}
	elseif($status == "online") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>Online!</b>";
	}
	elseif($status == "offline") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>Offline!</b>";
	}
	elseif($status == "busy") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>Busy!</b>";
	}
	elseif($status == "away") {
	$userdisp = "".$usersname."'s Profile: Online Status: <b>away!</b>";
	}

Then find where it says:
PHP:
    $article_title = $userdisp."'s Profile:";
And change it to:
PHP:
    $article_title = "$userdisp";

Like I said this is just the very least you can do with the code. There is so much you can do with it. Who knows, maybe Ill bring in something else. =D
 
RE: Some very cool add-ons

Bloodrun said:
Ashje said:
Nice, but I'm still waiting for the upgrade so I can't use it...

Ahh, you haven't installed the upgrade yet?

Well, seeing as the upgrade script isn't out and I can't be bothered doing what Sea did, No...
 
RE: Some very cool add-ons

Ashje said:
Bloodrun said:
Ashje said:
Nice, but I'm still waiting for the upgrade so I can't use it...

Ahh, you haven't installed the upgrade yet?

Well, seeing as the upgrade script isn't out and I can't be bothered doing what Sea did, No...

Wait, what? I think we are talking about two seperate things..
First off, who is Sea, and what did he/she do?
Secondly, which script are you talking about?
 
RE: Some very cool add-ons

1. Sea = Seapyramid, Senior Member here. He uploaded the new files and changed his MySQL to fit. In other words, a manual upgrade.
2. This script, the adoptables one.
 
RE: Some very cool add-ons

Ashje said:
1. Sea = Seapyramid, Senior Member here. He uploaded the new files and changed his MySQL to fit. In other words, a manual upgrade.
2. This script, the adoptables one.

I didn't have any trouble installing the new one :?
 
RE: Some very cool add-ons

I'm upgrading from the old version, which you can't currently do unless you do what Seapyramid did and convert all the files manually. I can't be bothered XD
 
RE: Some very cool add-ons

Ashje said:
I'm upgrading from the old version, which you can't currently do unless you do what Seapyramid did and convert all the files manually. I can't be bothered XD

Ahh, you always have to be mister lazy lol.
 
RE: Some very cool add-ons

True, true. Besides, I'm not a professional so I don't want to screw anything up...
 
RE: Some very cool add-ons

Ashje said:
True, true. Besides, I'm not a professional so I don't want to screw anything up...

Lol if you say so.
Can't learn if you don't try.
 
RE: Some very cool add-ons

Ashje said:
1. Sea = Seapyramid, Senior Member here. He uploaded the new files and changed his MySQL to fit. In other words, a manual upgrade.
2. This script, the adoptables one.

Sea is a she & mother of 3 so please denote that :)

Yes I did an upgrade of the myadopts.php page & if you want more info you can pm me on it. BUT if you MUST have knowledge of HTML, PHP and MYSQL! I am NOT a teaching service. I will offer the scripts & MySQL info... but I will NOT train you on it.
 
RE: Some very cool add-ons

Seapyramid said:
Ashje said:
1. Sea = Seapyramid, Senior Member here. He uploaded the new files and changed his MySQL to fit. In other words, a manual upgrade.
2. This script, the adoptables one.

Sea is a she & mother of 3 so please denote that :)

Yes I did an upgrade of the myadopts.php page & if you want more info you can pm me on it. BUT if you MUST have knowledge of HTML, PHP and MYSQL! I am NOT a teaching service. I will offer the scripts & MySQL info... but I will NOT train you on it.

You were referencing attention to ashje on last part.. right?
 
RE: Some very cool add-ons

Seapyramid said:
Sea is a she & mother of 3 so please denote that :)

Oops, sorry. I haven't been here long enough to see a post with reference to your gender/lifestyle. My apologies.
 

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,277
Messages
33,122
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top