Re: [PHP] MySQL get second row problem
Either limit your query to return only the second row ( look in mysql manual for the limit caluse), or you will need to move the array counter forward one for the $row_rsLastL = mysql_fetch_assoc($rsLastL) operation.(php manual under array functions) On Thu, 2003-10-02 at 12:10, Joe Harman wrote: Hello... I am having just alittle trouble with this... I know it's simple... Look at my comment for the problem I am having ?php mysql_select_db($database_ideation, $ideation); $query_rsLastL = SELECT * FROM logins WHERE user_id = '$UserID' ORDER BY `date` DESC; $rsLastL = mysql_query($query_rsLastL, $ideation) or die(mysql_error()); $row_rsLastL = mysql_fetch_assoc($rsLastL); $totalRows_rsLastL = mysql_num_rows($rsLastL); // Prints the first row... I just want to print just the second row echo $row_rsLastL['date']; mysql_free_result($rsLastL); ? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Accumulated Information in DB??
As the previous comment states: MySQL is a DB, it's built to store data, so it's pretty good at it, and the limiting factors re usually your hardware/OS. However, just one thought. I am always very protective of my databases. If data is never going to change and no other process will be accessing the data , then I usually think twice before i store it in a db. It sounds to me like these reports are pretty static once they are run, ie, they are date dependant ( report xyz for the period 2000-01-01 to 2001-01-01), and arguably, the data that was used to generate that specific report is also fixed in history. So my assumption would be that the report would also never change again. So, if that is the case, why not generate the report, and simply save the static html version of the report on the file system as a normal html file? If your reports are not as my assumption states, then simply store them in mysql, i assure you it can handle it. As I stated, you must just be aware of hardware and your OS/filesystem limitation wrt table sizes. On Wed, 2003-10-01 at 08:39, [EMAIL PROTECTED] wrote: Hi all, I am having some doubts here and hope to hear some advices/solutions from all of you out there. Right now, I have a daily, weekly, monthly and yearly reports which stores information on all my customers. These info will of course, be stored in the DB.(MySQL). As all these reports are not to be deleted, it will accumulate as years go by. And so, my question is: is it possible to have such a system in my project and how should I go about doing it??Can the MySQL DB hold all this big chunk of info? These report info are to be viewed in a graphical format(PHP Graph)later on Regards, Irin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Returns..
nl2br() On Fri, 2003-09-19 at 13:27, Chris Mach wrote: I have a simple little script that displays news articles that are stored in mySQL database. However, when the script displays the data, it doesn't recognize the returns/enters. So I have to put brbr when ever I want a new paragraph to begin. How can I get my script to recognize the returns? is there any functions for this type of thing? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] navigation question
The function is correct, BUT, it looks like you are trying to run this script off one server and then attempting to feed the function a directory structure off another server. Your code will work as-is if you run the script off my_domain2, but it won't work if you run it off my_domain asking for a directory structure located on my_domain2. I am not sure that opendir() can work like this, and you would probably need to look at some remote file functions like the ftp functions... On Mon, 2003-09-15 at 08:38, Andre wrote: Hello, For my website I use some PHP code for navigation. Therefore I use a directory structure which contains some navigation files the visitor can open. The directory structure looks like this: my_domain | - /navigation | - file_1.html | - file_2.html | - file_3.html | -/images : : The name of the files the visitor can open (file_1file_3) I detect from reading the files in the directory navigation. The function I use is this: $handle=opendir(./navigation/); $counter=0; while ($file = readdir($handle)) { $the_type = strrchr($file, .); $is_html = eregi(htm,$the_type); if ($file != . and $file != .. and $is_html) { $newsflash[$counter] = $file; $counter++; } } closedir($handle); rsort($newsflash); reset($newsflash); With some other code I can echo the different files, this code works on the same server. Now I want to read the navigation files from a different server (my_domain2), then I get an error and the name of the files are not shown. When I try it with Apache on my local computer an error is shown on the first line $handle=opendir(http://domain2/navigation/;); Is there an other way of getting the filenames from a different server? The directory structure at my_domain is equal to my_domain2. Apparently the function opendir is not correct, can someone help me? Thanks in advance, Andr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reboot pc with PHP
Hi List I've gone through the list for previous questions and the only one that seems to be a solution is to use sudo, however, I cannot seem to get it right. Just as background: I want to make a small admin utill for an intranet machine, so the security risks don't bother me at all. Instead of myself having to ssh into the box to reboot or do other routine commands, I'd like to make a simple password protected webpage that would have simple links on them like reboot, redial etc, so that someone with some sort of responsibility can do it themselves. Obviously these command(s) need to be run as root, so I looked at the /etc/sudoers and added apache , BUT, in the error log it prompts for a password. I tried to add the option NOPASSWD: ALL to the file, but it says there's a syntax error. What am I missing? Any other ways of doing this? PS, I don't even want to consider Webmin, it's way too complicated, I just want a handfull of predefined commands to be run, nothing else) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost
OK, Difficult to see from your pseudo code EXACTLY what it is that you want to do, but I'll take a stab anyway... Firstly, instead of using your elaborate ways of running through the result set and extracting the variables, use something like this: $sql = whatever; $result = mysql_query($sql); echo 'tabletrtdID/td.../tr while ($myrow = mysql_fetch_assoc($result)) { extract($myrow); //or $id = $myrow[id]; etc. ... //construct your table here echo 'trtd'.$id.'/td.../tr'; ... } echo '/table'; You must also remember that in cases where you do limit queries, and want to continue on the next page, you must remember that your result will NOT contain the next page's data. You will need to do another query with the new limit data. It *looks* like this is what you are in fact attempting in your code, just making sure... In your case, I would say the easiest is to call the page onto itself. Ie, your first query will be $sql = whatever limit 0,6; it will return the (maximum) 6 rows and then, on your next link you should include the data for the next query. Ie, create a link like this: a href=same_page.php?limit=xstart=yNext/a Meaning that you call up the same page that you used to display the first query results, but you pass it different values for the start and limit numbers in the query ( x,y ). To recap, one of you biggest mistakes in the pseudo code below is that you open a the table inside the while and close it as well (which is fine if you want to create a table for each row you display , BUT, you close the table again AFTER the while, that *could* cause the HTML to freak out. So, the reason your app is not working is probably not PHP related, but related to the fact that you are creating erroneous HTML with your PHP. The pseudo code you are using *should* work, although, as I stated above, there are easier and more efficient ways of doing the same thing as per my example... -Original Message- From: Verdon vaillancourt [mailto:[EMAIL PROTECTED] Sent: Sunday, August 17, 2003 9:47 PM To: 'PHP-General' Subject: [PHP] Nestled 'while's or 'for's or 'foreach's -- I'm lost Hi, somewhat newbie warning :) I'm trying to take a paged result set and divide it into two chunks for displaying on the page. Basically making something that looks like a typical thumbnail gallery. I'm limiting my result set to 6 records and want to display it as 2 rows of 3 cells with a record in each cell. I've had no trouble getting my result set, paging etc. I'm not having much luck splitting my result into 2 chunks. I've tried nestling 'while' statements with a number of arguments and either end up with no results or a loop that seemingly never ends. That lead me to looking at some other apps which seemed to use a variety of ways to achieve what I want. That lead me to looking at 'for' and 'foreach' in the php manual. And that lead me to being more confused than I was before I started ;) Sometimes there's just too many ways to skin a cat, eh! Below, I've include a rather lengthy bit of pseudo code that represents basically where I'm at now. This particular version returns no results, though I know it's just the nestled while's that are causing this. The results are there. My research makes me think that I should replace the nestled while's with 'foreach's. I was kind of hoping that before I spend a few hours trying to puzzle out how to use the 'foreach's correctly that somebody would venture an opinion as to whether or not that would be the way to go. Thanks in advance for any advice, Verdon -- pseudo code -- ?php $limitPerPage = 6 ; $initStartLimit = 0; if (!isset( $startLimit )) { $startLimit = $initStartLimit ; } $querylimit = limit $startLimit,$limitPerPage ; $nextStartLimit = $startLimit + $limitPerPage ; $previousStartLimit = $startLimit - $limitPerPage ; if ( $sortby != ) { $sorted = order by $sortby ; } $bareQuery = select * from pieces order by rank; $queryall = $bareQuery .$sorted .$querylimit; $resultall = mysql_query ($queryall); $numberall = mysql_numrows ($resultall); if ( $numberall == 0) { echo No Records Found ! ; } else if ( $numberall 0) { $x = 0; echo h2Page of Pieces/h2; while ( $x $numberall ) { // Retreiving data and putting it in local variables for each row $id = mysql_result ($resultall ,$x ,id); $title = mysql_result ($resultall ,$x ,title); $description = mysql_result ($resultall ,$x ,description); $thumb = mysql_result ($resultall ,$x ,thumb); $company = mysql_result ($resultall ,$x ,company); echo table cellspacing=\0\; echo tr; while ($x = 0 $x 4) { echo td; if ($thumb) { echo thumbnail with a link; } else {
Re: [PHP] What does - mean?
You should read up on classes and objects in the manual. On Thu, 2003-08-14 at 09:14, James Johnson wrote: Hello, I've searched through Zend and php.net and can't find the answer. In the following code: $this-vendor = $vendor; What does the - mean or do? Thanks, James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mysql query and PHP loops
Hi List I've been trying to do something with one MySQL query, but I don't think it is possible, so, I would need to probably do multiple queries, and possibly have queries inside loops, but I am rather weary of that so, I'd like your views/possible solutions to doing the following: Consider this: id val1val2val3 1 a 1 1 2 b 2 3 3 a 1 2 4 b 2 1 5 c 3 3 6 c 2 1 I need to query this table to return this: id val1val2val3 3 a 1 2 4 b 2 1 6 c 2 1 Thus, I need to firstly only return ONE row for each val1, and that row MUST be that last row (ie, the row with the highest id, OR, should val3 for instance be a date, then with the highest date). if I do a select distinct val1, MAX(id) from table order by val1, then it returns id val1 3 a 4 b 6 c which is correct, BUT select distinct val1, MAX(id), val2 from table order by val1 it returns id val1val2 3 a 1 4 b 2 6 c 3 --- incorrect it then returns the FIRST hit for val2 in the db, and NOT the one in the row with the max id... Can I do this with one query? ( PS, I cannot use MAX on val2 or val3, they are text) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why wouldn't a simple script work on my server thatworks on other servers?
Look;s like he has short_open_tags = on in php.ini, BUT, as I understand it, this is a supplemental setting, meaning that it does not disable the use of the (proper) ?php tags, it simply ADDS the use of ? to your options. Thus, I don't think it's because of the tags that the script won't run on your server, it must be something else. Have you checked that the xxx.php file has execute permissions on your server? Also, what (if any) errors does PHP/Browser report? On Wed, 2003-07-30 at 08:45, Dan Anderson wrote: I have a client who had me upload a relatively simple script to his server. Oddly, it does not work there but works every where else I test it. AND he has other PHP scripts running on his server. So I checked out his server and all scripts are of the form: ? start_session() ? // HTML HERE ? // some functionality ? versus my scripts as ?php ? Why would this affect things? -Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Bizarre SQl, if issue....
Hi Mike, List Where is the $place variable coming from that you use in your query's where clause? I hope it is not being POST'ed or GET'ed (sic), cause then you might have the dreaded old register_globals issue. Humour me, echo your sql string in your code and see if it actually has something in the $place. -Original Message- From: Mike At Spy [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 9:25 PM To: Jay Blanchard; Mike At Spy; [EMAIL PROTECTED] Subject: RE: [PHP] Bizarre SQl, if issue [snip] $person = mysql_query(The Query); $thecount = mysql_num_rows($person); echo $thecount \n; And tell us what $thecount is... Returns 0 (zero). [/snip] Then if($thecount == 0){ $whatever = 1; } else { $whatever = 4; } $whatever should be 1 But that is my point - and I think we are going in circles now. It just doesn't do that. It returns 4 (as per your example). :\ -Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL query/PHP logic?
Hi List OK, I've posted this on the MySQL list as well, but it seems a bit quiet there, and arguably it could definately be a PHP rather than mysql question depending on whether it can be done with one query (then it was/is a mysql query), or whether it should be done with some structures and multiple queries ( then it's arguably PHP). So, here goes. I'm trying to return from multiple tables, the records that have field information_sent between two dates. The tables are all related by means of the id of the entry in the main table, ie.. main id entity_name ... fof id_fof id information_sent ... pub id_pub id information_sent ... etc. So, I tried the following join select * from main left join fof on main.id = fof.id left join pub on main.id = pub.id left join gov on main.id = gov.id left join med on main.id = med.id left join ngo on main.id = ngo.id left join own on main.id = own.id left join sup on main.id = sup.id left join tra on main.id = tra.id where ( (fof.information_sent '$date1' and fof.information_sent '$date2') OR (pub.information_sent '$date1' and pub.information_sent '$date2') OR (gov.information_sent '$date1' and gov.information_sent '$date2') OR (med.information_sent '$date1' and med.information_sent '$date2') OR (ngo.information_sent '$date1' and ngo.information_sent '$date2') OR (own.information_sent '$date1' and own.information_sent '$date2') OR (sup.information_sent '$date1' and sup.information_sent '$date2') OR (tra.information_sent '$date1' and tra.information_sent '$date2') ) order by entity_name BUT, although it seems to be joining the tables correctly AND only returning the ones with the correct date criteria, it does NOT return the id or the information_sent fields correctly ( due to duplication in the result ) Can this be done in one query without sub-selects, or should it be broken up (in which case I would still need help with the logic and to minimize the amount of queries inside loops) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP should know my data!
Quit horsing around fellas, what if the developers take interest in this thread and decide it's a good idea to release PHP6 with cranial electrodes that will detect what I want to do, and instead of me having to code the application, PHP will just spit out the application... That way our bosses won't need us... ;P On Fri, 2003-07-25 at 15:08, Comex wrote: [EMAIL PROTECTED] Step Schwarz: I'm trying to open a pop-up window with PHP but I keep getting an error. HELP! Does anyone know if they plan to fix this bug in PHP5? LOL! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I'm really getting annoyed with PHP
If you want to use PHP, then you must use the headers() function. BUT, with the header function, you MUST make sure that there will be absolutely NO output to the page before the header() function is called, not even a space... Otherwise, you can simply use a meta refresh... -Original Message- From: Beauford.2005 [mailto:[EMAIL PROTECTED] Sent: Thursday, July 24, 2003 9:41 PM To: PHP Subject: [PHP] I'm really getting annoyed with PHP Yes, I'm still screwing around with this stupid redirection thing, and either I'm just a total idiot or there are some serious problems with PHP. I have now tried to do it another way and - yes - you guessed it. It does not work. I mean really, it can not be this hard to redirect a user to another page. If it is, then I must look into using something else as I just can't be wasting days and days on one minor detail that should take 30 seconds to complete. If anyone has some concrete suggestion on how to get this to work It would be greatly appreciated. In the mean time I have given up on it as I am just totally pissed off at it. TIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to execute a bat file on the Apache server
Well, firstly, you should not have to use the double \\ when using the single quotes, try it without and see if it works... ie, ?php exec('c:\WINNT\system32\cmd.exe /c START c:\test.bat c:\xxx.txt'); ? On Mon, 2003-07-21 at 16:34, Mikael wrote: Hello all, I am trying to execute a bat file, and its not working. I manage to get the CMD in the win task list however its not executing the bat file, and its not closing it self...?? What I need it for is to execute a modem to send a SMS. I got that working but the php stuff is not really my bussiness...so please, I need some help. I have tried: ?php exec('c:\\WINNT\\system32\\cmd.exe /c START c:\\test.bat c:\\xxx.txt'); ? Os:win 2000 Can anyone sheed some light on this...? Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Register Globals
a simple extract($_POST) or extract($_GET) would also work On Mon, 2003-07-21 at 14:22, stfmoreau wrote: Hi, include this code in your header file : // _GET if (isset($_GET)) while (list($key, $val) = each($_GET)) { eval ($.$key. = '.$val.';); } // _POST if (isset($_POST)) while (list($key, $val) = each($_POST)) { eval ($.$key. = '.$val.';); } // _SESSION if (isset($_SESSION)) while (list($key, $val) = each($_SESSION)) { eval ($.$key. = '.$val.';); } It may works (I have not expirimence it) Stf -Message d'origine- De : Daryl Meese [mailto:[EMAIL PROTECTED] Envoy : lundi 21 juillet 2003 14:18 : [EMAIL PROTECTED] Objet : [PHP] Register Globals I would like to rewrite my scripts to work when register globals is off. The problem is that my scripts encompass several thousand files. Does anyone have any suggestions for an effective tool to help in this process? Daryl Meese -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting files with PHP
If you place files inside a webfolder, then they are publicly accessible, period. They might not be obvious, ie. you would have to guess that there are files in a specific folder AND know the exact name of the file, but if you do happen to guess correct, then the files are downloadable. There are ways to still have files in public folders and have a measure of extra protection, but that is up to your webserver, and not PHP. Use .htaccess to place a username/password on the folder, or better yet, you can use ftp, but then you place the files outside the webfolder. PHP has built in ftp functions that would allow you to create a pretty secure system to give access to files. On Thu, 2003-07-17 at 15:58, Maria Garcia Suarez wrote: Hi there! I'm developing an application to which you can upload files. Right now the destination folder of those files is at /public_html/files which makes them visible from the internet. I thought of putting that ./files/ folder outside the ./public_html/ folder and make those files be only accessible via PHP pages (if the pages doesn't display a link to that folder there's no way to download the file). But, there's any way to keep on having the ./files/ folder inside ./public_html/ and have those files protected? Right now to identify users (authenticate them) I use session variables... it should be a protection that could be used together with session variables Thanks a lot. Kisses, Maria __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with loop inside loop and mysql queries
Hi List. I cannot see my error: I have relation tables setup. main id entity_name main_type etc etc date_in 1 testtype1 x y 2003-06-02 2 test2 type2 xx yy 2003-03-11 3 test3 type1 xxx yyy 2003-02-02 type1 id_type1id field1 field2 field3 1 1 1st rec (1) 2003-07-07 -00-00 2 3 1st rec (3) 2003-07-10 2003-07-12 3 1 2nd rec (1) 2003-07-13 -00-00 type2 id_type2id field1 field2 1 2 1st rec (2) 2003-01-23 2 2 2nd rec (2) 2003-07-07 etc... So, what I'm trying to do is this: On a search page, the user selects a date range to view the records in the main table. What I want to display now on the result page (code below), is something like this: Date Captured NameLast Action Date of Action 2003-02-02 test3 field3 2003-07-12 2003-03-11 test2 field2 2003-07-07 2003-06-02 testfield2 2003-07-13 In the above examples, if there are dates as record entries, then the field_type is date. The field_name is the action name, like info sent, contact made etc, so if there is a non-zero date in the field, it means that specific action happened that day. So in the code below I tried to 1) query the table for all the entries in the data range ( for my example, the date range was wide enough to include ALL) 2) Make sure that I have the last row for the specific entity by looking for the max id in the related table matching the main table's id. 3) Once I know that id, I query the sub table for all the fields in that row. Then I tried to run through all the fields in the result set and get the highest date from that row, else fall back to the original capture date_in in the main table (meaning that no actions have yet been taken (when I enter something in the main table, it automatically enters a new row in the $main_type table with default zero dates) My problem is somewhere in the code, but I cannot see where (maybe my logic sucks with the whole thing?) It returns the correct stuff for the first entry, but then takes the same for the rest (as if it's not going back to the beginning of the loop, or not resetting the values) I use a class that does the connect and querying to the db. I'm 100% sure the class is correct, I'm not 100% sure if I USE it correct though... Any help appreciated. include (main_class.php); $db = new my_db_class; $db -connect(localhost,user,password,db); if ($_GET[st] == date) { $sql = select * from main where (date_in '$_POST[date_1]' and date_in '$_POST[date_2]') order by entity_name; } //echo $sql.'br'; $db -query($sql); if ($sql) { echo 'tabletr bgcolor=#99FF99tdDate In/tdtdName/tdtdLast Action/tdtdDate of last action/td/tr'; while ($myrow = mysql_fetch_assoc($db-result)) { extract($myrow); $sql_search = select MAX(id_$main_type) as mid from $main_type where id = '$id'; //echo $sql_search.'br'; $db1 = new my_db_class; $db1-query($sql_search); $myrow_search = mysql_fetch_assoc($db1-result); $pointer = $myrow_search[mid]; $sql_search_2 = select * from $main_type where id_$main_type = '$pointer'; //echo $sql_search_2.'br'; $db2 = new my_db_class; $db2-query($sql_search_2); $myrow_search_2 = mysql_fetch_assoc($db2-result); $fields = mysql_num_fields($db2-result); $test_date = -00-00; for ($i=0; $i $fields; $i++) { $type = mysql_field_type($db2-result,$i); if ($type == date) { $action_name = mysql_field_name($db2-result,$i); $val = $myrow_search_2[$action_name]; if (($val = $test_date) ($val != -00-00)) { $test_date = $val; $XXX = $action_name; $YYY = $test_date; } } } if (!$XXX) { $XXX = Original Capture; } if (!$YYY) { $YYY = $date_in; } echo 'trtd'.$date_in.'/tdtda href=main_view.php?id='.$id.''.$entity_name.'/a/tdtd'.$XXX.'/tdtd'.$YYY.'/td/tr'; if ((mysql_num_rows($db-result)) == || (mysql_num_rows($db-result) == 0)) { echo 'No Results Found!br'; } } echo '/table'; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with loop inside loop and mysql queries - SOLVED
Grr Needed to reset the $XXX and $YYY vars BEFORE the for loop... Anyway, should you have nothing better to do, plz look through and see if there is a better way to do this with possibly less queries made on the db... Ta On Wed, 2003-07-16 at 09:25, Petre Agenbag wrote: Hi List. I cannot see my error: I have relation tables setup. main identity_name main_type etc etc date_in 1 testtype1 x y 2003-06-02 2 test2 type2 xx yy 2003-03-11 3 test3 type1 xxx yyy 2003-02-02 type1 id_type1 id field1 field2 field3 1 1 1st rec (1) 2003-07-07 -00-00 2 3 1st rec (3) 2003-07-10 2003-07-12 3 1 2nd rec (1) 2003-07-13 -00-00 type2 id_type2 id field1 field2 1 2 1st rec (2) 2003-01-23 2 2 2nd rec (2) 2003-07-07 etc... So, what I'm trying to do is this: On a search page, the user selects a date range to view the records in the main table. What I want to display now on the result page (code below), is something like this: Date Captured NameLast Action Date of Action 2003-02-02test3 field3 2003-07-12 2003-03-11test2 field2 2003-07-07 2003-06-02testfield2 2003-07-13 In the above examples, if there are dates as record entries, then the field_type is date. The field_name is the action name, like info sent, contact made etc, so if there is a non-zero date in the field, it means that specific action happened that day. So in the code below I tried to 1) query the table for all the entries in the data range ( for my example, the date range was wide enough to include ALL) 2) Make sure that I have the last row for the specific entity by looking for the max id in the related table matching the main table's id. 3) Once I know that id, I query the sub table for all the fields in that row. Then I tried to run through all the fields in the result set and get the highest date from that row, else fall back to the original capture date_in in the main table (meaning that no actions have yet been taken (when I enter something in the main table, it automatically enters a new row in the $main_type table with default zero dates) My problem is somewhere in the code, but I cannot see where (maybe my logic sucks with the whole thing?) It returns the correct stuff for the first entry, but then takes the same for the rest (as if it's not going back to the beginning of the loop, or not resetting the values) I use a class that does the connect and querying to the db. I'm 100% sure the class is correct, I'm not 100% sure if I USE it correct though... Any help appreciated. include (main_class.php); $db = new my_db_class; $db -connect(localhost,user,password,db); if ($_GET[st] == date) { $sql = select * from main where (date_in '$_POST[date_1]' and date_in '$_POST[date_2]') order by entity_name; } //echo $sql.'br'; $db -query($sql); if ($sql) { echo 'tabletr bgcolor=#99FF99tdDate In/tdtdName/tdtdLast Action/tdtdDate of last action/td/tr'; while ($myrow = mysql_fetch_assoc($db-result)) { extract($myrow); $sql_search = select MAX(id_$main_type) as mid from $main_type where id = '$id'; //echo $sql_search.'br'; $db1 = new my_db_class; $db1-query($sql_search); $myrow_search = mysql_fetch_assoc($db1-result); $pointer = $myrow_search[mid]; $sql_search_2 = select * from $main_type where id_$main_type = '$pointer'; //echo $sql_search_2.'br'; $db2 = new my_db_class; $db2-query($sql_search_2); $myrow_search_2 = mysql_fetch_assoc($db2-result); $fields = mysql_num_fields($db2-result); $test_date = -00-00; for ($i=0; $i $fields; $i++) { $type = mysql_field_type($db2-result,$i); if ($type == date) { $action_name = mysql_field_name($db2-result,$i); $val = $myrow_search_2[$action_name]; if (($val = $test_date) ($val != -00-00)) { $test_date = $val; $XXX = $action_name; $YYY = $test_date; } } } if (!$XXX) { $XXX = Original Capture; } if (!$YYY) { $YYY = $date_in; } echo 'trtd'.$date_in.'/tdtda href=main_view.php?id='.$id.''.$entity_name.'/a/tdtd'.$XXX.'/tdtd'.$YYY.'/td/tr'; if ((mysql_num_rows($db-result)) == || (mysql_num_rows($db-result) == 0)) { echo 'No Results Found!br'; } } echo '/table'; } -- PHP General Mailing List (http://www.php.net
Re: [PHP] elegant way of doing something else the last timethrough a loop? SOLVED
Hi Yes, I see your point. Guess I'm way too trusting a person, should think like a criminal... So you're basically saying I should always place sensible default values in my script and then compare the $_POST vars, else stick to the default, ie, have the $_POST overwrite your default before the script can use it? Petre On Tue, 2003-07-15 at 17:39, David Otton wrote: On Tue, 15 Jul 2003 16:47:22 +0200, you wrote: Well, it should never be, it comes from a drop down that only has 3 options, any, all or exact Any caveats there? You can't trust the client. I can submit any data I want to your script, most easily by knocking up my own form: form method=post action=http://domain.com/yourform.php; input type=hidden name=any_all value=xyzzy input type=submit name=go /form In this particular case, it's no big deal - your script exits gracelessly, but no real harm is done. However, the same class of attack (injecting unexpected data into a script) can cause far more serious problems. What I'm trying to say is that it will pay off in the future if you learn a defensive coding style now. Assume that all input from the outside world is potentially malicious. The code we're takling about can easily be made safe: $logic = exact; if ($_POST[any_all] == any) { $logic = or; } elseif ($_POST[any_all] == all) { $logic = and; } BTW, try putting error_reporting(E_ALL); at the top of the script to flag the string literal problem I mentioned originally, and see what happens if any_all isn't in the $_POST array at all. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get size of variable n bytes
Hi List Sorry, tried to find it in manual... I'd like to query a db and and see how big the result is in bytes. How can I do that? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] get size of variable n bytes
Yes, well, that complicates things. You see, I'm trying to determine the size that the $_POST variable will be in bytes, because there is a byte limit in the php.ini file for POST variable size, so I was hoping for something easy like bytes_size($_POST)... Would also be handy to calculate how much memory your script will use/need. So, you say there is no such function or no way to determine it? -Original Message- From: David Nicholson [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2003 4:36 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] get size of variable n bytes Hello, This is a reply to an e-mail that you wrote on Wed, 16 Jul 2003 at 15:31, lines prefixed by '' were originally written by you. One way would be to assume that 1 character takes 1 byte to store so... $sizeinbytes = strlen($field); Also, this will only work with text data as numbers types, bool types etc will be stored differently. David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] really no way to get byte size of variable?
Hi List Just want to make sure: Is there no way for me to easily determine the byte size occupied by a variable (regardless of type)? It might be trivial, or I'm missing the point (as per usual)... I would like to find the actual byte size that is transmitted when say a $_POST variable is sent, or how much memory a particular variable is taking up. Just want to make sure. Some of the post received so far suggest that one character = one byte etc, but I would love to work with something more precise if possible, also, is a variable contains a multi-dimensional array, would that one character = one byte formula still return a fair representation? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] elegant way of doing something else the last time through a loop? SOLVED
Well, it should never be, it comes from a drop down that only has 3 options, any, all or exact Any caveats there? -Original Message- From: David Otton [mailto:[EMAIL PROTECTED] Sent: Monday, July 14, 2003 2:58 PM To: Petre Agenbag Subject: Re: [PHP] elegant way of doing something else the last time through a loop? SOLVED On 14 Jul 2003 14:35:28 +0200, you wrote: if ($_POST[any_all] == any) { $logic = or; } elseif ($_POST[any_all] == all) { $logic = and; } elseif ($_POST[any_all] == exact) { $logic = exact; } [...] if (!empty($temp)) $temp .= ' '.$logic.' '; Consider what would happen to $logic if $_POST['any_all'] was 'xyzzy'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] elegant way of doing something else the last time through a loop?
HI list Is there an elegant way to know when the last time through the loop is going to be and to do something else? I want to search through a table by exploding the search string and then compounding my own sql string by working through the array. From my example below, you can see I use a foreach to loop through the array. Arguably I could first determine the amount of elements in the array and then use a for instead of a foreach, but I'm not sure if that will help ( will probably need a switch instead if you want to work with the sheer array elements), however, the if statement inside the loop is meant to strip out the and and, meaning that it won't much help to use that approach anyway. Anyway, as you can see my problem lies with the SQl when the last element is reached, then it should NOT add another and or or. My attempts at backtracking the $sql string/array and start writing the end part of the string obviously fails. Any help with my logic, ie, how do/would you guys do this? Thanks $table_name = test; if ($_POST[any_all] == any) { $logic = or; } elseif ($_POST[any_all] == all) { $logic = and; } $string = $_POST[text]; $phrases = explode( , $string); $sql = select * from $table_name where ; foreach ($phrases as $key=$val) { if (($val != the) ($val != and)) { $sql.= name like '%$val%' $logic; } } $length = strlen($sql); $newlen = $length - 4; $sql[$newlen].= order by name; echo $sql; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] elegant way of doing something else the last timethrough a loop?
Sheer genius my man! Thanks! On Mon, 2003-07-14 at 13:38, Tom Rogers wrote: Hi, Monday, July 14, 2003, 9:11:11 PM, you wrote: PA HI list PA Is there an elegant way to know when the last time through the loop is PA going to be and to do something else? PA I want to search through a table by exploding the search string and PA then compounding my own sql string by working through the array. From my example below, you can see I use a foreach to loop through the PA array. Arguably I could first determine the amount of elements in the PA array and then use a for instead of a foreach, but I'm not sure if that PA will help ( will probably need a switch instead if you want to work with PA the sheer array elements), however, the if statement inside the loop is PA meant to strip out the and and, meaning that it won't much help to PA use that approach anyway. PA Anyway, as you can see my problem lies with the SQl when the last PA element is reached, then it should NOT add another and or or. PA My attempts at backtracking the $sql string/array and start writing PA the end part of the string obviously fails. PA Any help with my logic, ie, how do/would you guys do this? PA Thanks PA $table_name = test; PA if ($_POST[any_all] == any) { PA $logic = or; PA } PA elseif ($_POST[any_all] == all) { PA $logic = and; PA } PA $string = $_POST[text]; PA $phrases = explode( , $string); PA $sql = select * from $table_name where ; PA foreach ($phrases as $key=$val) { PA if (($val != the) ($val != and)) { PA $sql.= name like '%$val%' $logic; PA } PA } PA $length = strlen($sql); PA $newlen = $length - 4; PA $sql[$newlen].= order by name; PA echo $sql; I would do this $like = ''; foreach ($phrases as $key=$val) { if (($val != the) ($val != and)) { if(!empty($like)) $like .= ' '.$logic.' '; $like.= name like '%$val%'; } } $sql .= $like; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] elegant way of doing something else the last timethrough a loop? SOLVED
Following works nicely for me now, thanks all! ?php include (main_class.php); $db = new my_db_class; $db -connect(localhost,user,password,table); $table_name = main; if ($_POST[any_all] == any) { $logic = or; } elseif ($_POST[any_all] == all) { $logic = and; } elseif ($_POST[any_all] == exact) { $logic = exact; } $string = $_POST[text]; $phrases = explode( , $string); $sql = select * from $table_name where ; if (($logic == or) || ($logic == and)) { $temp = ''; foreach ($phrases as $key=$val) { if (($val != the) ($val != and) ($val != ) ($val != )) { if (!empty($temp)) $temp .= ' '.$logic.' '; $temp.= name like '%$val%' ; } } $sql.=$temp; } elseif ($logic == exact) { $sql.=name like'%$string%'; } $sql.= order by name; //echo $sql; $db-query($sql); $db-draw_table(); ? On Mon, 2003-07-14 at 14:00, Marek Kilimajer wrote: I always do it this way: $condition=''; foreach ($phrases as $key=$val) { if (($val != the) ($val != and)) { $condition.= name like '%$val%' $logic; } } $condition=substr($condition, 0, strlen($condition) - strlen($logic)); $sql .= $condition; $length = strlen($sql); $newlen = $length - 4; $sql[$newlen].= order by name; echo $sql; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML
Hi List Firstly, thanks for the replies and mostly for the accommodating attitude to this, arguable non-PHP subject. I don't want this thread to become a flame war on why one should use XML, or why not. I do have personal issues wrt XML and the way it works, and although I cannot *yet* see the need, it doesn't mean that there isn't one. My original post should have made this clear, but it seems it didn't. I have laid to rest my reservations wrt XML, and am more interested in understanding the entire process in the hope that 1) I will see the need, and 2) understand how all those XML jargon fits together ( XML, XSL, XSLT, DTD, DOMXML, phew...) That was why I gave a brief summary of where I am atm wrt understanding what it is. What I still don't know much about, and at last, this is where the PHP comes in, is once I have this XML file, whereto from here using PHP ( you see, it should be clear that I want to use PHP as my one and only trusty tool. As I stated, and correct me, the XML file contains the structured data, and the XSL file contains the look and feel and the XSL file is written in XSLT language. My understanding is further that, again focused only on web applications here, one would have an XML file in your web folder, along with it's XSL file. These files would be linked by means of calls or references to each other inside the files. Having these two files (oh, and the dtd which can be used to verify the XML, but doesn't seem necessary from what I can see), as I understand it, gives the basis from where one would then parse the XML into XHTML in order to actually see anything in a browser via one of two routes: 1) client side via the browser's built in XML parser - arguably leaving the old Netscape/IE gap wrt compatibility, or 2) server side parsing with the built-in XML parser that comes with the webserver (IIS or Apache in my case) - with this approach being in my mind the best if you want to make sure you don't run into browser issues. This is where my PHP question really starts: On apache.org they talk about the XML support of apache etc, and in the PHP documentation there are lots of XML functions and yet more jargon like DOMXML etc, which is not clear for me what to do now (should I elect to parse server side). If someone can just give me a quick and easy tour on what to do and what is needed from here to actually parse and display the contents correctly, I should have enough to keep me busy for a while, and hopefully help me to increase my knowledge and understanding so I won't ask stupid questions on this list ;) Thanks again for the input. On Wed, 2003-07-09 at 00:36, Ray Hunter wrote: I see that not many sites require the use of xml/xsl(t). Many sites can just use html and database to accomplish 99.9% of the work. I always suggest that when you have tons of data that you need to send to the user that it is a good idea. Especially now that xslt is growing up :) I like to use xml and xsl for various reasons, mainly i can really separate the logic and presentation. All data is keep in the xml file and presentation in the xsl file. So when i need to make changes in the presentation then i only change the xsl file and never really have to touch the logic (php) code. This is really, really great for some sights that are extremely complex. Also in php i can create standards that my xml files will follow (dtds, schema) and allowing me to create modules (functionality) very efficiently and timely. Also as mentioned xml provides a format for transfering data. However, i would not use it with databases unless it is large amounts of data. However, i have used xml for creating sql queries and setting up configureation files which are extremely reliabe. -- BigDog On Tue, 2003-07-08 at 15:51, Jeff Harris wrote: |-Original Message- |From: Petre Agenbag [mailto:[EMAIL PROTECTED] |Sent: Tuesday, July 08, 2003 6:27 AM |To: [EMAIL PROTECTED] |Subject: [PHP] XML | | |Hi List | |Firstly, this question is arguable more about XML than PHP, but they are |interlinked, so I hope it is topical for this list. | |Firstly, Where I come from: | |I am VERY comfortable with PHP/MySQL on Linux and understand all those |concepts. | |Now I'm trying to see the benefits of XML, and quite frankly, I just |cannot see why one would want to use it... | [snip] On Jul 8, 2003, Joe Harman claimed that: |Okay Petre... You have asked the question that I always wanted to ask!!! |I can't wait to see peoples answer... I simply can't find a use for it |either | |Joe This probably should be on another list, but it might give someone an idea on how to create something in PHP. I've been trying to figure out if some of what I'm doing would be good for XML. The answer for that is no, use a database. It seems to me, that XML is a way of encoding data for the transmission between two processors
[PHP] XML
Hi List Firstly, this question is arguable more about XML than PHP, but they are interlinked, so I hope it is topical for this list. Firstly, Where I come from: I am VERY comfortable with PHP/MySQL on Linux and understand all those concepts. Now I'm trying to see the benefits of XML, and quite frankly, I just cannot see why one would want to use it... Anyway, I don't want to start a discussion on that from. I have done extensive reading on XML/XSL(XSLT : XHTML), DTD and XML parsing on browser and server side. I arguable still don't have a 100% understanding of exactly how things fit together, but the little bit I think I got so far is: I would use an XML doc to package my data in a structure. This XML file is useless on it's own, and good for transporting data to another app or client. Should I need to do something with the data, I would look at XSL and in particular XSLT in order to convert the XML into XHTML so a browser can display the data ( so we can safely assume that I am only interested in the web applications of XML) This is where I'm starting to get a headache, because now it seems that there are browser issues wrt XSL, and one also have the added choice of parsing the XML with the browser or on server level. For me, parsing it on browser level must be a no-no, as I would assume that it's would take alot of effort to find out what type of browser the client has, then load the appropriate XSL file for that browser. So, I'm here, with the server side XML parsing in mind. Now on M$ systems, it seems that IIS has built in ActiveX XMLDOM parsing built in, and you can easily parse the XML document by using ASP etc. So can I assume that this is also true with PHP/Apache, ie, Apache has a built in XML parser and I can use PHP fnuctions to parse my XML file on the server side and thus pump out XHTML that is compatible with all past and future browsers? Also, what is the procedure that most of you (members of the PHP lists) follow when dealing with XML. ie, do you go for the client side parsing or do you do server side parsing. And how do you decide when to use XML and when to stick to trusty old PHP/MySQL? ( Sorry, know this is probably the dumbest question I can ask, but I really battle to see when to use it, or rather WHY I should use it seeing that the data is arguably static in nature ( I would either get the XML file from somewhere else, or I would generate it from some source and pass it on, effectively creating a little data island/snapshot of the actual data at a point in time?) Thanks for any input. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Form 2 PDF 2 Form
Hi List OK, firstly, sorry if this has been on the list before... What I'd like to do is something like this: I currently have an app that takes user input via a normal html form, and then pops the content into mysql. The problem is that lots of user complain that the submit times out due to slow/bad connections, and hence the data gets lost. What I was hoping to do now, was to somehow create a PDF form from the current html form ( should generate itself on the fly ) , the PDF form will obviously need to be downloaded to the user's PC, and will be unique for each time they use the system, ie, I don't want to just give them a blank template PDF, some of the values need to be auto-completed and inserted into the form as read-only, as well as a couple of hidden fields with identifying values so I can know where to pop it into the db. The idea is that the user will now come to the point where he would usually have filled in the html form, but instead, the app must autogenerate a PDF with some values auto-completed and/or hidden, and the user then downloads the pdf to his/her PC, where they continue to fill out the pdf form. Then, on completetion, I'd like to investigate several delivery mechanisms, arguably, the easiest way for the users ( who are mostly techno-peasants), is to simply e-mail the pdf as an attachment to me), but then I will either have to create an auto-parser for the email (prolly difficult and prone to problems with making sure the attachment is correct etc), or I will have to then manually process the attachments. Either way, I would need to feed the pdf to my app, where the form/hidden variables would need to be harvested from the form, and noly then (after validation), be entered into the db. So, simple concept, but I'm sure many pitfalls, the least being probably that I have never done this, and don't know where to start, or even if it's possible/advisable to follow this route. Hence my post here... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form 2 PDF 2 Form
Hi Shiva Appreciate your input. Wrt the spanning of the form, I think, in my situation, it would actually make things worse... You see, my suspicion is that most of the users who are experiencing problems, have very bad connections, many complain that they lose connectivity while they are busy with the form ( it takes them maybe 30 min or so to fill out the entire form ( they basically transfer the data off paper forms they have filled out earlier while on-site, so it's not really alot of data, but there are a lot of fields...) So, my fear with this approach is that they will maybe get past the first part of the form, submit that OK, then start getting trouble with subsequent parts, leaving me with a whole lot of partial entries in the DB., and how do I get them to resume at a a later stage? You don't understand the mindset of these people, when something goes wrong, they'll switch off their PC's and try to start from scratch, so it's going to be difficult to try and get them to understand the concept of multi-part forms... I shudder to even think what will happen, or worse, how I will be able to allow them to make corrections on a certain part of the form once they have submit it. And sometimes, to their defense, it's not them that want to change the details on the form, but the subject of the form who has decided to change their name etc... I'm not ditching this idea, I will definitely give it some more thought, it's just at this moment, my mind is running through my original idea of PDF forms trying to evaluate it. Each method will have it's pro's and cons, and I'll have to go and weigh them. I must add, I don't see effort as a con for a particular solution, as long as I know it will solve the problem without adding other cons... Thanks again, will take it up with you again ( need some more input on this PDF thing to get some balanced views) PS, if you have experience with using this method, I would appreciate it if you could let me have your field notes and how successfull it's working for you. You see, the main thing here is that I need to KNOW when someone who says they have submitted something actually have, and that they are not trying their luck... On Tue, 2003-07-01 at 13:43, Shivanischal A wrote: hi, seems u have complicated task on hand mate. cant u simply consider span the user input over multiple pages? i mean using 2 or more form on different pages instead of a single form on one single page. if this cant be done, we'll think of other measures. but this is by far the most simple method -shiva Petre Agenbag [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi List OK, firstly, sorry if this has been on the list before... What I'd like to do is something like this: I currently have an app that takes user input via a normal html form, and then pops the content into mysql. The problem is that lots of user complain that the submit times out due to slow/bad connections, and hence the data gets lost. What I was hoping to do now, was to somehow create a PDF form from the current html form ( should generate itself on the fly ) , the PDF form will obviously need to be downloaded to the user's PC, and will be unique for each time they use the system, ie, I don't want to just give them a blank template PDF, some of the values need to be auto-completed and inserted into the form as read-only, as well as a couple of hidden fields with identifying values so I can know where to pop it into the db. The idea is that the user will now come to the point where he would usually have filled in the html form, but instead, the app must autogenerate a PDF with some values auto-completed and/or hidden, and the user then downloads the pdf to his/her PC, where they continue to fill out the pdf form. Then, on completetion, I'd like to investigate several delivery mechanisms, arguably, the easiest way for the users ( who are mostly techno-peasants), is to simply e-mail the pdf as an attachment to me), but then I will either have to create an auto-parser for the email (prolly difficult and prone to problems with making sure the attachment is correct etc), or I will have to then manually process the attachments. Either way, I would need to feed the pdf to my app, where the form/hidden variables would need to be harvested from the form, and noly then (after validation), be entered into the db. So, simple concept, but I'm sure many pitfalls, the least being probably that I have never done this, and don't know where to start, or even if it's possible/advisable to follow this route. Hence my post here... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form 2 PDF 2 Form
Well, I'm still a bit concerned about what would happen if the connection got broken while they are busy... The session will time-out (by most defaults, after 1440s), so if they cannot re-connect, and somehow get the same SESSID, then all would be lost that they have done so far..., and that is the main problem; The way I have it set-up atm, is that I place all the necessary details as hidden elements into the form and I then allow them to actually disconnect their connections ( if they want), and to then re-conncet before they want to submit, and then try to submit. This works, but, wrt saving what they have done so far; when the form has submitted successfully, I re-construct it on the action page, and this gives them the opportunity to save the page or print it out, all well and good if the form actually submitted correctly. BUT, when something happens DURING the submit, then it seems that the app behaves strangely; sometimes, it will generate the result form, but will not actually insert anything into the db, or it would only insert partial data... Now on those, I don't think one would ever be able to do something, but if I could at least find a way to let them save the form contents so they don't have to start all over again... The BACK button works sometimes, but some have reported (unconfirmed by me) that it doesn't always return them to the filled out form before they submit. One solution would be to have them save the form page BEFORE they submit, BUT, I intentionally do not want them to do that, because it would have the submit button on it, and I KNOW that some clever bloke is gonna try to gippo the system by not going through the whole process to generate the correct form (they all look the same , but the hidden content differs, and are crucial,to the functionality of the app) So, it's a catch 22 I guess... On Tue, 2003-07-01 at 15:18, Kristin Schesonka wrote: Hi :) I'm actually working on an Multipart-Form and i'm saving all data during the Fill-In process in a Session - then, at the end, i save the whole sessiondata in my table. That will solve the connection-problems i hope . . . If I am wrong, please correct me :) Greetings from Germany Kristin Schesonka -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Form 2 PDF 2 Form
Hi Kristin Yes, of course that is a possibility, and it would surely address the problem of resuming at a later stage. I'm just rather worried at managing these broken submissions. They might start one, then for some reason don't finish, and forget about it altogether... But, I think my biggest problem is the way the app is currently working. To have to change it to incorporate user-id's etc, would be almost as big a task as trying to get the PDF thing to work, and unfortunately I can't give you ALL the details of the app ( classified stuff and too large anyway ;) ), I don't think it would be possible to do this. But with PDF thing, I forsee that it *could* be possible, since one would only change the process in one place, namely the form submit, iow, I would break the process there, relay the process via another (PDF?) route and re-connect at the submit phase. The coding would be difficult, but the process to the user would seem to be identical, which it probably wouldn't if I change the system to incorporate user-id's (and possibly extra interfaces to view partial forms for a specific user)... sound just too complicated atm (but don't get me wrong, I'm listening! as I said in a previous comment, I'm not shooting down any ideas, I'm just more biased towards ANYTHING that might help me out without breaking the current process flow of the app... Thanks again for the input, please continue! On Tue, 2003-07-01 at 16:00, Kristin Schesonka wrote: Hmm, i don't know if you want it that way, but i got the idea of making the stuff personalized . . . I mean the user logges on and gets an Userid - then you always save your data with the Userid, so you can look which entries in your DB belong to this user and the user can start again at a different stage . . . . Greetings Kristin Schesonka -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
Have you checked register_globals = on/off in your php.ini? If register_globals=off, then you must access your POST variables by: $_POST['whatever']; and your get (the stuff you put at the end of your URL's): $_GET['whatever']; On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i++) { echo tr; $row = mysql_fetch_row($result); for ($j = 0; $j mysql_num_fields($result); $j++) { echo(td . $row[$j] . /td); } echo /tr; } echo /tbody /table; } echo hrbr form action=$PHP_SELF method=post input type=hidden name=query value=\$query\ input type=hidden name=database value=$database input type=submit name=\queryButton\ value=\New Query\ input type=submit name=\queryButton\ value=\Edit Query\ /form; unset($form); exit(); } /* Section that requests user input of query */ @$query = stripSlashes($query); if (@$queryButton != Edit Query) { $database = ; $query = ; } ? form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td input type=text name=database value=?php echo $database ? /td /tr tr td align=right valign=topbType in SQL query/b/td tdtextarea name=query cols=60 rows=10?php echo $query ?/textarea /td /tr tr td colspan=2 align=centerinput type=submit value=Submit Query/td /tr /table /form /body /html Any ideas would be greatly appreciated as I am floundering badly! Simon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Forms
Most books, specially the older ones will use this type of coding. It relies completely on register_globals (and some other settings) to be enabled in your php.ini. However, many possible security risks has been identified with having register_globals=on, so newer versions come with that feature disabled by default. This has been discussed to great depths in the archives, and arguably, if you design your code with security in mind, turning register_globals on, will and should not cause any problems. On the other hand, it is becoming a standard, so unless you have your own server, or you know your ISP will turn it on for you, then you are probably better off accessing your variables through the POST and GET arrays. As I said in my first post, it is basically in the way that you call your variables. If you look at your example: You have a form that has the same page as the action, using the POST method, meaning that all the names of form elements and the correlating values, will be passed to the action page as POST variables. All these variables get stored in the $_POST array. So, as an example: Your form has a input type=text name=var1 value=test With your code in mind, hitting the submit on the form, will place a new element in the $_POST array, called var1 ad associative value = test And if you need to echo or use that variable/value, you should do so by calling it like so: echo $_POST[var1]; output - test If you look closely at your code, you will see an If /* Section that executes query */ if (@$form == yes) { and you will also see that the form being shown on first load of the page, has a get variable appended to it in the action: form action=?php echo $PHP_SELF ??form=yes method=post table tr td align=rightbType in database name/b/td td that ?form=yes bit, creates a $_GET variable called $_GET[form] with a value of yes So, for your code to work, the IF statement should read: if ($_GET[form] == yes) { Basically, the reason why it looks like your page is not doing anything, is because the if cannot be satisfied... You should thus go through that sample code and change the nameing of your POST and GET variables (ie, the variables that are passed to the next page to the abovementioned method and all should be fine. -Original Message- From: Simon Chappell [mailto:[EMAIL PROTECTED] Sent: Monday, June 30, 2003 6:22 PM To: Petre Agenbag Subject: Re: [PHP] Forms thanks for the reply yes I have tried both on and off, it is currently off? Where would i put those in my script? or do I have to start from scratch? The reason I am asking, is that all the books I have seem to be doing the same out of date coding, and if it is possible to make a quick change that I can carry with me through my learning then I can get use out of all the books that i have bought! but if all the scripts are pointless then i might as well light a match or give them to my 6 year old and ask him to look after them!! Many thanks Simon On Monday 30 Jun 2003 3:14 pm, Petre Agenbag wrote: Have you checked register_globals = on/off in your php.ini? If register_globals=off, then you must access your POST variables by: $_POST['whatever']; and your get (the stuff you put at the end of your URL's): $_GET['whatever']; On Mon, 2003-06-30 at 15:48, Simon Chappell wrote: Hi can anyone help me with this? I have been failing to get any forms working with PHP now I have run out of ideas? Having bought 3 books the latest one being php mysql for dummies(which might be appropriate for me) I am still failing at this hurdle. the following script is a classic example taken straight out of the book, I get round the $PHP_SELF problem ok but then all the script does is loop back to itself? !-- Program Name: mysql_send.php Description: PHP program that sends an SQL query to the MySQL server and displays the results. -- html head titleSQL Query Sender/title /head body ?php $user=root; $host=localhost; $password=; /* Section that executes query */ if (@$form == yes) { mysql_connect($host,$user,$password); mysql_select_db($database); $query = stripSlashes($query) ; $result = mysql_query($query); echo Database Selected: b$database/bbr Query: b$query/b h3Results/h3 hr; if ($result == 0) echo(bError . mysql_errno() . : . mysql_error() . /b); elseif (@mysql_num_rows($result) == 0) echo(bQuery completed. No results returned./bbr); else { echo table border='1' thead tr; for ($i = 0; $i mysql_num_fields($result); $i++) { echo(th . mysql_field_name($result,$i) . /th); } echo /tr /thead tbody; for ($i = 0; $i mysql_num_rows($result); $i
RE: [PHP] quotes
What you also need is to htmlspecialchars() the vars that you echo as form element values, else your HTML will be broken if one of the vars contains . This should work for both text fields and textareas input type=text value=?=htmlspecialchars($var)? or textarea?=htmlspecialchars($var)?/textarea -Original Message- From: Lso . [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 25, 2003 4:21 PM To: [EMAIL PROTECTED] Subject: [PHP] quotes Ok I have been searching to no avail. I have a form that lets you add new sets of information to a database. Once you add information i have a page that displays this information in a series of text fields. I have done this so you can alter the information in the fields hit edit and the information is updated, you are brought back to the same page and there you see your updated information. This all works fine. The problem is if the usere enters a quote. I have used addslashes(), and the information is entered fine, but when I display the information in the form fields its cut off right after the quote. I tried stripslashes() didnt work. If i url encode the input i get the html entity displayed in the form field. Does anyone have any suggestions? Im just trying to make a nice interface for editing this data. Thanks in advance. Lucas Owens www.lucasowens.com www.technoiraudio.com _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sending headers
Hi List I am having trouble using headers. I try to include a redirect header in my script, but is fails with the familiar ( headers already sent) error. I KNOW you should put the headers call where it will cause the first output, and I do that, the only thing happening infront of the headers call is an include statement to my main db class; this class has absolutely NO output unless a function is called (which it is not)... What am I missing? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problems with quotes in URL
Hi List I don't know what I'm doing wrong: Firstly, I upgraded from 4.0.1 to 4.3.1 and made sure that I have similar settings in php.ini wrt register_globals and magic_quotes. I now have problems with some of my apps: For instance: IN a mysql db, I would have a name like :[ whatever whatever ] I do a select on the table and then echo the name on a page, as well as add it to a url: page.php?myvar=$myvar where $myvar contains the [ whatever whatever ] Now, when I try to echo $myvar on the page.php, I don't get the entire story. I tried to addslashes() before the url line, I tried urlencode() and htmlspecialchars, all causes an echo of $myvar on the page.php page to only display whatever , or, whatever \ but NEVER, whatever whatever What am I doing wrong? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with quotes in URL
OK, this is the URL that my code produces after it get's the my_var from the mysql table. my_var in the table is = whatever whatever whatever whatever So I do a select and I do a $my_var = $myrow['my_var'] (after all the proper mumbo jumbo about the $myrow = mysql_fetc_assoc...etc.) I then do a $my_var = addslashes($my_var)as well as $my_var = urlencode($my_var). Then I simply create a link like so: echo 'a href=page.php?my_var='.$my_var.'next_var=blablalink/a'; Clicking on that link displays exactly the following in the browser's URL location: page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22next_var=blabla And now, on page.php If I do an echo stripslashes($my_var); I get exactly this: whatever whatever \ What am I missing? On Wed, 2003-06-18 at 11:18, Chris Hayes wrote: IN a mysql db, I would have a name like :[ whatever whatever ] I do a select on the table and then echo the name on a page, as well as add it to a url: page.php?myvar=$myvar where $myvar contains the [ whatever whatever ] Now, when I try to echo $myvar on the page.php, I don't get the entire story. I tried to addslashes() before the url line, I tried urlencode() and htmlspecialchars, all causes an echo of $myvar on the page.php page to only display whatever , or, whatever \ but NEVER, whatever whatever What does your link in which 'whatever' is look like ? How do you test to see what is in the variable? This does the job for me: ?PHP if ($_GET['x']=='') {$i='whatever Whatever'; echo 'a href=get.php?x='.urlencode($i).'link/a'; } else echo 'x is '.urldecode($_GET['x']); ? and the url looks like:http://www.X.nl/get.php?x=whatever+%22Whatever%22 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problems with quotes in URL - SOLVED - plz FLAME me!!!
Hi lists ( and all the guys trying to help me) Firstly SORRY, I oversimplified my examples that I posted in the hope that I would get to the solution faster. What i failed to mention in my stupidity, was that I echoed the variable as the value of a form input text field, so I actually messed up the HTML, and I just realized it, and a simple $var = htmlspecialchars($var) does the trick beautifully. Again Sorry guys, I really should have known better than to post stripped down code as the problem is usually a simple thing like this... Just for the by-and-by, my previous claims to having a perfectly working application before upgrading to 4.3.1 was also then a load of bull, and I only realized now that my app had this bug in it all the time! Just goes to show. Anyway, I deserve a good flaming for this one! I'm ready;) On Wed, 2003-06-18 at 14:39, Chris Hayes wrote: (cutted the part about sending a var as get) page.php?my_var=whatever+whatever++%5C%22whatever+whatever%5C%22next_var=blabla ok so here the variable is still complete, including slashes and quotes. And now, on page.php If I do an echo stripslashes($my_var); I get exactly this: whatever whatever \ i get better results with echo stripslashes(urldecode($_GET['my_var'])); (or in your version echo stripslashes(urldecode($my_var)); ) this even though Marek said Incomming GET values are urldecoded automaticaly, no need to do this. (this=urldecode) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] magic_quotes_gpc - 4.0.1 to 4.3.1
Hi List Is there a difference in the way PHP handles the magic_quotes_gpc between these versions? I had 4.0.1 running on my server for a little over a year and all went well, ie, data that contained quotes etc were discreetly handles by PHP and inserted into MySQL with no problems ( when you vies the data in the table with phpMyAdmin for instance, you would not see any slashes in the content. However, since I upgraded to 4.3.1 (and turned on magic_quotes_gpc), I notice that the same process now produces slashes in the db, meaning that I will now need to edit my code and add stripslashes() when I need to display them. [STOP RIGHT HERE] - I KNOW that it is best to use addslashes() and stripslashes() BUT, I inherited the code, and it is really going to be an enormous task to go through the code for the entire app. So naturally I'm looking for a quick fix in the form of another magic function, and in the absence of such a function, I'd like to know what the differences are, maybe I can then look at a class or a function to handle all for me??? Thanks for any help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dealiong with quote's in SQL strings
Hi List I recently installed 4.3.1 and enabled the magic_quotes_gpc to deal with quotes in mysql inserts. However, I think I have run into a problem that might be related, and was wondering if there is an easy way to fix it: I have a script that gets user input from a drop-down, on the action page I search a mysql table for the row matching the selection made previously. What I do then is to extract the result of that select * from table where data = form_selection and then to re-insert the data into the table ; note, re-insert, NOT UPDATE ( the app cals for a new row to be added with the updated data, so the old row stays intact and a new row is added that contains some of the old row's data plus some new stuff I add). So, the new insert sql looks as per usual insert into table (`var1`,`var2`,`var3`,`var4`,...) values ('$var1','$var2',); where $var1, $var2 etc is either inherited from the extract of the first querie's result set, or overwritten with my newly generated values. The problem now comes in with this: If one or more of the extracted variables containes something like O'Healy or something similar that causes trouble with the quotes in the new INSERT sql, well, you see the problem... And I don't want to have to go and addslashes to all my extracted variables, because there really are a whole heap of them. So, is there another php.ini setting that I'm missing to help me with this, or maybe a function that will addslashes to all my extracted vars? I'm lazy, shoot me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dealiong with quote's in SQL strings
Hi Awlad Yes, I know addslashes(), but that's the point, I would rather NOT want to go and have to use addslashes() to all my extracted vars as there are almost a hundred vars, and I douldn't want to go and have to add addslashes($var1), addlsashes($var2), ., addslashes($var100) UNLESS it is the unanimous feeling of the list that there is no other way ( BTW, the app worked fine on PHP 4.0.4, hence my suspicion that there might be a php.ini setting I missed when upgrading to 4.3.1) On Fri, 2003-06-13 at 15:46, Awlad Hussain wrote: addslashes (PHP 3, PHP 4 ) addslashes -- Quote string with slashes Description string addslashes ( string str) Returns a string with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote (), backslash (\) and NUL (the NULL byte). - Original Message - From: Petre Agenbag [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, June 13, 2003 2:43 PM Subject: [PHP] dealiong with quote's in SQL strings Hi List I recently installed 4.3.1 and enabled the magic_quotes_gpc to deal with quotes in mysql inserts. However, I think I have run into a problem that might be related, and was wondering if there is an easy way to fix it: I have a script that gets user input from a drop-down, on the action page I search a mysql table for the row matching the selection made previously. What I do then is to extract the result of that select * from table where data = form_selection and then to re-insert the data into the table ; note, re-insert, NOT UPDATE ( the app cals for a new row to be added with the updated data, so the old row stays intact and a new row is added that contains some of the old row's data plus some new stuff I add). So, the new insert sql looks as per usual insert into table (`var1`,`var2`,`var3`,`var4`,...) values ('$var1','$var2',); where $var1, $var2 etc is either inherited from the extract of the first querie's result set, or overwritten with my newly generated values. The problem now comes in with this: If one or more of the extracted variables containes something like O'Healy or something similar that causes trouble with the quotes in the new INSERT sql, well, you see the problem... And I don't want to have to go and addslashes to all my extracted variables, because there really are a whole heap of them. So, is there another php.ini setting that I'm missing to help me with this, or maybe a function that will addslashes to all my extracted vars? I'm lazy, shoot me! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dealiong with quote's in SQL strings
Thanks, it was there right infront of me... Just as a matter of interest, are there security/performance issues with this setting as well as the magic_quotes_gpc or other oddities that it could cause? On Fri, 2003-06-13 at 15:54, CPT John W. Holmes wrote: I recently installed 4.3.1 and enabled the magic_quotes_gpc to deal with quotes in mysql inserts. However, I think I have run into a problem that might be related, and was wondering if there is an easy way to fix it: I have a script that gets user input from a drop-down, on the action page I search a mysql table for the row matching the selection made previously. What I do then is to extract the result of that select * from table where data = form_selection and then to re-insert the data into the table ; note, re-insert, NOT UPDATE ( the app cals for a new row to be added with the updated data, so the old row stays intact and a new row is added that contains some of the old row's data plus some new stuff I add). So, the new insert sql looks as per usual insert into table (`var1`,`var2`,`var3`,`var4`,...) values ('$var1','$var2',); where $var1, $var2 etc is either inherited from the extract of the first querie's result set, or overwritten with my newly generated values. The problem now comes in with this: If one or more of the extracted variables containes something like O'Healy or something similar that causes trouble with the quotes in the new INSERT sql, well, you see the problem... And I don't want to have to go and addslashes to all my extracted variables, because there really are a whole heap of them. So, is there another php.ini setting that I'm missing to help me with this, or maybe a function that will addslashes to all my extracted vars? magic_quotes_runtime in php.ini ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I display new lines in a textearea?
Hi I want to have a textarea that contains details read from a mysql table, but I want to echo each row so that it is on a new line. What is the new-line character for a textarea? ( in effect the reverse of nl2br() ) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I display new lines in a textearea?
Hi Thanks, I DID use \n, BUT, I made a stupid mistake, I did: textarea ?php echo $word.'\n'; ? /textarea And the literal ' did not parse the \n, replacing with works fine... On Thu, 2003-06-05 at 16:32, CPT John W. Holmes wrote: I want to have a textarea that contains details read from a mysql table, but I want to echo each row so that it is on a new line. What is the new-line character for a textarea? ( in effect the reverse of nl2br() A newline is \n $text = word\nword\nword\n; echo textarea$word/textarea; will have each word on a different line. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GEnerating PDF's
Hi List I'm investigating different possibilities to generate printable and read-only documents, and the best method seems to be generating PDF's, however, I have NO experience with working with PDF's, and the examples in the manual only list a simple one-liner text pdf. Where can I find more material that will explain in layman's terms how to generate pdf's from various sources. As example, I'd like to generate PDF's of a webpage on-the-fly or even from data in MySQL tables. It seems that you need to provide the pdf generation process with the co-ordinates and size of each element, but it is the location of the elements that I have trouble with, ie. what is needed to define each element? Thanks for the help. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables don't pass... *sniff*
RegisterGlobals = Off You need to access these variables by $_POST[aVariable] or in your case ( adding the variables to the end of a URL means you are using the GET method: $_GET[aVAriable] etc. On Wed, 2003-05-28 at 11:37, [EMAIL PROTECTED] wrote: Hi all! I'm using Apache 2.0.45, PHP 4.3.2RC4, and MySQL 3.23.49 on Windows 2003 Server Standard. I have a problem passing variables between pages. They simply get lost. Neither GET nor POST pass values, and even hardcoding them into the URL, like htpp://localhost/comeon.php?aVariable=dinganotherVariable=dong and putting this in comeon.php: echo(Values: $aVariable, $anotherVariable); only outputs Values: , ...I've tried with RC3 of PHP, even 4.3.1, but it doesn't work. I've used PHP on my machine with Apache 2 before, and it worked fine. Actually I used the same scripts fine on my old config. This was on XP however, so I'm not sure if it's got something to do with the OS. I'm hoping it's a configuration issue. Any ideas are VERY much appreciated =). Thanks, Daniel There are 10 kinds of people - those who know binary and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables don't pass... *sniff*
It's not backwards compatible. If your code simply mentioned the variable name and not the method array, it will not work (as you noticed) when registerglobals is turned off ( for security reasons). However, there are many ways of making your old code work, the easiest is probably to extract the $_POST or $_GET array. Look in the manual at the array functions ( extract() ) and also read up on working with registerglobals = off. On Wed, 2003-05-28 at 11:49, [EMAIL PROTECTED] wrote: Thank you mate, this works! =) Just curious, though... I'd like to keep my scripts as compatible as possible, so can you tell me if this method is backwards compatible? I've never used this method before, the variables have just been there on a subsequent page. I'm kinda fearing for my previous work, if the servers suddenly change their configurations, rendering scripts non-functional... And, I'm guessing $_POST would be the array to hold POSTed variables, right? Is there a function to release the contents of these arrays into global variables in a scripts, so you don't have to go... $var1 = $_GET[var1]; $var2 = $_GET[var2]; ...if that's what you wanted? (Not sure I want to, but just to know) Again, thank you! =) Daniel - Original Message - From: Petre Agenbag To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 11:40 AM Subject: Re: [PHP] Variables don't pass... *sniff* RegisterGlobals = Off You need to access these variables by $_POST[aVariable] or in your case ( adding the variables to the end of a URL means you are using the GET method: $_GET[aVAriable] etc. On Wed, 2003-05-28 at 11:37, [EMAIL PROTECTED] wrote: Hi all! I'm using Apache 2.0.45, PHP 4.3.2RC4, and MySQL 3.23.49 on Windows 2003 Server Standard. I have a problem passing variables between pages. They simply get lost. Neither GET nor POST pass values, and even hardcoding them into the URL, like htpp://localhost/comeon.php?aVariable=dinganotherVariable=dong and putting this in comeon.php: echo(Values: $aVariable, $anotherVariable); only outputs Values: , ...I've tried with RC3 of PHP, even 4.3.1, but it doesn't work. I've used PHP on my machine with Apache 2 before, and it worked fine. Actually I used the same scripts fine on my old config. This was on XP however, so I'm not sure if it's got something to do with the OS. I'm hoping it's a configuration issue. Any ideas are VERY much appreciated =). Thanks, Daniel There are 10 kinds of people - those who know binary and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables don't pass... *sniff*
Sorry, I missunderstood your question about backwards compatible. YES, accessing your variables this way ($_POST[] etc), IS backwards compatibel, ie, they are placed in those arrays anyways, BUT, the method is not backwards compatible to older versions of PHP, there the arrays were called $HTTP_GET_VARS or something similarly unlike $_GET... On Wed, 2003-05-28 at 11:49, [EMAIL PROTECTED] wrote: Thank you mate, this works! =) Just curious, though... I'd like to keep my scripts as compatible as possible, so can you tell me if this method is backwards compatible? I've never used this method before, the variables have just been there on a subsequent page. I'm kinda fearing for my previous work, if the servers suddenly change their configurations, rendering scripts non-functional... And, I'm guessing $_POST would be the array to hold POSTed variables, right? Is there a function to release the contents of these arrays into global variables in a scripts, so you don't have to go... $var1 = $_GET[var1]; $var2 = $_GET[var2]; ...if that's what you wanted? (Not sure I want to, but just to know) Again, thank you! =) Daniel - Original Message - From: Petre Agenbag To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Wednesday, May 28, 2003 11:40 AM Subject: Re: [PHP] Variables don't pass... *sniff* RegisterGlobals = Off You need to access these variables by $_POST[aVariable] or in your case ( adding the variables to the end of a URL means you are using the GET method: $_GET[aVAriable] etc. On Wed, 2003-05-28 at 11:37, [EMAIL PROTECTED] wrote: Hi all! I'm using Apache 2.0.45, PHP 4.3.2RC4, and MySQL 3.23.49 on Windows 2003 Server Standard. I have a problem passing variables between pages. They simply get lost. Neither GET nor POST pass values, and even hardcoding them into the URL, like htpp://localhost/comeon.php?aVariable=dinganotherVariable=dong and putting this in comeon.php: echo(Values: $aVariable, $anotherVariable); only outputs Values: , ...I've tried with RC3 of PHP, even 4.3.1, but it doesn't work. I've used PHP on my machine with Apache 2 before, and it worked fine. Actually I used the same scripts fine on my old config. This was on XP however, so I'm not sure if it's got something to do with the OS. I'm hoping it's a configuration issue. Any ideas are VERY much appreciated =). Thanks, Daniel There are 10 kinds of people - those who know binary and those who don't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables don't pass... *sniff*
Maybe they could include a quick overview of the latest changes as well as a link to the on-line manual in your sign-up message when joining the list? On Wed, 2003-05-28 at 11:46, Chris Hayes wrote: Could someone with power over php.net please try to make this change in variable handling very extremely clear for downloaders? Make it something you cannot miss? Not everybody reads release notes and readme.txt files. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie help, pressing the submit button returns nothing
Your problem is not with PHP but with basic HTML. Your FORM tag needs an action=www.somepage.com in order to do something. With PHP, you can call the same page back onto itself. On Fri, 2003-04-04 at 14:37, David McGlone wrote: Hi all, I have a real quick question. I'm trying to learn PHP and right now im working with variables, anyway, I cannot get the code below to work correctly, could anyone help me out here the problem is, when you submit the name, the name will not appear at all. code below HTML FORM METHOD=post Name:br INPUT NAME=UserName TYPE=textbr INPUT TYPE=SUBMIT VALUE=Enter /FORM br Your name is: ?php echo ($UserName); ? /html -- David M. Edification Web Solutions http://www.edificationweb.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Issues
Hi Nicole First of all you need to tell us where and for which service these users are trying to log in, ie. are they logging in to receive mail, access secure website section etc? And what is the authentication method/dependencies? I think if you can answer these questions, we will know better to tell you where to look for the cause. For example, if the problem is with users loggin into the website, and the authentication you use is a sql table , then the problem could lie with either Apache being too busy, or with mysql being too busy, and the problem would probably be evident in the logs of either service. You can also scrutinize your /var/log/messages file to see if there are any evidence of system lockups or other errors. Regards Petre On Wed, 2003-04-02 at 09:04, Nicole wrote: --- My System: A dedicated server with: Red Hat 7.2 P4 2 GHZ 1GB Ram -Apache -PHP 4.2 -MySQL Ensim panel --- I am having strange occurrences of people telling me they cannot sign into their accounts. It happens every now and then, and it happens to anyone -- but not everyone. I am not sure what this could be a result of. I start to think it's a server issue. I see no common pattern, they are using either windows 98 or XP with IE 5 and 6. I personally run XP and have the same setup as some of these that report trouble signing in. If they try to sign in later, they get in fine. I run several sites on this server, and this particular site is high traffic. My other site has just about 30 members and I have had not a single complain in 6 months. So I'm baffled. The hour of the day varies,as well. There's no regular or common pattern that I can see. Could it be from an issue with Apache, MySQl and PHP? Maybe it is even an issue with PHP sessions. I wondered if anyone else has heard of or experienced something similar. If so, have you figured out what is causing this? Have you found a workaround? Thanks! -- Nicole -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Books
Hi Chris The first book, Teach Yourself PHP and MySQL in 24 Hrs: I got that one myself, but it tends to gather dust nowadays... It was very useful in the beginning with learning the basix syntax etc, but I quickly outgrew it, and rarely use it at all, not even for reference. I got the book called PHP and MySQL web development by Luke Welling and Laura Thompson. This is a great book, I sleep with it under my pillow and use it regularly as a reference to examples. I'd say it's basic enough to start out with, yet advanced enough to keep you interested as you grow more adept. BUT, I must admit, at this point, the single resource I use the most wrt PHP is the manual that comes with PHP, great reference to functions etc, but of course, you need to know of these functions before you can just refer to them... So, I would still suggest getting the Luke Welling et al book. There's a new edition on Amazon for $35, plus shipping of about $25. The last time I ordered, the Rand was much weaker, and the VAT was about R55, bringing my total to about R800, but it's well worth it... There is also a new book by Rasmus Lerdorf and it's cheaper than the book I mention, unfortunately I don't have insight into that book, and what would the guy that wrote PHP know about it anyway heh? ;p On Wed, 2003-03-12 at 11:45, Chris Blake wrote: Greetings learned PHP(eople), Can anyone offer comment on the following books on PHP. I`m in the early stages of PHP and am looking for a suitable guide to begin with. = Sams Teach Yourself PHP MYSQL and Apache in 24 Hours Publisher: Sams Publishing ISBN: 067232489X Publishing Date: 2003 Format: Paperback = PHP BIBLE Author: Tim Converse Publisher: WILEY ISBN: 0764549553 Pages: 875 Format: Paperback == Beginner's Guides (Osborne): PHP 4: A Beginner's Guide Author: Bill McCarty and William McCarty Publisher: MCGRAW HILL ISBN: 0072133716 Publishing Date: 2001 Pages: 544 Format: Paperback If anyone has used these manuals I would appreciate your input as I don`t wanna spend a fortune on a manual and then find out it`s [EMAIL PROTECTED] -- Chris Blake Office : (011) 782-0840 Cell : 083 985 0379 Your mouse has moved. Windows must be restarted for the change to take effect. Reboot now? [ OK ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session
Well, I guess it's all about the type of application you're writing and the kind of resources you have at your disposal... Making garbage collection 100% will basically cause the system to go through the steps of determining what should be disposed and what not, and that would be determined by the time-out setting... So making it 100% and keeping the time to 24 minutes would mean that a session wouldn't last much longer than 24 minutes on your system. Is that good? Only you will know; if your application demands long visit times for users, then it is not a good idea, as they will find the session destroyed after 24 minutes of use... Running the process too often might cause some performance problems on an average server, and leaving it for too long *could* cause memory and disk space problems; so it's a balance really, and you should tweak the settings to match your needs ( which you should have determined in dry runs before going live...) On Tue, 2003-03-11 at 09:47, Shaun van den Berg wrote: Hi, What should the probability of your garbadge collector be ? is a 100% bad , and how long must the max lifetime of your session variables be , the default is 1440 secs(24 min) , is 24 hours to much ? Thanks Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session
Garbage collection is a random process. You can however set the probability of it starting on every session call in the php.ini file, along with the elapsed time of a session variable, after which it is considered garbage. On my system, my probability is set to 1, meaning there is a 1% chance of the garbage process starting when I call a new session, and my garbage define time is 1440, meaning if the data is older than that amount of seconds, then it is to be considered garbage by the next garbage process, and hence, destroyed... On Mon, 2003-03-10 at 15:30, Shaun van den Berg wrote: When does the carbadge collector start ? Thanks Shaun -- Novtel Consulting Tel: +27 21 9822373 Fax: +27 21 9815846 Please visit our website: www.novtel.co.za -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form input security
It all depends on what you will do with the data... The use will dictate the level of cleaning up. You MUST clean it up for DB entries as you mentioned, but if you are only going to e-mail the contents as-is to yourself etc, then cleaning up the data becomes of lesser importance. On Sun, 2003-03-09 at 21:18, Chris Cook wrote: Hello all, When using forms, when do I have to worry about cleaning up user data? I know to use escapeshellarg() when using system functions, but how about when using the user data for database inserts? Also, if I do not insert the data into the database or use any system commands, do I still need to clean the data? Thanks, Chris _ Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [mysq] help with displaying table {off Subject}
I presume you are talking about phpMyAdmin here. The Browse link only works when there are entries in the tables, ie., it won't work on empty table. You must first insert data into the tables, and for that you uise the INSERT link. You can change the tables by using the PROPERTIES link. On Tue, 2003-03-04 at 09:18, Karl James wrote: hey guys im trying to figure out why the browse link wont work in mysql is there anything special to edit so that i can view the tables so i can edit them and add value ultimatefootballleague.com/index.php [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reminder mail when date is within a month of today.
HI I'm having a bad thinking day. I know it's going to be a very easy solution, but please humour me. I have a mysql table with a bunch of subscribers and the date that they subscribed. I want to query the table to find all the subscribers who will come up for renewal within the current month. So, each time I access the page, it must generate a table with those who's subscription is going to expire in this month, as well as those who might already be past the renewal date. I can handle the generation of the table and all, I'm just not coping with the query string. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] reminder mail cont.
Sorry, forgot to mention, the subscription is annual, so the subscription date I have for the subscriber is lets say 2002-02-28 , so I want to capture that he will need to renew by 2003-02-28 as well as all people past today's date... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reminder mail when date is within a month of today.
Thanks for the quick response. Just to clarify: $query=mysql_query(select * from TableName where month(FieldNameForDate)=month(FieldOfDate)+1); Which one of the dates in your query is the system's date and which is the one from the db? Also, I need not just the ones that are true, but also the ones that are already past, so I presume you should have a then? On Tue, 2003-02-25 at 12:10, Sunfire wrote: well... $query=mysql_query(select * from TableName where month(FieldNameForDate)=month(FieldOfDate)+1); that should do it.. or at least it does on mine anyways... - Original Message - From: Petre Agenbag [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, February 25, 2003 4:07 AM Subject: [PHP] reminder mail when date is within a month of today. HI I'm having a bad thinking day. I know it's going to be a very easy solution, but please humour me. I have a mysql table with a bunch of subscribers and the date that they subscribed. I want to query the table to find all the subscribers who will come up for renewal within the current month. So, each time I access the page, it must generate a table with those who's subscription is going to expire in this month, as well as those who might already be past the renewal date. I can handle the generation of the table and all, I'm just not coping with the query string. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.443 / Virus Database: 248 - Release Date: 1/10/2003 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] script to check if server is up
Hi I have two servers on two different networks. I would like to implement some sort of a watchdog application between the two to inform me should either of the machines go down or has a connection problem. I was thinking along the line of using a PHP script running from cron on an hourly basis to ping the server as well as another server such as google.com (they seem to be always up) and to only raise the alarm when google can be reached, but NOT the other server. My only problem is with the actual recognition of a failed ping, or for that matter a successful one? Can anyone give me some brain food as to the code for detecting a up/down connection? pseudo code: make connection with server1 get result of connection_server1 make connection with google.com get result of connection_google if connection_google !connection_server1 sms me else chill out and a plus would be to do this ONLY if the result of the next cron-run is the same, ie, don't sms me if the problem has been fixed within an hour. I just don';t know what to use to make connection and get result of connection Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ftp file to client machine
HI I am trying to do the following: I have an ftp server configured, but instead of the user having to use an ftp client, I'd like them to use the browser: So I'm trying to make a mini web-based ftp client. Idea is to get their username and password ( and maybe the ftp address as well?) and to then have php log into the server and list the contents of the folder (no need to handel subfolders etc.). Then I would want them to be able to click on the file to download it. I have done the first part with no problem as per below: ?php $ftp_server = 192.168.0.23; $ftp_user_name = test1; $ftp_user_pass = test1; // set up basic connection $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo FTP connection has failed!; echo Attempted to connect to $ftp_server for user $ftp_user_namebr; die; } else { echo Connected to $ftp_server, for user $ftp_user_namebr; } // get dir listing $file_list = ftp_nlist($conn_id,); foreach ($file_list as $num=$val) { echo bra href=\download_ftp.php?user=$ftp_user_namepass=$ftp_user_passfile=$val\$val/a br; } ftp_close($conn_id); ? But I am baffeled for the rest, ie, what to do on the download.ftp page. First I tried the ftp_get() with the $file used as the local and remote files, but it seems that that will not download the file to the client machine, but rather to the server itself. So, how can I have the file download to the client's machine ( ps, the files are NOT inside a webfolder, so I cannot simply make links to them, and yes, it is done for security reasons; basically I am trusting/using vsftp's security instead of having to devise my own method..) Please point out my obvious lack in knowledge of these matters. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] encrypt passwords on URL
HI This is a sort-of continuation on my previous question regarding being able to puch a file to a client machine using PHP. I have created a login page that connects to the ftp server and then lists the contents of the folder. My original hope was that I could somehow have the user just click on the file he want's to download it, but since the files are not in a webfolder, I couldn't just make links to them... Another scenraio that could work is to simply have the user go to ftp://username:[EMAIL PROTECTED] BUT, that leaves the password on the URL and the data is sensitive. So, my question: Can I encrypt the password with PHP and then generate the link as above but with the encrypted password? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Echo # problem
Two ways: a) echo blabla # $blabla; or b) echo 'blabla # '.$blabla; The # character must just be inside the echo's quotes. On Wed, 2003-02-12 at 13:36, Paul McQ wrote: I am writing an application in which I need to redirect to an url using the Header function. This redirection must include the # character so that the user is taken to the relevant part of the following page. PHP sees the # as a comment no matter what I do and therefore the redirection doesn't work as I would like. Does anyone know how you can use PHP to echo the # character? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] best way to save form data on user side
Hi I have a rather annoying problem regarding forms. I have built an app that allows the users to fill in a rather large form (much like a claim form) and then have the data pumped into a mysql db. The problem is: the users want to be able to save their forms on their systems as a) backup/proof that they have filled it in and b) for their records for future use and c) the hope is that it would also allow for a reliable method to complete the form off-line and then submit it when online again. So, I'm not sure what the best way is to tackle this situation. My gutt says it would need some kind of client stand alone app, but I wouldn't want to go there unless I am proven beyond reasonable doubt that it is the only way. The users are mostly in computer limbo, and if they had their way, they would want to use Word or Excel to complete the forms, save it to their hard drive and click to send it away... Help!, Please?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] best way to save form data on user side
Hi Bryan Thanks for the suggestions. Can you elaborate on the pdf option? Wouldn't that mean the users would need a copy of adobe acrobat writer? On Tue, 2003-01-28 at 21:53, Bryan Brannigan wrote: 3 choices as I see it.. a) create a PDF for download b) let the users create the form in Excel and then figure out a way to import that into your database using a webapp c) client side app :( -Original Message- From: Petre Agenbag [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 28, 2003 2:35 PM To: [EMAIL PROTECTED] Subject: [PHP] best way to save form data on user side Hi I have a rather annoying problem regarding forms. I have built an app that allows the users to fill in a rather large form (much like a claim form) and then have the data pumped into a mysql db. The problem is: the users want to be able to save their forms on their systems as a) backup/proof that they have filled it in and b) for their records for future use and c) the hope is that it would also allow for a reliable method to complete the form off-line and then submit it when online again. So, I'm not sure what the best way is to tackle this situation. My gutt says it would need some kind of client stand alone app, but I wouldn't want to go there unless I am proven beyond reasonable doubt that it is the only way. The users are mostly in computer limbo, and if they had their way, they would want to use Word or Excel to complete the forms, save it to their hard drive and click to send it away... Help!, Please?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] best way to save form data on user side
Hi Chris On Tue, 2003-01-28 at 22:09, Chris Shiflett wrote: --- Petre Agenbag [EMAIL PROTECTED] wrote: I have a rather annoying problem regarding forms. I have built an app that allows the users to fill in a rather large form (much like a claim form) and then have the data pumped into a mysql db. The problem is: the users want to be able to save their forms on their systems as a) backup/proof that they have filled it in and b) for their records for future use and c) the hope is that it would also allow for a reliable method to complete the form off-line and then submit it when online again. Well, this sounds like a bad idea in general, but if you have no choice in the matter, I suppose cookies can fulfill the need. Anything you implement like this is going to lessen the security of the data, because rather than the client sending it to you once, you are going to expose it over the Internet several times. If this risk is acceptable for whatever reason, then cookies are probably no less secure for this data than anything else. Normally, I would highly recommend *not* storing client data on cookies, because that opens you up to several types of attacks, but you can accomplish what you want to do with this method. Only punish those who want this feature by setting these cookies only for those who choose to save this data locally. You could help the situation by encrypting the data in your cookies, so that only presentation attacks are a concern, but your users wouldn't be able to easily look at their data as verification of anything. My recommendation is to leverage your position as the technical expert to advise a more proper solution, one that you agree to, not them. They should not be consulted regarding application design unless they have experience with it. Rather, they should be describing their needs and let you (or the technical lead / project manager) do the technical design. This is exactly what I'm looking to do; but my problem remains: I don't know what the best solution is. The problem is clear: the users actually need an electronic copy of the data they submit; they must revisit certain issues annually, and would need to access the data they submitted the previous year; either for review purposes, or to make the new submission a speedy matter of simply changing the details that are different from last year. It's much like a normal office scenario: each person works on Word docs that need to be shared with others, yet needs to be editable and must be saved etc, BUT the difference here is that the data of all the collective sources must be entered into a central db. So the non technical solution would be for the users to do the forms in word, then fax it to the central office, where you have a temp type the data into the db... we can't have that now... Any ideas? PS, I don't think cookies are going to do this. Remember, the user needs to be able to access and re-submit the form at any stage. Good luck to you. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail Function Parameters
You have to use sendmail with the -f flag. I have written a small test util to do this: ?php $address = recipient@address; $message = Subject: Test\n; $message.= \n message; $result = `echo -e $message | /usr/sbin/sendmail -f your@address $address`; $result.= `$message`; echo $result; ? On Thu, 2003-01-23 at 16:12, Adam Voigt wrote: I have a site with a PHP auto-mailer where the owner of the site gets a report generated from the DB, it all works fine, except his server has spam filtering enabled so the FROM header in my PHP-Generated email, which says apache@hostname doesn't work because what the hostname is set to, isn't resolveable outside our network. Now I know I can just set the servers hostname to a valid DNS name, but this brings up another problem, even though I'm manually setting the From and Reply-to headers in the PHP mail command (the last parameter), when the email's are listed in his box, it works, if you open the headers in the email near the very top it still says From: apache@hostname and a little ways below it says the From and Reply-to I set. So, is there anyway to override the top From which says apache@hostname? Maybe setting additional parameters on my sendmail command line in the php.ini? Any ideas? I appreciate it. -- Adam Voigt ([EMAIL PROTECTED]) The Cryptocomm Group My GPG Key: http://64.238.252.49:8080/adam_at_cryptocomm.asc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP sendmail configuration
The problem you are having took me a while to grasp. Basically, what happens is that sendmail sends the mail as the user php/apache was installed as (usually nobody@ or apache@ yourdomain.com). Setting the Return-Path does not work, as you cannot override the Return-Path set by the server in this way, that's why messages bounce to your root account when sent with a php mail() function. If you only host one domain on a server, you can fix this by editing the sendmail.cf file and setting the Return-Path: to something more meaningful: However, most people don't have the luxury of having a one domain hosting solution. Your only other option is to invoke sendmail with the -f switch: sendmail -f sender@address recipient@address file_containing_message This forces a from: address, but it also produces a warning to the recipient that the message headers might be forged, but return mails and replies are directed to the address specified. Only problem with all this is that you need to do one of 2 things: a) use of PHP's system commands eg. $mail = `echo -e Subject: Subject here\n\n Message here | /usr/sbin/sendmail -f $your_address $recipient_address`; OR b) use a PERL script to do it. I am currently looking at both, and it seems at this stage that the PERL script will be the better option, specially if you need to mail to alot of people. You need to issue the sendmail in a loop, and for load balancing, it's best to put a sleep() inside the loop; even if you only make this a sleep(1) (sleep for 1 sec), PHP will timeout after only 30 recipients unless you override the default timeout setting for php scripts. On Tue, 2003-01-07 at 03:09, Peter Houchin wrote: richard check your php.ini the mail stuff in there .. it's most likely using the address either there or ur web server config file -Original Message- From: Richard Baskett [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 7 January 2003 10:49 AM To: PHP General Subject: [PHP] PHP sendmail configuration Ok I know it's off topic, but I've been working on this for over 5 hours now and I almost have it configured, but something is definitely wrong! Basically I can send email using sendmail by this command: echo Just a test | mail -s test [EMAIL PROTECTED] Now [EMAIL PROTECTED] receives the email, but the From address is [EMAIL PROTECTED] and I have no idea where it is getting that address from! Does anyone know how I can change that from address? And what would stop the above command from delivering to certain valid email addresses? This is definitely causing problems with my php server also when trying to send emails... Rick Only a life lived for others is worth living. - Albert Einstein -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Dreaded Return-Path and mail()
Almost exactly the same question as the message with subject: Sendmail configuration The problem you are having took me a while to grasp. Basically, what happens is that sendmail sends the mail as the user php/apache was installed as (usually nobody@ or apache@ yourdomain.com). Setting the Return-Path does not work, as you cannot override the Return-Path set by the server in this way, that's why messages bounce to your root account when sent with a php mail() function. If you only host one domain on a server, you can fix this by editing the sendmail.cf file and setting the Return-Path: to something more meaningful: However, most people don't have the luxury of having a one domain hosting solution. Your only other option is to invoke sendmail with the -f switch: sendmail -f sender@address recipient@address file_containing_message This forces a from: address, but it also produces a warning to the recipient that the message headers might be forged, but return mails and replies are directed to the address specified. Only problem with all this is that you need to do one of 2 things: a) use of PHP's system commands eg. $mail = `echo -e Subject: Subject here\n\n Message here | /usr/sbin/sendmail -f $your_address $recipient_address`; OR b) use a PERL script to do it. I am currently looking at both, and it seems at this stage that the PERL script will be the better option, specially if you need to mail to alot of people. You need to issue the sendmail in a loop, and for load balancing, it's best to put a sleep() inside the loop; even if you only make this a sleep(1) (sleep for 1 sec), PHP will timeout after only 30 recipients unless you override the default timeout setting for php scripts. On Tue, 2003-01-07 at 02:37, Timothy Hitchens (HiTCHO) wrote: Hmm... I would expect that your sendmail.cf (if you are using sendmail) hasn't got your webserver (running as eg www or apache etc) in it's trusted users file / listing. HiTCHO has Spoken! Timothy Hitchens (HiTCHO) [EMAIL PROTECTED] -Original Message- From: David T-G [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 7 January 2003 10:34 AM To: PHP General list Cc: Monty Subject: Re: [PHP] Dreaded Return-Path and mail() Monty -- ...and then Monty said... % % Okay, I've read just about everything on the Internet about how the change % the Return-Path header in an e-mail sent using mail(), but, I STILL can't % get it to work. All e-mail sent via PHP says Return-Path: [EMAIL PROTECTED] % and Received: (from nobody@localhost). How interesting. What do you get if you put $to = [EMAIL PROTECTED] ; $subj = here is a subject ; $body = this is the message body ; $hdrs = From: [EMAIL PROTECTED]\r\nReturn-Path: [EMAIL PROTECTED] ; mail($to,$subj,$body,$hdrs) ; in a php script and execute it? If it doesn't work, what do the mail server lots on your web server say? I just tested this code on my box and it worked, so if you have problems then you can figure it's your mail setup and not your code. If it works, expand from there in small steps :-) HTH HAND :-D -- David T-G * There is too much animal courage in (play) [EMAIL PROTECTED] * society and not sufficient moral courage. (work) [EMAIL PROTECTED] -- Mary Baker Eddy, Science and Health http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No Idea - Comparing Lines
When you read the first line, split the data into it's components , then assign each value to a variable. Call them: $octet_1,$unix_time_1 etc. Now, start the loop. Inside the loop, read the next line, assign to $octet_2, $unix_time_2 etc. Do your calculations ( $answer = $octet_2 - $octet_1 etc. ) Now, before exiting the loop: $octet_1 = $octet_2; $unix_time_1 = $unix_time_1; etc On Mon, 2003-01-06 at 15:51, Christopher J. Crane wrote: Ok, this is the first time I will post a message without a line of code. I am not sure how to go about this task. So I will describe it and maybe someone will have some thoughts. I use PHP to connect to our many routers and get data using snmp. I have written a script that refreshes itself every 10 secs. It writes the data to a text file. The key element of this data is the Octet counters, or the amount of data that has been transfered both in and out. To keep it simple, I will only talk about outs. In order to find the amount od data being transfered, I have to compare two lines. Then run a calculation on that and then push that data into an array to plot on a chart later on. Here is an example of the file the data is written to: OctetsIn:4300492881|OctetsOut:4300544503|UnixTime:1041629017 OctetsIn:4305184236|OctetsOut:4305234971|UnixTime:1041629031 OctetsIn:4308716675|OctetsOut:4308782481|UnixTime:1041629044 OctetsIn:4312595737|OctetsOut:4312685815|UnixTime:1041629058 OctetsIn:4315910414|OctetsOut:4315961443|UnixTime:1041629072 OctetsIn:4318948400|OctetsOut:4318975102|UnixTime:1041629085 OctetsIn:4322040239|OctetsOut:4322091605|UnixTime:1041629098 OctetsIn:4324981522|OctetsOut:4325033235|UnixTime:1041629111 OctetsIn:4327971528|OctetsOut:4328029496|UnixTime:1041629125 OctetsIn:4332318792|OctetsOut:4332379277|UnixTime:1041629138 OctetsIn:4335594241|OctetsOut:4335635318|UnixTime:1041629153 OctetsIn:4339008729|OctetsOut:4339048246|UnixTime:1041629166 OctetsIn:4342539875|OctetsOut:4342591776|UnixTime:1041629180 OctetsIn:4346070439|OctetsOut:4346127821|UnixTime:1041629193 OctetsIn:4350288360|OctetsOut:4350355417|UnixTime:1041629206 I can open the file and read the contents line by line split up but the delimiters and get the data I needbut this is what has to happen. If PHP is on line 1, do nothing (it's needs two lines to compare against) If it's on line 2, then subtract Line 1, OctetsOut from Line Line 2 OctetsOut. Then do the same with the UnixTime. Now run a calculation on that data and push that into an array as the first data point. Now move on, with a loop I would assume, and do the same for lines 2 and 3, and so on, until we reach the end. There could be 5 lines or 500 lines. I can loop through the file and do everything, the biggest problem I am having is getting the data on the line PHP is currently on, and then subtracting the line prior to it. I just can't seem to get a grasp on it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] communicate with cyrus imap
Hi I wonder if someone can give me some pointers on this. I have cyrus/sendmail running on a RH server, and it works great. I use ximian evolution as my mail client and other users also has no problem with OE or MO. I've been looking at various web based mail clients to implement on my server for my clients, but they all seem to have messy temp folders that need to be taken care of with cron jobs etc, and it seems like these temp folders/cron jobs are not 100% fool proof in either the size that they grow, or in detecting old messages to delete. So, I would just like to get my mind in line here with the actual problem. Are these php based webmail clients forced to use this kind of temp folder structure, or is there just no other way, and one would have to live with it. Would a Java client be less of a hassle then? I would have asked something like Can't you simply let cyrus handle the whole process and just use php to create the 'frontend' , but I obviously don't know enough about the actual workings of these php clients ( squirrel and webmail for instance ). I just don't want to put one on my server as a solution to my clients if I cannot be 100% assured and comfortable with the system as I am with cyrus in general. Thanks Hope someone can enlighten me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Syntax Help
What do you mean by dont post proper data? Have you added slashes to the variables? (use addslashes() and then stripslashes() when reading the contents from the db) On Thu, 2002-11-14 at 11:22, conbud wrote: Whats wrong here ?? The variables are getting the correct information from the form but for some reason as soon as I put the variables into the $sql they dont post the proper data to the database, its connecting to the database ok but just not updating the data. $sql = UPDATE updates SET member= '{$_POST['mem']}', email= '{$_POST['email']}', position= '{$_POST['pos']}', dateadded= '{$_POST['dateadded']}', descp= '{$_POST['descp']}', message= '{$_POST['message']}' where id= '{$_POST['id']}'; $result = mysql_query($sql); Lee -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to echo the end marker '?'
I'm just curious. Why do you want to echo within an echo? echo 'form action='.$PHP_SELF.''; will do the trick won't it? Unless I miss the point, I cannot see why you need to open new php tags for this? On Fri, 2002-11-08 at 14:25, Ernest E Vogelsinger wrote: At 12:15 08.11.2002, Philipp Bolliger spoke out and said: [snip] subject's allready my question ! I want to echo something like : form action = \,?php echo $PHP_SELF ? \ so that the action becomes ? echo $PHP_SELF ? !! But I can't figure out how to escape ? so that the interpreter doesn't take it as the end of the script ! Any idea ? [snip] Try echo 'form action=', '', '?', 'php echo $PHP_SELF', '?', '', ''; This should work (untested) -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fw: [PHP-DEV] When my PHP file opens, I want it toautomatically submit
Are you just interested in getting the IP address of the visitor? IF so, this info is already added to the website's apache log, so you actually only need to go look through the log, or, if you want to make it a bit more surgical, you can write the 'REMOTE_ADDR' variable straight into a mysql table, without the added trouble of mailing , specially with using mailto: ; this actually opens up a new message window on the client's side's e-mail program, and the user has to click on send, if he doesn't, you won't get the mail So, if it's crucial stuff, don't rely on the client ( that's actually the golden rule for all apps...) On Tue, 2002-11-05 at 13:05, Marek Kilimajer wrote: body onload=yourForm.submit() form name=yourForm action=mailto:address;server.net input type=hidden name=ip value=?= $_SERVER['REMOTE_ADDR'] ? /form /body is this what you want? This is too complicated, why not sending it from the server? Chris Shiflett wrote: This type of question should be addressed to [EMAIL PROTECTED] I am forwarding it there. Also, please correct your reply-to address. Chris Luke wrote: Hello, On my website, I have a php form which submits the global Ip address of the computer its on to a specific email address, I want it to automatically click the submit button on the website without questions, it already has an email address specified in it, but you have to open the document and click submit.. any ideas? Thanks, Luke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] creating and ftp text file
HI I need to create a text file that is in a specific format from a mysql query, and then ftp that file to another server. The format will be something like this: Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Cellphone: xx Reference: 123456 Notify: 0 Validity: 2h text message As you can probably deduct, this is for sending SMS message. The x are the numbers that I will be getting from a mysql query, I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: creating and ftp text file
Erwin Thanks a million. That's actually much simpler than I thought it would be... I'm gonna give it a go just now, but I'm sure it will work! Thanks again! On Tue, 2002-11-05 at 17:09, Erwin wrote: I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? In fact, it is...just open the file on the ftp directly ? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ? You can then write directly to that filepointer: ? fwrite( $fp, 'some text' ); ? Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that) ? fclose( $fp ); ? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. You'll have to loop trough the resultset ? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . \n; } $content .= 'Reference: ' . $reference . \n; $content .= 'Notify: ' . $notify . \n; // And add everything else to the $content variable which needs to be written $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ? HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: creating and ftp text file
Hi Erwin OK, my first problem: your code genrates errors, it says fwrite and fclose are invalid file descriptors. I gathered thatit is possibly because thos are for normal files, so I looked in the manual and found the FTP-functions, but it takes a $local_file variable, and that must be the name of the local file on disk, so I cannot simply put $content in there... Any ideas on how to directly stream the variable to the ftp site? Thanks On Tue, 2002-11-05 at 17:09, Erwin wrote: I am pretty up to standard with getting stuff into and out of mysql, so I am basically just in need of pointers with generating the text file and ftp'ing automatically. It would be an even greater plus if it wasn't actually necessary to create a physical text file on the hard drive, but to simply ftp the memory file via the ftp functions, but I don't think that is possible? In fact, it is...just open the file on the ftp directly ? $fp = fopen( 'ftp://ftp.domain.com/file.txt', 'w' ); ? You can then write directly to that filepointer: ? fwrite( $fp, 'some text' ); ? Don't forget to close the file (I think PHP does that anyway, but it's nicer if you do that) ? fclose( $fp ); ? My routine will already have connections to the db, and the query will have already been run (something like select number from table where group=1) and I would then have a while to step through the result set. This is where I need help, how to create the file and add the numbers and static text to the file, and once completed with the loop, to ftp to a server with username and password. You'll have to loop trough the resultset ? $query = 'select number from table where group=1'; $result = mysql_query( $query ); $content = ''; while ( $res = mysql_fetch_array( $result ) ) // This piece of code will add all the Cellphone-numbers to the $content variable { $content .= 'Cellphone: ' . $res['number'] . \n; } $content .= 'Reference: ' . $reference . \n; $content .= 'Notify: ' . $notify . \n; // And add everything else to the $content variable which needs to be written $fp = fopen('ftp://ftp.domain.com', 'w' ); fwrite( $fp, $content ); fclose( $fp ); ? HTH Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Problems taking me hours to solve!
No, it should not return what you want. When you do $orderid = mysql_query($query); all this does is actually execute the query, and returns an array containing the actual result set. What you need to do from here is to do: $myrow = mysql_fetch_assoc($orderid); Now, what you have is an associative array in $myrow containing the row with identifiers being the collumn names in the db, So, from your query, you should do: $my_id = $myrow[orderid]; $my_id will now contain the id you want... On Fri, 2002-11-01 at 10:21, Steve Jackson wrote: This is the query I am running on my database: $query = select orderid from receipts order by receipt_id DESC LIMIT 0,1; $orderid = mysql_query($query); That should return the last record in the DB? Correct? I currently get a number returned which is the number plus 1. IE if 423 is the last DB record then 424 is returned. Any ideas why this happens? Also in the same table I have a shipping price variable. My query for this is: $query = select shipping from receipts order by receipt_id DESC LIMIT 0,1; $shipping_cost = mysql_query($query); Again this should return the last record? It doesn't return anything however. Any ideas? Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com http://www.violasystems.com/ [EMAIL PROTECTED] Mobile +358 50 343 5159 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] client-side zip of POST or GET data, auto unzip on server.
Hi Yes, I thought your last comment would also be doable, but it would be nice to have this zipping done on the user' behalf. The whole reason why I *think* this is possible, is because you can unzip and process the data on the server side in an automatic way, so it *should* be possible to do this on client side as well, I just don't know how... Something like a zip-wrapper for form data, or any data for that matter... Hope someone else can shed some ideas??? On Fri, 2002-11-01 at 10:56, @ Edwin wrote: Hello, Petre Agenbag [EMAIL PROTECTED] wrote: Hi I'm wondering if something like this will be possible. I am correct in thinking that POST and GET data are sent as plain text? Not always. (POST - SSL) And, that being plain text, they should probably be highly compactable by zip utils? Not really sure how you can do this... The reason I'm thinking this route is that I have a couple of forms for some client websites that are particularly large, some of the POST data sent are more than 2 MB, but obviously it can vary depending on the amount of data entered by the user ( I cannot limit this, as these forms are assessment forms, and they need to contain all relevant info, regardless of size ). All fields are text fields. 2MB of TEXT? If my calculation is correct hat would be over 2 million characters! I'm sure you can limit the size depending on when and where they enter relevant info. So, what happens now is that for some users on slow connections, these forms can either take years or they simply time out every time. I'm afraid so... Being a specific application with controlled number of users, I wouldn't think it bad practise to force the user to install a zip package on his pc; that's to say if it would be possible to write some client side script (JS?) that will receive the form data, zip it, then send the I don't think this is possible. zipped packet via POST or GET as per usual to the server, where, upon receipt, the POST package is unzipped and the handled as per usual. How? Would something like this be possible or feasible at all? Are there other better ways to accomplish this? I think it'd be better to divide your form(s) in different sections and POST data in smaller units. Or, perhaps, you can just ask them to (1) create a text file (better if it's XML) then (2) zip it if it's big and then (3) upload them to the server. Then, perhaps, you can write a script that would parse the file and do whatever is needed. (Unzip it first if necessary.) Just an idea... - E -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Simple Problems taking me hours to solve!
Well, OK I think your problem is here: You sql *could* and probably does return more than one row. Yet, your code as it is now will only return the first row. You need to cycle through the result rows with a while statement, like this: while ($myrow = mysql_fetch_assoc($result)) { $my_id = $myrow[shipping]; echo $my_id; echo br; } Now, this will probably be a bit difficult to incorporate as is into your function, as you will have multiple returns, and each will override the previous value, so you'll end up with only the last row's id.. Some pointers: Use something like $result = mysql_query($sql) instead of saying $shipping = mysql_query() It will work the same, but it is easier to read throuhgh your code and see where you actually invoke a result, and where you are simply assigning a value to a variable ( which you are NOT doing with this command, $result only contains the result set identifier of the query, not the actual result, that's why you pass the $result to a mysql_fetch_assoc(), only then do you have any kind of workable data) Next, use mysql_fetch_assoc(), instead of ...fetch_array() Difference is: array = [0,pointer1,value1,1,pointer2,value2,2,pointer3,value3.] associative array = [pointer1,value1,pointer2,value2,pointer3,value3 ] So, they hold the same data, but assoc's are smaller as they don't have the numerical pointer, which you don't use anyway. When you do the $my_id = $myrow[shipping]; what you are doing is retrieving the shipping-th value from the array, and you would never do a $my_id = $myrow[2]; for instance... So, assoc's are generally better to use. You can safely change it in your code, the previous errors you got was not because of this, it was simply because your result set was empty, and mysql_fetch_array OR mysql_fetch_assoc would have given the error... I would suggest you try to accomplish your goal without a function at this point as to allow you to understand what you are trying to do better. You will have to either build a loop into your function, or call your function from within a loop, and both can be quite difficult to grasp initially... On Fri, 2002-11-01 at 12:24, Steve Jackson wrote: Ok thanks. Still having problems though. This is the function now: function get_shipping_cost() { //Get order ID from DB to pass to receipt. $conn = db_connect(); //$query = select * from receipts order by receipt_id DESC LIMIT 0,1; $query = select shipping from receipts order by receipt_id DESC LIMIT 0,1; $shipping = mysql_query($query); $myrow = mysql_fetch_array($shipping); $my_id = $myrow[shipping]; $shipping_cost = $my_id; return $shipping_cost; } Still zero DB results. There is definitely a connection as DB_connect() works. No!!! Why are you doing this? $my_id = $myrow[shipping]; $my_id = $shipping_cost; return $shipping_cost; $my_id already contains the value you want, just return $my_id, the reason it doesn't work now, is because $shipping_cost has no value. If you really want to have the value stored in $shipping_cost, you must do: $shipping_cost = $my_id. You see, $my_id has a value in it the moment you say: $my_id = $my_row[shipping]; but when you do $my_id = $shipping_cost, you are overwriting the value inside $my_id with $shipping_cost, which is like saying $my_id = 0; On Fri, 2002-11-01 at 11:07, Steve Jackson wrote: Okay. Now I have this and it still returns nothing. function get_shipping_cost($shipping_cost) { //Get order ID from DB to pass to receipt. $conn = db_connect(); $query = select shipping from receipts order by receipt_id DESC LIMIT 0,1; $shipping = mysql_query($query); $myrow = mysql_fetch_array($shipping); $my_id = $myrow[shipping]; $my_id = $shipping_cost; return $shipping_cost; } And I still get one added to the variable in this function which pulls orderid from the same table. function get_order_id_receipt($orderid) { //Get order ID from DB to pass to receipt. $conn = db_connect(); $query = select orderid from receipts order by receipt_id DESC LIMIT 0,1; $order = mysql_query($query); $myrow = mysql_fetch_array($order); $my_id = $myrow[orderid]; $my_id = $orderid; return $orderid; } Well and truly confused! Steve Jackson Web Developer Viola Systems Ltd. http://www.violasystems.com [EMAIL PROTECTED] Mobile +358 50 343 5159 -Original Message- From: Petre Agenbag [mailto:internet;vsa.co.za] Sent: 1. marraskuuta 2002 10:23 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Simple Problems taking me hours to solve! No, it should not return what you want. When you do $orderid = mysql_query($query
Re: [PHP] Serverside script
Are you familiar with PHP, or are you more worried about how to call and execute the script from the server itself on a weekly basis ( cron job) ? On Fri, 2002-11-01 at 14:41, Davíð Örn Jóhannsson wrote: I need to write a stand alone script runing on a server that checks and updates a database every week, is this posable and if so could some one direct me to a tutorial or to any info on doing this. Regards, David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] client-side zip of POST or GET data, auto unzip on server.
Hi I'm wondering if something like this will be possible. I am correct in thinking that POST and GET data are sent as plain text? And, that being plain text, they should probably be highly compactable by zip utils? The reason I'm thinking this route is that I have a couple of forms for some client websites that are particularly large, some of the POST data sent are more than 2 MB, but obviously it can vary depending on the amount of data entered by the user ( I cannot limit this, as these forms are assessment forms, and they need to contain all relevant info, regardless of size ). All fields are text fields. So, what happens now is that for some users on slow connections, these forms can either take years or they simply time out every time. Being a specific application with controlled number of users, I wouldn't think it bad practise to force the user to install a zip package on his pc; that's to say if it would be possible to write some client side script (JS?) that will receive the form data, zip it, then send the zipped packet via POST or GET as per usual to the server, where, upon receipt, the POST package is unzipped and the handled as per usual. Would something like this be possible or feasible at all? Are there other better ways to accomplish this? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] back and forward through a result query
Hi I need to do the following, and have a slight idea of how to do it, but I'm not sure... I want to do a select id from table where something = whatever , then I will display all the hits from that query as links to a display page, sending along the id's of the row. On that next page, I will use that id to retrieve the relevant data to display for that specific record, but, I want to have a previous|next function, that will display the relevant data of the previous or next record as was displayed on the original page that showed the list of hits. So I *think* I should create an array containing all the id's of that query, and send it along with the clickthrough to the display page and then from there use the array functions next and prev to get the id's directly adjacent to the one I currently have, but I'm not sure if this is the best way to do it, for one, I don't know how to put those id's into an array from the original query, and two, don't know how to tell it to get prev of current id from array or get next of current id from array. And I think it might be a bit of an unnecessary overhead to send that entire array via GET to the display page if you are only ever going to use 2 values from it, so It would make much more sense to me to pass the current id, the next id and the previous id for each hit along to the display page. Any ideas on how I could do that? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] back and forward through a result query
PS, also, I would need to know and handle the beginning and end of that array, ie, if there isn't a next or previous, I wouldn't want to display a next or forward button, or maybe disable it... Thanks On Tue, 2002-10-29 at 14:06, Petre Agenbag wrote: Hi I need to do the following, and have a slight idea of how to do it, but I'm not sure... I want to do a select id from table where something = whatever , then I will display all the hits from that query as links to a display page, sending along the id's of the row. On that next page, I will use that id to retrieve the relevant data to display for that specific record, but, I want to have a previous|next function, that will display the relevant data of the previous or next record as was displayed on the original page that showed the list of hits. So I *think* I should create an array containing all the id's of that query, and send it along with the clickthrough to the display page and then from there use the array functions next and prev to get the id's directly adjacent to the one I currently have, but I'm not sure if this is the best way to do it, for one, I don't know how to put those id's into an array from the original query, and two, don't know how to tell it to get prev of current id from array or get next of current id from array. And I think it might be a bit of an unnecessary overhead to send that entire array via GET to the display page if you are only ever going to use 2 values from it, so It would make much more sense to me to pass the current id, the next id and the previous id for each hit along to the display page. Any ideas on how I could do that? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST-ing or GET-ing an array
Hi I KNOW I'm gonna get flamed, but I can't find this anywhere in my books or in the manual, yet I know I've read it somewhere. I created an array in a loop as such: $sql = select stuff from my_table; $result = mysql_query($sql); $count = 0; while ($myrow = mysql_fetch_assoc($result)) { $id = $myrow[id]; $my_array[$count] = $id; } Now, I want to send that array to another page with a normal: a href=next_page.php?array=$my_arrayNext/a BUT, that obviously doesn't work... Please just help me out, I'm suffering... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] POST-ing or GET-ing an array
Oops, I forgot to add the $count++ at the end of the while loop, but that was just an ommission of this post, in my real code, the array is created fine ( tested it with a print_r($my_array) ). On Tue, 2002-10-29 at 19:40, Petre Agenbag wrote: Hi I KNOW I'm gonna get flamed, but I can't find this anywhere in my books or in the manual, yet I know I've read it somewhere. I created an array in a loop as such: $sql = select stuff from my_table; $result = mysql_query($sql); $count = 0; while ($myrow = mysql_fetch_assoc($result)) { $id = $myrow[id]; $my_array[$count] = $id; } Now, I want to send that array to another page with a normal: a href=next_page.php?array=$my_arrayNext/a BUT, that obviously doesn't work... Please just help me out, I'm suffering... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] exploding values into new variables
Hi The manual states: $pizza = piece1 piece2 piece3 piece4 piece5 piece6; $pieces = explode( , $pizza); So, if I want to be able to echo piece1 to the screen at a later stage, I would go: echo $pieces[0]; or $first_piece = $pieces[0]; echo $first_piece; Right? Just want to make sure I understand it before I try to use it... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to setup mysql logging from php scripts
Hi I need to be able to see logs of all mysql queries from php scripts on my server. I have a multitude of virtual hosts on my RedHat server, with many mysql db's, and would like to be able to see what queries are done against the db's from which scripts. The reason being is that I suspect that some of the scripts on some domains are causing problems, for example infinite loop db queries etc. Yesterday again I had mysql freeze up completely on the server, and the only interaction with mysql are from php scripts on the various domains, so looking at the mysql.log file gives no help. Ideally I would like to see something like the following logged: time || path/to/script.php || sql_query || mysql_error or ANYthing that will help me to determine what went wrong. At the moment I can merely blame the gremlins, and I don't know if it is a poorly written script causing this or not, so I can't do anything about the situation... ANY suggestions or methods being used by ppl out there are also welcome. Thanks alot. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] pretty simple problem in mailing a dynamic page
You need to add another header telling it the content type = text/html On Wed, 2002-09-25 at 17:04, usha wrote: I just want to email a dynamic page ( So I designed a page consisting of datas pulled from db and are formated with html tags: here in below code $d is such variable to be mailed) But the problem is that, instead the code contained in $d is sent. The code is as such: $ebody=html$d/html; mail([EMAIL PROTECTED], The subject,$ebody,From: [EMAIL PROTECTED]\r\n); Cna anyone give me solution for this pretty simple problem. Regards Usha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dropping mail into queue
Hi list Is is possible to change the default behaviour of the mail() function to send the message to the queue instead of trying to send it immediately? I did do some research into this a while back, but it never really got to a point where I was completely satisfied with the results. I can recall from then that the behaviour of the mail() function was inherited from the way sendmail was configured on the server, but I cannot go that route ( ie, reconfigure sendmail to send all mail requests to the queue, as the server is not only a webserver, but servers my clients normal e-mail as well), so I'm basically asking if it is possible to override the sendmail behaviour when you issue the mail() function, or to even compose and write the message directly to the /var/spool/mqueue folder ( that would obviously NOT use the mail() function). The reason for all this is that there are some clients that are abusing/miss-using the mail() function to query a mysql db of 20K users with a while() loop and then doing a mail() inside the while, this is causing some serious problems on my server, and I'm trying to look for ways to put a tab on this.So any other suggestions are also very welcome. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] dumping mysql database with php script
put the exec(...) line OUTSIDE the while loop.As your codeis now, it's dumping with each new row , so i'ts overwriting itself. On Mon, 2002-09-02 at 09:47, [EMAIL PROTECTED] wrote: I am having a problem with a script to dump a mysql database to a text file. When I run the command below it creates the database.sql file but it only puts the first three lines in that file they look like this # MySQL dump 8.13 # # Host: localhostDatabase: testdata1 # # Server version3.23.37 If I run the following at the command line it work perfect passing the whole database to the txt file /usr/bin/mysqldump -u testdata1 -ptestdata1 testdata1 /home/sites/www.directphp.net/sitebackup/databases/testdata1.sql Why is it stopping on the third line when I run it with a PHP script This is my script while($row = mysql_fetch_array($result)){ $databasename=$row[databasename]; $databaseusername=$row[$databaseusername]; $databasepassword=$row[$databasepassword]; exec(/usr/bin/mysqldump -u $databaseusername -p$databasepassword $databasename $Databasesdir/$databasename.sql); } -- Best regards, rdkurth mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] autocomplete list box
Hi I am wondering if it is possible to write/create/implement an autocomplete type list box, something that will basically work the same as when you have a normal textbox in a form and have autocomplete enabled in the browser, but not quite exactly, I want the textbox and the listbox to be combined and browser independant. Is this possible? Dependant/do-able with PHP or is it a Java/Browser feature? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Stepping through an array more than once (offlist)
Hi Justin OK, a quick feedback on your previous suggestion: I tried to unset the $myrow_it, but it still didn't produce any output. The only way I could get it to work was with the same method you suggested in this e-mail. I had to create 2 new vars ( which basically boils down to 2 more SQL's). I think I'm not 100% understanding what the $result variable contains $sql = 'select * from table'; $result = mysql_query($sql); As I would think, $result contains the entire table in some sort of structure or matrix right? And doing a while ($myrow = mysql_fetch_assoc($result)) creates a one dimensional array of each row in the table with each pass. I was just looking for a way to step through $result again and again, without having to query the DB again... But the only way I can get it to work is to do: $result2 = mysql_query($sql); $result3 = mysql_query($sql); and then I can while ($myrow = mysql_fetch_assoc($result2)) and later while ($myrow = mysql_fetch_assoc($result3)) It's like the contents of $result can only be used once...Is that the case? I tried to do $test = $result; immediately after doing the query and then using $test in the while , but that doesn't work either... Anyway, not a train smash, will carry on with the trusty old ways. On Wed, 2002-08-28 at 18:30, Justin French wrote: Hi, I haven't got a heap of time tonight, but you should really look at arrays. What I noticed with your code was that you basically did the same thing (same layout and presentation three times -- and it might be 50 times later!!). This sort of thing cries out for an array or function -- or both!! Let's start by recognising your 3 loops: OPEN, CURRENT, OLD. Arrays come in many shapes, but generally a one-dimensional array is in the form of 'key' = 'value'. In this case, I've chosen to use the three types of status as the key, and the natural language or heading as the value. ? $ticketTypes = array( 'OPEN' = 'New Tickets', 'CURRENT = 'Current Tickets', 'OLD' = 'Old Tickets' ); ? Then you can loop through this array with a foreach, and do the same thing to all three elements. Now, we have to take the $type (key) and $heading (value) of each array element (the three options) and use them within the loop to produce the different results. ? // array of ticket types $ticketTypes = array( 'OPEN' = 'New Tickets', 'CURRENT = 'Current Tickets', 'OLD' = 'Old Tickets' ); foreach($ticketTypes as $type = $heading) { // print heading echo B{$heading}/BBR; $sql = SELECT * FROM tickets WHERE status='{$type}'; $result = mysql_query($sql); if(!$result) { echo There was a database error: . mysql_error() . BR; } else { // no need to to do an $i++ count... just use this: $total = mysql_num_rows($result); while ($myrow = mysql_fetch_array($result)) { // a little trick i have to make each column // name (eg status) into it's own var (eg $status) foreach($myrow as $k = $v) { $$k = $v; } echo {$company} :: {$title} :: {$content}br; } echo Total New: {$total}br; } } ? Now, I haven't tested the above, so gimmie a yell if it breaks... When I strip all the bullshit and comments out, and condense the script down to it rawest form, it's like 19 lines of code -- that's including error handling and all sorts of stuff!! And it will work for 2 ticket types (still less lines of code than your 40+) and for 50 ticket types -- just make the array bigger. The other point is, if this script was called for many different pages, then you could include it all in a function... but that's for another day! Sure, you're doing three sql queries, but each one of them is returning a more focused result set... I'd have to do some tests, but I reckon there's very little difference between ONE QUERY + MASSIVE AMOUNTS OF PHP CODING if() sections etc etc, versus THREE QUERIES + SOME CODING. The nature of what you want to achieve with this script is conducive to using three separate queries. I know less queries == faster, but it's not always the case, and not always worth worrying about, unless you've got a HUGE site with millions of hits a day... you just won't notice the benefit, in comparison to the advantage. Some pages on a site I'm working on right now, hinge.net.au, have 5-10 queries on them, for sessions, users, content, data, counters, logging, message boards, etc etc. And I've NEVER noticed a performance problem, or got any complaints. When you've got maybe 500 rows in there (or 5,000, or 50,000), it'd be nice to run an a/b test with a script timer, and get some averages to find out definitively. Enjoy, Justin on 28/08/02 11:16 PM, Petre Agenbag ([EMAIL PROTECTED]) wrote: Justin, Thanks
Re: [PHP] Re: Stepping through an array more than once (offlist)
Jason Sorry, I completely forgot to comment on your suggestion: I did try mysql_data_seek(), but it didn't work for me ( guess I don't know how exactly it works), BUT, it did look like it was meant for stepping through a one dimensional array, and $result is not a one dimensional array, right? Maybe I'm just not thinking correctly, Justin has also just commented on your suggestion and he seems to give some sort of an implementation of using mysql_data_seek(), maybe it will explain it a better for me, I'll quickly see if I can get it to work. Thanks for the input! On Thu, 2002-08-29 at 08:46, Jason Wong wrote: On Thursday 29 August 2002 14:16, Petre Agenbag wrote: Hi Justin OK, a quick feedback on your previous suggestion: I tried to unset the $myrow_it, but it still didn't produce any output. The only way I could get it to work was with the same method you suggested in this e-mail. I had to create 2 new vars ( which basically boils down to 2 more SQL's). [snip] I've said it once already: mysql_data_seek() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Heller's Law: The first myth of management is that it exists. Johnson's Corollary: Nobody really knows what is going on anywhere within the organization. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Stepping through an array more than once (offlist)
Jason Thanks the mysql_data_seek() works. With Justin's help, I used the mysql_data_seek() to reset the $result matrix to 0, and re-issued the same while statement. It now produces the desired output. Thanks. On Thu, 2002-08-29 at 08:46, Jason Wong wrote: On Thursday 29 August 2002 14:16, Petre Agenbag wrote: Hi Justin OK, a quick feedback on your previous suggestion: I tried to unset the $myrow_it, but it still didn't produce any output. The only way I could get it to work was with the same method you suggested in this e-mail. I had to create 2 new vars ( which basically boils down to 2 more SQL's). [snip] I've said it once already: mysql_data_seek() -- Jason Wong - Gremlins Associates - www.gremlins.com.hk Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * /* Heller's Law: The first myth of management is that it exists. Johnson's Corollary: Nobody really knows what is going on anywhere within the organization. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Stepping through an array more than once
Hi I would like to do something like the following: I have a table that contains a bunch of info at various stages. To optimize the load on the db, I was thinking it would be better to do a select * from table , and then use PHP to sort through the results, rather than have 3 SQL's with where status=xxx . There are essentially 3 stages or states at which the data in the table can be sorted, so I would need to loop through the array 3 times in order to display the entire contents of the table ordered by the 3 statges. This is my first attempt: $sql_it = 'select * from tickets '; $result_it = mysql_query($sql_it); echo 'New Tickets br'; $count = 0; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == OPEN) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; $count++; } } echo 'Total New:'.$count.'br'; echo 'Current Tickets br'; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == CURRENT) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; } } echo 'Old Tickets br'; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == OLD) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; } } Now, obviously this only echoes the first part, as it seems the array is at the end when it tries to loop through again. I tried a reset($myrow_it) , but it drops an error about $myrow_it not being an array. I'm not sure if my logic here is correct. Is this the way to re-loop the array? Hope I explained what I am trying to do well enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Stepping through an array more than once
Actually, it's not accurate for me to say stepping through an array more than once, as I want to step through the database ( $result) more than once, without having to make connections to the db again. Can this be done? On Wed, 2002-08-28 at 13:58, Petre Agenbag wrote: Hi I would like to do something like the following: I have a table that contains a bunch of info at various stages. To optimize the load on the db, I was thinking it would be better to do a select * from table , and then use PHP to sort through the results, rather than have 3 SQL's with where status=xxx . There are essentially 3 stages or states at which the data in the table can be sorted, so I would need to loop through the array 3 times in order to display the entire contents of the table ordered by the 3 statges. This is my first attempt: $sql_it = 'select * from tickets '; $result_it = mysql_query($sql_it); echo 'New Tickets br'; $count = 0; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == OPEN) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; $count++; } } echo 'Total New:'.$count.'br'; echo 'Current Tickets br'; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == CURRENT) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; } } echo 'Old Tickets br'; while ($myrow_it = mysql_fetch_assoc($result_it)) { $status = $myrow_it[status]; if ($status == OLD) { $company = $myrow_it[company]; $title = $myrow_it[title]; $content = $myrow_it[content]; echo $company.' :: '.$title.' :: '.$content.'br'; } } Now, obviously this only echoes the first part, as it seems the array is at the end when it tries to loop through again. I tried a reset($myrow_it) , but it drops an error about $myrow_it not being an array. I'm not sure if my logic here is correct. Is this the way to re-loop the array? Hope I explained what I am trying to do well enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.04 -- 4.1.2 incompatible
Hi Can someone please tell me what settings to check for on 4.1.2 in order to ensure that scripts that runs on 4.0.4 will run on 4.1.2? I HAVE checked registered_globals = on, but I still get variables that are not passed on via URL and form submits. The app has a login form that submits to an action page, on the action page I generate a link that goes to another form, I append the username and password to the end of the URL of the link on the action page, and then create hidden fields that echo the username and password in the subsequent form to be passed along with the extra form field to the last page. This whole process works 100% on 4.0.4, but breaks at the second page on 4.1.2 (ie, it DOESN't pass the username and password to the action page from the form fields). I need to resove this, as I have lots of applications that was written in this way, and are currently working, but want to upgrade the server to RedHat 7.3 that comes with 4.1.2 and don't want to end up with a bunch of broken apps. I know it's not the correct way to have coded, but it's done now, and for now, I won't mind to have register_globals = On, although THAT doesn't seem to be the solution... Please advise. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 4.04 -- 4.1.2 incompatible
Yes, phpinfo() returns that register globals is ON... On Tue, 2002-08-20 at 11:52, Thies C. Arntzen wrote: On Tue, Aug 20, 2002 at 11:28:55AM +0200, Petre Agenbag wrote: Hi Can someone please tell me what settings to check for on 4.1.2 in order to ensure that scripts that runs on 4.0.4 will run on 4.1.2? I HAVE checked registered_globals = on, but I still get variables that are not passed on via URL and form submits. The app has a login form that submits to an action page, on the action page I generate a link that goes to another form, I append the username and password to the end of the URL of the link on the action page, and then create hidden fields that echo the username and password in the subsequent form to be passed along with the extra form field to the last page. This whole process works 100% on 4.0.4, but breaks at the second page on 4.1.2 (ie, it DOESN't pass the username and password to the action page from the form fields). I need to resove this, as I have lots of applications that was written in this way, and are currently working, but want to upgrade the server to RedHat 7.3 that comes with 4.1.2 and don't want to end up with a bunch of broken apps. I know it's not the correct way to have coded, but it's done now, and for now, I won't mind to have register_globals = On, although THAT doesn't seem to be the solution... Please advise. Thanks have you checked that register_globals _is_ actually on? just look at the output of phpinfo(); re, tc -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php