-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Use a constructor or method. If you don't know what those are then read up on object-oriented programming.
-
This topic has been moved very early in the morning to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359281.0
-
Insert key=value pair in array after given key
requinix replied to Jessica's topic in PHP Coding Help
array_splice lets you insert into the middle of an array (if you know the numeric offset it should go into). Can I ask why you have to insert into the array? You know that for most purposes the arrangement of the keys/values makes no difference at all? -
Proper way to do includes for small site
requinix replied to philosopherdog's topic in PHP Coding Help
__DIR__ is the directory containing the currently-executing file (exactly like how __FILE__ is the full path to the file). So if you use require_once __DIR__ . "/header.php"; in /forum/views/*.php then it'll include /forum/views/header.php, and if you use it in /index.php then it'll include /header.php. Why's that? Are you serving the site out of a subfolder or something? -
Proper way to do includes for small site
requinix replied to philosopherdog's topic in PHP Coding Help
No: it's relative to the directory of the first executed file. If that first file includes a file in some other directory, the include path will not "update" to reflect that other directory. Use absolute file paths to include files. // relative to the current file require_once __DIR__ . "/path/../to/../function.php"; // PHP 5.3+ require_once dirname(__FILE__) . "/path/../to/../function.php"; // relative to the web root require_once $_SERVER["DOCUMENT_ROOT"] . "/path/to/function.php"; -
What does the marquee code look like?
-
This topic has been abducted by aliens, probed, and dropped off in JavaScript Help http://www.phpfreaks.com/forums/index.php?topic=359251.0
-
1a. Viruses can't do anything unless they're executed. So to prevent viruses from doing anything, don't execute files. 1b. If you're actually worried about viruses being uploaded, install AV software on the server and manually scan files as they're uploaded. 2. Store uploads in a place that is not web accessible. Or prevent the webserver from allowing access to them. 3*. Have PHP create the upload folder: chmod 0777 the parent folder, use mkdir() to create the upload folder then chmod() 0755 it, then chmod 0755 the parent folder. 4. Use a PHP script to send (eg, show or trigger a download on) an uploaded file. Don't link to the files directly - though you could have URL rewriting make it look like you are. Don't forget access controls. * If the server configuration is altered and the PHP user changes, you'll have to do a little work. But this is pretty rare.
-
IP block in .htaccess doesn’t work for http
requinix replied to frans12's topic in Apache HTTP Server
Did you check to make sure you didn't accidentally add some emoticons in the configuration? What's in your .htaccess and how is the HTTPS site set up? -
No... That's kinda the point.
-
Only use //s when you're writing the expression as an object, inline. pattern = /^handle\[\d+\]/; (that won't work, of course) If as a string then leave them out. pattern = "^" + handle + "\\[\\d+\\]";
-
__destruct() needs to be public so PHP can call it. __construct() can be whatever you want. If public then anybody can instantiate the object; if protected then only it and its children can instantiate it (or in the case of child objects, call it in their constructors); if private then only the object can instantiate itself.
-
What do you mean by "default main page"? Any examples? Does DirectoryIndex answer your question?
-
What about nl2bring it, then replacing two consecutive s with a \n?
-
Because there's something else going on. Or in other words, not enough information. Is this online somewhere we can see?
-
Anyone have any ideas for short projects/assignments?
requinix replied to RORJACK's topic in Miscellaneous
I try not to link across forums but here is a fairly long list of ideas. Not all of them apply to PHP but it's a place to get some ideas. -
It gets you partway. It's still possible for people to exploit events like Hover over me strip_tags() won't remove attributes. Best idea I've seen is to use strip_tags() to remove the tags you don't want, then DOM (eg, DOMDocument) to remove all attributes (except any ones you want to allow).
-
Actually it's quite good. I guess you mean to say that it won't work in your case. So why not?
-
If by "rich text" you mean one of those JavaScript editor things then, You don't have to use it: stuff will already be entity-encoded. If you're worried about disallowed HTML tags then strip_tags is a good start.
-
problem in getting data using document.getElementById
requinix replied to newphpcoder's topic in Javascript Help
And exactly what change(s) did you make? -
problem in getting data using document.getElementById
requinix replied to newphpcoder's topic in Javascript Help
You misspelled the function name. -
problem in getting data using document.getElementById
requinix replied to newphpcoder's topic in Javascript Help
Its ID is "$joinId", not "SubQty". -
What type of field is user_id?
-
PHP Build on Windows 2008 x64
requinix replied to sanchez77's topic in PHP Installation and Configuration
Did you grab the SDK tools? -
Use absolute links like Note the leading slashes.