-
Posts
16,734 -
Joined
-
Last visited
-
Days Won
9
Everything posted by PFMaBiSmAd
-
This topic has been moved to PHP Freelancing. http://forums.phpfreaks.com/index.php?topic=364516.0
-
There's a green solved button at the lower-left on the page.
-
I don't see a session_start() statement on the maint_update page. So no $_SESSION variable you set there will exist outside of that page.
-
A) Stop bumping old thread having nothing to do with what you are asking. B) The point of a programming help forum is not to give or help you find code to do what you want. C) If you want someone to write code for you, post your question in the freelancing help forum. D) If you have a programming question, programming problem, or programming error that you need help with, start your own thread. E) If you continue doing #A, your account will be banned.
-
Given his email address, I smell a test for posting future spam about LED lights. I locked the thread at about the time you were posting, Pika...
-
You have put the error_reporting/display_errors settings at the end of your code. How could that help with errors that occur when your code runs? Those two settings would need to be put before the session_start() statement. You should actually have those two values set in your master php.ini so that you don't need to put them into your code and you don't need to remember to remove them when you put your code onto a live server. Having them in your master php.ini will also report and display fatal parse/syntax errors in your main file.
-
The single-quotes you just added didn't fix anything. They are hiding the fact that $id is empty in the query. You shouldn't have quotes around numerical data values inside of a query anyway. You still must find out why the $id variable doesn't have a value in it (you shouldn't even be running the query if there's no $id.)
-
You can always use get_magic_quotes_gpc. Even after the magic_quotes feature is removed, the function to test the magic_quotes setting will exist -
-
Return back on same page after valid user login
PFMaBiSmAd replied to vishalonne's topic in PHP Coding Help
The overall simplest solution is to just integrate the login on any page that needs it. See this post - http://forums.phpfreaks.com/index.php?topic=364349.msg1726012#msg1726012 -
The solution that will always work, is to put all your php logic first, producing content in php variables, then you output that content in your html document only at the end of the page. <?php session_start(); // php code that produces the content on the page - $main_navigation = "..........."; ... $login_content = ".........."; ... $main_content = "........."; ... // output the actual page ?> <!DOCTYPE html> <html lang="en"> <title>Typical page that produces the content above, then outputs it all at once in the HTML document -</title> <body> <div><?php echo $main_navigation; ?><div> <div><?php echo $login_content; ?><div> <div><?php echo $main_content; ?></div> </body> </html> By arranging the logic on your page this way, any php code that needs to redirect or set a cookie can do so, since it comes before you output anything on the page. This also has the affect of separating the main logic on your page that produces the content for the page from the html that defines the page layout.
-
The $_COOKIE variables are set based on the cookies that the browser sends to the server with a http request. They won't show the result of a setcookie() statement until the next http request. Echoing a $_COOKIE variable right after a setcookie() statement doesn't show the current value in the cookie in the browser until the browser makes a http request to the server. session_unregister was depreciated 10 years ago and has been completely removed in php5.4. You should use unset to remove a single $_SESSION variable and if you want to clear all $_SESSION variables, use $_SESSION = array();
-
The previous issue with SMF was that someone else could make login attempts against a username and if the failure count was reached it logged the actual user out. This was fixed in a previous version, but perhaps it is a feature that is back in the current version. The only errors listed under your ip address/username (the only info I can access) are - Password incorrect - jesirose ?action=login2 Today at 12:28:45 pm Your email address needs to be validated before you can login. - jesirose ?action=login2 Today at 09:21:17 am I presume the times listed are adjusted to my time setting, which is MST. Perhaps an Admin could check other SMF logs to see if there is anything specific listed for your ip/username that would pin down if this is something on your end or something happening on the forum.
-
There's nothing wrong with that method, except the html you are trying to output. The short-answer (to Life, the Universe, and Everything) is that the only thing you can output to the browser for a dynamically produced image is the Content-type header, followed by the binary image data. The HTML you have in your main.php file - <html> before <br> and <br> after </html> will have to be removed from the main.php file or you will have to put it (the html) inside of a conditional if(){} statement so that it is not output when the dynamically produced image is being output. To make an actual web page, with html markup, you would need to include your main.php file into that web page and then pass the main.php file to the ->StrokeCSIM('main.php') method so that it will use main.php as the URL in the <img tag.
-
When you have a prepared query statement that returns a result set.
-
Also, the alternate syntax takes more typing. The closing keyword, in all cases, is longer then the two character {} syntax.
-
Someone already stated that, along with the restrictions under which it could be used.
-
How to get all the letters in random order?
PFMaBiSmAd replied to tibberous's topic in PHP Coding Help
Ummm, tibberous' post concerns something the forum software apparently did when he hit a menu button in it. -
bind_result and mysqli_stmt::fetch are used with prepared statements. He suggested using mysqli::fetch_array (no stmt in it), which isn't used with prepared statements. It's used with non-prepared statements that are executed via $mysqli->query().
-
I think the intent of the statement concerns using a database abstraction layer, which would have the affect of removing the actual execution of the query from within the application code and moving it to one single place in the abstraction layer.
-
Let's take a step back. Why are you including your plot.php file into another file, rather than having all of the code/data needed to call the jpgraph functions in only the plot.php file? That's how you would normally dynamically produce an image (using the ->Stroke() method) and you would output it on a web page by putting the URL of the code that results in the image being output into an <img src='plot.php' alt=''> tag. If you don't actually have a web page yet, you can browse directly to the URL of the code that results in the image being output, which is probably how you are doing this for testing. For what you are doing with two files, a main file that includes your plot.php file, and for the ->Stroke() method, you would need to put the URL of your main file into the <img tag. Your main file and the plot.php file cannot output anything to browser except the content-type header and the image data, which is what the ->Stroke() method does.
-
Figuring out session variables? Having a problem
PFMaBiSmAd replied to scm22ri's topic in PHP Coding Help
Or rather than redirecting all over the place, you can simplify everything by integrating (including) the login code directly on any page that needs it. The logic is simple - [*]If the login form is submitted, perform the normal login authentication. If authentication succeeds, set a session variable with the user's id/username indicating he is logged in, and redirect to the current page to clear the post data. If authentication fails, display any error message and since the visitor is not logged in, step #2 will redisplay the login form. [*]If the visitor is not logged in, display the log in form. The log in form submits to the current page. [*]If the visitor is logged in, display a 'You are logged in/Hello" message with his username instead of displaying the login form. [*]If the visitor is logged in, execute the logic and output the content you have defined for the page. -
Yes. The code on your page is currently outputting HTML, the <html>before<br>, before outputting the image using the ->Stroke()/->StrokeSCIM() method, which outputs a content-type header followed by the image data. The HTML that is output first prevents the content-type header from working (assuming that output buffering is turned off in your php.ini) or it becomes part of the image data (if output buffering is turned on in your php.ini.) In either case, the http request for an image doesn't return the proper data. Edit: The conditional logic I mentioned for the ->StrokeSCIM() method would allow this HTML to be output when the page is requested as a web page, but prevent it when the page is requested as a dynamic image. If you have the error_reporting/display_errors settings set as suggested above, you would be getting a header error ... output started at ... message that would help debug problems with this.
-
I finally know enough about what jpgraph is doing to tell you why the data doesn't exist when jpgraph is trying to produce the image. When you call the ->StrokeCSIM() method when a page is first requested, it outputs HTML consisting of a <map></map> tag and an <img > tag. The URL in the image tag is that of the included file (plot.php). When the browser tries to fetch the image to display it in the <img > tag, it is only requesting plot.php. Since the data is being defined in your main file, it does not exist in plot.php. If you need to use your current scheme of having a main file that defines the data and an included file that uses the data, you would need to supply the name of your main file as a parameter to the ->StrokeCSIM(...) method. You would also need to add conditional logic in your code so that when the page is requested due to the <img > tag, that you don't output any content yourself before the header/image data that ->StrokeCSIM() outputs. When I tried this, the URL in the <img tag has a ?_jpg_csimd=1 get parameter on the end of the URL. You would need to detect this and prevent any output from your script.
-
I have just reviewed the code and images of code you have been posting and you are changing variable names ($tempy, $datay) and the name of the posted include file (temp3.php, temp4.php) and don't have a proper match between all of them. So, I can easily see you setting one variable name in the main.php file and the actual file you are including (apparently temp3.php in all cases) is using a different variable name.
-
I tried your code and it doesn't produce that 25121 ... error. I could only produce that error when the first parameter in the LinePlot($tempy,$tempx) statement doesn't exist. I'm going to guess that you have multiple temp3.php files at different paths on the server (or perhaps different main.php files) and php is finding the wrong one, one that is using a different variable name for the first parameter than what you are actually setting. Using include 'temp3.php'; causes php to search the include_path to find the file. You can use include './temp3.php'; to force php to ignore the include_path and look in the current folder. This would also indicate that your include_path setting doesn't have a . (dot) as the first setting to cause php to look first in the current folder. Do you have php's error_reporting set to E_ALL and display_errors set to ON (and output_buffering set to OFF) so that php will report and display all the errors it detects. When I caused the first parameter variable to not exist/mismatch what was being used in the LinePlot() statement, I got an expected php error - Notice: Undefined variable: tempy in ... \temp3.php on line 14, followed by the JpGraph Error: 25121 ... Edit: Also, the full path that would be displayed in the php Notice: ... message would identify exactly where the temp3.php file is at, that php using.