Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Addons and Modifications > Addons/Mods Graveyard

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 04-25-2009, 03:47 AM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default Modification Out-Dated New one will be added.

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 Code:
CREATE TABLE IF NOT EXISTS `adopts_users` (
  `
uidint(11NOT NULL auto_increment,
  `
usernamevarchar(20) default NULL,
  `
passwordvarchar(100) default NULL,
  `
emailvarchar(60) default NULL,
  `
usergroupint(11) default NULL,
  `
newmessagenotifyvarchar(10) default NULL,
  `
membersincevarchar(20) default NULL,
  `
isbannedint(11) default NULL,
  `
statusvarchar(11NOT 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 Code:

$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 Code:
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 Code:
$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 Code:
// **********************************************************************
// Begin Template Definition
// **********************************************************************

//Define our current theme
$file $themeurl
Then between those two, add the following:

PHP Code:
$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 Code:
$status $_POST["status"]; 
Then, for the protecting, add this:
PHP Code:
$status secure($status); 
Then right below that group of text find where it says this:
PHP Code:
    $article_title $regnew;
    
$article_content $regnewexplain."<br><form name='form1' method='post' action='register.php'> 
And place this:
PHP Code:
  <p
    <
input name='status' type='hidden' id='status' value='yes'>
</
p
Then where it says this:
PHP Code:
    //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 Code:

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

    $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 Code:
    $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 Code:
    $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 Code:
    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...
Reply With Quote
  #2  
Old 04-25-2009, 07:31 AM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 12,483
Ashje
Default RE: Some very cool add-ons

Nice, but I'm still waiting for the upgrade so I can't use it...
Reply With Quote
  #3  
Old 04-25-2009, 07:14 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Some very cool add-ons

Quote:
Originally Posted by Ashje
Nice, but I'm still waiting for the upgrade so I can't use it...
Ahh, you haven't installed the upgrade yet?
Reply With Quote
  #4  
Old 04-25-2009, 09:46 PM
Blue Icebox Blue Icebox is offline
Member
 
Join Date: Jan 2009
Posts: 45
Credits: 5,907
Blue Icebox
Default RE: Some very cool add-ons

useful, useful... very useful!

I just needed this!

-bookmarking this page also!--
Reply With Quote
  #5  
Old 04-26-2009, 04:40 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Some very cool add-ons

Quote:
Originally Posted by Blue Icebox
useful, useful... very useful!

I just needed this!

-bookmarking this page also!--
Lol, glad I could help you. =)
Reply With Quote
  #6  
Old 04-26-2009, 07:43 PM
Blue Icebox Blue Icebox is offline
Member
 
Join Date: Jan 2009
Posts: 45
Credits: 5,907
Blue Icebox
Default RE: Some very cool add-ons

you should change all the [code ] to [php ] cause it has the syntax colors! :D
Reply With Quote
  #7  
Old 04-26-2009, 08:00 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Some very cool add-ons

Quote:
Originally Posted by Blue Icebox
you should change all the [code ] to [php ] cause it has the syntax colors! :D
Lol, I changed some, but not all.
Reply With Quote
  #8  
Old 04-27-2009, 03:20 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default 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 Code:

$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 Code:
$status=@mysql_result($result,$i,"status"); 
Under the second group:
PHP Code:
$status stripslashes($status); 
Then find where it says:
PHP Code:
<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 Code:
  <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 Code:
// 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 Code:
$status $_POST["status"];
$status secure($status); 
Then find where it says:
PHP Code:
// Run update queries...

$query "UPDATE ".$prefix."users SET newmessagenotify='".$newmsgnotify."' WHERE username='".$loggedinname."'";
mysql_query($query); 
And place this under it:
PHP Code:
$query "UPDATE ".$prefix."users SET status='".$status."' WHERE username='".$loggedinname."'";
mysql_query($query); 
profile.php
Find where it says:
PHP Code:
    $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 Code:
    $status=@mysql_result($result,$i,"status"); 
Then find where it says:
PHP Code:
    $ccstat cancp($usersgroup);
    if(
$ccstat == "yes"){
    
$userdisp "<img src='templates/icons/star.gif'> ".$usersname."";
    }
    else{
    
$userdisp $usersname;
    } 
And place this
PHP Code:
    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 Code:
    $article_title $userdisp."'s Profile:"
And change it to:
PHP Code:
    $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
Reply With Quote
  #9  
Old 04-27-2009, 04:41 PM
Ashje Ashje is offline
Member
 
Join Date: Jan 2009
Posts: 179
Credits: 12,483
Ashje
Default RE: Some very cool add-ons

Quote:
Originally Posted by Bloodrun
Quote:
Originally Posted by Ashje
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...
Reply With Quote
  #10  
Old 04-27-2009, 05:31 PM
Bloodrun's Avatar
Bloodrun Bloodrun is offline
I am, who I am.
 
Join Date: Apr 2009
Posts: 532
Gender: Male
Credits: 35,540
Bloodrun
Send a message via Yahoo to Bloodrun
Default RE: Some very cool add-ons

Quote:
Originally Posted by Ashje
Quote:
Originally Posted by Bloodrun
Quote:
Originally Posted by Ashje
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?
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Certain Items Won't Be Added? AlexC Questions and Supports 4 03-27-2012 03:22 PM
A modification jcga1992 Questions and Supports 7 11-07-2011 02:31 PM
Modification Directory Kaeliah Mys v1.1.x Mods 14 02-28-2011 05:14 PM
Anna's New Mods -- UPDATED ! Mod added at the bottom! redheadturkey Mys v1.1.x Mods 17 01-17-2011 07:38 AM
Adoptables not being added Ashje Questions and Supports 2 12-16-2009 11:35 PM


All times are GMT -5. The time now is 01:14 PM.

Currently Active Users: 784 (0 members and 784 guests)
Threads: 4,081, Posts: 32,029, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636