[PHP] Redirection with header (was Re: [PHP] Cookies and sent headers)

2007-08-18 Thread Otto Wyss
M. Sokolewicz wrote: emits). Now, I'm not going to go into how redirecting that way won't work (or at least shouldn't), but a hint would be to do it properly using header('Location: [...]') instead. I'm aware that using Javascript within a PHP code block doesn't seems logical yet I haven't know

Re: [PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss
M. Sokolewicz wrote: On a sidenote, 99% of the world never calls ob_flush (or any such function) since PHP flushes the buffer automatically at the end of its execution. I'll keep the ob_end_flush just for showing what's going on, but thanks for the hint. The reason why setting cookies for y

Re: [PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss
n that case, put the call to ob_start(); on the first line of the file you're calling. You will still have to make sure to not have any whitespace before your wrote: Kelvin Park wrote: Otto Wyss wrote: If built a simple login page and store any information within $_SESSION's. Yet I'd

[PHP] Cookies and sent headers

2007-08-18 Thread Otto Wyss
If built a simple login page and store any information within $_SESSION's. Yet I'd like to move these into cookies but I always get an error about sent headers. Is there a way to circumvent this problem without changing too much in the page? The setting of the cookies happens just at the end o

[PHP] Using PHP files from Ajax and from other PHP files

2007-04-17 Thread Otto Wyss
I want move all database access into separate PHP files so I could use these files either through an Ajax call from the client or in another PHP files (require_once) on the server. Is this possible? What interface would be needed? Has anybody else tried something similar? Since I plan use Jso

Re: [PHP] Json.php

2007-04-16 Thread Otto Wyss
Jochem Maas wrote: that's going to make it completely impossible to use then isn't it. no way you could possibly wrap the class/objects functionality in a wrapper function. At the moment it's sufficient, since I've now time to figure out how the Json package can be installed. Then I can switch

Re: [PHP] Appending into associative arrays

2007-04-16 Thread Otto Wyss
Zoltán Németh wrote: what do you mean by doesn't work? what error is thrown if any? what result do you get instead of the expected? at first glance I cannot see anything wrong with your function... It simply doesn't add any sub folder to $dirs. Could it be that the function doesn't return the $

Re: [PHP] Appending into associative arrays

2007-04-16 Thread Otto Wyss
Alister Bulman wrote: $dirs[$d] = filemtime($d); Has he even retrieved the directories in sorted order by modification time? If not he still needs to sort. Then he'll need an asort($dirs); They would not have come in any particular order, so you have to sort them for whatever you need anywa

Re: [PHP] Json.php

2007-04-15 Thread Otto Wyss
Satyam wrote: www.json.org lists all json resources in any language you care to think of. I must admit I haven't checked each reference but the ones I have have only packages to install and not a PHP source. Maybe I wasn't clear when asking. O. Wyss -- PHP General Mailing List (http://www.p

Re: [PHP] Json.php

2007-04-15 Thread Otto Wyss
Tijnema ! wrote: *ROFLMFAO*...Did you actually try google for json.php? Second result: http://mike.teczno.com/JSON/JSON.phps This doesn't have a json_encode but needs a $json object which then could be used as $json->encode(...). Thanks anyway. O. Wyss -- PHP General Mailing List (http://ww

[PHP] Appending into associative arrays

2007-04-15 Thread Otto Wyss
I want to sort directories according there modification time and thought accociative arrays would be perfect. But when I add an element like $dirs = array (filemtime($d) => $d) the previous ones are lost. I tried array_push but that doesn't seems to work, at least I always get syntax errors. N

[PHP] Json.php

2007-04-14 Thread Otto Wyss
I've seen a json.php file somewhere in a project for cases where the json module isn't installed (e.g. PHP4), yet I can't find that project again. Is there an official or unofficial download site for json.php? Why isn't this available in the PHP manual (http://ch2.php.net/manual/de/ref.json.ph

Re: [PHP] Posting a variable

2007-04-12 Thread Otto Wyss
Richard Lynch wrote: On Wed, April 11, 2007 12:53 pm, [EMAIL PROTECTED] wrote: Quoting Robert Cummings <[EMAIL PROTECTED]>: mysql_fetch_row()? It's a religious question. I find mysql_fetch_assoc to be less clear because you end up not necessarily using the data until much later, and by the

Re: [PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Otto Wyss
Jochem Maas wrote: // if you have this available: http://php.net/manual/en/function.json-encode.php echo json_encode($files); I thought there might be a solution with Json but couldn't locate it. I prefer it versus the iteration, thanks. Sometimes solutions are so simple if one knows them. O

[PHP] Copying PHP array into a Javascript array

2007-04-10 Thread Otto Wyss
I don't know if I should ask this question here or in the JavaScript group. I'll try it here since people usually are more helpful. I've an array of file names $files = getFiles ($d); but would like to use this array in a JavaScript array. How can I copy this $files into a JavaScript variab

[PHP] PHP sample code for XMLHttprequest with jQuery

2007-03-30 Thread Otto Wyss
I'm currently evaluating jQuery as a Javascript library for my web site but first would like to see a working sample with PHP doing XMLHttprequest. Is anyone else using jQuery and has some sample code to look at? O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] Computing and calculating dates

2007-03-25 Thread Otto Wyss
Strtotime is usefull, you can just put first day next month and it just works... Lol... Then you could explode that back into mktime, or just into a string. There are many ways to do what your asking :) Jake -Original Message- From: Otto Wyss [mailto:[EMAIL PROTECTED] Sent: Satu

Re: [PHP] Computing and calculating dates

2007-03-24 Thread Otto Wyss
Travis Doherty wrote: Otto Wyss wrote: local_formated_date + 7; // days local_formated_date > local_formated_first_day_next_month; local_formated_date > (current_date + 14) etc. Which functions are best suited for such calculations? O. Wyss www.php.net/strtotime is probably

[PHP] Computing and calculating dates

2007-03-24 Thread Otto Wyss
This probably has been asked several times yet I can't find a satisfying solution. What's the simplest way to compute dates like local_formated_date + 7; // days local_formated_date > local_formated_first_day_next_month; local_formated_date > (current_date + 14) etc. Which functions are b

[PHP] Posting variable outside of the post form

2007-03-12 Thread Otto Wyss
I submit a form back to itself with action="" methode="get" yet I've a large PHP variable which I'd like to access afterwards as well. Is this possible somehow? O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Array mysteries

2007-03-11 Thread Otto Wyss
Steve Edberg wrote: At 9:51 AM +0100 3/11/07, Otto Wyss wrote: function convert_from_weekday ($weekday) { return $wdays[$weekday]; } If the above is your exact code, then the problem is one of scope; move the $wdays declaration inside your convert_from_weekday() function. I&#

[PHP] Array mysteries

2007-03-11 Thread Otto Wyss
I want to convert weekdays with a simple function like $wdays = array (0 => "Sonntag" ,1 => "Montag" ,2 => "Dienstag" ,3 => "Mittwoch" ,4 => "Donnerstag" ,5 => "Freitag" ,6 => "Samstag" ); function convert_from_weekday ($weekday) { return $wdays[$weekday];

Re: [PHP] Creating variable names from values

2007-03-08 Thread Otto Wyss
Satyam wrote: $key = 'K' . $key; if ($$key) { notice double dollar sign, it means, not the value of $key but the value of the variable $key says. Thanks, any idea where this is described in the PHP manual? Searching for "$$" produces no results. O. Wyss -- PHP General Mailing List

[PHP] What sripts,helpers to use for AJAX

2007-03-08 Thread Otto Wyss
I want to add some AJAX communication to my pages and would like to know, what scripts, helpers you would recommend. I don't want to use a full featured framework, just something to do the AJAX work. So far I've come across the following solutions http://prajax.sourceforge.net/ http://sanjer.b

[PHP] Creating variable names from values

2007-03-08 Thread Otto Wyss
From an arry I create a table like foreach ($persons as $key => $pers) { echo " ... } so each checkbox field has its own name created from $key. Yet how can I access these fields (names) later on? foreach ($persons as $key => $pers) { if ($K???) { $cnt += 1; ...

Re: [PHP] GET doesn't work as POST

2007-02-24 Thread Otto Wyss
Pintér Tibor wrote: echo ""; print_r($_REQUEST); echo "; and think... After reload Array ( [page] => bvallist.php [kind] => regions ... ) After change in form with method="get" Array ( [state] => validated ... ) After change in form with method="post" Array ( [page] => bval

Re: [PHP] GET doesn't work as POST

2007-02-24 Thread Otto Wyss
Dotan Cohen wrote: Try $_GET["kind"] Tried, doesn't help. O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] GET doesn't work as POST

2007-02-24 Thread Otto Wyss
With $_GET and $_POST? Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -Original Message- From: Otto Wyss [mailto:[EMAIL PROTECTED] Sent: Saturday, February 24, 2007 12:51 PM To: php-general@lists.php.n

[PHP] GET doesn't work as POST

2007-02-24 Thread Otto Wyss
On the page http://www.orpatec.ch/turniere/5erfussball/index.php?page=bvallist.php&kind=regions I have a form with method="post" and action="?>". While it works fine this way, as soon as I change the form to method="get" it looses the parameter "kind" when I change e.g. the second parameter

[PHP] Understanding session variables with input field and register_global

2007-02-20 Thread Otto Wyss
I've an input field in a form and with register_global I can use this field in PHP as variable $username. Yet if I use a session variable $_SESSION['username'] = 'value' the variable $username gets the same value. On the other side when I enter a value in the input field, the session variabl

Re: [PHP] Multi lingual pages

2007-02-19 Thread Otto Wyss
Jochem Maas wrote: don't go down the define('LANG_KEY', 'lang string value'); route - defines are comparatively SLOW to create. IF you go down the road of loading in text from 'per lang' files I would suggest using an array as the storage mechanism: $Lang = array( 'LANG_KEY' => 'lang st

Re: [PHP] Multi lingual pages

2007-02-19 Thread Otto Wyss
Paul Novitski wrote: Unless your site is insanely popular or huge, does the method really Sure I hope to once have an insanely popular or huge site, albeit that probably won't happen. O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.

[PHP] Accessing cookies in PHP and Javascript

2007-02-15 Thread Otto Wyss
Assuming I have a cookie setcookie ("username",$_SESSION['Username'], $expires); how can I access the same cookie in Javascript? Or how do I have to create a cookies so it's accessable as $_COOKIE["username"] O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: h

Re: [PHP] Multi lingual pages

2007-01-26 Thread Otto Wyss
Paul Novitski wrote: I formulated my question in general since I couldn't find an other message here about supporting multiple languages. http://www.w3.org/International/articles/ http://www.w3.org/TR/i18n-html-tech-lang/ http://php.net/setlocale Thanks a lot, these are good points for re

[PHP] Multi lingual pages

2007-01-24 Thread Otto Wyss
I'd like to make my pages multi lingual, showing everything in the language the user chooses. My pages show mostly static text. So what's the usual implementation for this case. O. Wyss -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Going back with multiple submits to the same page

2007-01-18 Thread Otto Wyss
Paul Novitski wrote: At 1/15/2007 01:52 PM, Otto Wyss wrote: When values are entered on one of my page I submit the result back to the same page (form action=same_page). Unfortunately each submit adds an entry into the history, so history back doesn't work in a single step. Yet if the cou

[PHP] Going back with multiple submits to the same page

2007-01-15 Thread Otto Wyss
When values are entered on one of my page I submit the result back to the same page (form action=same_page). Unfortunately each submit adds an entry into the history, so history back doesn't work in a single step. Yet if the count of submits were known I could use goto(n). What's the best way t

Re: [PHP] Security with dbHost, dbUser, dbPassword

2007-01-11 Thread Otto Wyss
Jochem Maas wrote: > > this file outside of the webroot ... > > I thought so too but wasn't sure if possible. >> >> if (!defined ("config_include")) die ("Error..."); > > It helps me a little if I make mistakes. > > granted define() is slower than creating a var - which is why some > > people

[PHP] Security with dbHost, dbUser, dbPassword

2007-01-10 Thread Otto Wyss
What is the usual save way to store/use DB access info in a script. I currently just use some PHP variables in a file which I include in all other scripts. config.php Is this save enough or are there better ways? Where should I store this file so it isn't accessible via the net but inside sc