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 07-22-2010, 02:32 AM
MikiHeart's Avatar
MikiHeart MikiHeart is offline
Premium Member
 
Join Date: Apr 2009
Posts: 187
Gender: Female
Credits: 20,328
MikiHeart
Default Sea's Cash mod addons [released]

I've been working on some addons for Sea's Cash mod, which is here: http://www.rusnakweb.com/forum/showthread.php?tid=1333&page=1

Okay, so I fixed it all up. It's all working, you'll have to fix it up to suit your own needs though

Features:
Displays the amount to user
Supports multiple currencies*
Donate amount to user
Checks to see if user is valid
Checks to see if the amount is valid(can't give what you don't have)

* To have a second currency, or even more then that, just use the sql that Sea provides, just change the name. You'll have to work out how to give that currency to the users though(it is possible to code it so that they get more then one currency when leveling up)

mycash.php
Code:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");

$themeurl = grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links = getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads = getads("account");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];

$pointsname = "MooPoints";
$gemsname = "MiiGems";

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

$act = $_GET["act"];
$act = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $act);
$act = secure($act);

$more = $_GET["more"];
$more = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $more);
$more = secure($more);

if($isloggedin == "yes"){

// We are logged in, so we must have an account
// Now we switch through our actions...

if($act == ""){

$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = mysql_query($query);
$num = mysql_numrows($result);

$points=@mysql_result($result,$i,"points");
$gems=@mysql_result($result,$i,"gems"); //Money info, helps display money to user

$article_title = $loggedinname."'s Cash";
$article_content = "You have " . $points . " " . $pointsname . " <br />
You have " . $gems . " " . $gemsname . " <br />
<a href='mycash.php?act=donate'>Donate</a>";

}
else if($act == "donate"){

// If donating, we show the form

$article_title = "Donate";
$article_content = "<br><form name='form1' method='post' action='cash.php'>
  <p>To : 
    <input name='donateto' type='text' id='donateto'>
    Type :     <select name='cashtype'>
<option value='points'>MooPoints</option>
<option value='gems'>MiiGems</option>
</select>
		  Amount : 
    <input name='amount' type='text' id='amount'>

    <input name='act' type='hidden' id='act' value='donate'>
</p>
  <p>
    <input type='submit' name='Submit' value='Donate'>
</p>
</form>";

}
else{

// No valid action specified...

$article_title = "No Valid Action Specified";
$article_content = "Invalid Action";

}

}
else{

// Guest access to this page is forbidden

$article_title = $accden;
$article_content = $nopriv." ".$reqlogin;


}



// **********************************************************************
// Begin Template Definition
// **********************************************************************

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

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links
$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************



?>
cash.php
Code:
<?php

// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// **********************************************************************

// Wake the sleeping giant

// **********************************************************************
// Basic Configuration Info
// **********************************************************************

include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");

$themeurl = grabanysetting("themeurl");

// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************

$links = getlinks();

// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************

$ads = getads("any");

// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************

$pagecontent = getsitecontent("index");
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);

// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************

$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");

// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************

$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];

// **********************************************************************
// End Prepwork - Output the page to the user
// This file actually processes the adoption of a pet...
// **********************************************************************

$act = $_POST["act"];
$act = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $act);
$act = secure($act);

$more = $_POST["more"];
$more = preg_replace("/[^a-zA-Z0-9\\040.]/", "", $more);
$more = secure($more);

if($isloggedin == "yes"){

if($act == ""){

// No action specified

$article_title = "Access Denied";
$article_content = "Direct access to this file is not allowed.";

// If donating, switching to donate
}
else if($act == "donate"){
// Get the form data

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

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

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

if($cashtype == "points"){
    
$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = mysql_query($query);
$user_data = mysql_fetch_array($result);
if($user_data['points'] >= $amount){
	$amountvaild = "yes";
    }
    else{
        $amountvaild = "no";
    }
    }
    else if($cashtype == "gems"){

$query = "SELECT * FROM ".$prefix."users WHERE username = '$loggedinname'";
$result = mysql_query($query);
$user_data = mysql_fetch_array($result);
if($user_data['gems'] >= $amount){
    $amountvaild = "yes";
}
else{
    $amountvaild = "no";
}

    }
        else if($cashtype == ""){
    $amountvaild = "no";
}


$query = "SELECT * FROM ".$prefix."users WHERE username = '$donateto'";
$result = mysql_query($query);
$num = @mysql_numrows($result);

    
if($donateto == "" or $donateto == "$loggedinname" or $num == "0" or $amountvaild == "no"){

$article_content = "Please check to make sure you filled in all the fields correctly.";
}
else if($cashtype == "points"){

$query = "SELECT * FROM ".$prefix."users WHERE  username = '$loggedinname'";
                  $result = mysql_query($query);
                  $num = mysql_numrows($result);
                  $points = @mysql_result($result, $i, "points");

$donated = $points - $amount;

$query = "UPDATE ".$prefix."users SET points = '$donated' WHERE username = '$loggedinname'";
                  $result = mysql_query($query);

// And giving it to the donatee
$query = "SELECT * FROM ".$prefix."users WHERE username = '$donateto'";
                  $result = mysql_query($query);
                  $num = mysql_numrows($result);
									$points = @mysql_result($result, $i, "points");
									
$donation = $points + $amount;

$query = "UPDATE ".$prefix."users SET points = '$donation' WHERE username = '$donateto'";
mysql_query($query);


$mtitle = "You have received a donation!";
$mtext = "You have received a donation of <b>" . $amount ."</b> MooPoints from <b>" . $loggedinname . "</b>";

$mtext = mysql_real_escape_string($mtext);

$date = date('Y-m-d');
$query = "INSERT INTO ".$prefix."messages VALUES ('', 'SYSTEM', '$donateto','unread','$date','$mtitle', '$mtext')";
mysql_query($query);

$query = "INSERT INTO ".$prefix."cash_logs VALUES ('$donateto', '$loggedinname', '$cashtype', '$amount', '$date')";
mysql_query($query);

// Now we check if we are sending out an email to the user alerting them of the message...

$query = "SELECT * FROM ".$prefix."users WHERE username='".$donateto."'";
$result = mysql_query($query);
$num = mysql_numrows($result);

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

$newmessagenotify=@mysql_result($result,$i,"newmessagenotify");
$email=@mysql_result($result,$i,"email"); 

$i++;
}

if($newmessagenotify == 1){

// We are sending this user an email about the new message...

	$systememail = grabanysetting("systememail");
	
	$headers = "From: ".$systememail."";

	$site_name = grabanysetting("sitename");

	$message = "Hello ".$owner.";\n\nYou have received a new Private Message from SYSTEM at ".$site_name." with the title ".$mtitle.".\n
	You can read this message at: http://www.".$domain."".$scriptpath."/messages.php\n
	Thank You.  The ".$site_name." team.";

	mail($email, $site_name." - You Have Received a Donation", $message, $headers);

}

// Then we show a success message to the user

$article_title = "Success";
$article_content = "Yay you did it!!<br /> You donated <b>" . $amount . "</b> MooPoints  to <b>" . $donateto . "</b>";
}
else if($cashtype == "gems"){
    $query = "SELECT * FROM ".$prefix."users WHERE  username = '$loggedinname'";
                  $result = mysql_query($query);
                  $num = mysql_numrows($result);
                  $gems = @mysql_result($result, $i, "gems");

$donated = $gems - $amount;

$query = "UPDATE ".$prefix."users SET gems = '$donated' WHERE username = '$loggedinname'";
                  $result = mysql_query($query);

// And giving it to the donatee
$query = "SELECT * FROM ".$prefix."users WHERE username = '$donateto'";
                  $result = mysql_query($query);
                  $num = mysql_numrows($result);
                  $gems = @mysql_result($result, $i, "gems");
									
$donation = $gems + $amount;

$query = "UPDATE ".$prefix."users SET gems = '$donation' WHERE username = '$donateto'";
mysql_query($query);


$mtitle = "You have received a donation!";
$mtext = "You have received a donation of <b>" . $amount . "</b> MiiGems from <b>" . $loggedinname . "</b>";

$mtext = mysql_real_escape_string($mtext);

$date = date('Y-m-d');
$query = "INSERT INTO ".$prefix."messages VALUES ('', 'SYSTEM', '$donateto','unread','$date','$mtitle', '$mtext')";
mysql_query($query);

$query = "INSERT INTO ".$prefix."cash_logs VALUES ('$donateto', '$loggedinname', '$cashtype', '$amount', 'now()')";
mysql_query($query);

// Now we check if we are sending out an email to the user alerting them of the message...

$query = "SELECT * FROM ".$prefix."users WHERE username='".$donateto."'";
$result = mysql_query($query);
$num = mysql_numrows($result);

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

$newmessagenotify=@mysql_result($result,$i,"newmessagenotify");
$email=@mysql_result($result,$i,"email"); 

$i++;
}

if($newmessagenotify == 1){

// We are sending this user an email about the new message...

	$systememail = grabanysetting("systememail");
	
	$headers = "From: ".$systememail."";

	$site_name = grabanysetting("sitename");

	$message = "Hello ".$owner.";\n\nYou have received a new Private Message from SYSTEM at ".$site_name." with the title ".$mtitle.".\n
	You can read this message at: http://www.".$domain."".$scriptpath."/messages.php\n
	Thank You.  The ".$site_name." team.";

	mail($email, $site_name." - You Have Received a Donation", $message, $headers);

}

// Then we show a success message to the user

$article_title = "Success";
$article_content = "Yay you did it!!<br /> You donated <b>" . $amount . "</b> MiiGems  to <b>" . $donateto . "</b> ";
    
}
}

}
else{

// Guest access to this page is forbidden

$article_title = $accden;
$article_content = $nopriv." ".$reqlogin;

}

// **********************************************************************
// Begin Template Definition
// **********************************************************************

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

// Do the template changes and echo the ready template
$template = file_get_contents($file);

$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);

$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);

//Define our links
$template = replace(':LINKSBAR:',$links,$template);

//Get the content for the side bar...

$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);

//Get the ad content...
$template = replace(':ADS:',$ads,$template);

//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);


echo $template;

// **********************************************************************
// End Template Definition
// **********************************************************************



?>
Okay, do have some logs in the admin panel, look for this code:

Code:
$article_title = "Access Denied";
$article_content = "Your usergroup does not seem to have the permission to edit the user based settings...";



}

} // End the settings content block .. start a new setting here...
Then, below it, add this:

Code:
else if($set == "cash"){
    
        $article_title = "Cash Logs";
$article_content = $article_content."
<table style='border: 1px;'>
<tr>
<th>To</th><th>From</th><th>Type</th><th>Amount</th><th>Date</th>
</tr>";

    $query = "SELECT * FROM adopts_cash_logs ORDER BY date DESC";
    $result = mysql_query($query);
$num = mysql_numrows($result);

while( $log = mysql_fetch_array($result)) {
  $to = $log['to'];
  $from = $log['from'];
  $type = $log['type'];
  $amount = $log['amount'];
  $date = $log['date'];

$article_content = $article_content."<tr><td>".$to."</td><td>".$from."</td><td>".$type."</td><td>".$amount."</td><td>".$date."</td></tr>";
}

$article_content = $article_content."</table>";
    }
Then add this link somewhere in your admin panel :) "admin.php?set=cash"

Code:
CREATE TABLE IF NOT EXISTS `adopts_cash_logs` (
  `to` varchar(40) default NULL,
  `from` varchar(40) default NULL,
  `type` varchar(40) default NULL,
  `amount` int(11) NOT NULL default '0',
  `date` varchar(25) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Reply With Quote
  #2  
Old 07-25-2010, 02:56 PM
redheadturkey redheadturkey is offline
Senior Member
 
Join Date: Jan 2010
Posts: 136
Gender: Female
Credits: 10,079
redheadturkey is on a distinguished road
Default RE: Sea's Cash mod addons [released]

thank you for this! :)
Reply With Quote
  #3  
Old 07-27-2010, 05:29 AM
MikiHeart's Avatar
MikiHeart MikiHeart is offline
Premium Member
 
Join Date: Apr 2009
Posts: 187
Gender: Female
Credits: 20,328
MikiHeart
Default RE: Sea's Cash mod addons [released]

You're welcome.
I'm still working on the script just a little.
But until I get this last thing sorted I won't be updating the code.

The newer one of this lets the user know that they've gotten a donation, the amount, type of currency and who from.
It'll also have cash logs of who give who what and when in the admin panel ^^

I'm also trying to work on a paypal IPN. I've hit a brick wall so I got a friend working on it ^^
Reply With Quote
  #4  
Old 07-30-2010, 11:22 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,503
fadillzzz is an unknown quantity at this point
Default RE: Sea's Cash mod addons [released]

hmm...I think I'll just wait for another update
and btw, I find this line in mycash.php
PHP Code:
$article_content "<br><form name='form1' method='post' action='cashnew.php'> 
Where is the cashnew.php file? Is it the cash.php file?
Reply With Quote
  #5  
Old 07-30-2010, 09:51 PM
MikiHeart's Avatar
MikiHeart MikiHeart is offline
Premium Member
 
Join Date: Apr 2009
Posts: 187
Gender: Female
Credits: 20,328
MikiHeart
Default RE: Sea's Cash mod addons [released]

Ohh, sorry! I just forgot to rename that!! Just take out the 'new'
When I was working on it, I had the first version which didn't work very well. Then I restarted the script, and recoded it in a file named 'cashnew.php' So just take out the 'new' and it'll work ^^ Sorry for the mistake.
Reply With Quote
  #6  
Old 08-01-2010, 04:42 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,503
fadillzzz is an unknown quantity at this point
Default RE: Sea's Cash mod addons [released]

ok, I just tested it on my site, and it works perfectly
But it would be nice if you release the newer version you've mentioned :)
Reply With Quote
  #7  
Old 08-04-2010, 12:27 AM
MikiHeart's Avatar
MikiHeart MikiHeart is offline
Premium Member
 
Join Date: Apr 2009
Posts: 187
Gender: Female
Credits: 20,328
MikiHeart
Default RE: Sea's Cash mod addons [released]

I updated the script with the files I'm using.
Nothing much. Just logs are pretty cool.
In the future I plan to add more areas in the admin panel. Like editing a user's cash and so on. But for now, it's fine.

I also have my own shop script which I've sort of finished coding. (yes, my own shop script XD)
I thought it would be better to code my own to do what I wanted it to do.
You can buy items from shops, and then view them in your inventory, and if they are a usable item, then you can click the use button, and it'll use the item ^^
It also has a stock feature. So the shops have stock, and a max stock. I plan to create a cron for restocking.

I plan to add more to it, like a sell back feature, where the users can only get 75% what the item sold for in the shop.
I plan to have a giving option, and some sort of trade system for items and pets.
And I plan to create some admin features, like logging and also item adding and stuff. :)

If anyone wants a copy, just let me know. It's not everything I want just yet, but it does what it's meant to. And it's anti cheat so far.

I feel so proud of myself so far, to have coded all this. I'm only a beginner when it comes to scripting. These codes are the first I've built on my own. Even when stuck, and I ask for help from people who know more then me, they don't end up fixing the problem, I end up fixing it on my own XD
Reply With Quote
  #8  
Old 08-04-2010, 09:33 AM
fadillzzz fadillzzz is offline
Dev Staff
 
Join Date: Jan 2010
Posts: 501
Gender: Male
Credits: 32,503
fadillzzz is an unknown quantity at this point
Default RE: Sea's Cash mod addons [released]

Sounds awesome! Please share your script :D
If I were you, I'd be proud of myself too!
Reply With Quote
  #9  
Old 08-08-2010, 05:11 PM
redheadturkey redheadturkey is offline
Senior Member
 
Join Date: Jan 2010
Posts: 136
Gender: Female
Credits: 10,079
redheadturkey is on a distinguished road
Default RE: Sea's Cash mod addons [released]

would LOVE to get the shop script!! thank you!!!
Reply With Quote
  #10  
Old 08-09-2010, 05:40 AM
MikiHeart's Avatar
MikiHeart MikiHeart is offline
Premium Member
 
Join Date: Apr 2009
Posts: 187
Gender: Female
Credits: 20,328
MikiHeart
Default RE: Sea's Cash mod addons [released]

I'll post up the shop script when I'm done with some work I've got to do.
You'll have to make it suit your own needs, make your own items and functions for it.
If you'd like me to customize it, and change it to suit your needs you'll have to commission me.^^ (fair enough request I think D=)
Reply With Quote
Reply

Thread Tools
Display Modes

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
Convert Mys v1.1.x Addons/mods to Mys v1.2.x? Hall of Famer Mys v1.2.x Mods 11 05-30-2011 12:22 AM
Trade System[Released] Hall of Famer Mys v1.1.x Mods 4 01-02-2011 04:32 AM
MyBB 1.4.11 released! God of Webmasters Area 0 12-30-2009 01:50 AM
Buying 'cash' with cash? Quillink Questions and Supports 4 07-20-2009 03:21 AM


All times are GMT -5. The time now is 11:20 AM.

Currently Active Users: 459 (0 members and 459 guests)
Threads: 4,080, Posts: 32,024, 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