Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
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 // ********************************************************************** ?> 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 // ********************************************************************** ?> 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... 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>"; } 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; |
|
|
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 01:22 AM |
Trade System[Released] | Hall of Famer | Mys v1.1.x Mods | 4 | 01-02-2011 05:32 AM |
MyBB 1.4.11 released! | God of | Webmasters Area | 0 | 12-30-2009 02:50 AM |
Buying 'cash' with cash? | Quillink | Questions and Supports | 4 | 07-20-2009 04:21 AM |
What's New? |
What's Hot? |
What's Popular? |