[PHP] page cannot be displayed after a post of form with over 80 post elements
hi guys, i am facing the above problem. i couldn't explain whats causing this behavior. however, those data does get posted to the server. only thing is that the result page is not showing up but the above error page. i have tested with 60+ post elements, but no error of such occur. any idea what could be the cause? platform: win2k, sp3 iis5 php on cgi i have been wondering if it is iis5 that is giving the problem. thanks, lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fixed - Re: page cannot be displayed after a post of form with over80 post elements
managed to found out the cause. it was the cookies. it got overloaded with data and exceed the 4k limit. the cookies was storing preferences for too many users thus it break the limit. B.C. Lance wrote: hi guys, i am facing the above problem. i couldn't explain whats causing this behavior. however, those data does get posted to the server. only thing is that the result page is not showing up but the above error page. i have tested with 60+ post elements, but no error of such occur. any idea what could be the cause? platform: win2k, sp3 iis5 php on cgi i have been wondering if it is iis5 that is giving the problem. thanks, lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy Paste URL was [Re: [PHP] Would appreciate thoughts on sessionmanagement ]
one reason that i could think of for not including session id into URL and using cookies would be copy paste. users could just copy and paste the url and send it to his/her friends. and it could be a considerably number of people. imagine couple of people clicking on the link. that session will be shared among that no. of active people at that particular time. in short, session hijacking will occur. Ernest E Vogelsinger wrote: At 22:41 10.11.2002, Charles Wiltgen said: [snip] I'm about to implement session management, and I'm considering rolling my own instead of using PHP's. Hmm - NIH syndrome? (not invented here) Specifically, I'm considering using hidden fields for persistent object properties because (1) I don't want cookies to be an issue, (2) I prefer not to have session IDs appear in a URL, and (3) I prefer not to use require a database just to store persistent properties. [snip] As Justin already pointed out you make yourself stick to forms, not allowing any normal page be session-dependent - but that's only one of the drawbacks. The issue that would disturb me the most is data security - if you use the client browser to store object persistent data this opens up a whole world of possibilities to hack your data... Of course you could always check if the hidden fields are still ok, using some md5 or whetever, but why the hassle? If you don't want cookies (I too don't use them for a session and have disabled session cookies in our php.ini), PHP will transparently merge the session identifier into its output (as long as you don't use ob_gzhandler, that is). But why don't you like the session ID magled into links? prefer not to use a database - that's not the case with standard php sessions, they get written to a file somewhere. Just make sure that this somewhere is a) read/writable by apache b) not read/writable by anyone else and you are (relatively) secure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Editor
http://www.phpedit.net Bryan McLemore wrote: Hi guys, just wondering if anyone could recomend a good editor that is based on windows. Thanks, Bryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: All Queries TRUE even when they should be FALSE
you should use mysql_num_rows() to check for records returned instead of using mysql_query(). this is because if $query is a valid $sql statement, mysql_query() will always return a resource link. which evaluates to true. so this will work for you: if (mysql_num_rows($result)) echo record found; else echo record not found; --lance Monty wrote: Even though I have no record in my MySQL DB with that has 005 in the ID field, the following statement always reverts to Record Found, or True, no matter what ID I use. What's wrong? I'm using PHP 4.2.2. Has something changed that makes this work differently? Thanks. $query = SELECT id FROM member WHERE id = 005; $connect = mysql_pconnect(localhost, dbname, password); $result = mysql_query( $query, $connect ); // Query DB. if ( !empty($result) ) { echo RECORD FOUND; } else { echo RECORD NOT FOUND; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: checkbox question
if you can't use [] for the checkbox, the only way out is to have unique name for each checkbox. otherwise, php will always be returning the value of the last checked checkbox if all checkboxes share the same name without the []. --lance Alex Shi wrote: How to ontain data from a group of checkbox using same name? For example, in a form there're 6 checkboxes and all named as Interesting_Area. I know if put a pairs of square brackets at the end of the name then in php all the values of them can be ontained. However, for some reason I cannot use square brackets. Please help me out if anyone know how to do the trick. THanks! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}
probably this will be faster? $fn = str_replace(.gif, 1.gif, $fn); Lallous wrote: ? $fn = 'test.gif'; echo preg_replace('/(.+?)(\..+?)/', '\1a\2', $fn); ? This script will output 'testa.gif' now how can i make it produce 'test1.gif' ? if i replace the: '\1a\2' with '\11\2' it will understand to replace with occurence number 11 ! How can i escape the 2nd '1' so it is considered as a string an not another number. Elias -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: tricky preg_replace and how to escape the \{occurencenumber}
hm... this should work, notice the double quotes echo preg_replace('/(.+?)(\..+?)/e', '\1.1.\2', $fn); Lallous wrote: Oh well, I could have solved it w/ too many other methods, but how can I escape the \{occurence} as in my case? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with array and session
try this instead: session_start(); . . . if (mysql_num_rows($_query)) { $_rec = mysql_fetch_array($_query); if (!isset($_SESSION[bkmks]) || !in_array($_rec, $_SESSION[bkmks]) { $_SESSION[bkmks][] = $_rec; } else { echo Already exist.; } } to test: echo pre; print_r($_SESSION[bkmks]); echo /pre; p.s. assuming you are using php 4.1 or above Ricky wrote: Hello everybody I'd like to make a page in which the results shown can be bookmarked by clicking a button aside each of them. Actually first it should check if the session is open already ... Then if that item(that comes from a query to a MySQL table) has been registered already, finally it registers all the variables in a multidimensional array. this is the code: session_start(); if(!session_is_registered(bkmks)) {session_register(bkmks)||die(WE GOT PROBLEMS MAN); $bkmks = array(array(tab=$tab, id=$id, url=$url, nome=$nome, ind=$ind, com=$com, pv=$pv, tel=$tel, chi=$chi)); print htmlbody Your choice has been stored/body/html; } else { foreach($bkmks as $v) { if(($v[tab]==$tab)($v[id]==$id)){ print htmlbody You have already chosen this item/body/html;exit; } } $bkmks[][tab]=$tab; $bkmks[][id]=$id; $bkmks[][url]=$url; $bkmks[][nome]=$nome; $bkmks[][ind]=$ind; $bkmks[][com]=$com; $bkmks[][pv]=$pv; $bkmks[][tel]=$tel; $bkmks[][chi]=$chi; print htmlbodyYour choice has been stored/body/html; } It doesn't work! I can't figure out why. It starts storing fine and then it seems messing up with values so it recognises as already stored only the variables of my first choice (the value stored at bkmks[0])... I tried to print values stored in the array: the output is a mess I don't know why! Thanks a lot ! Bye. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: need help
to do a comparison between two values / variables, you have to use == instead of = = is an assignment while == is a comparison operator if($row['gid'] == 0) { $rat = 110; } elseif($row['gid'] == 1) { $rat = 9.5; } else { $rat = 6.6; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing an array in a link
you could try this: transmitting end: ?php foreach ($keylist as $key = $value) { $searchArg .= keylist[]=.htmlentities($value).; } ? a href=myphp.php??php echo $searchArg?array from search argument/a receiving end: foreach($_GET[keylist] as $key = $value) { echo {$value}br; } David T-G wrote: Hi, all -- I collect field keys in an array that looks like $keylist = array('comment','job','spaced out key name','foo',...) ; and would like to pass the array to myself in a call like print a href=\/myscript.php?keylist=$keylist\link/a ; but when it's actually run it of course says ...keylist=Array... which is quite bad. I'd use a simple scalar $keylist = comment job spaced out key name foo ... ; but, of course, those darned fields which have spaces embedded in the names will really mess that up. How can I pass myself an array -- and recognize it on the receiving end? TIA HAND :-D -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing an array in a link
from my experience, you don't really have to worry much on the space issue. is the delimiter to determine that the string terminates and a new argument begins next. and very often, the browser will do an auto conversion from space to %20 when you click on the link. David T-G wrote: snip so that takes care of walking the array but now I need to protect myself from the spaces. I've looked at htmlentities() but it doesn't seem to convert spaces... /snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Good Damn
you might wanna use this instead: $result = mysql; if (mysql_num_rows($result) { while } else { echo 'no articles'; } $result will always hold an int value if the query does not contain any error. so doing a num_rows on it will be more accurate in telling you if records are been retrieved. Sascha Braun wrote: $Query = SELECT * FROM basket_db WHERE session_id = '$PHPSESSID'; $Result = mysql_query($Query, $connect); if ($Result) { while ($arrResult = mysql_fetch_array($Result, MYSQL_ASSOC)) { echo 'tr bgcolor=#fffdd7 class=text01'; echo 'td'.$arrResult['image_id'].'/td'; echo 'td'.$arrResult['name'].'/td'; echo 'tda class=text01 href='.$PHP_SELF.'?action=deleteid='.$arrResult['id'].'delete/a/td'; echo 'td Hier Preis'.$arrResult[''].'/td'; echo 'td hier gesamt'.$arrResult[''].'/td'; echo '/tr'; } } else { echo 'tr bgcolor=#fffdd7 class=text01'; echo 'td colspan=5There are no Artikles in Cart./td'; echo '/tr'; } This script is not doing what I want it too! Ich want to see : There are no Artikles in Cart when there are no Artikels in Cart But it good damn doesn't work! Please tell me why -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Cookie array
to store: setcookie (TestCookie[0], zero, time() + 3600); setcookie (TestCookie[1], one, time() + 3600); setcookie (TestCookie[2], two, time() + 3600); or setcookie (TestCookie[one], 1, time() + 3600); setcookie (TestCookie[two], 2, time() + 3600); setcookie (TestCookie[three], 3, time() + 3600); to retrieve: foreach($_COOKIE[TestCookie] as $key = $value) { echo {$value}br; } or echo $_COOKIE[TestCookie][one]; echo $_COOKIE[TestCookie][1]; Jan - Cwizo wrote: Hi ! How can I stoor array in to a cookie ? Do I just define an array and stoore it in a cookie ? How do I access the data in the array then ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Random mirrors and download quota
how about using the counter to store an id of the mirrors instead of randomly picking one? this will provide you a sequential traverse through all mirror sites. if there are 10 sites, the counter will always be from 0 - 9. this way each mirror site will have equal share on hits. so if the counter == 2, your script will know that the next hit will be to mirror site 2. $_nextSite = (isset($_nextSite))?++$_nextSite % 10:0; the above code will always ensure the counter counts from: 0 - 9 - 0 - ... this way, you can store all counters (into database?) on the main site for all mirrors. Andrew Conner [EMAIL PROTECTED] escreveu na mensagem [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I have a script (at bottom) that, upon loading, will randomly select a mirror or primary server (on average, the primary servers will be selected twice as much). It all works good, but now, I have to add a quota manager that will, for both mirrors, limit the times the file can be downloaded to 1200 times (there is only one file being downloaded). I have thought about storing a text file for each of the two mirrors that shows the current count of downloads, and it will be checked if the mirror is randomly selected and if it is above 1200, will randomly select another server, and if it isn't, will just add one to it and update the file. How would I go about this, or is there a better way to do this? Thanks in advance. Andrew Conner The script (I know it doesn't use the best design, but it works, any better ways of doing this?): ? // This array holds the servers, and has a double entry for the primary servers $adArr = array(http://www.someprimaryserver.com/file.exe;, http://www.someprimaryserver.com/file.exe;, http://www.someprimaryserver2.com/file.exe;, http://www.someprimaryserver2.com/file.exe;, http://www.someprimaryserver3.com/file.exe;, http://www.someprimaryserver3.com/file.exe;, http://www.someprimaryserver4.com/file.exe;, http://www.someprimaryserver4.com/file.exe;, http://www.somemirror.com/file.exe;, http://www.somemirror2.com/file.exe;); // This randomly gets a server... srand((double)microtime()*100); $wOne = rand(0, 9); $choice = $adArr[$wOne]; // This fwds the user to the server picked. // Somewhere in here needs to be the mirror stuff... header(Location: $choice); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: FW: [PHP] session problem
you might wanna check if register global is turned on or off. Naintara Jain wrote: One thing I forgot to mention is that the same code works perfectly on the web server (running on Apache and a Unix flavor). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] t]On Behalf Of Naintara Jain Sent: Saturday, July 06, 2002 6:09 PM To: Php-General@Lists. Php. Net Subject: [PHP] session problem I am storing some values in session variables. The behavior of the session is pretty unpredictable. On the first page I begin with: session_name(aname) session_start() session_register(var1,var2) In another page I check for existing value of session variable var2. In the next page I have the following code: session_name(aname) session_start() if(($var2)== || !isset($var2)) invalid But the strange thing is that the session value is not accessible in the other page. I have tried passing the session id though session_id() in the URL. Session handling has been giving me some trouble (windows 2000, IIS) The strange thing is that it works some times. Can anyone give any pointers? -- 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] HTTPS vs. HTTP ? - the weakest link
sorry to barge in. but the weakest link ain't in ssl. doesn't really matter how secure vs insecure it is. you can come up with the most secure technology in the whole world that no one can break into. the weakest link lies on the user/customer themselves. you just need a trojan horse in their computer and there goes the neighbourhood. they can by all means send their credit card information over to amazon.com. but this piece of information will still be open to the person who plant the horse in the machine. so i suppose the debate over here should really be: is ecommerce safe? and not: http vs https just my 2 cents b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
not from meta refresh. but javascript could do that. set a timeout that will fire the submit event after 2 seconds. that will work. b.c. lance Alberto Serra wrote: ðÒÉ×ÅÔ! Probably a stupid question. Is there anyway to force POSTing a form from the refresh META? META HTTP-EQUIV=Refresh CONTENT=2;URL=someURL/somescript.php IMHO that is NOT possible, but maybe I am wrong. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
you might wanna fire that javascript using onload from the body tag. that kinda assure the page is loaded successfully before the event takes off. Alberto Serra wrote: I already have that and it works fine. The problem is when jscript is not working (or missing). I was trying to build up some panic tree in case jscript fails. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks
hm... how about sticking couple of iframes that will load the piece of javascript and have each of the javascript in the iframe firing at different time? i suppose at least 1 copy of javascript will be there to do the intended work. Alberto Serra wrote: It is there already. My problem is to do it something that will save my *ss in case jscript is *NOT* there. So it must be a no thrills HTML solution that will run anyway, no matter how poor in resources the browser is. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Thanks - Actually POSTING without javascript
yes. now its clearer. hm... but i can't think of submitted the information if javascript is off on the client browser. unless you stick in a button telling the user to hit it if the page do not bring him to another after a specific timing. a button probably don't look presentable. use an image as the input type. that will probably brighten up the page. in short, what i mean is let the user do the submit if javascript fails. an image of brintney spear and a text on it telling the user to click on sounds appealing to you? ;) b.c. lance Alberto Serra wrote: ðÒÉ×ÅÔ! *The problem was here*. What if this second step fails? easy, I just leave the META as is and stock previous data on a session during the first execution of index.php At this point index.php knows all it needs to fill in cionfiguration data and it just includes the real home page. From now on we will be able to tailor channelling (that is, cookies or not, jscript or not) without reasonable doubts. Yes, the user *may* change it's configuration during the session, but this is very low percentage of cases and we can live with it. Well, that's the most general part of it. But at least it's clearer. ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Mailing all the elements of a form
you could loop through $_POST (assuming you are using a post action) to extract the value out. e.g. $arr = array_keys($_POST); for ($i = 0; $i count($arr); $i++) { $msg.= {$arr[$i]}: {$_POST[$arr[$i]]}\r\n; } echo $msg; b.c. lance Jeremy Bowen wrote: Hey, I have looked in PHP manual but I cannot seem to find what I am looking for. I have a very large form that I need to be able to mail. I just don't want to have to code all of the field into my mail() function. Thanks, Jeremy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] does a form submit from a http page to a https ensure secure data?
hi, the above question has been puzzling me for a while. the situation is this. http://domainname.com/register.php display a user registration form having [form action=https://domainname.com/register.php; method=post] will the data from that page be encrypted when it is sent via https specified in the [form] action? note: the registration form is served from http. could someone enlighten me on this? regards, b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] does a form submit from a http page to a https ensure securedata?
thanks for the insights. :) basically the 2 files are from 2 different domains saving to the same database server. the 2 sites share the same userbase. and when the registration form is submitted to the 2nd site, upon successful registration, it will redirect back to the 1st site and display a success page. otherwise it will redirect back to the 1st site and prompting them an error. you probably wonder why the complexity of the above scenario. basically the 2nd site has a ssl cert while the 1st site doesn't. so as a cost saving measure, the 1st site will be using the 2nd site's ssl cert to complete the user registration process. hope the above make sense to you. lance Michael Sweeney wrote: Your form action parameter has an absolute url specifying an https protocol. When the browser submits the form, it uses the url you specify which is https. So the request is going to be encrypted. You might consider serving the form page from https as well to kind of tighten things up a little, but the data will be posted under https which is an encrypted connection. Your main problem is going to be the fact that the http and https services are accessing two different file system spaces (or they should be unless you've got your server badly misconfigured) so the http://...register.php is going to be a different file from the https://...register.php. You might want to reconsider your design. ..mike.. On Tue, 2002-07-02 at 04:21, B.C. Lance wrote: hi, the above question has been puzzling me for a while. the situation is this. http://domainname.com/register.php display a user registration form having [form action=https://domainname.com/register.php; method=post] will the data from that page be encrypted when it is sent via https specified in the [form] action? note: the registration form is served from http. could someone enlighten me on this? regards, b.c. lance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php