KevinM1
Moderators-
Posts
5,222 -
Joined
-
Last visited
-
Days Won
26
Everything posted by KevinM1
-
http://arstechnica.com/microsoft/news/2009/03/microsofts-own-speed-tests-show-ie-beating-chrome-firefox.ars An comparing IE8 to IE6, Can you believe a fucking 9 yearold (Yes, that was IE6's release date)'s 'crappy icky hole filled' browser still beats performance aspects on modern day browsers? There's no mention of IE6 in that article. This discussion is not about IE8. Your point is?
-
You have multiple hidden inputs with the same name but different values. PHP is getting the result of the last one. Change up the names.
-
Even if security isn't your concern, I don't see why you'd stick with a browser that has a dodgy track record with W3C standards and JavaScript efficiency. And, while anecdotally IE6 may seem/be faster than modern browsers for you, the actual numbers show that it isn't, by a long shot (look at the myriad results from Ars, Gizmodo, etc).
-
I, for one, eagerly await the Hot or Not API.
-
... we can't see your PHP code just by looking at your page or its source. You'll need to post your code here if you want anyone to help. Please be sure to use BBCode code tags when you do.
-
I Have a Question About Object-Oriented Programming PHP
KevinM1 replied to $Three3's topic in Miscellaneous
Misnomer. Virtually everything in JavaScript is an object. The difference is that JavaScript uses prototypal inheritance rather than the traditional parent-child form of inheritance most popular languages use. For the OP - OOP is a programming methodology, a way of programming that many (including myself) feel make it easier to write flexible, maintainable code. You shouldn't look at it as a decision between OOP and JavaScript/Ajax. One is a way of programming, the others are technologies used in programming (Ajax is a bit of both, if you want to get pedantic). And, if you want to be taken seriously as a developer, you'll need to learn both. -
Yes, you can have multi-dimensional arrays.
-
Remember - quotes denote strings (text). To use numbers, simply write them without quotes.
-
I'd add a bit of value checking and clearer methods to your class, because right now you're asking LoginError to do a bit too much (both registering the error and displaying it): <?php class Authentication { private $error; private function hasError() { if (!empty($this->error)) { return true; } else { return false; } } public function displayError() { if ($this->hasError()) { echo $this->error; } } public function Login($username, $pass) { $db = new Database(); $query = "SELECT * from user where Username='$username' AND Password='$pass'"; $db->query($query); $db->singleRecord(); if ($db->numRows() > 1) { $this->error = "Login error: Please contact Adminstraitor"; } elseif ($db->numRows() == 0) { $this->error = "Username or Password incorrect, please try again"; } else { header( "Location: home.php" ); } } } ?> <div id="content"><?php $login->displayError(); ?></div> If that doesn't help, show more code.
-
Try ucfirst or ucwords, depending on what your needs are. And, like always, when in doubt, consult the manual: http://www.php.net/quickref.php
-
Sorry I was not clearer. Ubuntu supports client side php and my small php program works on Ubuntu except that the mail function does not seem to send mail. Do you have a mail server installed on your Ubuntu machine?
-
Problem with Code - unexpected T_STRING - Please help!
KevinM1 replied to ebryant77's topic in PHP Coding Help
You're missing a " at the end of the string you assign to $sMailBody -
Look at your logic - you have it so if the user enters a username ($username > 0) or if the user already has a valid e-mail address ($email == $row['email']) to trigger an error, thereby ignoring the request to send the e-mail and reset the password. That seems pretty backwards to me.
-
Your use of double quotes within the echo statements is wrong. You also have the semicolons in the wrong spot. Easiest solution is: if ($crank <= 4) { echo "<a href='addwar.php'>Add War Report</a>"; }
-
Also, since we seem to have had an influx of similarly phrased topics in the last month: http://www.phpfreaks.com/forums/index.php/topic,200925.0.html
-
If you're looking for a solution that would let you work with PHP locally, there's probably nothing simpler than an Ubuntu or Linux Mint system with Apache.
-
Why not use MySQLi or PDO?
-
I'm mostly self-taught. The computer and math courses I took in college really helped me when I first started teaching myself web development. And, to be honest, a lot of web development is pretty easy. The nature of the HTTP request cycle really simplifies things. If you're ambitious and a hard worker, you can probably teach yourself most of what you need to know during summers and other breaks from class.
-
What is your major? Does your college have a computer science program you could enroll in? Here in the States, it's often a bad idea to trade a degree for a mere certification. So, stay in school, or transfer to another where you can at least get an associate's degree in something applicable to programming.
-
Remember: the currency of OOP is objects, not classes, methods, or functions. What are objects? Instances of a custom data type you create. What is a data type? Data and the operations that can be performed on that data (example: an integer represents both a counting (i.e., non-decimal) number and the operations that can be performed on that number - addition, subtraction, multiplication, and division). Objects are designed to be black boxes. Their internals shouldn't matter to other coders, or even the system at large. All that's required to use an object is knowledge of its public interface (its publicly available methods and data members, which is not the same as the language construct named 'interface'). Separating the internals from the public interface is known as encapsulation, and is a cornerstone of OOP methodology. The objects shouldn't know or care about the main script they're being used in. Similarly, the script shouldn't care about how an object does its job. Why does all of this matter? Encapsulation, along with polymorphism and inheritance, allows objects to be flexible. They can plug into and mix with other objects with little difficulty if designed correctly. These combinations of objects create subsystems, which, in turn, create entire applications. It also promotes code reuse. You can lift entire subsystems from one project to put in another without having to rewrite a single line of code because the objects aren't tied to the system that use them. It's programmable LEGOs. You design the bricks (color, thickness, size, number of holes), and then you can assemble them in a variety of different ways depending on what you need to do. These bricks represent a membership system. These other bricks represent the database. And these represent command objects that act on the system in different ways depending on HTTP request info.
-
Static functions vs Initialized Object Functions
KevinM1 replied to SchweppesAle's topic in PHP Coding Help
Well, the difference stems from the decision you need to make on whether or not you need an instance of a class in order to do the job. Factories are often abstract with static methods because it's often unnecessary to have to deal with a concrete object for the factory to do its job. They return concrete product objects, however. -
OOP is far more than stuffing similarly themed functions into classes. If that's all you're aiming to do, classes won't be of any more benefit than generic procedural library code.
-
Dunno. Must be one of those wonderful JavaScript quirks that bites people in the ass from time to time. Unless you have your heart set on using the <br /> version of the tag, I'd just use the old school <br> version.
-
PHP OOP - Connecting and disconnecting to mysql
KevinM1 replied to kartul's topic in PHP Coding Help
Ok. I declared this like all others. Now the notice is gone. But still, disconnecting part doesn't work. It loads quite long and then displays same stuff - 'This webpage is not available.'. Any idea how do fix this..? Oh, and also, I should close db connection at bottom of every page, right? Do a test - do you get the same error when not using your object to handle the db connection? -
PHP OOP - Connecting and disconnecting to mysql
KevinM1 replied to kartul's topic in PHP Coding Help
Like the error states, your object doesn't have a property named $con. You need to declare it with the rest of your database properties (like you did with $host, $pass, etc.) before you can use it.