Force Reload Of Page When User Press "Back" Button
Is there a way to force a page to reload if a user har pressed the "Back" button in the browser.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Preventing Visitors Ability To "re-visit" A Page Via The "back Button"..
I have a rather complex registration/member sign up form.. which gets a little confused, when a visitor "backs" completely out of the form, then for whatever reason returns to the form. The form contains 'cancel' buttons, which naturally cancel the reg process and redirects them to the document just before they started. JS provides us with the "location.replace()" method, but I can't seem to find a way to coordinate the use of location.replace() with the posting of the form values. In short, I want to "replace" the first step of the form with the "second step". I think what's making this tricky, is that each step of the form are located within the "same" page (register.php). The document works like so: The first step is the "Member Agreement" when they click "agree" (submit) the system creates a new row in the temporary register table of the db. It then issues a registration cookie, which carries the row id, and session value. in addition (for those cookie impared users) we carry the row id and session value in hidden elements. So far, as long as the user continues through the process all is fine, but if they (for whatever reason) back all the way out, and click 'agree' again, the process fails. I guess I have to find a way to force a reload of the 1st step "if they've gone back" OR "replace()" the first step with the second, so as to prevent the user from going "back" to the 1st step of the register page.
"Warning: Page Has Expired" - How To Aviod When Using Browser Back Button?
In summary: I want to a form to submit information via a HTTP POST, however, when using Internet Explorer I want to be able to use the back button and all the information retained. Presently we get a "Page has expired" message. How can we avoid this? Full details: Having searched for postings on how to avoid the "Page has Expired" they are numerous, however, I have not found one that answers the question adequately. Hence this posting. One posting directed me to the following webpage: http://in.php.net/session_cache_limiter but I played around with "session_cache_limiter()" and it did not give the desired results. (It seem to make no difference). Also many people say to use HTTP GET instead but this is not an option in this case. Where can I find concise definitive information on how to avoid "Warning: Page has Expired" and allow the user to press the back button and see the form as it was before they submitted it?
Getting Link To Act As "back" Button?
I've wrote a script that does calculations based on user input from two select boxes and two text fields. The results of the calculations show up on a second page. Where I'm having difficulty is I put a "try again" link on the results page to take the user back to the input page, which refreshes the page. When the "back" button is used on the browser, though, the info the user input/chose is still there. Most of the time the user will only need to change one field for multiple calculations, so the "back" button is ideal. Is there a way I can make the "try again" link act as the "back" button on a browser?
Re-Directing Back To "Sort After" Page&
I am using sessions and a MySQL user database to restrict users to certain pages on a website. If the user has not logged in and tries to access a protected page they will get the login page. Now if they are trying to acess a page like specials.php and they have to logon to access that page, then they get the login page and they then enter login details to access it. If their login is correct, I send a header Location to the Index of the site. How do I direct the user to the page they were looking to access(specials.php) without getting directed to the index.php page. I want to implement this function to all the restricted pages. I know its something pretty simple... maybe keep the url of the "sort after" page in a variable and then re-direct to that page after login ? Can someone give me a hint Thanks
What Is The Best Way To Use PHP To "reload" Web Page?
I am trying to code my "notfound.html" page when people click on the link that will send them back to home page, that the "entire" browser is "refreshed". Reason for doing this. I have frames on the home page. When user click on the link on "notfound.html", the home page appears within the home page frame. So I see 2 home pages. I have to physically click on the "reload" button on the browser to the the appearance that I want. But I know that "common" user will not think of that, and will determin that the home page is buggy...
FTP_login + $pass="" And $user=""
I use the following scrit in an Intranet with the user name = "" and the password = "" : <?php $ftp_server = "192.168.25.25"; $ftp_user = ""; $ftp_pass = ""; $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { echo "Connected at $ftp_user@$ftp_server "; } else { echo "Can't connect with $ftp_user "; } ?> I have the following message : Connected to 192.168.25.25 Warning: ftp_login(): 'USER': Invalid number of parameters in E:www est_ftp.php on line 26 I tried to : ftp_login($conn_id, "", "") but i have the same result...
"Force Download" Function
I've built a website that uses a force-download php script that's triggered by an on-click javascript event. The script works fine when fired via javascript, but I'm trying to tweak it into an includable function that's generically portable and is triggered by an input button within an "empty" form - nothing's between the form tags but the input button and two hidden fields which feed the file name and directory path of the file to the download function. The input trigger works, and the file name and path are passed succesfully, but I get a bunch of "can't modify header information" warnings. The force-download script does have a bunch of header information in it. Anyway, is there a way to make this work without using javascript?
How Can I "reload" The Values Of A Field
I try to "reload" the value of a form - field called name each time the form is being reloaded. I put this code in the php script: session_start(); if (isset($name)){ $_SESSION['name'] = $name; } else { $name = $_SESSION['name']; } ...... <input type="text" name="name" value="echo $name;"> however, when I restart the IE Browser and reload the url, then I do NOT get the value of $name. What do I do wrong?
Error In Page When Checking Http_get_vars("myvar") And "myvar" Was Not Passed In URL String
PHP, coming from ASP coding if (HTTP_GET_VARS['b']==1){ print "Yes"; }else{ print "No"; } when "b" is not passed via (http://www.mydomain.com?b=1 an error occurs and the "NO" is printed but an error is printed too. How can I check for the value of "b" so that no error occurs if b is not passed?? example http=www.mydomain.com $myvar=HTTP_GET_VARS['b'] causes an error because "b" does not exist (ie. its not passed in the URL string. $myvar maybe evaluated as NULL or Empty but the error is printed in the page, anyway.
How Do I Force A FRESH RELOAD Of A Page
I've built a few php scripts, but since its reloading the same page I can't get it to refresh the page. I've implemented some expire meta tag...but is there anyway I can try and force it to refresh?
Reading An Array Of Records From MYSQL Then "Save As" Them Back As Copy
Hi all, Ok here is what I want to do then I will show you what I have. I have some records in a MySQL DB that I want to store in an array and then immediately copy them back where the only thing that would change would be one field - the date. So here is my table: ------------------------------------- |userName | date | value | -------------------------------------- | theDano | 200005 | 123 | -------------------------------------- | theDano | 200005 | 345 | -------------------------------------- | theDano | 200004 | 678 | -------------------------------------- | joeUser | 199908 | 897 | --------------------------------------- So if I am querying for the user "theDano" on a specific date (format yyyymm) in this case 200005 (year 2000 month of May) Here is my array to query all records to fullfill this request: if ($update=="future") { if ($month!="01") { $db = mysql_connect("localhost", "dbuser"); if($db) { mysql_select_db("dbName",$db); $result = mysql_query("SELECT * FROM tableName WHERE userName = '$userName' AND date = '$date' ORDER BY value DESC ",$db); if ($result) { $num=mysql_numrows($result); $i=0; while($i < $num) { $userName = mysql_result($result,$i,"userName"); $value = mysql_result($result,$i,"value"); echo "<tr>"; echo "<td width=Ê×'>" . $userName . "</td>"; echo "<td width=ï`'><div align='right'>" . $value . "</div></td>"; echo "</tr>"; ++$i; } } } } } Now I want to take the array of records queried which was: | theDano | 200005 | 123 | -------------------------------------- | theDano | 200005 | 345 | and copy them to look like this back into the database: | theDano | 200006 | 123 | -------------------------------------- | theDano | 200006 | 345 | so you can see that the only thing changed was increasing the month by one. Would seem simple to most but I am having a tough time wirting the code to read the array and increase each date value by "1". Thank you in advance for anyone that replies. ) Dano
"force" A Download
Ive got the following code. however its telling me to download itself ( download.php), and not the file in the $_GET data... <?php header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); readfile("$_GET['file']"); ?> is this the correct code or do i need to try something different? The data type will change. at the moment the data types are as following: .py, .java, .zip, .js( not sure). We may also be downloading .exe etc. *its a programmign website.
How To DISABLE "BACK" When Doing Forms
I want to be able to disable the back button when someone submits a form. Right now i have a page like, questions.php When the person submits it, it inserts into database. But my problem is this: After the person submits the form, if he/she clicks back and then submits again, it will screw up the data in the DB. How would i be able to do with this php, perhaps hidden tags? session?
How Do I Do Something Like $color = ("red", "yellow", "blue")[$colornum]?
How do I take an index of a literal array, instead of a variable? That is, say I want to get the short name of a month. Can I do something like: $monthname = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")[$month]; or do I always have to do: $blah = array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"); $monthname = $blah[$month]; It seems a shame to have to create a variable specifically for this one-shot purpose.
Emulate "Close" Button
How do I emulate the web page "Close" Button, i. e. the "X" in the upper right hand corner of each web page?
Mail() Won't Work; Server Says "Unable To Authenticate User..."
I am working on a sendmail script using the PHP mail() function. If I click on the HTML form page from within my hosting control panel (while I'm logged into my hosting account), fill out the form, and then click on the "submit" button the mail sends just fine. However, if I log out of my control panel and approach the form page, just like a visitor or stranger would do, the PHP mail() function will not send the mail. If I look inside the "./tmp/mailError.log" file there is the following message: "Unable to authenticate user. Message not sent." It appears that the server will not send the mail because there is not any identification for the outgoing mail. I have tried inserting a fourth variable in the PHP mail() function a couple of different ways like so:
Customizing The "User Agent" With CURL Screen Scraping?
I have a script which performs a screen scrape of a webpage using cURL. I was wondering, how can I customize the "User-Agent" that shows up in the server-logs whenever my tool is used so that I can track it's usage on my site.
Refreshing On "Back"
I want the page to refresh (the script to run again) when the user presses Back button.
Using Setcookies In My "new User Login" Program
While using setcookies in my "new user login" program, i'm facing a problem. My cookie is storing the login name in the same page but as i go to another page and insert information about that user, who has just logged in, then it doesn't take the login in the sql query.
Pagnation - Limit Number Of Pages Between "Previous" & "Next" Hyperlinks
Was hoping for some advice with a part of page navigation.... It works at the moment so there is a "Previous" & "Next" Hyperlink underneath the records. In between the Previous & Next links are the number of pages that there is of these records. e.g: Previous 1234 Next This is fine if there are only a few pages of records, but when there are hundreds of pages the numbers are listed and they take up half the web page with them. How can i make it so only limited 10 numbers of pages say appear between the "Previous" & "Next" Hyperlink and as you progress through the pages they are as do the next 10 numbers of pages? Code:
Checking If $user & $pass = " "
if !( $user=="" || $pass==""); mysql_query("INSERT INTO users (id, sn, pw) VALUES ( '$idhigh + 1', '$user', '$pass')"); It wont load up my page when I try to run it with this in my page, what am I doing wrong? It checks my text boxes to see if the user and pass equals a blank input when the person clicks on the submit button, and if it does, then it does nothing.
[regex] Stripping Out "name" And "value" Values Out Of Tags, Aaargh
Searched through the site, but couldn't find the right regex syntax I was looking for. the thing i want is, to extract with preg_match_all the given values in a tag... ex. $str = '<input type="text" name="name" value="value">' $pattern = some magic stuff I need to know preg_match_all($pattern, $str, $result); And in result I want to have the values text, name and value AND it's important that the order doesn't matter so structure of tags can be <input type =name= value=> or <input name= class= value= type=> etc, etc...
'Parse Error' Problem In "isset" And "empty"
I've been having some problems with a parse error that I can't figure out (PHP 4.3.11 on Solaris9). Sample code: <?php // getting strange parse errors on this class A { var $value; function A() { $this->value = 1; } function getValue() { return $this->value; } } $a = new A(); if (!empty($a->getValue())) { echo "success"; } else { echo "failure"; } ?> The result of this is: Parse error: parse error, unexpected '(', expecting ')' in /foo/public_html/parse_errors.php on line 15 I also get the same effect with "isset", however, testing with "is_null" or "is_int" produces the correct ("success"/"failure") result. Any ideas?
Reload Outside Page OnClick Of Submit Button
I'm using frames to create a "bookmark-like" page. You can enter a URL and it gets added to my database. I have two frames (leftFrame - to display bookmarks entered and mainFrame to show web page). I want the leftFrame to automatically refresh when the user enters a bookmark. As of now you must physically refresh the page to see the results. Here's my code:
Question About Using "global" On One Page Then Using The Variable On Another Page
I am taking over an exisitng app. I have the following function on one page: function check($v) { global $user; return $user->validate($v[1], $v[0]); } And it reference $user on the next page. Register_globals are set on the existing server but I am moving to a new server where it is not. The code of the next page is lilke: session_register('user'); $user=$_SESSION['user']; I also want to turn it around so it's: $_SESSION['user'] = $user; But that fails - $user is empty. By the way, $user is an object. Any ideas to how to make sure: $_SESSION['user'] = $user;
Certain Custom "Page Not Found" Page Problem
I have an ISAPI instalation of PHP over IIS5 server on Windows 2000. Everything works fine but as I am under website development I would like to keep PHP error messages turned on - for my development purpose. Unfortunately, that concludes that in case somebody types a fake address like: http://www.myurl/xyz.php the server replies with something like that: Warning: Unknown(C:Inetpub ootxyz.php): failed to open stream: No such file or directory in Unknown on line 0 Warning: (null)(): Failed opening 'C:Inetpub ootxyz.php' for inclusion (include_path='C:InetpubPhpIncl') in Unknown on line 0 This is not the kind a message I would like to be presented to anybody. In this case I would rather like to see a custom "Page not found" message instead. Any ideas how can I configure PHP to keep displaying regular errors and warnings in all situations but in case of "page not found" - to display custom error message instead ?
"Page Not Found" Because Script Takes Too Long?
I am developing an online calculator for my school district. Without going into too much education-ease, the idea is simply that the user puts in some numbers, and the system crunches those numbers. The form, and the form handler are contained in one script, using a hidden variable to tell the script to process the information upon submitting to itself... Everything was working great, until I put in the various algorithms... They are not particularly numerous, lengthy, or complicated, but clicking on 'Submit' now yields a 'Page not found' error. When I commented out half of the math, the page loaded ok...so it seems to be 'timing out'... I'm baffled.... this script is simple, and short... what could be the problem???? Here is the math part of the script..
How To Refresh Page Without Prompt The "resend Information...."?
I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every minute. But the page always display the dialog box ask me to resend the information. How to disable this warning message. I using POST and REQUEST to get the data from user input page.
"Paging" (First/Previous/Next/Last To Limit # Of Listings Per Page)
I'm trying to get a handle on the best way to handle setting up my listings so that I display groups of about 25 records per page. I currently have a page that returns over 1,000 names/addresses, which is obviously not very efficient. Does anyone have any suggestions on the best way to approach this, or recommendations on what pitfalls to avoid? I'm assuming that I need to be able to count the total number of records that match the search criteria, possibly at the top of the page before any HTML output, then find some way to identify/track the first record, next record, etc...? I know I should replace my existing query with something that limits it to about 25 records at a time, right? <?php include('dbconnect.php'); echo "<TABLE width="100%" align="center" border="0" cellpadding="0" cellspacing="0">"; $query="SELECT * from artists WHERE mentor=Ɔ' ORDER BY country DESC, state ASC, city ASC, lastname ASC"; $result=mysql_query($query) or die(mysql_error("Could not execute query.")); while($row = mysql_fetch_array($result)) { $artistID = $row['artistID']; $firstname = (ucwords(strtolower($row['firstname']))); $lastname = (ucwords(strtolower($row['lastname']))); $mentor= $row['mentor']; $city= (ucwords(strtolower($row['city']))); $state= (strtoupper($row['state'])); $country= (strtoupper($row['country'])); //....etc.... echo " <TD align="left" valign="top" width="50%"><FONT size="2" face="Arial, Helvetica, sans-serif"> <A HREF="javascript:;" onClick="openProfile('artist.php?artistID=".$artistID. "','Artist','resizable=yes,width=750,height=400')">".$firstname." ".$lastname."</A></FONT></TD> //....etc....
PhpDocumentor: No "page-level Docblock" But Worked Without...
I am using phpDocumentor to generate documentation for my files. This worked without problems but today it told me "has no page-level DocBlock, use @package in the first DocBlock to create one" for ALL of my files, but I definetely have those @package lines. Did anyone observe this strange behaviour? Any tips for me? Perhaps new versions of PEAR/PHP/Zend Optimizer I installed recently damaged the installation. I reinstalled phpDocumentor several times (manually AND using PEAR)
"Please Wait" Page While Php Runs Mysql Queries
Does anyone have any idea what I should google to create a "splash page" that tells the user to wait while a few mysql quieries are run through the php page? It takes anywhere from 5 to 20 seconds, and I don't need a progress meter, just a splash page so they do not go anywhere and the user doesn't think there is a problem with their browser or network connection.
Can I "include" A Perl Script With In Php Page?
I was trying to use "include" to execute a perl script in my pHP page. Instead, it just printed out the contents of the Perl script and didn't execute thes cript. Is there any kind of function which executes a script.. i know SSI has this.. does php? something like >> execute("cgi-bin/script.cgi"}
Php Reference In <SCRIPT> Tag Gives "Error On Page" In IE6.0
I have some problems with a PHP reference in a <SCRIPTtag, but only with the Internet Explorer, which gives a "Error on page" message in the Status Bar. The code is as follows : <script> <!-- var stat =<?php echo stripslashes($status); ?>; window.status = stat; //--> </script> The error given is : Line:24 Char:13 Error: Syntax error Code: 0 Char 13 is the "<" or looking to the source of the page with the IE browser, it's ";" I get the error message as said before only in the Internet Explorer browser and it does not affect the display nor the functionality of the page, but it's not good looking ...
How Can I "stick" Yahoo's Page Into Mine
I am trying to "stick" yahoo's home page into the middle of mine using the include function, ie // my page include("http://www.yahoo.com"); // my page continues here but what winds up happening is that links on yahoo's page are prefaced with my URL. For example, the link to Yahoo Finance becomes "http://www.myurl.com/finance" instead of "http://www.yahoo.com/finance" Also, a lot of the pictures are broken images.
Write Text To An "image-page"
If I generate an image, is it possible to write text on the same page then? If it isn't so, there's no special meaning to generate images, who wants to surf on a page that is out of content, right? <? Header("Content-Type: image/gif"); $img = ImageCreate(100, 100); $black = ImageColorAllocate($im, 0, 0, 0); ImageFill($img, 100, 100, $black); ImageGIF($img); ?>
PHP Pages Getting 404 Error, "Page Cannot Be Displayed"...
I tried putting this into the PHP Installation forum but don't get any answers or suggestions there so I'm going to try it here and hope it doesn't get moved. I'm on a Windows 2003/PHP 5.22 setup. I'm TRYING to upgrade from PHP 5.02 which did work on my server and quite well. I followed the upgrading and installation instructions layed out on the PHP.net set -- I still can't get it to work. The install dumped all the PHP related files under "c:program filesphp". I've ensured that path is in my windows PATH statement for my env vars. I've also verified that "c:program filesphpphp-cgi.exe" is in my Web Service Extensions listing in IIS and the status is set to "Allowed". From the command-line, I can execute my "test.php" file that has the phpinfo(); info function in it and it works fine. It's only when I try to use my web browser to access the php file that I get the 404 error, "page cannot be displayed". I know that IIS in general is working ok because I can point it to the default http://servername/iisstart.htm and it resolves to that page just fine. It's only when I change it to http://servername/test.php (which has my phpinfo()) function in it when I get the 404 error. My web server just doesn't seem to be interpretting PHP files anymore and I can't figure out why.
Echo "<!--#include File="top.html" -->";
I have a search script which returns a page of results, however I'd like the returned page to be in the same format as the rest of my site. To do this I've tried adding the HTML for my site to my PHP page with echo" " commands. This works for the plain HTML, but my regular pages also use SSI to do other stuff (some of them even execute other PHP scripts to generate tables of data etc). I've tried echo "<!--#include file="top.html" -->"; but it doesn't work as I get a parse error. My question is, how do I go about doing this properly? Is this possible at all? And if not have you guys got any suggestions to get around this?
Any File Size Limit In <PARAM Name="***" Value="***"> ?
I embed an applet in my php script which has a parameter providing an input file for the jar. Does this file has size limit? The code is as follows: <APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0 ALIGN=middle> <?php echo "<PARAM NAME="data" VALUE="myfile.">";?> when "myfile" is beyond 15M, my applet cannot load sucessfully, but while this file is limited like 5M or 7M, it works well. Does anybody know is the reason caused by php script limit, applet mechanism, or by different browser?
How To Do PHP "require()" Or TCL "source" In Bash Script
I can't figure out how to explain this any better than this. In PHP we have a command "require()" that obtains a file and logically places it into another file. I cannot figure out how to do this in bash script as the requirement is necessary for a migration script to obtain the code from a .cfg file and then be able for the "parent" script to run the code it "imported" from the .cfg file, much like PHP's require() or TCL's "source". This is what I have so far and it fails: if [ -f ivc.cfg ]; then cat ivc.cfg fi Anyone really know bash script well please help, it's a barrier for me not to be able to get just this one piece working.
Best Way To Keep User "logged In"?
I'm trying to build a web app where my users can login and view personalized data (their profile, stuff specific to them) and I'm really pulling my hair out over what would be the best way to log them in and keep them "authenticated" through out different pages. So far I have two ways in mind. 1) Keep the username and password in session variables, and check it against the database on every page access. So each time a user clicks on a page, that page will re-evaluate them against the database to see if they are allowed to be viewing what they are viewing. This also allows me to grab their User ID, which is the primary key of that table, so I can use it to search other tables where that User ID is a forgein key. 2 Session Variables: user, pass Problem: I am not sure if this is overkill on the database. I have to run that query every single page the user access a new page. Is this a bad thing? And since I have to re-authenticate on each page I have to keep the user/pass in session variables. 2) Use a boolean flag. The user logs in, and i compare the user/pass to a database. If yes, I store the their User ID in a session variable and set another session variable, such as $allow=true, and use that to "allow" the user to go from page to page. Each page checking the session variable "allow" and the session variable that contains the User ID so I can query the database to get their relevant information. 2 session varialbess: allow flag, User ID Problem: If for some reason the variable name of the flag becomes known, a simple alteration of a url could allow access to the pages.
Assigning "page Of ?", Pdf And RegEx
I am currently well into generating a decent pdf report writer. One thing that I will only know after the file is generated (which I am writing to a text file and then rerouting the user to that file) is how many total pages are in the document. So what I need to be able to do is manipulate either the $buffer from PDF_get_buffer or the text file in such a way as to replace a marker with my final page count. Here is the bit of code that I thought would do just that:
Why Do I NOT Get The "Page Has Expired" Warning?
Normally, when you submit a form to a page using the POST method, and you subsequently use the browser's back button to navigate back to that page, it comes up with the standard warning "Page has Expired... To resubmit the information click the refresh button". I understand why that happens - the page resulting from a POST submission becomes immediately stale. BUT... on one of my sites this isn't happening and I can't understand why. I can click Back and the page displays just fine. I don't want that to happen as I want to generate a unique transaction ID each time that page is displayed. The page is submitted via POST to PHP_SELF but I've tried submitting it to a different page and that makes no difference. Has anyone come across this problem before? I've been scratching my head for hours.
|