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:
View 11 Replies (Posted: November 13, 2007, 12:32:09 PM)
Sponsored Links:
Related Forum Messages:
Functions Can Recognize My Global Variables Without Sending These Variables As Parameters In The Function Headers?
If I define a variable $var, and then define a function Func(), then I can't use the variable $var inside the function because the variable is defined outside the function. If I want to use the variable $var inside the function, then I have to send it as a parameter in the function header like this, Func($var). But the problem is that I have many global variables, and many function. I don't want to pass all these variables to all the functions! Isn't there a way that the functions can recognize my global variables without sending these variables as parameters in the function headers?
Posted: August 19th, 2001, 06:16 AM
View 7 Replies!
View Related
Http Headers - Send Redirect Page Pass Variables As Post Variables From A Script?
you can find a similar question here PHP Post Request inside a POST Request but this is not working in my context. I have a form (reservation form for a tour website) and when the form is submitted, the values are processed in a script like validation and calculation of values and sending email. after processing the variables, i want to send it to a page for payment and this page will post payment details to paypal. My question is after the reservation form is submitted, after processing values retrieved from reservation from, how can i redirect the page in such a way that the variables will be passed as post variables. (I am not looking from response from the other form, i want to redirect to the other form).
Posted: Dec 19 10 at 6:54
View 3 Replies!
View Related
Variables Not Holding / Variables From The Previous .php Script Dont' Transfer Over?
I have a .php script with 2 variables. $company and $user. During this .php script I require_once "/var/www/etc/etc/etc/etc/" The .php file that I require_once, the variables from the previous .php script dont' transfer over. I can't figure out why, or what I am doing wrong. Ex. master.php script $company = "Some Company"; $user = "John"; require_once "/var/www/$company/$user/example.php example.php script $myFile = "/var/www/$company/$user/Template/Download/example.php"; The data that is held in the variables $company & $user doesn't hold through on the example script. I can't understand why.
Posted: May 2 at 18:36
View 3 Replies!
View Related
Regex - Passing Variables To Perl - Using Spaces Between Variables Method?
i had been using this method to call perl (before i started trying to do this with regular expressions).. passing in a regex string as a variable causes all sorts of problems, such as using " ( )" anywhere makes it not work, among other things.. I am wondering if there is a better way to do this, than the string of variables after the perl filename method as it seems to have some glaring limiations. the way I do it currently: $file = "/pathtomy/perlscript.pl $var1 $var2 $var3" ; ob_start(); passthru($file); $perlreturn = ob_get_contents(); ob_end_clean(); return $perlreturn;
Posted: Aug 16 10 at 4:47
View 2 Replies!
View Related
Linux - Testing Two Double-variables Gives Different Result Without Changing The Variables?
in my code i have two double values. Lets call them $a and $b. now I want to test which one of them is larger, so I wrote the following: print ($a > $b ? "larger " : "smaller "); print ($a > $b ? "larger " : "smaller "); does anybody encountered a similar problem before? This problem only appears on our embedded linux system using php-cgi. Here is the whole code: I need to decode a hex value into a decimal value regarding the sign and eventually useng numbers larger than the integer-size [Code]...
Posted: May 19 10 at 7:30
View 1 Replies!
View Related
Assign Variables To The Value Of The Post Variables Using The Field Names?
I’ve been using an older version of PHP up until recently. Using the older build I had 'register_long_arrays' on. However this depreciated some time ago and I want to start working with 'register_long_arrays' set to off. My question is; if, for example you have a form with 25 fields is there a quick way assign variables to the value of the post variables using the field names? Code:
Posted: 06-25-2006, 08:08 AM
View 3 Replies!
View Related
Setting Variables Ahead Of Time With Gobal Variables
I just obtained a book that teaches you how to use php to handle form info. I created the example form as well as the php script to handle the form input. But when I run the form the $name(Variable) and $email(Variable) will not populate. I tried setting variables ahead of time with gobal variables, but didn't work. Ex. $name=$_post['name'] $email=$_post['email'].
Posted: 8:55 am on June 8, 2005
View 1 Replies!
View Related
Convert $_GET Variables To Regular Variables? About 10 Times
Do you guys always convert your GET and/or POST variables to regular variables $variable = foo;? On a page, I'm using a GET variable about 10 times, would it be more efficient to convert it to a regular variable (I'm sure there's a name for this type of variable) at the beginning? Does it have anything to do with load on the PHP (interpreter, like it goes to check the variable from the URL every time, which is maybe more of a strain than from the document itself), or just mere file size?
Posted: 07-27-2007, 10:07 AM
View 5 Replies!
View Related
Funny Behaviour Of Cookie Variables And Session Variables?
I wrote a little PHP script below to demonstrate my question. Run the code below like this:[URL]You will see that the number echo'ed to your screen is always 1 digit behind the url number?! Maybe because I cant a cookie and immediately read the same cookie? //If query string has $test, store in session, and cookie for later. if($_GET[test]){ $_SESSION['test'] = $_GET[test]; setcookie("test", $_GET[test], time()+60*60*24*30*12*10); //10 years } //If user comes back later, then get $test from cookie if (isset($_COOKIE["test"])){.......
Posted: Nov 14 10 at 1:43
View 3 Replies!
View Related
Class Design - Variables In Array Instead Of Distinct Variables?
I'd like some suggestions/critique/opinions on the following setup of class "bar". Both classes "bar" and "foo" hold the same data and do the same stuff, the difference being that in one case data is held in an array whereas in the other there are distinct variables. Is there anything fundamentally wrong with that approach that would make you say "I would never do that"? Obviously it's not easily possible to convert the variables in the array to "public" - but I do not intend to do so - I prefer using accessors and mutators for exposing class variables. The advantage that I see is that I can build a "lazy" constructor where I can simply fill the whole class-data in one swoop - for example from an array that I got through a datareader class that retrieves them for me from a DB. [Code]...
Posted: 03-12-2010, 06:02 PM
View 4 Replies!
View Related
Change PayPal Posted Variables Into Local Variables?
How can I change PayPal posted variables into local variables? I just want to echo out the amount in my page. And I want to send visitors to my page directly when they click paynow button I want to skip other step. Now paypal show the 2 links 1 is go to my site and 2 is paypal account overview when they hit the paynow button. i dont want to show those links. Here is my code: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="business" value="joyson_1310654220_biz@hotmail.com"> [code]..... my page code <?php $amount = $_POST['amount']; echo $amount; ?>
Posted: Jul 15 at 11:49
View 1 Replies!
View Related
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?
Posted: March 5th, 2001, 11:33 AM
View 7 Replies!
View Related
Converting Post Variables Into Session Variables
I have a script in which I take a whole lot of data from a number of pages of a form, compile it into one, and let the user edit it before it's eventually thrown into a SQL database. The data coming from the forms is in post, and I've created arrays of all of the fields in the form, like: Code:
Posted: 06-03-2006, 03:54 PM
View 5 Replies!
View Related
Passing Variables To A WCF Web Service - Variables Are Blank
I have a WCF Service, the interfaces work fine when connecting with a c# application but when I connect using a PHP application all variables passed to the service are null. This is the PHP code used to connect to the service and send the data. $SelectedFolder = $_REQUEST['folder']; var_dump($SelectedFolder); try { [Code].... The var dump displays the following string 'Pictures/Sample/' (length=16) This is the service code [OperationContract] List<VersionedFileDataModel> GetAllLatestVersionsString(string partUri); I've tried passing a static value instead of a variable and both times the value received by the service is null.
Posted: Apr 22 at 12:37
View 1 Replies!
View Related
Session Variables Lost Between Pages Or Use Same Variables?
I have Wamp Server(2.2.11) with PHP(5.2.9.-2). I know I did something wrong but I didn't find myself.Before I wrote this e-mail I red many document with different search items. I test a same application with different User IDs. When I use "session.use_cookies = 0", session variables lost between pages for SAME UserID. When I use "session.use_cookies = 1", same session variables are used DIFFERENT User IDs. My php.ini's session settings at below: [Session] session.save_handler = files session.save_path = "c:/wamp/tmp" [code]....
Posted: Jan 2 at 16:04
View 1 Replies!
View Related
Session Variables Interchanged With Local Variables?
I've encountered a very odd issue in regards to session variables and local variables in php. if I am not understanding something about sessions in php or if this is an issue with the php version my host is using.Here is a very simple code to demonstrate the weird issue: session_start(); var_dump($kenny); var_dump($_SESSION['kenny']); [code].... It looks to me like the session variable 'kenny' and local variable $kenny become aliases to one and the other after running the script more than once. hmm... I really don't think this is how session variables and local variables work in php.My web host is running php 5.2.2. When I try this exact same code on other hosts running php 5.2.1, 5.2.14 and 5.3.1, they always give me what I expect: 1st time:NULL NULL NULL string(3) "def" string(3) "abc" string(3) "def" thereafter: NULL string(3) "def" NULL string(3) "def" string(3) "abc" string(3) "def" I checked the change log on php.net and didn't find anything that I can relate to that may address this issue. But like I mentioned, an earlier build (5.2.1) works ok, so that's very puzzling to me.If anyone runs any other version of php 5.2.x, please give it a try and let me know if you see the same issue.
Posted: Sep 23 10 at 15:33
View 1 Replies!
View Related
SESSION Variables Clash With Normal $ Variables?
Code: session_start(); session_regenerate_id(); $_SESSION['username'] = 'steve'; $username = 'steve'; I am using these two variables in my program, but somewhere I have a bug and I'm having trouble fixing it.Is it possible for these two variables to clash in some way since they have the same name? I keep loosing the value held in $_SESSION['username'], whilst all the other $_SESSION variables remain intact.Does doing this cause ambiguity in some way?
Posted: March 12th, 2010, 09:58 AM
View 1 Replies!
View Related
Global Variables = Off To Pass Variables To SECOND & THIRD Page?
Currently using PHP 4.4.9 and I am having a hard time figuring this one out. I can get this to work with Global variables set to ON but I do not want to use this setting and want it to be OFF. I have done many searches and have not turned up anything that works. All examples seem to be only for passing variables to the next page.....and unfortunately that isn't working either Here is my scenario.PAGE 1:I define variable $usrID = 5; on this page as something that needs to be passed to other pages.PAGE 2:I want to echo $usrID or use it for somethingPAGE 3:I want to echo $usrID or use it for somethingI have session_start(); located at the top of each page. I have tried many different combinations of $_SESSION, $_REQUEST, $_POST, etc etc etc but cannot seem to figure out how to pass the variable that is defined on PAGE 1 to be display on any other page and it is killin me a slow death I can successfully pass a value from one page that is a FORM and $_POST the values to the next page, but like above, I cannot get those values to $_POST to another page after they have been submitted to a DB for example and then later show them on another page.If someone could show me a really easy example as far as what to put on each page it would be greatly appreciated as then I can test it out and then start applying my more complex example.
Posted: April 17th, 2009, 07:49 AM
View 4 Replies!
View Related
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;
Posted: 7:50 am on April 22, 2007
View 1 Replies!
View Related
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:
Posted: June 1st, 2003, 07:56 PM
View 2 Replies!
View Related
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
Posted: February 20th, 2001, 11:02 AM
View 2 Replies!
View Related
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.
Posted: July 1st, 2002, 06:59 PM
View 14 Replies!
View Related
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.
Posted: July 16th, 2005 10:45 PM
View 1 Replies!
View Related
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.
Posted: November 30, 2007, 07:52:35 PM
View 3 Replies!
View Related
Defining Variables - Print The Variables
Can it be done? I ve been searching the net for ages looking for tutorials or examples and i cant find anything. What im trying to do is something like this: <? if ($variable == "blah") { $a = 1; $b = 2; $c = 3; }; { echo ($e . $f . $g); }; ?> Ive tried about a hundred different ways of doing it, but none of them print the three variables. what im doing wrong or give me the correct coding for this?
Posted: April 22, 2007, 08:14:15 AM
View 1 Replies!
View Related
Can You Set FILES[] Variables To Session Variables?
I have some code to upload files to my site. it works when the <input type="file" is posted once even when I use session variables from the posted variables but when I carry those session variables to a new page the upload will not work. despite the variables being set. I have echoed then on the second page and they display correctly but they just dont work in the move_uploaded_file() function. Code:
Posted: October 17th, 2006 06:45 PM
View 7 Replies!
View Related
Convert Variables To JavaScript Variables?
I am trying to insert php variables into javascript. Here is the broken code: var tokens = [<? $result = mysql_query("SELECT * FROM accounts ORDER BY id DESC") or die (mysql_error()); while ($row = mysql_fetch_array($result)) { $user_name = $row['user']; $user_id = $row['id']; echo "['$user_name','$user_id'],"; } ?>]
Posted: Nov 2 09 at 0:07
View 3 Replies!
View Related
OOP Class Variables Vs Object Variables?
when making a class in php what is the difference between these two : class Search function __construct() { $this->variable1= 1234; } } [Code]... if i need to access a value across different methods does it make any difference which approach i chose?
Posted: Mar 23 at 14:50
View 4 Replies!
View Related
Get Variables From A Shell Script Into Variables?
run a shell script from php and he needs to get the variables created in the script back into the php code when the shell script is finished. creates the variables in php and send those to the shell script instead; he could do this but would prefer to use the shell script if possible. This is the code I am using to call the shell script: PHP Code: $font = "Helvetica-Bold"; $pointsize = "50"; $textcolor = "red"; [code]....
Posted: Jun 27, 2009, 00:30
View 10 Replies!
View Related
Variables As Session Variables
From a main form I submit and reach different other forms/scripts and eventually return to the main form. When I return to my main form I find that the form's variables are empty (their values no longer exist) and what I need is that each time I return to my main form, I want to still have the values. Is it common practice to have forms directly stored in session variables to overcome this problem? For example: <textarea name=_SESSION['lineArray'][$line][firstName] > $_SESSION['lineArray'][$line][firstName] </textarea>
Posted: 03-22-2007, 02:11 PM
View 4 Replies!
View Related
|