Jump to content

Anti-Moronic

Members
  • Posts

    571
  • Joined

  • Last visited

Everything posted by Anti-Moronic

  1. Without speaking for everybody else, we are all nerd enough; every one of us.
  2. Depending on how many variables, you might consider storing this data in the database. You can store LOTS of variables in a single column using JSON. Again, depending on how many variables I would consider using constants as sloppy. You can see how some people manage this in the language files for popular php apps like this forum for example. However, if you do require these variables in classes and such you have to globalize them which is bad practice. From what I can tell, you don't mean globalizing variables in that sense, you mean defining a ton of variables (or an array) in a file which you can include in the scripts which need the values. THAT'S ok. Another idea is wrap the whole thing in a class, and have a kind of global array/variable manager. Oh, and you can't use '-' in your variable names. Using includes to do this is THE easiest, fastest way. Either that, or declare them in each script, or pull them from a database. A quick include can't be matched.
  3. Yeh, even though it does provide a faster, more seamless experience you do lose the ability to bookmark! However, I do believe solutions are already being thought up which will alleviate this problem.
  4. To be honest we can't go wrong with notepad++. Ultra fast, simple and has quite a few plugins to extend basic functionality. I can't offer an unbiased opinion as I have only used a few editors - DW, notepad++ and Zend Studio 7,8. I can't stand DW and I work with ZS on my main projects but mainly due to using Zend Framework so it all integrates very nicely. That, with project specific settings and sessions etc AND the incredibly customizable template code insertions makes it a breeze to develop in. I might move onto DW again if the next trial version impresses me.
  5. Indeed. A strong learning curve but it will pay off in the future if you know it (I already see more and more companies asking for people that have experience with ZF). ZF 2.0 (currently under development) has been completely refactored (and some rewrites) and uses PHP5.3 and has lots of speed improvements. Diving into ZF also means you will be spending some time learning OO if you don't know already. So having a book handy on OO Principles, Patterns, and Practices will save you some headaches Couldn't agree more! Really looking forward to ZF 2.0. I can't comment on any other frameworks because I haven't used them *much* or *recently* but I do believe the trend in companies asking for ZF experience is a good sign. Hopefully these speed improvements will put the performance talk to sleep.
  6. Well, yeh, I'd search first. Personally, I use the ZF exclusively now. I have a 'skeleton' application which allows me to setup and build basic applications extremely fast. I don't think you should overthink what framework you use too much. Find a decent comparison and go for it. ZF has loosely coupled components so you can easily use say one of the web service components in another framework. Important thing is that you improve the 'skeleton' as best you can so you have a solid foundation to build on.
  7. Stop fixating on .htaccess. That is so trivial compared to what thorpe mentioned it's not even worth thinking about. Pass all queries through the index.php file and go from there. Stop worrying about .htaccess. Oh, and no I wouldn't advise trying to find an alternative to using an app specific .htaccess. You want your code to be somewhat portable too. Editing server configuration files is host-dependent. mod_rewrite is largely supported and enabled. I haven't written any MVC-based frameworks so can't advise on that but I can tell you along with optimizing your code, you will want to look into caching. You should also note the major bottleneck in most web apps is the database so focus on optimizing that.
  8. Don't know why nobody has laid this out fro you instead of pointing out the obvious or asking questions you clearly will not understand. Trouble here is that you should be using a database. $users = array() should be $users = mysql_query() which will then query the database for the user. You need to read up on some basic user management, mysql, and sessions in php: http://www.wikihow.com/Create-a-Secure-Login-Script-in-PHP-and-MySQL It's quite simple stuff but what is more important right now is that you see how you are approaching this is fundamentally wrong.
  9. It is when someone is trying to prove that they have worked on decent sized projects. That about sums it up. The answer to the original question obviously needs to take into account the users abilities. I'm still not convinced you or your mate are anything but typical OOP fanboys. Wow Thorpe, way to get personal matey! Didn't direct one thing toward you personally. Typical attitude of somebody who isn't mature enough to discuss. Listen, I brought up some of the projects I've worked on because it raises a VERY important point: whether procedural or OOP is better doesn't matter. What matters is what is in demand. That is it. Not hard to understand. On the projects I and my team work on I am yet to find in the last 5 years more than a handful of clients who do NOT specifically require OOP and/or OOP based frameworks to be used to develop php applications. Dunno what else to say. Supply and demand and OOP is in demand.
  10. No, I'm no hobbyist. I take on $1000-5000+. $5000+ being large. I also run a company with 5 other developers who do exactly the same thing. Not due to lack of work, but due to choice. Managing 4 or 5 $5k projects is easy peasy and earns me a LOT of money. Sorry, but I just don't accept procedural code in php and neither do my clients. Get over it.
  11. Yup, no point in reinventing the wheel. SPL have already done it, among building on many other much needed functions. You should check it out, it's very helpful.
  12. There is no need for 5 queries. $users = "SELECT * FROM users WHERE username = '".$username."'"; $userQuery = mysql_query($users); while($usersArray = mysql_fetch_assoc($userQuery)){ echo $usersArray['usergroup']; } So now you only need to compare the $usersArray['usergroup'] column: switch($usersArray['usergroup']){ case 'Staff': echo "<span>".$username."</span>"; break; case 'Pro': break; // ETC ETC } .. to check banned you just compare the $usersArray['banned'] column. No need for all of these queries.
  13. Building on what thorpe said, this isn't well designed. However, in terms of maintainability and reusability it is better than nothing. All you have to do is include your class and feed it username and password - build in some functions for setting table name and connection settings and it's self sufficient. Again though, that is bad design. You should have a class for: database connection user mapping validation ..at very least. Where each of those classes will actually extend abstract classes. Your checkEmpty() method I wouldn't consider form validation at all. You're checking if two parameters exist or not, those could come from anywhere. The problem here is that you're given so much flexibility in how you structure things it's sometimes hard to decide the best way. My advice is to download a decent OOP based framework and have a look at how they structure their code (specifically, database connection and interaction with tables etc).
  14. Very happy I could help! I wish someone warned me before I picked up bad habits before I started. Whereas google *will* provide you very good material should you learn how to search for it, don't hesitate to ask other questions here. Even the smallest thing. Sometimes you need somebody to explain based on a very specific example for you to understand. EDIT: Sorry, something you should do asap is install WAMP/MAMP so you can test your php on your local computer without having to upload files etc. This is also suggested in that brilliant article on tutsplus. In fact, just by reading that article in it's entirety and taking note of each point you'll already be a better developer than most.
  15. First of all, if you don't have ANY programming experience then you should start by searching for 'beginner tutorials'. Before you do read anything else here is the most important piece of information: validate what you read! This means search for 'best practice php', search for php tutorials in 2009/2010. Outdated sloppy code will turn you into an outdated sloppy coder! To get some quick and dirty examples on how to use an API, you might search 'how to twitter api php'. Don't forget - check the date! Know best practice code so you can ignore tutorials which contain sloppy code. Second, I'd say before you try 'third' below look for 'libraries' which are already implementing the API you want to use. For example if you want to use the twitter API, then search for 'best twitter api libraries php' or something like that. Keep searching until you find a decent library. Third, you might want to check out the actual documentation. Links can usually be found in the footer for websites which allow api, failing that search: "twitter api" and click on links found on twitter.com. To put the above into action: http://www.tizag.com/phpT/ http://www.w3schools.com/php/php_intro.asp http://net.tutsplus.com/tutorials/php/30-php-best-practices-for-beginners/ ..and twitter: http://stackoverflow.com/questions/422879/best-twitter-php-library http://woork.blogspot.com/2009/06/super-simple-way-to-work-with-twitter.html http://apiwiki.twitter.com/w/page/22554650/Getting-Started Learning how to research is an invaluable skill also. Always try to learn best practices. If someone says - "you need to use a mysql db for that". Type in google: "php mysql best practices". Validate the information etc etc
  16. I would put this down to bad design. You shouldn't have to upload a file every 48 seconds to maintain data. You then have to convert these files? I can only assume there is a very good reason you have not tried to use a database. Another idea - you could use http://www.sqlite.org/ as an alternative. Again though, the main issue here is that you are using FTP.
  17. Would you not just do a join and append a where clause? You know how to do that by now, right?
  18. Could you explain what the code is doing? Maybe there is a better way because it looks like flash is sending x/y mouse co-ords to a script which is then updating the database. How often does this happen? Every iteration?
  19. How do you mean server is 'busy'? do you mean unreachable, offline?
  20. First of all <? ?> are short tags. Shouldn't be using them as not all installations have this enabled by default. Second ?: (see pikachu above) ..and: <?=( isset($_REQUEST['id']) ? "&id={$_REQUEST['id']}" : null )?> can be written as <?php echo ( isset($_REQUEST['id']) ? "&id={$_REQUEST['id']}" : null ); ?> or if(isset($_REQUEST['id']){ echo "&id={$_REQUEST['id']}"; }else{ echo null; } Hopefully that will help clarify the line for you. Note: echo null would not be done, you wouldn't use an else.
  21. The main reason for using mysqli inside this class is to abstract the database access layer. If you don't require that, then it is simply a case of managing the database connection effectively. Should note that simply having this as it is, is hardly considered abstraction. The only use is it contains a central place for database connection settings. Some simple documentation on mysqli here: http://www.php.net/manual/en/mysqli.query.php
  22. No, you will have to do this: class MySQLDatabase { private $connection; function __construct(){ $this->open_connection(); } public function open_connection(){ $this->connection = new MySQLi('localhost','MyDatabase','password','billpay') or die($mysql->error); } public function query($query){ return $this->connection->query($query); } } I'm not really sure this is the best way to be interacting with the database. You might consider downloading a decent library which already has this setup for you.
  23. Does the tutorial use query() method? It is because you are either a) not extending any other classes and so not inheriting any other functionality, or b) do not have query() method defined in your current class.
  24. To be quite honest if you are the least bit unsure about how to do this: hire somebody else who knows exactly what they're doing. You're dealing with people's money and believe me if you're not careful you might end up costing somebody a lot of money.
  25. You would start with a book about php and mysql web development. Thread here has some great resources: http://www.phpfreaks.com/forums/miscellaneous/good-programming-and-web-design-books/ With that, at least you will have an idea of where to start. Without that, you can't do anything apart from paying somebody to do it for you.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.