Jump to content
MakeWebGames

Investment Bank


wrux

Recommended Posts

I've had a go at creating an app for mccodes and it's just a simple investment bank but I guess it's a start. I know it's not very imaginative, but I guess it's better than nothing. First off, i'm not sure what kind of APIs people have created, but I wrote a super simple flash message class just incase people don't have one already.

[ATTACH=CONFIG]1398[/ATTACH][ATTACH=CONFIG]1399[/ATTACH][ATTACH=CONFIG]1400[/ATTACH][ATTACH=CONFIG]1401[/ATTACH]

Ok so first of all, this requires at least PHP 5.3 and it requires you to change the DB engine for the users table, nothing to bad, it may cause some problems if you don't do this.

So heres the SQL to run:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

If you wish to use the flash message class then add this somewhere in global_func.php. It's nothing complex (DRY and all that jazz though?) and i'm sure the use of __toString() is incorrect, but it's just a shortcut.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Then if you open up globals.php; right AFTER require "global_func.php"; add this line:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

Somewhere in your template, you'd now want to display the messages so add this section:

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

And finally, heres the investmentbank.php code you need to add:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

 

One thing to note is the lack of ORM and if somebody has written a decent ORM for mccodes then i'd be happy to update my code, but for now I just used super old code which works, but it's not ideal.

ID-not-finished.png.d3acf950e7519a40d662d7ae3ae37ed4.png

ID-invest.png.0e6dfdef674860962d5249c4751621e4.png

IB-withdraw.png.be2b24bf9aa8a717db14e7c56f23dfd2.png

IB-finished.png.b1fc298f7134c18e8419d14e5fdf8bc9.png

Link to comment
Share on other sites

You half use MCC and half not, you may want to look into the database class a little more, work a little on those nested ifs, but other than nice nice to see some OO stuff

Link to comment
Share on other sites

You half use MCC and half not, you may want to look into the database class a little more, work a little on those nested ifs, but other than nice nice to see some OO stuff

Yea I looked at the DB API but it sucked so I just used the mysql commands directly which is kinda bad but I guess I could update it

Link to comment
Share on other sites

Yea I looked at the DB API but it sucked so I just used the mysql commands directly which is kinda bad but I guess I could update it

Mysql_* is the worst, whether it sucks or not, using native methods is so much easier in the long run, mysql_* is also depreciated.

Personal preference but I am totally against those if statements if : endif: it just looks horrible imo

Link to comment
Share on other sites

Mysql_* is the worst, whether it sucks or not, using native methods is so much easier in the long run, mysql_* is also depreciated.

Personal preference but I am totally against those if statements if : endif: it just looks horrible imo

Ahh, the alternative syntax is just more human readable so good for the template section

Link to comment
Share on other sites

Ahh, the alternative syntax is just more human readable so good for the template section

I have just updated my local code so that the database calls now use the procedural mysqli class. The only issue is that this requires an additional DB connection as not all of the website uses this. I'll post it anyway:

In your globals you'd need to setup a MySQLi object called $mysqli first.

 

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

No matter what you think of the default mysql*_ class you should still use it just to be consistent with the engine. Some people dont know how to create class objects, methods, etc. The more "talented" people can rip your stuff apart and use their own way of db communications.

So for the people that like to keep everything consistent I went ahead and converted it for ya:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Or for the people that really want to use this the way it is:

Add to globals.php/globals_nonauth.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

Link to comment
Share on other sites

No matter what you think of the default mysql*_ class you should still use it just to be consistent with the engine. Some people dont know how to create class objects, methods, etc. The more "talented" people can rip your stuff apart and use their own way of db communications.

So for the people that like to keep everything consistent I went ahead and converted it for ya:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Or for the people that really want to use this the way it is:

Add to globals.php/globals_nonauth.php

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Ha cheers dude.

I've noticed the massive difference with people's code on here, like how you changed the curly brackets. That's one reason I think i'll stick to python, no arguments over code indentation and brackets lol.

Link to comment
Share on other sites

Just realised theres an error in the code I posted. I think I must have clicked somewhere when I was posting this...

This line:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

Needs to be replaced with this:

You're unable to view this code.

Viewing code within this forum requires registration, you can register here for free.

 

And that should now create a timedelta of the number of days. Whoops :/

Link to comment
Share on other sites

Just so people are aware or maybe it's my phone but there is in fact an underscore "_" in the $end_date var or "end date" as it looks to me

Never Mind

The line it's sitting in for the bbcode parser is just a tad bit thin height wise :o

Ahh ok, I just checked and it looks okay on desktop :cool:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...