[PHP] Sessions don't work?
Hewwo all, (please be so kind as to CC me in replies as I am not a subscriber to this mailing list (yet)) The following code snippet always outputs "You have visited this page 1 times!". What am I doing wrong? " " I realise I could use $_SESSION, and I actually prefer it, but I have to write code that will run on 4.0.6. Versions and the like: PHP 4.2.2 Apache/1.3.26 (Unix) Debian GNU/Linux All this on Linux ppc (benh kernel) 2.4.19 Thanks in advance, -- Alexander Deruwe AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sessions don't work?
I'd like to post a follow-up to my previous message on this subject. Please still CC me when replying, thanks. New test code: " "); echo(sprintf("You have visited this page %d times!", $counter2) . ""); echo(sprintf("You have visited this page %d times!", $_SESSION['counter3']) . ""); ?> " Tried these on PHP 4.0.6 (register_globals = On): - counter: doesn't work - counter1: works - counter2: doesn't work (to be expected) PHP 4.2.2 (register_globals = Off): None of the counters work; same when register_globals = On I'm really puzzled by this; could someone please point me in the right direction? -- Alexander Deruwe AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Lazy evaluation?
Hey all, Does PHP support lazy evaluation? Meaning that if: if (isset($HTTP_POST_VARS['submit']) && $HTTP_POST_VARS['submit'] == 'create') does PHP stop evaluating after the first condition if $HTTP_POST_VARS is not set? (please CC me in replies) Thanks in advance, -- Alexander Deruwe ([EMAIL PROTECTED]) AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP for shell scripting: weird error.
Hey all, When running PHP scripts from the command line, I get this error: "Content type: text/html PHP Fatal error: Unable to start session mm module in Unknown on line 0" The script doesn't run, or so it seems. I also get this error when I run generic stuff such as 'php4 --help', or just 'php4 -q'. The script in question is this (though I hardly think it matters): #!/usr/bin/php4 -q Does anyone know what is going on? Searching the archives for the error string turned up nothing. I'm running PHP v4.0.7RC3 (from package php4-cgi) on Linux 2.4.10-ac11. Distribution debian unstable. Thanks in advance, Alexander Deruwe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Weird database stuff.
Hey fellow PHP-codemonkeys. :) Let me start by laying out some facts: SELECT e.NAME AS customer, g.NAME AS driver_lastname, g.FIRSTNAME AS driver_firstname, $CommonSQL, COUNT(g.NAME) AS number FROM ENTITY e, ENTITY g, EXPERTISE_FILE f, DAMAGE_CASE d WHERE (f.CUSTOMER = '$CustomerID') AND (e.ID = f.CUSTOMER) AND (g.ID = f.DRIVER) AND (d.OWNER_EXP_FILE = f.ID) AND (f.DATE_REPORT BETWEEN '$StartDate' AND '$EndDate') GROUP BY e.NAME, g.NAME, g.FIRSTNAME The query above is one of the statistics gathering queries in my application. This one will run flawlessly. If however I add this condition: "AND (f.DRIVER = '$DriverID')" before "AND (g.ID = f.DRIVER), the script will eat all CPU and RAM (and eventually swap aswell) on my PowerEdge 2500SC. If I run both queries from inside psql (I use PostgreSQL), they -both- (!) complete within split seconds... If I leave set_time_limit() on the default of 30 secs, my script will time out somewhere around these lines (though it seems like coincidence...): function CalcDenied ( $Requested, $Agreed ) { $Denied = $Requested - $Agreed;--> Timeout here if ($Denied < 0) --> Sometimes here { $Denied = 0; } return $Denied; } To me, this does not seem to make any sense, especially since the first query (without the additional condition) runs fine, whilst it has to return many more rows. Does anyone have any idea what could be going on? If you reply, please include a CC for me, as I am on digest (I don't have time to sort through all the messages at work anyway, but I do contribute from home. :) Thanks -- Alexander Deruwe ([EMAIL PROTECTED]) AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Printing Reports
On Tue, 27 Nov 2001, Dan Koken wrote: > As a Newbe to PHP, I need to print reports. One way to do it, I think is use XML/XSL. I have never done it before though (I use PDF's myself, but would like to get away from it).. Could anyone with some real-world experience with this elaborate, please? -- Alexander Deruwe ([EMAIL PROTECTED]) AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How can i start using templates
On Tue, 27 Nov 2001, narko wrote: > How can i start using templates? PHPLib or Smarty come to mind. Search Google. -- Alexander Deruwe ([EMAIL PROTECTED]) AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP + Smarty question.
Using Smarty templates (it is my guess this question is valid for other template engines aswell), is there a way to pass an array to the template, then stuff it in a hidden form field and retrieve it in another PHP source file as an array? is_array() does not seem to detect the object is an array, and thus my code creates it anew. Basically what I am trying to do is add new stuff to the array, after it has been passed to the template and back into the script. Thanks, (please CC me in replies because I no longer subscribe to php-general due to too much traffic..) -- Alexander Deruwe ([EMAIL PROTECTED]) AQS-CarControl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] verifying that a dropdown was selected
On Thu, Jul 05, 2001 at 12:05:28PM +0200, Tom Gitzinger wrote: > Hello Richard, > > I'm not quite sure but I think the problem is the following: > - If no month has been specified, the variable $month is not defined. > - If you then mention $month in >if ($month == "") > the Parser creates the variable. Its value is unpredictable, but it is > most unlikely that > it is an empty string (""). > > To solve the problem, you should be able to check whether the variable > $month exists. I'm sorry I can't help you here because I've only started > programming PHP but reading the function reference or something might help you. You could check if it has been set by doing: if (isset($month)) or even if ($month) (I'm not 100% sure about the last one, though..) ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Single quote
On Fri, Jul 06, 2001 at 11:28:38AM +0200, Andy wrote: > I got a data file containing this line: > $ 1'000'000.- > > Then I read and echo this line > $fp = fopen ( $sFilename,"r"); > $sData = fgets ( $fp, 1000 ) ) > > echo $sData > > Now what came out is > $ 1\'000\'000.- > > I tried to get rid of these slashes with > ereg_replace( "\\'", "'", $sData ); > but I had no luck. > Use: stripslashes($sData); That ought to do the trick.. ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] HTML/PHP's static state problem.
Hey all, I've run into a little problem: Take, for example, combobox A and combobox B. Suppose B's s depend on what is selected in A.. Is it possible to update B according to what is selected in A? Thanks, Alexander 'ad' Deruwe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] HTML/PHP's static state problem.
Hello Maxim, Basically I mean this: I load the page, it has two comboboxes ( with ). The first one contains names of countries, the second names of cities within those countries. When I select "Belgium" in the first one, I only want to see all Belgian cities. Now with JavaScript this wouldn't really be a problem, I guess, but I need PHP for going into my database. Any ideas? Alexander 'ad' Deruwe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sorry, i need HTML help
On Wednesday 29 August 2001 19:08, you wrote: > Sorry to post here but i need to know this info fast! > > How do i make a scrolling marquee in HTML without using javascript You use the Insert scrolling text here tags. ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] syntax help please?
On Wednesday 29 August 2001 14:45, Glyndower wrote: > Heres my "I'm a newbie" question... exactly how and where do I define the > variables so that i can use them in a different order than they are in the > query? Go over your results like this instead: while ($row = mysql_fetch_row($result)) { echo $row['listnum']; // displays 'listnum' field echo $row['officephone']; // etc... } (I've assumed your syntax for the mysql_fetch_row() function, I haven't used it in a while (use PostgreSQL myself)). ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Countdown
On Wednesday 29 August 2001 19:38, you wrote: > Hi ! > > I have a Problem with a Countdown.I want that somebody can register through > my PHP Script. After the Registration the Script should email this person > after exact 30 days on his emailadress without visiting the Homepage > again.So how should i do this ? Thank you for your Support !!! Hey there Chris, One way to do it is to store a timestamp in your database whenever a user logs on. Then every night or so, you run a cron-job (assuming you are on a UN*X sysem. Windows will probably have something similar that I'm not familiar with) that checks the timestamps and sends mails to every user that hasn't logged in for 30 days. If you have PHP compiled to an executable (i.e. you can run scripts on the command line), then your cron-job can just use a PHP script, otherwise I would recommend Perl. ad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How to call a member from the base class?
On Monday 03 September 2001 09:47, A. op de Weegh wrote: > How do I make sure in the something() member of class B, that the parent > class member something() is also called? Can I do this: Hello there, person with the same name as self, :) class B extends A { function something() { // some other actions $this->something(); // calls A::something } } I've used this code for calling base class constructors. These ofcourse have different names, while your functions are both called the same. I don't think that should make any difference, though. ad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] how to connect to php from vb
On Wednesday 05 September 2001 16:19, sagar wrote: > hi, > > can i connect to php from a vb appliation. > should this be asked elsewhere (if so pl > let me know) Uhm, I don't quite understand what you mean there. Anyhow, accessing PHP from VB seems kindof, like a nono, but perhaps you mean accessing your database serevr (MySQL or whatever) from within VB? ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] returns (functions)
On Wednesday 05 September 2001 17:17, Joseph Bannon wrote: > I have a foreach loop running in a function. During the foreach loop, if a > variable matches another variable, it does "return $variable". My question > is this: does the function automatically stop running when the variable is > returned? Yes. ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] book help
On Thursday 06 September 2001 16:35, Nikola Veber wrote: > Can anyone who has this book suggest what chapters should > I read first or which topics on php are the most apropriate for a beginner. You shouldn't use the cookbook in that way. Try like this: You are writing whatever application it is you are writing, and you come across problem X dealing with stuff about Y. What you do now is browse through the very first section of the book, called "Contents at a Glance". Look for the header concerning Y, then look on for a solution to problem X. Most problems you will encounter as a newbie are indeed touched upon by this book, and when that is not the case, there is the internet. > My only php resources are internet and this book. Great. That combination should get you well underway. ad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Releasing Your Code
On Thursday 06 September 2001 21:20, James wrote: > Multiple part question to all: I would like to add a 12th question to this: 12) Is it useful to release source for a business application, specifically target to one line of work? Are there any considerations beside the obvious (what license, ...)? ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Smarty + JavaScript
Hey all, If anyone else out there is using Smarty as templating engine, how do you put JavaScript into the template? It seems to barf on the opening and closing braces of every JS function, rendering JS totally useless. I must be missing something. ad. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] JavaScript, PHP cooperation.
Hewwo, When selecting a value from a combobox, I always have a link that allows adding a record to the table the combobox pulls it's data from. Here is my problem: Is it possible in any way to window.open() a popup window (JavaScript), fill in a record, add it to the database (PHP) and then reload the caller page so that the just added record appears in the combobox where the user can select it for completing the file? Or add it to the combobox manually with JavaScript to avoid a reload? Alexander Deruwe. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] form handling problem
On Monday 17 September 2001 15:24, you wrote: > Well, > > > > always works fine for me. > > Note that you should use "action" instead of "target", and the semicolon > after $PHP_SELF should be inside the ?> not outside of it... might be one > of these two errors causing the problem (although I can't think why) The target= attribute is usually used to open hyperlinks in a different frame than the current one. It might be that if there is no frame with such a name, it just opens a new window (with that name), thus causing his troubles. ad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Writing to two tables in 1-N relationship.
I have two DB tables that are in a 1 - N relationship. I need to enter data once in the 1-side, and then many times data on the N-side. (For those who like it less abstract: The 1-side is a table with data about a car (frame number, brand + type, and a carrier), the N-side has records about damages found on that car after transport) I'm a little bit confused about how to deal with this: - After every data input, write the stuff away to a temp text file, and when all input is done, write that text file at once to the database. - Store the data in arrays, and pass them on between runs of the script as part of the URL (but I could run out of space?) - A better way that I don't see? One thing is for sure, and that is that the data needs to be written to the DB in one go (so as to be able to use transactions effectively (in PostgreSQL)). Can anyone advice? Someone must have been in this position before. :) I hope I explained the problem ok, I tend to get carried away. Thanks in advance, Alexander Deruwe -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable conversion problem
On Friday 21 September 2001 01:45, Neil Silvester wrote: > Another PHP problem has kept me up all night, scouring through my database > books and trying everything I could think of. I am still new to the MySQL > and PHP field, but never the lass I will not give up. > $cat is a variable that is passed to the query from the previous page. The > SELECT statement works faultlessly, except for the point at which no choice > is made from the drop down on the page prior to this one. I have set a > value > > of "x" to the drop down for a non selection, but am having problems > converting that "x" value to a "%" value (the MySql wildcard symbol) > withing my SELECT statement. > I am assuming that I will need an IF THEN before the SELECT, but I have > tried several variation to no avail. > > $result = mysql_query("SELECT CompetitorName > FROM competitor, competitorproducts, productcategory > WHERE competitorproducts.CompID=competitor.ID > AND productcategory.ID=\"$cat\" > AND competitorproducts.CatID=productcategory.ID" > ); I'd say there are 2 solutions: 1) Set the default value in the dropdown box to '%'. 2) Just set $cat to whatever you want, when it is 'x' if ($cat == 'x') { $cat = '%'; } Alexander. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] php and java problem
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sunday 30 September 2001 21:36, Nikola Veber wrote: > Hi ! > > I was able to determine the user's screen resolution, but I'd like to let > php know that(the next page loaded should be in > the right resolution, I'd like to pass a value to php, but I don't know > how). pagethatdeterminesresolution.php determines the resolution, and has a link such as this one: Link (The numbers are pure fiction ofcourse, you need to get them.) This means that in correctpage.php you will have two variables, $Xres and $Yres that will represent the resolution. Alexander -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7uG1AySJLuRUx8aQRAkf0AJwMutj7TZ3HCqFGEEyv0Gn8souqdACdFToE 20D9LSWxEYKAwOYvHD8psMU= =Ghac -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Detecting user logout.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey all, I keep track of my users using PHP4 sessions, with verification against a PostgreSQL database. How can I detect when a user logs out / is logged out? I provide a hyperlink 'Logout' which users are supposed to click, so I can obviously check there. My main concern however is that people won't really use that link, but just close their browser.. Which means my table with logged in users will never get properly updated. Any ideas are appreciated. Alexander -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7ueiKySJLuRUx8aQRAmLtAJ44EBWco333d62y513SEL9pNZr2qACbBNsY 4oKO7dlN2E957UeT3tuWG+A= =Aaku -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Detecting user logout.
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Tuesday 02 October 2001 18:11, tonyz wrote: > why bother charting logouts. use cookies that expires so you know that > they will eventually lose access and need to login again. Yes, but then I can't show a list of logged in users (for administration purposes). Alexander -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE7umgFySJLuRUx8aQRAo7+AJkB0GD6i+0mNIfsaoakw/WP1klyagCfZ8l6 QB3ijCXziMhlhHyjDBgu/rM= =Tlms -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] something like alert (javascript)
On Wednesday 03 October 2001 14:30, Eduardo Kokubo wrote: > Is there any function in PHP that is similar to alert() or confirm() of > javascript ? I tried die() but that's not what I need. PHP is server side, so you cannot have it pop windows up, or ask the user questions in an inputbox (unless you build the javascript in PHP of course, but that probably is still not what you want). For immediately informing the user of an error, or whatever, die() makes sure they see it. :) Alexander -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] File extension inc?
On Wednesday 03 October 2001 12:13, Jan Grafström wrote: > Hi! > How does server handle the .inc extension and for what do I use it ? You should be aware that if the webserver is not set up to handle .inc files as PHP code, that it might output them as text to the user. Thus possibly showing passwords, usernames and whatnot. Alexander -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]