-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Posts posted by PFMaBiSmAd
-
-
If you have a list of sequentially named variables, it is a sure bet that you should be using an array.
A list of sequentially named variables will require you to carry around another variable that says how many of them there are. With an array, you don't need to waste time and code doing that.
-
You can't. It is a standard - http://www.faqs.org/rfcs/rfc1321
-
You would need to give an example of a link that works and one that does not work. It is likely you are writing it incorrectly.
Are you trying relative file system paths or URL's? A file system path is relative to the current working directly of the main script that is running. Using a URL in php function that normally operates on file system paths, requires a fully qualified URL (http://domain/path/file)
-
If you check your web server log for errors or turn on full php error reporting, you will probably find out why it is failing.
-
The path on the client's computer only has meaning to the browser. After the file has been uploaded to the server, that information is irrelevant, not to mention that it is not available because it would expose client side information.
-
You page contains invalid HTML and CSS that is preventing it from rendering the way you want it in each browser -
-
Add the following line to make sure error display is on -
ini_set ("display_errors", "1");
Also, if there is a fatal parse error, you will get a blank page. Check your web server log for errors.
-
Because PHP is a parsed/interpreted language, function definitions can occur in the code any place.
I recommend checking your web server log for errors.
Is nothing displayed, not even the red-x where the photo should be? What do you get in your browser's "view source" of the page the images are on?
Post the code with the <img src="...." tag that is using the two php files you posted.
-
I played with that script and it contains a bug that triggers a php error when it references an array element that does not exist without first testing if it exists. The php error output "breaks" the image header, in the same way that outputting content to a browser breaks things like cookie/session/redirect headers.
It may very well be that if you call the script and provide values instead of using defaults, that it works without error. The offending line (there could be more) is line 98 in the class_PieChart.php file -
Change this -
if ($item["color"]) {
to this -
if (isset($item["color"])) {
Note: If you have previously browsed to a url where the image appears as a broken image (red-x), and you correct the problem so that the image actually works, you will need to hit your browsers refresh button to get the actual image to be fetched (or clear you browser's cache.)
-
SemiApocalyptic is correct. The ONLY way to put an image (a static one or one dynamically produced by php) on a web page (without browsing directly to the url of the image) is using a proper HTML <img scr="..." tag.
If you got a red-x, you will need to troubleshoot why.
Was the URL in the src="..." parameter the php file that you can browse to and get the chart to display?
The garbage you are getting means that a proper mime type header for the image is not being output. The class function you are using should have a way of outputting the header.
Edit: Actually, I found the script you are using and it does output a PNG header. That would mean the grabage output is due to you outputting the image directly in the HTML on the page instead of using an <img src="..." tag.
-
It works, if your array is structured correctly (tested) -
<?php session_start(); $_SESSION['recent_items']['ItemNumber'][0] = 1; $_SESSION['recent_items']['ItemNumber'][1] = 2; $_SESSION['recent_items']['ItemNumber'][2] = 3; $item_num = 2; if(in_array($item_num,$_SESSION['recent_items']['ItemNumber'])){ echo "yes"; }
-
Checking your web server log file for errors would both tell you if the include function is failing to find the file and if the function is undefined.
Is the first file a .php file or is the file extension .htm/.html?
-
Put the following in a .htaccess file in the folder that you want to prevent web access to -
order deny,allow deny from all
The session.gc_probability and session.gc_divisor randomly determine when GC runs, so you might need to execute a number of session_start() statements before it would run and clean out files that are older than the session.gc_maxlifetime. You actually need to create more than one session to see any effect, because when you access a session, it updates the time information on the file and that would keep the file's age less than the session.gc_maxlifetime.
-
The only thing apparent from the information provided in the post is the global $database; line of code has absolutely no effect because the global keyword only has meaning when used inside of a function.
Without specific information as to what it is or is not doing, no one in a forum can possibly answer your question.
-
Using not equal != tests OR'ed together will always be true, unless you can make the variable be all the values at exactly the same time, which is impossible.
You can correct the logic by using an equal test == and OR'in the values to give you a TRUE when one of them matches, or you can use the not equal != test and AND them together, but it is much cleaner to make an array of the possible values and use in_array() or !in_array() to test if a variable is present or not present in the array.
-
It sounds like the session is ending due to the deletion of the session data file on the server, when garbage collection runs.
On shared hosts, the script from all the accounts on that server with the shortest session.gc_maxlifetime will win and any session data files older than that shortest setting will be deleted when GC runs.
You should create your own session save folder (preferably below your doc root folder) and set session.save_path (in a .htaccess file or in your scripts before each session_start()) to point to that folder. Then the garbage collection routine will only operate on your files using your session.gc_maxlifetime setting. If you cannot place the folder below your doc root and you can only put it above your doc root, make sure you put a .htaccess file in it that denys all http/https web requests to files in it.
-
That either means that no image type header was output or you are attempting to output image data directly on a web page instead of using a proper HTML <img src="..." tag.
In either case, you need to post your code so someone here can see what you are doing.
-
Variable names cannot contain spaces (or dots.) Just alphanumeric characters and underscores.
-
LOL. I was just going to post that your query has single-quotes around the table name and the column name. Remove the single-quotes around messages and to (however because to is reserved mysql keyword, either change the name of that column or use back-tacks `to`.)
-
Checking your web server log for errors and/or turning on full php error reporting in php.ini or a .htaccess file would have exposed the function naming problem.
-
php 5.2.4 has a bug when php terminates due to a fatal runtime error that the output buffer is not flushed as part of the shut down logic.
What version of php are you using?
What exactly is the error message from your web server log?
It would probably be a good idea to correct the logic to prevent referencing array keys that don't exist. Code should not normally triggers any notice/warning/fatal errors.
-
Both of you please read the link I posted above to the php manual.
Image submit buttons set an x and y variable that in php is converted to name_x and name_y.
-
This will solve your problem - http://www.php.net/manual/en/faq.html.php#faq.html.form-image
-
If you set the cookie with your original code, that did not have the path parameter set to '/', then you can only delete it using the same settings.
[SOLVED] PHP Strings
in PHP Coding Help
Posted
Especially if what was re-stated only existed because the earlier post was edited to include that information.
This forum software only notifies of new posts made while composing a post, not of edits made to existing posts.