-
Posts
5,960 -
Joined
-
Last visited
-
Days Won
146
Everything posted by gizmola
-
New to php, Don't understand why this wont work
gizmola replied to MrDoug's topic in PHP Coding Help
His code makes no attempt to read from the filehandle, so there's no reason to open the file with 'a+' mode. Opening with 'a' is fine here and does work. As I posted previously I'm fairly confident this is a file permissions problem. By default this will try to write in the same directory as the executing script, and probably the Apache user doesn't have permissions to write to that directory. -
I need fresh eyes to help fix this INSERT error.
gizmola replied to poleposters's topic in PHP Coding Help
Please post a describe for the details table. -
New to php, Don't understand why this wont work
gizmola replied to MrDoug's topic in PHP Coding Help
My guess is that this is a permissions problem. Is this on a windows or Unix server? -
New to php, Don't understand why this wont work
gizmola replied to MrDoug's topic in PHP Coding Help
Certainly, although the "." is a reserved character in php used for concatenation, so you have to build the file name like so: $fp = fopen($user_name . '.txt', 'a'); -
The include process does indeed bring the code into the current script in the order in which it was specified. Ultimately you can think of your executing script as one giant static script where the full contents of any included scripts replaces the include statement at the exact point that it's included. Yes includes have a cost, but that is not something you need to worry about too much, as without them PHP would probably be close to unmaintainable.
-
I'm afraid I'm not following you. PHP provides the $_POST superglob, that has the contents of every form variable, hidden or not. It's an associative array, so accessing the contents is trivial. This data all comes in via HTTP but Apache and PHP parse it into pieces that make it convenient and easy to work with from within PHP. Look at all the data that comes from phpinfo().
-
I think you misunderstand the issue. The issue is NAT where you could have hundreds or even thousands of users with the same IP (remember AOL?). Ok, it's an overstated concern, but it's not a matter of reuse of IP's, but rather that NAT allows the same IP to be used simultaneously by multiple users *at the same time*.
-
Like all serverside programming languages, PHP takes the information received in the headers and in most cases makes it available in the superglobals like $_POST, $_SERVER etc.
-
By default, PHP sessions do create cookies. This is actually a *good thing* IMNSHO. Pulled directly from the PHP manual --- // Initialize the session. // If you are using session_name("something"), don't forget it now! session_start(); // Unset all of the session variables. $_SESSION = array(); // If it's desired to kill the session, also delete the session cookie. // Note: This will destroy the session, and not just the session data! if (isset($_COOKIE[session_name()])) { setcookie(session_name(), '', time()-42000, '/'); } // Finally, destroy the session. session_destroy(); ?>
-
You can do what you want using Ajax/Javascript. It's non-trivial, but not incredibly difficult either. If the dependency on the dropdowns is derived from the database, then Ajax is a good way to handle it --- no reloads required. Hopefully you are able to do some javascript coding.
-
Use this at the top of your script to set the reporting: http://us2.php.net/manual/en/function.error-reporting.php
-
So it sounds like you know where to look for you error: in the routine that determines whether or not to display the next button.
-
The text is written using the imagestring($NewImage, 10, 20, 8, $ResultStr, $TextColor);// Line. I'm not sure why this works, because the 2nd param, is suppossed to indicate the Font. Theoretically, making 10 something bigger would pick a bigger font, but it's not indicated in the manual that even a param of 10 is supported. Centering is tricky, you'd have to do a bit of math using the imagefontwidth() function. Theoretically, this value times the number of characters being added onto the image, would allow you to figure out where to start printing (x,y), by getting the 1/2 way point of the image, and subtracting 1/2 of the length of the string from that number (to get the X coord). Notice that currently the x,y values are hardcoded as 20,8, so you'd need to make those into variables.
-
Link won't center when using variable to store
gizmola replied to ndjustin20's topic in PHP Coding Help
For that TD align="center" -
Post the exact code you are trying to use please.
-
Yes it is possible -- but a really bad idea in my opinion. From a security issue most people don't want to allow the writing and deleting of files from webspace, as this is a good way to get exploited. Some systems require this in order to allow full functionality (Joomla/Mambo for example) but they are CMS systems with modules. You might also consider using sqllite which is a really lightweight embedded db that comes with PHP, and would require no installation by the end users.
-
Yes, but you can go line by line, using the reference manual and try and understand their techniques. Mostly what they are doing is looking for certain characters and stripping them out or converting them to something banal. As html needs to use things like script blocks etc., they are converting those to things that can't be executed. It uses a variety of techniques actually (the script) but as I stated, I'm not planning to delve in an make an academic study of it. As for the use of it -- it's certainly possible to use it without understanding fully what it does, although I've always found that exploring what you don't understand is a great way to learn.
-
Link won't center when using variable to store
gizmola replied to ndjustin20's topic in PHP Coding Help
Exactly, as I stated previously. The td is your block container, so the link is conforming to its flow. -
Seems pretty straighforward, if you read the documentation for the functions being called. You might notice for example, that this technique starts with an existing image and then adds to it. So if you modify that original image, you will already have modified the resultant image. $NewImage =imagecreatefromjpeg("img.jpg");//image create by existing image and as back ground
-
Probably a logic error, with all your nested empty loops all over the place, and no indention your code is impossible to follow. I don't want to take the time to indent your code just to figure out what you're doing, but I willl suggest that you break things up into smaller more discrete pieces, perhaps even using "functions". You might even want to try your hand at a simple flow chart.
-
Ok, so basically you are concerned about XSS exploits of your site? You might want to read a bit about what they are. Typically XSS is just some html/javascript that someone can embed into a page you render. This happens a lot in forums and places where people can post blocks of input. That routine does seem to prevent XSS exploitation, although I only scanned it quickly. You are probably a lot better off reading the documentation of the routine, or corresponding with the original author in regards to any questions you might have.
-
Link won't center when using variable to store
gizmola replied to ndjustin20's topic in PHP Coding Help
Well, hopefully the main point is, that a link by itself is "inline". In other words, it conforms to the flow of the "block" that contains it. If that block element (a paragraph or div perhaps) is centered, then the link will be centered. If it's a td in a table, ditto. With that said, I hardily endorse not using the deprecated font and center tags, as this will fail standards validations and just make you look like a noob