Jump to content
MakeWebGames

hamster01

Members
  • Posts

    1,108
  • Joined

  • Last visited

    Never

Everything posted by hamster01

  1. Re: No Database Selected I normally get that erro when i dont say what db i need. Or when the fields name is a function. in the query call it. ex: mysql_query("SELECT userid FROM dbname.tablename WHERE blah=$blah");
  2. Re: TwIsTeD WiShEs ! Granted, Everyone teases you.
  3. Re: Counting (nr game) 1221
  4. Re: Guess the next poster uhu.. kraig next?
  5. Re: FIRST THOUGH! electric
  6. Re: Extracting Images Nice tutorial, but i'm hopeless :(
  7. Re: Counting (nr game) 1217 skip the rest 1000000 :lol:
  8. In this tutorial you will learn how to: Make Cookies. Use Cookies. Check for of Cookies. Delete Cookies.   Remember: You cannot put Any html code before the code of the cookies! Firstly you must learn how to set a cookie. The order of it is: setcookie(name, value, expire);. example: $time = time(); $text = "This is what the cookie will hold"; setcookie(Name, $text, $time+3600); And that is how you set a cookie! Now to call a cookie to a script: You can use: echo "Your Cookies Value: ".$_COOKIE[Name]; That will then output: You can also use it to check for values. if (isset($_COOKIE[name])){ echo "You have a cookie!"; } else { echo "You have no cookies!"; } That will either return TRUE, if you have a cookie or FALSE if you dont. Now you know how to use cookies. Now onto deleting cookies. Its a good idea to check if there is a cookie first before deleting. Example: $time = time(); if (isset($_COOKIE[name])){ setcookie(Name, '', $time-3600); } else { echo "You have no cookies to delete!"; } It may look like we are making another cookie, but we are just adjusting to cookie to expire immediately! You just you - to set the cookie back to expire. Now we will make a test script using what you have just learned. We open the script and then check if the form is posted. if the post is "Submit" create a cookie, else if the post is "Reset" be delete it. <?php if ($_POST['Submit']){ setcookie(id,'kis works',time()+3600); echo "Cookie Made!"; } if ($_POST['Reset']){ if (isset($_COOKIE[id])){ setcookie(id,'',time()-3600); echo "Deleted!"; } else { echo "You have no such cookie to delete!"; } } Now we will make a form with two buttons. echo " "; Now we will display the cookie's value if it exists. echo "Previous Attempts: "; if (isset($_COOKIE[id])){ echo $_COOKIE[id]; } else { echo "None"; } Now we close the script. ?> You now know how to make, use and delete cookies! The complete script: <?php /* >> Basic Cookies Tutorial */ if ($_POST['Submit']){ setcookie(id,'kis works',time()+3600); echo "Cookie Made!"; } if ($_POST['Reset']){ if (isset($_COOKIE[id])){ setcookie(id,'',time()-3600); echo "Deleted!"; } else { echo "You have no such cookie to delete!"; } } echo " "; echo "Previous Attempts: "; if (isset($_COOKIE[id])){ echo $_COOKIE[id]; } else { echo "None"; } ?>   Hope This Helps some people. :wink:
  9. Re: Guess the next poster you are a llama. I have two llamas now (haha):lol: Scarlet next.
  10. Re: Guess the next poster noo llama llama or a duck is going to post next ;)
  11. Re: THIS OR THAT? markers :| Hamburger or pizza?
  12. hamster01

    When posting

    Re: When posting hmm..., Ill think about that.. :lol:
  13. hamster01

    When posting

    Re: When posting True, so just comment with your opinion? So you tell them you personaly think its (say like)live less, and then tell them why?
  14. Re: Ruby Trader Mod FREE!!! V2 Nice modification ;) I'll just have to convert it to use..
  15. Re: Send Money -- Mc Lite Try this:   <?php /* MCCodes Lite sendcash.php Rev 1.0.0 Copyright (C) 2006 Dabomstew This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 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['money'] = make_bigint($_POST['money']); //The limit one the amount of money they can send. $max['send'] = 1000000; // 1 million if($ir['jail'] || $ir['hospital']) { die("This page cannot be accessed while in jail or hospital."); } //user not older than 5 days cannot send money if ($ir['daysold'] < 5){ echo "You must be 5 days or older to send money!"; exit; $h->endpage(); } if(!((int)$_GET['ID'])) { print "Invalid User ID"; } else if(isset($_GET['ID']) == $userid) { print "Haha, what does sending money to yourself do anyway?"; } else { if((int) $_POST['money']) { $money = mysql_real_escape_string($_POST['money']); if (isset($money) > $max['money']){ echo "You are not allowed to send more than 1000000."; exit; $h->endpage(); } if(isset($money) > $ir['money']) { print "Die j00 abuser."; } else { mysql_query("UPDATE users SET money=money-'$money' WHERE userid=$userid",$c); mysql_query("UPDATE users SET money=money+'$money' WHERE userid={$_GET['ID']}",$c); print "You sent \${$_POST['money']} to ID {$_GET['ID']}."; event_add($_GET['ID'],"You received \$$money 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']}, $money, unix_timestamp(), '{$ir['lastip']}', '{$er['lastip']}','')",$c); } } else { print "<h3> Sending Money</h3> You are sending money to ID: [b]{$_GET['ID']}[/b]. <form action='sendcash.php?ID={$_GET['ID']}' method='post'> Amnt: <input type='text' name='money' /> <input type='submit' value='Send' /></form>"; print "<h3>Latest 5 Transfers</h3> <table width=75% border=2> <tr style='background:gray'> <th>Time</th> <th>User From</th> <th>User To</th> <th>Amount</th> </tr>"; $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="<span style='color:red;font-weight:800'>MULTI</span>"; } else { $m=""; } print "<tr> <td>" . date("F j, Y, g:i:s a",$r['cxTIME']) . "</td><td>{$r['sender']} [{$r['cxFROM']}] </td><td>{$r['sent']} [{$r['cxTO']}] </td> <td> \${$r['cxAMOUNT']}</td> </tr>"; } print "</table>"; } } $h->endpage(); ?>
  16. hamster01

    When posting

    Re: When posting Would or Would not? So this means you may not give an opinion to someone, and then along the line the get imbaresed because everyone said their "work" is good? I feel we have to express our opinions, so that people can: 1) Learn from their mistakes. 2) Not think they are the best, theres always someone better than you.
  17. Re: Counting (nr game) 1213
  18. Re: 3 Word Game that looked like
  19. Re: Installing Resources Yes, but.. nvm. (I wanted to say more people use ps on windows) True
  20. Re: Guess the next poster yep How about Scarlet next?
  21. Re: 3 Word Game but he was
  22. Re: THIS OR THAT? I-pod. Xbox or PS3?
  23. Re: Counting (nr game) 1211 8)
  24. Re: Dutch - Nederlands Ill speak afrikaans for you, as i dont know dutch ;) Sien, Nie so erg nie. Hoop jy kan hierdie lees :/
  25. Re: Installing Resources   Its called "Program Files" start>run: cd ../../ cd Program Files/Adobe/PhotoShop CS2 ;)
×
×
  • Create New...