CraigF Posted February 7, 2007 Posted February 7, 2007 I have been on DBS for about 5 days now and i have got a few mods off here, and i have never coded before, but today i have been looking at the codes, and editing a few, and i decided to test my new skill. so decided to make a "send crystals" mod. so here it is, tested and working!!! made by me using the "sendcash" mod from dabomstew! make a new called "sendcrystals.php" and put the code as: <?php session_start(); require "global_func.php"; if($_SESSION['loggedin']==0) { header("Location: login.php");exit; } $userid=$_SESSION['userid']; require "header.php"; $h = new headers; $h->startheaders(); include "mysql.php"; global $c; $is=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid=$userid",$c) or die(mysql_error()); $ir=mysql_fetch_array($is); check_level(); $fm=money_formatter($ir['money']); $cm=money_formatter($ir['crystals'],''); $lv=date('F j, Y, g:i a',$ir['laston']); $h->userdata($ir,$lv,$fm,$cm); $h->menuarea(); $_GET['ID'] = abs((int) $_GET['ID']); $_POST['crystals'] = abs((int) $_POST['crystals']); if(!((int)$_GET['ID'])) { print "Invalid User ID"; } else if($_GET['ID'] == $userid) { print "Haha, what does sending crystals to yourself do anyway?"; } else { if((int) $_POST['crystals']) { if($_POST['crystals'] > $ir['crystals']) { print "You dont have that many crystals!"; } else { mysql_query("UPDATE users SET crystals=crystals-{$_POST['crystals']} WHERE userid=$userid",$c); mysql_query("UPDATE users SET crystals=crystals+{$_POST['crystals']} WHERE userid={$_GET['ID']}",$c); print "You sent {$_POST['crystals']} crystals to ID {$_GET['ID']}."; event_add($_GET['ID'],"You received \${$_POST['crystals']} from {$ir['username']}.",$c); $it=mysql_query("SELECT u.*,us.* FROM users u LEFT JOIN userstats us ON u.userid=us.userid WHERE u.userid={$_GET['ID']}",$c) or die(mysql_error()); $er=mysql_fetch_array($it); mysql_query("INSERT INTO cashxferlogs VALUES ('', $userid, {$_GET['ID']}, {$_POST['money']}, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}')",$c); } } else { print " Sending Crystals You are sending crystals to ID: {$_GET['ID']}. Amnt: "; print " Latest 5 Transfers Time User From User To Amount $q=mysql_query("SELECT cx.*,u1.username as sender, u2.username as sent FROM cashxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5",$c) or die(mysql_error()." "."SELECT cx.*,u1.username as sender, u2.username as sent FROM cashxferlogs cx LEFT JOIN users u1 ON cx.cxFROM=u1.userid LEFT JOIN users u2 ON cx.cxTO=u2.userid WHERE cx.cxFROM=$userid ORDER BY cx.cxTIME DESC LIMIT 5"); while($r=mysql_fetch_array($q)) { if($r['cxFROMIP'] == $r['cxTOIP']) { $m="MULTI"; } else { $m=""; } print "" . date("F j, Y, g:i:s a",$r['cxTIME']) . "{$r['sender']} [{$r['cxFROM']}] {$r['sent']} [{$r['cxTO']}] \${$r['cxAMOUNT']} "; } print ""; } } $h->endpage(); ?> Next - Open "viewuser.php" and find: [Send Cash] (for me its line 128) after you found that, paste below it: [Send Crystals] save and upload them and your done!!! Quote
lem0n Posted February 7, 2007 Posted February 7, 2007 Re: Send Crystals FREE!! already had but well done for doing it :D Quote
CraigF Posted February 7, 2007 Author Posted February 7, 2007 Re: Send Crystals FREE!! hehe, but was it posted? Quote
CraigF Posted February 8, 2007 Author Posted February 8, 2007 Re: Send Crystals FREE!! yeah but i dont know how to do that as i just started, thanks =D Quote
CraigF Posted February 8, 2007 Author Posted February 8, 2007 Re: Send Crystals FREE!! i wont know how to use them though mate, your a good guy! Quote
Raptor_Jesus Posted February 8, 2007 Posted February 8, 2007 Re: Send Crystals FREE!! Works beautifully Quote
CraigF Posted February 9, 2007 Author Posted February 9, 2007 Re: Send Crystals FREE!! ty $hot! i know i did this but i used Dabonstews code first and then DaKing has done something not using my code but he still did something lol! =D this is a good community! Quote
CraigF Posted February 9, 2007 Author Posted February 9, 2007 Re: Send Crystals FREE!! sorry, NOOB QUESTION: where do i put: CREATE TABLE `cryxferlogs` ( `crID` int(11) NOT NULL auto_increment, `crFROM` int(11) NOT NULL default '0', `crTO` int(11) NOT NULL default '0', `crAMOUNT` int(11) NOT NULL default '0', `crTIME` int(11) NOT NULL default '0', `crFROMIP` varchar(15) NOT NULL default '127.0.0.1', `crTOIP` varchar(15) NOT NULL default '127.0.0.1', `crCONTENT` longtext NOT NULL, PRIMARY KEY (`crID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; If i dont get told, i cant learn =D Quote
UCC Posted February 9, 2007 Posted February 9, 2007 Re: Send Crystals FREE!! If i dont get told, i cant learn =D That's your problem right there. *sigh* Enter it in your database as an SQL query. Quote
Phases Posted February 10, 2007 Posted February 10, 2007 Re: Send Crystals FREE!! Maybe that was a poor choice of words... How about: If I don't ask questions, I might end up taking longer to find the answer. http://www.mysql.com or http://www.mysql.org http://www.phpmyadmin.net To answer this piece of your question... You need to use a MySQL client to create your tables. Your host should have provided you with some sort of tool to do it... phpMyAdmin being the most common. If not - you can find a nice *safe* directory and upload phpMyAdmin yourself, configure it to connect to your database and then voila! Once you either get the command line (should you have shell to your host) or the phpMyAdmin up and running... you simply need to look around for how to execute a SQL command. Quote
CraigF Posted February 10, 2007 Author Posted February 10, 2007 Re: Send Crystals FREE!! How about: If I don't ask questions, I might end up taking longer to find the answer. that is more like the right words i should of said! I see it more as a "If i cant be bothered to spend time struggling and learn, I get told" I could be bothered but i had lots of work to do to try and i believe its easier for people to inform me because it doesnt cost them to help me! lol thanks guys, I have PHPMYADMIN on my host =Di have entered it where the cashxferlogs are in it. but wen i send my crystals it doesnt go into the logs, same when i send cash! Quote
CraigF Posted February 10, 2007 Author Posted February 10, 2007 Re: Send Crystals FREE!! 1.1 :-) it should work then, but it doesnt, thanks for your help i think i should leave it Quote
CraigF Posted February 11, 2007 Author Posted February 11, 2007 Re: Send Crystals FREE!! its all good, thanks, but in the code you should atleast put "made by kraig AND $hot" Quote
CraigF Posted February 11, 2007 Author Posted February 11, 2007 Re: Send Crystals FREE!! :mrgreen: hehe, well thanks anyway, i added you =D Quote
oxidati0n Posted June 9, 2007 Posted June 9, 2007 Re: Send Crystals FREE!! ty $hot! i know i did this but i used Dabonstews code first and then DaKing has done something not using my code but he still did something lol! =D this is a good community! $hot and DaKing ??? None existant ?? lol Quote
CraigF Posted June 9, 2007 Author Posted June 9, 2007 Re: Send Crystals FREE!! ty $hot! i know i did this but i used Dabonstews code first and then DaKing has done something not using my code but he still did something lol! =D this is a good community! $hot and DaKing ??? None existant ?? lol they used to be Quote
Decepti0n Posted June 9, 2007 Posted June 9, 2007 Re: [mccode] Send Crystals No, $hot! Your other account, remember? Quote
CraigF Posted June 9, 2007 Author Posted June 9, 2007 Re: [mccode] Send Crystals me? i wasnt $hot! Quote
yaz123 Posted November 23, 2008 Posted November 23, 2008 Re: [mccode] Send Crystals I am sure that this comes with MCCODES.. Quote
ShadyNova Posted November 28, 2008 Posted November 28, 2008 Re: [mccode] Send Crystals ok i added this and i get an error when im trying to look at the log in the admin panel error: Fatal error: Call to undefined function view_cry_logs() in /home/life/public_html/admin.php on line 86 in admin.php line: case 'crylogs': view_cry_logs(); break; Quote
ShadyNova Posted November 30, 2008 Posted November 30, 2008 Re: [mccode] Send Crystals ok i added this and i get an error when im trying to look at the log in the admin panel error: Fatal error: Call to undefined function view_cry_logs() in /home/life/public_html/admin.php on line 86 in admin.php line: case 'crylogs': view_cry_logs(); break; yes i have the same prob anyone got any ideas to why??? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.