Faking Posted Variables
I have played with this some unsuccessfully and can't find any
references to it on-line.
What I have is a forms-based application where I POST the form. This
was decided on because of security and the length limits of a URL. Now
I have a need where I would like to link to a form and "fake" some of
the variables that are normally posted.
For example, I have a form that normally comes up where the user
selects information from a combobox and on reload, the fields are then
automatically filled in. I would like to be able to go to that form
from other locations and fake the POST variable of the combobox so that
the form will fill in when they first access it.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Escape All Posted Variables?
this works well enough when all the elements in $HTTP_POST_VARS are scalars, but it doesn't work so hot if one or more of them is an array: <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre> while(list($key,$val)=each($HTTP_POST_VARS)){$$key=htmlspecialchars($val);} [/code] So what I need is an easy way to tell if "$val" is an Array so that I can do something similar to each of its elements in turn.
Using Referal URL, Getting Posted Data, Passing Posted To Include *HELP*
OK.. here is my problem.. I am using PHP as a frontend for executing (actually including) a vb CGI .exe file the include just does the following right now: <?php include("http://localhost/test/make.exe?f=$_GET[f]&f2=$_GET[f2]&step=$_GET[step]"); ?> What I need to do is I have a form that needs to have a "Back" button/link and a "Next" button/link .. If they click on "Back" I want it to pass the "Back" as the say... $GET[do] ... needs to equals "Back" if they click back. If they click "Next" it needs to equals "Next" .. I thought I may be able to detect what URL it is posting from because it is being posted like this: URL This would be fine except I need it to retrieve all the data from the form and I do not know if the PHP would get the data from the entire form if you passed it like this it seems like it would only get the posted info in the link.. Is there a way to make the Links as Buttons or keep them as links and then have the links/buttons submit with the different "Back" or "Next" values? Pls post code on how to do this and I would greatly appreciate it.. This is giving me a headache trying to figure it out! Thanks a lot!
Faking Post Data
i've copied my bank's login form and saved a copy on my computer. However when i try to submit it, i get a 405 method not allowed error. Can't for the life of me figure out why, it's posting exactly the same data from exactly the same html code. Any ideas? It's a https (SSL) site.
Getting Arguments From A Shellscript Into $_REQUEST When Faking Callfrom A Web Server
My knowledge of php is regrettably poor but I need to call a third-party php script from within a bash cgi script (don't ask why, it's a long story). Now normally (with eg perl-cgi) to do this I need to set QUERY_STRING and REQUEST_METHOD appropriately; however with php this doesn't work, the $_REQUEST array is empty. $ export QUERY_STRING='test=1&wibble=2'export REQUEST_METHOD=GET;php -n -r 'print_r($_REQUEST);' Array ( ) $ What do I need to set in order for the _REQUEST variable to be populated correctly?
Notify Once Posted
While I'm writing a reply to a message, someone else writes one and posts it, now for my site I'll be making a message board. Is there anyway to tell the user that someone has posted a response while they're on the compose screen?
Name Of The Form That Was POSTed?
Is it possible to determine the name of the form that caused a page to be submitted? I have seen numerous examples of how to determine the method of the POST and how to retrieve data elements from the post, but I haven't seen any way to know the name of the form that caused the post. The page that is POSTing to my script has two forms and I'd like to know if I can determine which one of them was submitted without having to add a hidden element to the forms.
How To Check That Form Is Posted ?
i have a form on a php script - the php script is signup.php, i want to check that when it is submitted when user press the submit button, it will check whether the fields are empty or filled. how do i check that the user is clicking on the submit button and not going to the signup.php as a link ? because currently, when anyone click on signup.php, it immediately showed the errors (as if the user forgot to fill up the fields - when actually he is just going there from another link ). <? if(!$name&&!$email&&!$address&&!$phone) { // all not filled up echo "Error. You must fill up your name..... ";}?>
Previous Page/Posted From
I wanna know if there's a way to find out what page/file a form was posted from. Or wich was the prevoius page/file that was linked to the currant page.
Editing Posted Bulletins
I have a section on my church website that pulls announcements stored in mySQL and displays them with PHP. I recently started working on a control panel so that other people could login and edit/create the announcements so as to keep it up to date and lighten my load. I use a while statement to display all of the bits of news but my question is how can I make an edit button specific to each row in the table on mysql? All I need to really be able to do is have an edit button spit out for each post that will set a session variable to that particular posts index number. I created the mysql table with this in mind and have index numbers to reference the chunks of data.
Retaining Previous Posted Values
I have a form that if submitted correctly posts back to itself with a message that says the record was entered correctly. what I would like to do is retain the last values entered in some of the fields so that they don't have to retype everything if they want to add addtional records (it's a list of species and many times phylum, class, order do not change.) i thought I could do it with session variables but it doesn't work.
PHP/ List Authors That Have Posted More Than X Comments
I'm currently trying to implement sort of a "remember me"-addon to a newsposting script I'm using (cutenews, cutephp.com). What I need is to produce an array that contains comment-authors that have posted a set number of comments to my site. If I set this numer to 5, I want all commenter-names that have posted 5+ comments to be in the array this script is to produce. The format of the comments database is this: <unique id>¦<comment-authorname>¦<url>¦<ip>¦<comment-text>¦¦ (where ¦¦ means new comment follows - no seperate line for each comment.) Can anyone give me pointers to where I should start? This problem is really bugging me. 1, I need to search a huge text-file with hundreds of these unique comments, then I need to print a list of the authornames that have posted more than the set minimum number of comments to get listed. I'm going to use this list for a form field where people can select their name...
Outputting POSTed Data On Error
Got a form, user enters information, presses submit, then info added to my database. however, it checks to see if fields are empty when the button is pressed, if they are empty ive got it to bring up an error to say for example name, postcode empty. but the form comes back with blank fields i want it so if fields are empty form comes back with the fields that have already been filled in.
Best Way To Encrypt A Form Posted URL String?
Could someone post some examples with explanations of how to encode/encrypt a form posted URL and then decrypt it, so that it is very hard or currently impossible to break? so, something like http://localhost/page.php?product=12&price=4.50 would appear obfuscated in my browser display area like: http://localhost/page.php?Ur7@7892yRyw&wq84y@$y8@$ (or whatever)
Reading Data Posted With XMLHttprequest
I'm trying to post a form (using POST not GET) using the xmlHttpRequest object. I cannot work out how to get PHP (4.1.2) to read the data which I'm submitting. Everything works fine if I use GET I can just read it from $_GET. If I use POST nothing appears in $_POST. To try to use the POST method I'm encoding the fields into a URL encoded string and sending it as the parameter to the request.send() function from Javascript. /Something/ is going out because I can see it in the LiveHHTPHeaders extension to Firefox. Presumably it's being received by the server. But how on earth do I get at it!?
Identify Server That Posted Data.
I am looking into the security aspects of a site, and would like to know if there is any way to identify the source of the data that is posted to the php page responsible for processing the data. in other words I only wantt he php code to process the data if the data was posted from a form hosted on my server.
Make Forms Keep Data After Being Posted
I'm trying to set up a simple preview-type thing for my very first blog script (im new to php and mysql). First off, heres my code for the update (place to post a new article) page (excluding the includes to connect to the database): Code:
Removing Oldest Table Row When New One Is Posted
im trying to figure out how to make it so that a user can pick how many rows they want to keep stored in a database table before an old one is automatically deleted im guessing the query would be made, then a while loop would determine how many......ahhh i dont know there has to be a simpler way of doing it..
Reading Data Posted With XMLHttprequest
To use the $_POST global without enabling the raw data in php.ini, try the following code: objXMLHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); objXMLHttpRequest.send('var=value&var2=value2');
Converting The Posted String To The Value Of Html Element
I've been very confused in dealing with posted strings. For example, if I fill in a text element with "(double quote), submit it and display it in a text and a textarea, I get "(backslash followed by double quote) in the textarea element but (backslash only) in the text element. Code: <input name="somename" value="<?php if(isset($HTTP_POST_VARS['submitName'])) echo $HTTP_POST_VARS['somename']; ?>" /> I made a function which correct the misbehavings:
Losing Posted Form Fields Over Https
This has been driving me nuts. I have an application running for several clients. Some run on http and two run on https. Two weeks ago, the https customers started occassionally getting kicked out to the home page. This is not every time, it's generally 1 in 10 form posts. Refreshing the page asks you to repost the info and it posts as it should have in the first place. Dumping the $_SERVER variable shows me that if things go well I get the $_POST and $_GET variables and the $_SERVER["CONTENT_LENGTH"] is a number. When the error shows up, CONTENT_LENGTH=0 and there are no $_POST or $_GET variables. I can only reproduce this over https on Linux/Apache/PHP using Internet Explorer. I cannot reproduce it using Mozilla or Opera as a browser. And I also can't reproduce it using IE over https with Windows/IIS/PHP. None of the PHP code changed and there were no new installations on the server I can point to as a possible cause. We were running PHP v4.1.1 and upgraded to v4.3.4. I have been able to trap the condition to offer our users a page to inform them to refresh so they won't lose their data. Any suggestions, ideas, places to look or ask more questions, is much appreciated. $_SERVER[SERVER_SOFTWARE] => Apache/1.3.20 Sun Cobalt (Unix) mod_ssl/2.8.4 OpenSSL/0.9.6b PHP/4.3.4 mod_auth_pam_external/0.1 FrontPage/4.0.4.3 mod_perl/1.25
How To Automatically Make URLs Posted In A Forum Active Links?
I've been working on modifying a forum script for some time now and its almost ready to go. You can test it at http://www.designlaunchpad.com/forum if you like. The one additional feature I want to implement is the automatic creation of a link when someone posts a URL in their message. Most forums have this, is it that tough to add in? I'm pretty comfortable editing PHP and understanding what is happening where but I suck at authoring it. I checked the manual at php.net and tried searching this forum and google but keep running into dead ends. So can someone offer me some suggestions or point me toward some help?
Same Named Variables.. Or Addressing Variables In A Loop
I'm just starting to program in PHP.. fairly new to programming in general... and I've run across a (probably simple) programming problem I hope someone can help me with. I'm sending variable names through an HTTP get that are generated through a foreach loop. The names are along the lines of name1=, begin1=, end1=, name2=, begin2=, end2=.. etc. The number is the number of the current cycle through the loop. My problem is addressing the variables on the next page... namely how do I evaluate those variables in a loop? I want the value of name1.. but obviously for (i=1; i<3; i++) { echo "$name$i"; }; is not working. Is there an easy way to do this?
Passing Variables & Dummy Variables
Hi! thanks for all the previous help - I've made some progress & have dropdowns and a checkbox; however I have 2 probs which I can't figure out: grateful for any further help. THANKS! 1. Not sure how to code so that user can query from just 1 or all of the dropdowns (at the moment unless they select the correct answers from each dropdown - no results!) = defeats the whole purpose of searching. By selecting from menu options user selects from 2 diff tables. [the page allows user to search catalogue by selecting year of release, artist, music type - results from 2 tables need to be selected & sent to mysql. I just don't know how to code it so that user must make an initial selection to get any results, and whichever menu options they choose "add them together" if you like to make a complete query.... sorry my coding just isnt deep enough! A friend suggested using a dummy variable but as I'm a bit out of my depth; I need to get some help! The coding I've done so far;
Passing Variables And Session Variables
I'm currently working on a shopping cart script that works just fine with register_globals turned on but when turned off i get all kind of errors. The following page displays a detail of the book with the "Add to cart" link at the bottom. PHP Code:
Passing My Variables With Forms Variables
how to carry variables onto the next page along with the forms variables. I need to carry my own over too, but when I press submit on the form page only the forms variables carry over, not my own ?? I have two drop down menues on my form that provide two values "start & end" which I require to go with my own variables.I have tried "a href=" link which carries my variables but not the forms variables. <?php echo"<form method=get action=somepage.php?one=$one&two=$two&three=$three&four=$four>";?> also tried <a href=somepage.php?one=$one&two=$two&three=$three&four=$four&start=$start&end=$end
Persistant Variables - Application Variables
In the books I have read about PHP I haven't been able to find any descriptions of how to set variables that persist in the servers memory, in the way that Application variables persist in Cold Fusion. In CF, if I set an application variable then any of the application pages that are run will have access to those variables. And you can put complex arrays of data in the Application Variables and then access these variables at any time, without having to reload those variables for each page when it loads. I expect you can do this is PHP, but I can't find any info about how to do this.
Variables That Change Session Variables
I'm currently writing a mulit-page form app that uses a session to retain data from each form element in order for the user to jump between pages, then the final data is passed to a calculation script. However, I've noticed that if I assign a session variable to another variable, which then performs a mathematical calculation, the session variable changes. i.e. $_SESSION["inflation"] = 4; $temp_inf = $_SESSION["inflation"]; if ($_SESSION["inflation"] =="RPI") { $inflation = $rpi;} else {$inflation = ($temp_inf/100.0);} now it equals = 0.04 How can I take a value from a session and perform operations on it without altering the original session value.
Form Variables To Session Variables
I am writing a small script that consists of two pages: page one displays a bunch of values from a DB (ie. First Name, Last Name, Phone Number). On this page you will find a form that follows this format: <input type="text" name="edit_firstname" size="20" maxlength="35" value='Bob'> <input type="text" name="edit_lastname" size="20" maxlength="35" value='Smith'> <input type="text" name="edit_phone" size="20" maxlength="35" value='5552222'> So when you see the page there will already be a 'default' value in each line (which is information extracted from a DB). This works perfectly and has been tested thoroughly. On the second page I have the following code: $editfirstname = $_POST['edit_firstname']; $editlastname = $_POST['edit_lastname']; $editphone = $_POST['edit_phone']; What I am trying to do is this: the default value for edit_firstname from the form is 'Bob' by default, but the user can change this in the input field on the first page. This value, whether changed or unchanged, should then be stored as edit_firstname and by calling up the function $_POST[''] on the second page I want to transfer the value to the variable $editfirstname. However, it seems that $_POST['edit_firstname'] and the other fields do not return a value at all, hence $editfirstname = '' or $editfirstname = 'NULL'. I have never tried to do things this way before.
Building Variables From Variables
I am trying to build a variable, that will have a amount of that variable, can someone describe/explain in detail the best method to do this?
Variables
I have a variable holding text which I want the text to have a $ in front of it to convert it to a variable.
Php Variables
I'm trying to assign a new value to a variable passed from an html form to a php3 script. I'm using an if statement to evaluate variable 3 to see if it is equal to a specific string, if it is I'm reassigning variable 2 to be variable2+variable 3. if ($question3!="select days") { $question2=$question2+$question3; } This is the statement. It keeps giving me a parse error and I can't seem to find the right documentation to show me how to combine two string variables.
Variables
If i created an array that holds fields of a table, how could I call one of the fields ie $array[field] if i need the field part to be a variable?
What Does @ Do In Variables?
i've noticed that many scripts contain @ before a funciton is called as in the following: $host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]); so what is the purpose of the @ ?
Variables In URL
I have tried the following to pass a variable queried from a database to another page through the URL (id is the database record): $idnum = $row->id; print "<a href="page.php?$idnum>"; print "Click Here"; print "</a>" and then to print the results on the linked page: print $idnum; but it didn't work. What's the exact code to retrieve and print the variable $idnum? Also, can I use $idnum as a variable in a database query string such as $result = mysql_query( "select id from articles where id is like $idnum" );
JS Variables In Php
i've got a piece of javascript code which prints out the city + country of a visitor to a website. I want to print both, city & country to a file. JS doesn't have file I/O. Would it be possible to somehow import the variables to php? here's the JS code: <script language="Javascript" src="http://gd.geobytes.com/gd?after=-1&variables=GeobytesCountry,GeobytesCity"> </script> <script language="Javascript"> document.write("<p>Welcome to visitors from "+sGeobytesCity+", "+sGeobytesCountry); </script>
Variables Within Variables
The actual app I am building allows users to create an email which is then mailed out members from a db of email addresses. Although I am having a big problem reading a variable into the mail after the mail has been created. In a very simplified state all I am trying to do is this (the order of events has to be this way unfortunately): $content = "This is an email and the variable $name needs to be viewed at this point"; $name = "buttie"; echo $content; When $content is echoed the variable $name does not get read. What is the best way to let $content access the variable $name, using this order of events.
Variables By URL
Hi have a simple php script that gets the website URL from a form... puts it on a variable and calculates Link Popularity. How can I get this to work passing the site URL by the address instead of the form. [php] <?php if(isset($_GET['getlp'])){ // Edit this to your website url: $myWebSite = ($_POST['url']); [/php] I go to http://localhost/novo2/material/linkpop.php On the form I introduce my site and the address becomes http://localhost/novo2/material/linkpop.php?getlp=1 How can I avoid introducing the address and make the script assume that the address it needs its the address where it's being host?
PHP Variables Put Into A PDF
I have been searching for at least 5 hours all over the web and can't find a single thing to help me with this problem... I have a form created in Adobe Designer 7.0 (editable form) and I want it to receive variables from PHP and display the filled in form to users so that they can print it off for their own records. The form HAS TO BE laid out in the format I created in Designer 7.0. Any tips, suggestions, refering stuff?
Variables Through URL
I am trying to pass a variable through a URL eg. index.php?page=Features. Sadly, I used to do this in the Global off environment of PHP Nuke, and now have to cope with Global on. I have tried PHP Code:
Get URL Variables
how to get a variable passed in the URL, like this: <a href="issue.php?ticket=2">2</a> On the issue page how do I get the variable 'ticket'? There seems to be no HTTP_URL_VARS or something of that nature and nothing in the PHP manual that I could find.
Variables?
I simply want to print some text that has 2 variables in it. Here is the code i have now. PHP Code:
Php URL And Variables
It's probably very easy, but I cannot find my mistake: page1.php <?php echo "<a href=page2.php?vartrans=5342>Clic</a>"; ?> page2.php <?php echo "$vartrans"; ?> When I click on the link on page 1, page 2 appears on the screen but with the following error message: Notice: Undefined variable: vartrans in c:program fileseasyphp1-7wwwpage2.php on line 2 What's my mistake? I use php 4.3.3.
Variables
i have many pages (page1.php .. page100.php) and each of them include some fixed subpages (top.php, bottom.php). each subpage (top.php, bottom.php) uses a variable ("theme") defined in its "parent" (one of the pageX.php). this variable is also used (not only defined) in the parent page itself. i would like to have the variable "theme" defined in a single external file, instead of defyning it for every page. is it possible? sorry for the probably stupid question, im new to php.
Variables
Let me explain what i want with an example. I have 3 files :- File-A File-B File-C I am using a variable called $tdir in File-C. Its default value is stored in File-B. Now, there is a Form in File-A where i can input a certain value and when i click "Submit", the value will be stored as $tdir in File-B. From then, this new value will be used in File-A.
Get Variables
I want to transfer a variable to the next page. Here is the code: First Page: $page="1"; <a href="fav.php?page=$page">I like it!</a> Second Page, (retrieves the variable) $page = $_GET['$page'];
Sum Of Two Variables.
Im creating a small stats counter (god knows why after all the trouble it ahs caused me!) for my site, and getting all of the relevant data from the server log files. Getting the data isnt a problem, and slicing it up is fine but.. Ive created a rule that is trying to emulate a google analytics feature (the feature will count a visitor twice if they return after a certain amount of minutes even if its the same ip), but the code doesnt work. There are loads of different ip's in the log so I just cant understand why the code is interpreting just one ip. Code:
|