-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
You bet. Compare that withclass="Fitting" class="Info" title="View"See a pattern in there?
-
You can't find anything? It says line 7 and I'm looking at your code right now and there's definitely something there.
-
Reflection is a lot easier to use. Grab the list of functions and use reflection to get information about them. That can get you pretty much anything you might want.
-
You want a list of functions? Load up the page in DOMDocument, getElementById() for "quickref_functions" (it's a UL), and from that a getElementsByTagName() with "a" to get all the links. Then loop over that list.
-
Have you created a page that can show that kind of information yet? Once that's ready you can make this link to it.
-
Efficiency? You have security problems - only a couple but they're big. Deal with those before you start thinking about efficiency. 1. Table name isn't validated. 2a. Arrays aren't sanitized. 2b. I could bypass your string sanitizing by renaming textboxes into arrays with one element. As for a critique, 1. Not a fan of storing root paths in the session. Where are they set anyways? 2. The code that supposedly "unsets the table name" doesn't (but it doesn't matter unless there's a "table_name" column in the table). 3. Don't include the semicolons in queries. 4. Not a fan of looking for keywords like "created" or "modified" or "password". 5. array_unique() the POST values? What if the values are numbers like "1,1,2" and I want all three? 6. You may not like frameworks but you should use one. Even if it's your own. And use [code] tags when you post code.
-
What formula or specification are you working from?
-
Practical PHP - Simple OOP site wont render in browser
requinix replied to fersick's topic in PHP Coding Help
Do a View Source of the page. See your PHP code? That means PHP isn't running your script. Are you using a .php file extension? -
Having never seen the syntax before I'm surprised that var pos = months.indexOf( birthMonth.substring( (0, 3 /3) /3 ).toLowerCase() );is valid, but apparently it is. Anyway, looks like you repeated yourself a bit too much in that call to .substring().
-
Practical PHP - Simple OOP site wont render in browser
requinix replied to fersick's topic in PHP Coding Help
Seems like you don't have PHP installed. Are you making sure to run the file through a web server? Your browser should not have anything like "file://" in the address bar but look like a normal URL. -
So you mean that code doesn't work? Looks like it does.
-
Alter the code that does the upload so that it also updates the session data.
-
You can't use $_SESSION until you've called session_start().
-
And the error is... what? Undefined offset?
-
Can get_browser() slow down my PHP application
requinix replied to eldan88's topic in PHP Coding Help
Everything you do in code will slow down your application (typically only by microseconds). The question is whether it's still worth it. But yes, it is a little more expensive than most functions. PHP has to open up a file and do a lot of regular expression matching. -
Now you're joining on the art_id. Isn't that the primary key?
-
AND t1.artist_id = t2.artist_idYou told it to match on the artist_id too. There's only one row in table 2 and it has artist_id=2 so all you'll get is results from table 1 with artist_id=2 too.
-
404 Not Found For a file all healthy
requinix replied to mostafatalebi's topic in Apache HTTP Server
Because whatever you clicked doesn't exist. It's that simple. That could mean any number of possible things at fault: the link is wrong, there's URL rewriting that's changing it to something else, there's code that has a 404, Apache can't see the file... -
"Future-proofing" PHP development, need help
requinix replied to rockandroller's topic in PHP Coding Help
Code becomes obsolete over time. Fact of life. Either stuff is actively maintained to keep up with the times or it falls behind and eventually dies. PHP 4 was supported long after PHP 5 came out, and remained in use even longer, and should PHP 6 prove to be as large a change then I'm sure the same will hold true for PHP 5. There is no roadmap for PHP besides what you can overhear in the mailing list and the feature requests in the wiki (especially the RFC section). Don't use bad coding practices and you'll be set for a few years at least. -
SimpleXML only allows you to work in a single namespace in a time. It starts in the empty namespace (xmlns="") so if you do $xml->motorways it will try to find a in that namespace. Which doesn't exist in your XML. Use children to switch namespaces. $motorways = $xml->children("tns", true)->trafficConditions->motorways;(You don't need to children() every time after, only the first time really just to change the namespace.) [edit] is a child of . You have to go through that first. Also note that there may be more than one .
-
What's your code?
-
Make the download go through a PHP script instead of going directly to the file. That script checks if the user has paid and only outputs the file if they have. The "outputs the file" bit might look like header("Content-Disposition: attachment; filename=\"the name of the file.ext\""); header("Content-Type: application/octet-stream"); readfile($filename);
-
What's your code?