Web Hosting Talk







View Full Version : My latest project...


MGCJerry
05-23-2002, 03:51 PM
I have finally thought of a good project to work on, or I'm just over my head :D I'm wanting to learn more php/MySQL, and the only way I could to that is "hands on" so I thought of a project for me to do... And well.... Here it is below...

Extracted from: Personal Notes
I'm wanting to build a store, backend system, and a credit card processing system for my RPG website to allow my players to purchase items to help them in the game. I realize this isnt necessairly gonig to be a quick simple script, but it will get me going further in php/ MySQL if I work on a bigger project that I could use. I would like to start from scratch to build this script, but have some references in case I run accross a difficult problem.

I currently know:
if()
elseif()
rand()
srand()
date()
include()
variables
arithmetic operations
several others...

php MySQL functions:
db_connect()
db_select()
couple others...

MySQL functions:
select from
delete from
insert into
couple others...

After this is completed (if/when), I think it could push my abilites far enough to become a good beginner at php/MySQL programming and may just give me a little boost for something to do with my spare time and *maybe* get paid a little for some other php/MySQL smaller development.

I would like to construct this script alone (yup... Crazy, huh?) but get some advice here and there and some code snippets (watch out SourceForge), so expect sometime in the distant future to abuse my script to help test it :) and maybe offer suggestions. So... Who thinks I'm in over my head with this project :) ?


**********PROPOSED LAYOUT**********
I thought this out last night when I was showering. Since I crawled the Internet a looooooong time ago for such a script but never found one I recently remembered that php and MySQL could do what I want. Now that I have a grasp on php/MySQL I'd like to give it a try... Whuddya think?

PREFERRED LANGUAGE(S):
php and MySQL


GOAL:
To create a Credit Card like enviroment for my website where players can purchase items from the store using a special "Account" to mimic purchasing items with a credit card on the Internet.


PURPOSE:
This will give me a grasp in php/ MySQL programming using what I believe to be many simple php commands as a learning base and a functional example for future, larger, & complex scripts.


PROPOSED LAYOUT:
The Script should be *simple* yet secure and not require any other script to properly operate, but may be easily integrated as a module into a php/MySQL CMS or portal system such as phpNuke, Postnuke, etc. The proposed contents of the script is detailed below:

* Credit Card Number Database
This MySQL database will the the only necessary database for the entire sustem and will store the credit card holders name, ID number (assigned license number upon registering), MySQL UID number (auto increment), "bank", account number, status and balance. It may also have a table for approved Administrators to grant access to the Administration GUI.

* Bank GUI
This will allow players to do deposits, withdraws, etc. concerning their account (bank transactions from players will be verified by GM (Game Master) then "approved" and updated into the database (see Administration below).

* Administration GUI
This will allow the GM (Game Master) the facilities to create new accounts for users, process changes, and otherwise perform banker duties such as transfers, cancelling accounts, making mistakes ;) (to preserve a more "real" feeling to the game). This should allow almost all manipulation to all the fields to the Database without having to use an external or internal MySQL client (such as phpMyAdmin, or MySQL Front) to perform database maintence, and/or corrections. This section will also allow the GM to see what was bought, how many, by who, and where to send it to.

<edit>
Decided not to do a store from scratch, and to use an existing one.
</edit>

* Store Processor
This will allow the users to purchase items present in the store using their Credit Card assigned by the GM (Game Master). The Store Processor will automatically deduct from the balance from the users account providing they have the funds and provide the right credentials. If invalid credentials are used for a 3rd time, the Store Processor marks the account as stolen for the GM to look into. The Store Processor will also be required to give the player a receipt with a "transaction ID" and notify the GM of what has been ordered, how many, by who, and where to ship to.

End Personal Notes

Well.... who thinks I just sentenced myself to death? :D

My status so far: Not started yet :D still working out some "other" things...

DjPaj
05-23-2002, 04:00 PM
well good luck my friend, new journies are always fun...looks like we are switching places, as you responed to my last post, I am building a computer from scratch and you seem pretty knowledgable in that and I program daily in PHP/MySQL...

you may wanna get familiar with arrays in PHP they will be very helpful as with string manipulation and checking (ereg_replace, preg_replace etc....) this will help with forms and you are gonna need to look into a way with working with logins, as there are several ways cookies, sessions etc. Big thing is that you make sure you database is correct, you don't wanna realize when you are half way into coding that you're missing foreign and superkeys.

If you get stuck feel free to PM me and I'll be glad to assist ya.

Gadgy
05-23-2002, 04:02 PM
If you know the basics then you have a big start, I dont think your over your head at all. It may take you some time though. Does look like quite a fair bit of MySQL programming to plan out. May take some time if you want it completely done, but it will be worth it.

Yeah, its great fun playing ereg with a variable that holds a variable that holds an array!

My first script can parse a db of 10,000 site urls, filter the urls, then the words and produce to screen in under 3 seconds. Included in the scipt is logical php conditions to calculate amount of next pages, back and forward etc. Also included are various security filters and noise word system. Since writing that script a couple of years ago I shelved it, but now since I have learned many other php, mysql and most of all bash, I think I will soon take it out and make something similar, but with a spider in it. I would however build it very differently this time taking into account the various systems that can improve the efficiency and working of both MySQL and Php :D

Good luck to you! :D

MGCJerry
05-23-2002, 06:01 PM
*Crawls into the door covered in blood and riddled with bulltet holes dragging in a Flak Cannon*

Nothing like a nice 3hr game of Unreal. Wow... Too bad my enemies arent in such good shape that I am :D Oh... I don't think I need this anymore...

*tosses the Flak Cannon out into the street.*

Anyways... Thanks for the comments...

:homer: Doh, I knew I forgot to mention Arrays... Yes, I knew there was some more and thats one of the ones I didn't list. :)

But anyways, my first from scratch php script was a Child Roller (I posted a link here and its for a RPG) but I recently added a new feature to it, and commented on the code and made it partially skinnable. I updated it and it has an array of 130-140 boy names and 130-140 girl names, and even suggests names you can use for your living children. Its not live yet, but if anyone wants wants to take a look at it (see exactly what it does or peek at the code)

, I'll zip it up and post it here. The whole script is like 12KB. Isnt it great running a local webserver with php/MySQL installed :D

Hmm... Logins... Hmm..... I thought about using php session, or cookies for the script, but I heard cookies are a real bit** to mess with. I *should* use cookies, especially if the user is going to "buy" something.

With the database concern, I'm going to make the database (very simple one at that ;) ) and make a php page that can connect, select, edit, delete, & create entries into the database therefore I'll have a working sample to work off of. My first concern *is* the Database. What good will the script do if it cant use the database :ekk: ?

The good part is, I downloaded the php manual and so far has been the most useful documentation I ever downloaded so far.

Gadgy, that script sounds quite interesting indeed. That might with some work make a good search engine :) or a WHT hosting index engine :)

I dont think I messed with variables that holds another variable that holds an array...yet, but that sounds like something fun to try.

Well... Thanks for the comments everyone. Not sure when I'm going to start on it, but I'll prolly start in on it later tonight (when I fell like messing with php). I'm worknig on typing some logic for the script for certain situations.

Hopefully in the distant future I can give some of you good php/MySQL programmers a run for you're money :D Ok... prolly not... With my luck, by the time I get good at php/MySQL, there will be something new and improved.

Oh... heres the link to my first script... The Child Generator without the name suggestions...Link (http://2thextreme.org/2txbirth.php) Its a mean script, but Enjoy :)

Studio64
05-23-2002, 06:37 PM
All I have to say is good luck and say hello to my best friend caffiene for me...

MGCJerry
05-23-2002, 06:53 PM
Hehehehe...

Heres the sad part... Caffine does nothing for me, and neither does ephedrine. There are many other things that dont work on me (including some medications) and it kinda sucks :( However, straight Hersheys Syrup gives my about 3-5 mins of activeness.

MGCJerry
05-24-2002, 01:46 PM
After some consideration and thinking, I decided not to make a shopping cart... Afterall, thats going to be a lot of programming and will prolly take the bulk of the development time.

So... I got the processor, database, and the "banker" scripts to work on... Gee, this workload feels lighter already.

If anyone knows of a good open source php shopping cart, let me know. :) I currently have a custom shopping cart for phpnuke that someone made but it isnt finished yet, but its operational. :(

I just gotta figure out how to do the actual processor, and in the future I may need to make my own basic cart for it.

If anyone has some code for me to take a peek at, just holler :)

*wonders where the code snippets went on sourceforge*

Studio64
05-24-2002, 02:15 PM
Open Source PHP/MySQL Shopping Cart (http://theexchangeproject.org/)

I havn't had a real chance to dig through it yet but, it was just suggested to me by my hosting company after they decided to can Red Hat's Interchange Server (I think thats the name)..

So it's free... about 1.5+ Megs and open source... So you can play to your hearts content and also learn a little more about php.

MGCJerry
05-24-2002, 04:12 PM
Ohh... Thanks for the link Studio64. I'll definately take a look at it.

Hmm.... *gets another idea* maybe if I can get this cart up and running, I could just build my script off of this... *gets more ideas to "cut corners".*

Gadgy
05-24-2002, 05:43 PM
I had a quick look at your site, very cool. Sure I seen that theme before...

I couldnt see anything on your site to say so but my guess is you have a modified phpnuke?

I know that last year a kind Frenchman put together a shop that works well, I think it may have been taken as far as a paypal gateway or similar. As far as I know it was a module, about 6-7 months ago on the phpnuke.org site.

Might be worth a look for you.

MGCJerry
05-24-2002, 06:07 PM
Thanks for the comments on the site. Hmm... you seen that theme somewhere? Well... I made it available for download, and received some compliments on it.

Yup... If you look at "Stats" my phpnuke version is "5.5 hybrid". I went running around the code asking "whats this for? Do I need this?" with an itchy "delete key" finger ;)

The current script I got for phpnuke was created by someone who wrote thier own CMS. Their site is down now though, figures huh? Heres (http://www.wtdarkness.com) the link anyway if it ever goes back up. Good 3D modeller too :)

Looks like I gotta make another run to phpnuke's site to look for it.

Project Update:
I finished building the table for the users... I really hope it'll work. Then I'll have to make the admin table... That shouldnt be to hard. I have attached a screenshot. Any MySQL gurus think it'll work or see any problems with it? I have a local file that explains each part of the table.

<edit>
I noticed a problem in the database and had to fix it, but so far now, all the data is correct.

I removed the screenshot cause the db working to my satisfaction now. :)
</edit>