SFEBlackJack Copyright 2003, Kristina Pfaff-Harris (http://tesol.net/scripts/) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Contents of this file: Program Summary Known Problems with SFEBlackJack Copyright & Licensing Information Legal Notice & Disclaimer Getting Started with SFEBlackJack Setting up Files, Directories, and Permissions What to Do About Problems Other Scripts =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Program Summary: SFEBlackJack lets you set up a fun little Blackjack game on your website. Players start out with 100 credits, and when they've lost it all, the game gives them another 100 so they can start all over again. This is meant to be just a fun time-waster: it is not set up in any way to use actual money. It uses cookies to keep track of users' money and cards, so they can go away and come back (theoretically) to take up where they've left off. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Known problems with SFEBlackJack: I suspect that there may still be some problems scoring correctly when aces are involved. :-) Please email me if you notice strange things of this nature. The game is only set up to let the dealer draw a max of 4 cards once you decide to stand. It's possible that more would be required. I haven't seen this happen yet, but it could. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Licensing & Copyright Information: The Licensing terms and conditions are listed within the sfeblackjack.cgi program itself. This program is Copyright 2003, Kristina L. Pfaff-Harris. All rights reserved. You may use this program free of charge provided you agree to the License agreement contained within the program. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Legal Notice & Disclaimer: This program is offered as-is and no warranty is given, either express or implied. By downloading, modifying, copying, viewing, or using this program, you agree that neither the author of this program nor the owners or administrators of the site from which you downloaded this program are liable for any breach of security, damage or loss caused directly or indirectly by the use of this program, and that any such breaches, damage or loss is the sole responsibility of the person who downloads, modifies, copies, views, or uses this program. The author has attempted to make this program as bug-free and secure as possible, but there is always the possibility of something being overlooked, hence the author disclaims any responsibility for problems incurred in the use of this program. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Getting Started with SFEBlackJack: This assumes that you have permission to execute cgi programs on your server, and that you know where the programs have to go. Sometimes, a web server is set up so that all cgi programs must be in a single directory (usually /cgi-bin). If you don't know whether or not you have permission to do this, or if you don't know where the programs must go, ask the technical support people for your website. You'll need to modify sfeblackjack.cgi slightly for use on your own site. Open this file in a plain text editor such as Notepad, BBEdit, Pico, etc. You may also use an editor such as Microsoft Word or Wordpad, but if you do, make SURE to save the file as plain text, or it will break. sfeblackjack.cgi: There are a few places in this file that you will need to change. All of the instructions for changing them are located in the file itself and marked with **CHANGE** so that you can find them easily. Please be very careful when you make your changes. If you accidentally leave out a " or a ; or forget to put \ (backslashes) in the right place, the program will not run. If you have problems after you make your changes, please check very carefully the changes you've made. Once you've made these changes, you're ready to start uploading stuff to your website. This is how I suggest you install the script. 1. Make a directory on your website called "blackjack_images". Chmod it 755, and upload all the .gif files that came with this program into that directory. (There should be 8 of these .gif files.) Make sure you have set $image_url in the script to the URL of this directory. E.g: http://www.your.site/blackjack_images/ . 2. Make another directory on your website called "blackjack_files". Chmod it 777. You will not be uploading any files into that directory: this will be used for $basedir in the script, and the script will create its data files there. Make sure you have set $basedir in the script to the full system path to this directory. 3. Upload sfeblackjack.cgi to your cgi-bin (or whatever place you need to upload CGI scripts in order for them to be able to run). Chmod it 755. Now you're ready to begin playing blackjack! To start playing, just bring up a web browser and type: http://www.yoursite.com/sfeblackjack.cgi Where "www.yoursite.com/sfeblackjack.cgi" means the actual web address of where your sfeblackjack.cgi program is. If all has gone well, it will show you the game screen, and you're good to go! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Setting up Files, Directories, and Permissions SFEBlackJack needs to be able to create and modify files on your server. One of the main problems usually encountered in setting up SFEBlackJack is figuring out what "$basedir" is supposed to be. Here's what I suggest. Usually, user accounts have a folder or directory structure something like this: /home/users/yourname/public_html or /home/users/yourname/WWW Or something like that. (IMPORTANT: If you are on a Windows-type system (Windows 95, 98, NT) then the folder or directory structure will be something like "C:/users/yourname" -- In other words, it's pretty much the same but must start with the drive letter and a colon, rather than a "/". ) The "/home/users/yourname" part is known as your "home directory" and the "public_html" or "WWW" part is known as your "Document Root" or "web root". Basically, people on the web can see things in your web root, but they can't see things in just your base home directory because it is "outside" your web root. Stay with me now! For security reasons, it is best to have SFEBlackJack create its files and so forth OUTSIDE your web root. This is so that people can't just pull up the card and credit files from the web. If your scripts do not run suid (ask your local tech support people if your CGI scripts run suid), then you should make a folder outside your web root and call it "blackjack" or something similar. Now, you should have a directory like this: /home/users/yourname/blackjack Chmod that directory 777 (world read/write/execute), and, in sfeblackjack.cgi, where is asks you to set "$basedir," make it: $basedir = "/home/users/yourname/blackjack"; Please note that when I say "/home/users/yourname" I am speaking of your "home directory" as it is known to the tech folks. If you ask your tech support people "What is the full system path to my home directory?" then they should be able to tell you. Sometimes this might be something like "/var/opt/web/data/yourlogin" or something totally different. You've got to get this information from the people who run the server where your website is. Now, on some web servers, all of your files are in your web root, and there's no way to get out of it. If this is the case, there may be hope. Sometimes, your cgi-bin directory (if you have one) will refuse to show the contents of files to people unless they're actually CGI scripts. If this is the case, find your cgi-bin directory, and make a folder in there called "blackjack", and chmod it 777 (world read/write/execute). In sfeblackjack.cgi, where it asks you to set "$basedir", make it: $basedir = "/path/to/your/cgi-bin/blackjack"; All in all, it really doesn't matter where you put your directory for the SFEBlackJack files. However, it must be writeable by the web server, so this is often the way you have to do it. Note that *nothing* on the web is truly secure, so please take this with a grain of salt. Someone who is determined to get at the files probably can -- this will just make it a tiny bit harder. Not that it matters much, because, after all, this game is for fun only, right? :-) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= What to Do About Problems: A few notes: If bringing up the sfeblackjack.cgi in your browser gives you an error (especially "Internal Server Error"), here are a few things to check: 1. Did you ftp the file in ascii mode? You must ftp cgi programs in perl in ascii mode or they won't work. 2. Did you change the permissions of the sfeblackjack.cgi program to be 755 (On some programs you need to click "read" and "execute" for the file to do the same thing.)? 3. Is the path to perl with the #! on the very, very first line of the file? Sometimes this is tricky to tell, but there cannot be even a single blank line before #!/usr/bin/perl and the top of the file or it won't work. 4. In the sfeblackjack.cgi program, did you leave out a " or a ;, or did you use "" when it says to use ''? 5. Did you check the FAQ at http://tesol.net/scripts/FAQ/ for the most common problems? Your issue may already be covered there! IMPORTANT: If you contact me with a problem about this program, you MUST give me as much information as possible. Please include: The name of this program. (I have several programs on this website, so if you email me saying "The program doesn't work" I won't know what you're talking about.) The version of this program. (This is SFEBlackJack version 1.0.2). The error message you got. The location of where you have set up the script on your websie so I can take a look at it. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Other Scripts: If you like this program, try some of the other CGI scripts available at Kristina's Scripts for Educators: http://www.tesol.net/scripts/ Currently available are: AddrBook: A simple web-based address book CGI-Subscribe: An email mailing list manager Chat-N-Time: Real-time web-based chat CrosswordMaker: A tool to create and grade HTML crossword puzzles AutoCGIMail: Simple CGI Email form and program MakeBook: A guestbook/ongoing story program. Quadratic-O-Matic: A simple quadratic equation solver QuizTest: Offer multiple-choice/true-false quizzes RandomQuiz: Generates quizzes with randomly selected questions RemindMe: An email auto-reminder service SFESurvey: Another survey/quiz generator. SillySearch: Let people search for pages on your website SillyCount: Let's you create a web-page counter. SillySite: A simple web-page creation program VeryInteresting: Loan Interest calculator and amortization table generator VocabSearch: Create and search a list of vocabulary words Votesie: Online voting booth/Poll generator =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Thanks for using SFEBlackJack! =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=