These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
12Next page
 

EVE lottery or not lottery framework (Opensource)

Author
NickyYo
modro
The Initiative.
#1 - 2012-05-22 02:23:33 UTC  |  Edited by: NickyYo
Want to make a lottery website?
Want users to have an online balance?
Want the site to update all balances every 15-30 minutes?
Want total control over the design and feel?

Look no further than here, i present the EVE lottery framework.

Features

  • Automated IGB trust functionality
  • Ingame registration
  • Once registered ingame you can login out of game
  • Users will recieve online balances
  • Ingame deposits are tracked and updated out of game on the site via the EVE API KEY
  • Database & api Class coded up, easy to setup and modify
  • Semantic XHTML coded, minimal styling so you can do the fun part :)
  • More to come! it's in early stages..


The code

  • PHP (OOP)
  • Database class with instructions
  • API class and more
  • MySQL
  • JavaScript
  • Eve API key & XML
  • CronJob
  • Semantic XHTML Strict! coded


So what is all this?
This was orginally coded for personel use, but will now be shared. This is the basic code needed to have a functional lottery website. Your users will register ingame and all their isk deposits to your corp wallet will be updated to their balances on the website. With a simple setup proccess and a diagram on how it all works you can be confident to get rolling in no time and to make any changes you feel necessary.

You can download the zip file here: https://github.com/NickyYo/EveOnline-web-framework

Here is a proccess diagram on how the automated ingame registration works without the need of a browser refresh. https://github.com/NickyYo/EveOnline-web-framework/blob/master/howTheRegistrationWorks.png

You have the basis, now just expand.
If you need any help with, just ask.

P.S i am new to GitHub advice is welcome! :)

..

NickyYo
modro
The Initiative.
#2 - 2012-05-26 01:11:51 UTC
Anyone got any feedback on this please?

..

Dragonaire
Here there be Dragons
#3 - 2012-05-26 17:36:49 UTC
I haven't tried it out but I've looked at the code a little and it looks clean and seems to be a good base that could be built on anyway. I'll try it out when I find some time Blink

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

MJ Maverick
Hybrid Industrial
The Curatores Veritatis Auxiliary
#4 - 2012-05-26 23:59:56 UTC
This sounds really promising! Perhaps pop up some example screen shots of the admin side and the UI?
alittlebirdy
All Hail The Liopleurodon
#5 - 2012-05-27 06:12:35 UTC
This guy says he is quitting eve I would not depend on anything this poster has.
NickyYo
modro
The Initiative.
#6 - 2012-05-27 12:22:06 UTC  |  Edited by: NickyYo
alittlebirdy wrote:
This guy says he is quitting eve I would not depend on anything this poster has.


Thanks for the post, i made this for personal use. What is wrong with giving it away? It's not a CMS but is a very basic frame to have an api powered lottery website.

It could also be used for a corp bank application or something.

..

Line Ghost
School of Applied Knowledge
Caldari State
#7 - 2012-05-27 15:41:38 UTC  |  Edited by: Line Ghost
I read this code. It certainly helped me get a good grasp on how one might approach such an application, and owing to it's simplicity, it served as a good learning tool that way.

However, personally, I wouldn't use it in a production environment. There isn't any abstraction between presentation code and server logic, so it's not terribly maintainable/customisable, and, for example, multiple redundant calls are made to mysql_connect etc when reinstantiating the database object, which sometimes happens several times per request.
NickyYo
modro
The Initiative.
#8 - 2012-05-27 16:29:31 UTC
Line Ghost wrote:
I read this code. It certainly helped me get a good grasp on how one might approach such an application, and owing to it's simplicity, it served as a good learning tool that way.

However, personally, I wouldn't use it in a production environment. There isn't any abstraction between presentation code and server logic, so it's not terribly maintainable/customisable, and, for example, multiple redundant calls are made to mysql_connect etc when reinstantiating the database object, which sometimes happens several times per request.


Thanks for the reply and reading throught the code, and awesome debugging there, learn something new everyday :) i will check the classes for redundant calls and will try to correct it.

This code was just lying around so i thought i would get some experience from sharing it.
I'm tempted to expand it so users can register out of game with api keys and add some sort of social commenting functions to it and also possible something similiar to mining buddy; what advice would you give to that idea?

..

NickyYo
modro
The Initiative.
#9 - 2012-05-27 16:31:40 UTC
-

..

MJ Maverick
Hybrid Industrial
The Curatores Veritatis Auxiliary
#10 - 2012-05-27 17:24:43 UTC
I was going to try and use this as a tax monitoring tool but I can't work it out.

There isn't an admin panel to monitor the wallet tax (or lottery) is being paid to. Also in game registration being forced is redundant as headers can easily be hoaxed and all the information you need can be dragged through a users API key (with access mask 0).

Not actually sure how this works at all lol :P Perhaps a readme/guide is in order?
Grauth Thorner
Vicious Trading Company
#11 - 2012-05-28 15:46:24 UTC
MJ Maverick wrote:
Not actually sure how this works at all lol :P Perhaps a readme/guide is in order?


There is a small readme in the framework folder - no idea if this contains enough information for you though =)

Grauth Thorner

View real-time damage statistics in-game

>EVE Live DPS Graph application forum thread

>iciclesoft.com

Johnny May
Terrorists of Dimensions
HORSE-KILLERS
#12 - 2012-05-29 06:35:04 UTC
clean?
roflmao.

if it was clean it would not need to turn of errors (ini_set( "display_errors", 0);)
or add error suppression(@) at several spots.

Also, mixing up PHP and HTML in the same files is considered far from clean,
it at least could use a template system.

includes in the constructor of a method class? seriously? ******* up opcode caches ftw.

the prepareString of the database class does not properly sanitize users input (no addslashes and htmlspecialchars won't do), so there are sql injection vectors on this.

and isn't it just lovely how the dumpUsers.php script allows everyone to copy and run with the complete user database?


@OP: don't be scared away, lookup the things i just mentioned on the net, you might learn something

@Dragonaire: clean, rofl. idiot.

NickyYo
modro
The Initiative.
#13 - 2012-05-29 17:30:59 UTC  |  Edited by: NickyYo
Johnny May wrote:
clean?
roflmao.

if it was clean it would not need to turn of errors (ini_set( "display_errors", 0);)
or add error suppression(@) at several spots.

Also, mixing up PHP and HTML in the same files is considered far from clean,
it at least could use a template system.

includes in the constructor of a method class? seriously? ******* up opcode caches ftw.

the prepareString of the database class does not properly sanitize users input (no addslashes and htmlspecialchars won't do), so there are sql injection vectors on this.

and isn't it just lovely how the dumpUsers.php script allows everyone to copy and run with the complete user database?


@OP: don't be scared away, lookup the things i just mentioned on the net, you might learn something

@Dragonaire: clean, rofl. idiot.




I didn't release it to be perfect, like i said it was some code lying around and i thought i would share it.

..

NickyYo
modro
The Initiative.
#14 - 2012-05-29 21:39:38 UTC  |  Edited by: NickyYo
The HTML and PHP are seperate.. the only part that isn't is the pages that require the user to be logged in, and those pages simply call a php class to define a logged in instance.

dumpUsers.php is a test script to see how things are called from the database etc and to get an idea of the table layouts.. another reason is because there is no admin panel.

Yes the DB class does not have add slashes, but why don't you add that? its pretty simple to do. Or even better use REGEX aswel to validate.

Thanks for the reply, but most of what you said can simply be edited to your liking its not a complicated script setup.

Johnny May wrote:
includes in the constructor of a method class? seriously? ******* up opcode caches ftw.

Anyhows as for this, i guess i'll need to extend it from the db class? If not i'll check it out m8. thanks for the replies!

Thanks.

..

Dragonaire
Here there be Dragons
#15 - 2012-05-30 03:27:50 UTC
My comment on clean was two fold and I'll explain what I meant vs what Johnny May seems to think it does.
1. It's not sending a copy of your data some where else.
2. The code is nicely formated and the classes make sense.

If I'd said it was good solid code without error or bugs then you should laugh at me maybe Blink I do think as some others have pointed out it's a good place to start but I know I would make some changes before putting it on a live server myself but I'm glad to see someone actually put something out there so it can be peer reviewed and improved instead of the usual 'Give me X whatever and I'll make something for you'. From what I've heard from a couple people that has tried that route this code would have been an improvement over what they got.

What I would like to see happen is instead of just having a download is to have it hosted somewhere by the original author put it up on SourceForge, GitHub, or another public site like that so everyone can contribute to it more directly. I also don't remember seeing any kind of licensing like GPL etc being include with the code and that really would need to be cleared up before anyone could safely use it on their site as well.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Johnny May
Terrorists of Dimensions
HORSE-KILLERS
#16 - 2012-05-30 11:42:03 UTC  |  Edited by: Johnny May
NickyYo wrote:
The HTML and PHP are seperate.. the only part that isn't is the pages that require the user to be logged in, and those pages simply call a php class to define a logged in instance.

seriously, use a template system, and putting it in the same files is not separate at all.


NickyYo wrote:
dumpUsers.php is a test script to see how things are called from the database etc and to get an idea of the table layouts.. another reason is because there is no admin panel.

you should never have such testscript public available, you could have it require login or you could have denied access to it in your htaccess, or you could put it in a folder which requires http base login..

NickyYo wrote:

Yes the DB class does not have add slashes, but why don't you add that? its pretty simple to do. Or even better use REGEX aswel to validate.

this is not about regex or addslashes, neither of them work really safe. learn about prepared statements, since those are your safest bet with php+mysql.


NickyYo wrote:

Johnny May wrote:
includes in the constructor of a method class? seriously? ******* up opcode caches ftw.

Anyhows as for this, i guess i'll need to extend it from the db class? If not i'll check it out m8. thanks for the replies!
Thanks.

you could hand the information in it to the constructor of the class, you could have the class read a config file, you could go the ugly path by using defines in your config and including it before the class, you could inject it... there are a **** load of ways to solve this, that are better than what you are doing there.
Johnny May
Terrorists of Dimensions
HORSE-KILLERS
#17 - 2012-05-30 11:51:40 UTC
Dragonaire wrote:
My comment on clean was two fold and I'll explain what I meant vs what Johnny May seems to think it does.
1. It's not sending a copy of your data some where else.

no its offering them everyone who wants them to download.

Dragonaire wrote:

2. The code is nicely formated and the classes make sense.

simply not true, indent is ****** up on several places, it mixes html and php and its object orientation is very very rudimentary at best.


Dragonaire wrote:
If I'd said it was good solid code without error or bugs then you should laugh at me maybe Blink I do think as some others have pointed out it's a good place to start but I know I would make some changes before putting it on a live server myself but

"clean" and "good base" imply its solid code.


Dragonaire wrote:

I'm glad to see someone actually put something out there so it can be peer reviewed and improved instead of the usual 'Give me X whatever and I'll make something for you'. From what I've heard from a couple people that has tried that route this code would have been an improvement over what they got.

no one argues with it being a good move to publish it, but published code should always be reviewed critical and not "yay, random code". and just because people can make stuff worse that doesn't mean this is good.

Dragonaire wrote:

What I would like to see happen is instead of just having a download is to have it hosted somewhere by the original author put it up on SourceForge, GitHub, or another public site like that so everyone can contribute to it more directly. I also don't remember seeing any kind of licensing like GPL etc being include with the code and that really would need to be cleared up before anyone could safely use it on their site as well.

Putting his code to public domain without any license is a totally legit move, and personally i'd allways prefer that over the viral GPL.

The best way obviously would be a BSD style license, but you don't need to include a license of code that you hand to the public domain. Otherwise every little snipped code you'd give to anyone (hello world!) would need a license.
Dragonaire
Here there be Dragons
#18 - 2012-06-01 03:18:12 UTC
Quote:
Putting his code to public domain without any license is a totally legit move, and personally i'd allways prefer that over the viral GPL.

The best way obviously would be a BSD style license, but you don't need to include a license of code that you hand to the public domain. Otherwise every little snipped code you'd give to anyone (hello world!) would need a license.
Many countries in the world have laws that state if the owner doesn't declare something is public domain it isn't and you can't use it without permission. Creative Commons has some good information about how to do it correctly. BSD license is fine but GPL is better IMHO since it requires people to give back and not just take but that something every person has to decide for themselves when releasing code.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

Johnny May
Terrorists of Dimensions
HORSE-KILLERS
#19 - 2012-06-01 10:05:10 UTC
well, you can go ahead derail the thread about licenses to show off your "knowledge" about the subject to divert from other stupid stuff you said, i'm out of here.
Dragonaire
Here there be Dragons
#20 - 2012-06-02 02:49:26 UTC
Only one that was being stupid around here was you thinking you know everything and putting everyone else down.

Finds camping stations from the inside much easier. Designer of Yapeal for the Eve API. Check out the Yapeal PHP API Library thread.

12Next page