[PHP] a link in php generated mail
Hallo, I have an link in a php generated email that does not work. I tried adding http:// but with no result. It says the link is blocked. I created the mail with html formatting. I use pear email. Is there anything I have to consider to make this work? Thanks, Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] recursive function problem
Hello! I wrote a recursive function, but when running the function appache stalls, the error log says: module mod_php4.c is already running, skipping Is this a bug, or am I doing something wrong? Thanxs, Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] recursive function problem
Hello! I wrote a recursive function, but when running the function appache stalls, the error log says: module mod_php4.c is already running, skipping Is this a bug, or am I doing something wrong? Thanxs, Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] recursive function problem
Hello! I wrote a recursive function, but when running the function appache stalls, the error log says: module mod_php4.c is already running, skipping Is this a bug, or am I doing something wrong? Thanxs, Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] recursive function problem
No, I'm sure I didn't. My news server is incredibly slow, and I am (incredibly?) impatient, so I pushed the send button more than once ... Sorry about that! Sjef -Oorspronkelijk bericht- Van: Paul Scott [mailto:[EMAIL PROTECTED] Verzonden: donderdag 7 december 2006 14:50 Aan: Sjef CC: php-general@lists.php.net Onderwerp: Re: [PHP] recursive function problem On Thu, 2006-12-07 at 13:41 +0100, Sjef wrote: Hello! I wrote a recursive function, but when running the function appache stalls, the error log says: Did you write a recursive function to send this mail to this list perhaps? --Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning to the same page after log in
Hello all! This is a bit difficult to explain. On a site I am building I sometimes use the GET method to forward values to the next page. There are certain pages that you need to be logged in to to be able to see data. So you arrive at the page, you realize that you are not logged in, so you type your username/password and hit 'log in'. Then the page gets severely messed up as the GET data are not forwarded (at least, I think that's the problem). Any ideas how to solve this? I tried to send a header(location: ...) with the document_root and request_uri as the location, but that doesn't do the trick. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] returning to the same page after log in
I think I solved the problem. I've set the action of the login form to $_SERVER['REQUEST_URI'] instead of $_SERVER['PHP_SELF']. It works fine. May not be the proper way but hey ... Sjef Andrei [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] When u know the user is not logged in and you have to redirect him to login page, get all variables that are in $_GET and in $_POST (if u have data that u send in post also) and form a string with them as a return context string like: The code that you have to put in the page where you redirect the user to login page and where user will land back after login. $return_context = $PHP_SELF.?; foreach( $_GET as $key = $val ) $return_context .= .$key.=.$val; foreach( $_POST as $key = $val ) $return_context .= .$key.=.$val; header( Location: login.php?back_page=.urlencode( utf8_encode( $return_context ) ) ); In login page, after you created the session or whatever you do at login pagrt you do: if( empty( $back_page ) ) $back_page = $_GET[back_page]; if( !empty( $back_page ) ) header( Location: .utf8_decode( urldecode( $back_page ) ) ); else header( Location: somewhere_else.php ); exit; The code is not checked. It's only to have an ideea... Andy Sjef wrote: Hello all! This is a bit difficult to explain. On a site I am building I sometimes use the GET method to forward values to the next page. There are certain pages that you need to be logged in to to be able to see data. So you arrive at the page, you realize that you are not logged in, so you type your username/password and hit 'log in'. Then the page gets severely messed up as the GET data are not forwarded (at least, I think that's the problem). Any ideas how to solve this? I tried to send a header(location: ...) with the document_root and request_uri as the location, but that doesn't do the trick. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is this really a pdf?
Thanxs very much guys! I do realize that it is not foolproof, but better than nothing. In my situation mime_content_type doesn't work, so I will have to settle for the other method. Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] design?
Thanks, John. It's probably also a matter of how you name the classes. It needs to be a clear name that describes what it 'is'. Hence, the depot name. Anyway, indeed I have finished the concept of the app. Sjef John Wells [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] On 6/30/06, Sjef [EMAIL PROTECTED] wrote: Thanks, John, I'm not sure I completely get the idea of a pair class. As an question and answer are in the same database tabel I now created a questionDepot class that gets the array from the db, does save and update operations, and for example, sets a flag in the db tabel when a question is accepted for the list. Hi Sjef, It sounds as if you've got the idea, even if I didn't explain myself well. My point was to *not* create a Question class that maintained an array of questions, which was only _implicitly_ related to a similarly-structured but disparate Answers class. An array of questions sitting beside an array of answers is, in my opinion, not a proper abstraction of the objects you're dealing with. Perhaps it is out of experience that I'm harping on this point, because I've been burned by a similar design before. One of my first OO projects was a weblog, and I had built a Post class, and then for posts with galleries, a separate Gallery class that contained *only* image information for it's parent Post. On it's own, this wasn't all bad, but the big mistake I made was how I handled multiple posts and multiple galleries (like for building out the homepage where I showed 5 recent posts and a thumbnail from each, if they were galleries). Within each Post and Gallery class, I turned the properties into _arrays_. So what originally was a string for the post's title, now became an array of strings for many posts. Likewise for the Gallery class. Arrays of thumbnails became arrays of arrays of thumbnails. I'm sure The List will shudder at this design, but hey, I've learned my lesson. Be-lieve-me. Anyway, the point is, your initial approach was the same (if I read it correctly). You suggested an array of questions, and an array of answers, which would only be implicitly related. Your design started with the concept of many questions, and many answers, but my argument is that, abstractly, you should begin with one question, and one answer. Then think in terms of a question-answer pair that *belong to each other*. And then think of many question-answer pairs. Anyway, I'm sure that by the time you've finished reading this hair-splitting rambling, you've already finished your app and moved on to something else entirely. :) -John W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is this really a pdf?
Is it possible to recognize if a file for upload really is a pdf (like the function getimagesize retuns the file type of the image)? Thanxs, Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] design?
Thanks, John, I'm not sure I completely get the idea of a pair class. As an question and answer are in the same database tabel I now created a questionDepot class that gets the array from the db, does save and update operations, and for example, sets a flag in the db tabel when a question is accepted for the list. My question was asked with the experience that a complete procedural approach often turns out to become messy, you have to use certain visual objects more often in teh app, therefore why not create a visual class to use more than once. So, it was just an urge to write cleaner code By the way: as always, I already exceded the 3 or 4 pages David mentioned, if only for the idea to add a 'placed' tag in the db. Sjef John Wells [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] On 6/29/06, Sjef [EMAIL PROTECTED] wrote: Hi there, Hi Sjef, First off, I think David has a good point with regards to the OO vs Procedural approach. If you're looking to do this quick and easy, it might not be worth your time fussing with OO. Unless you'd like to just for the exercise, which I wholly support, so go for it! I want to create a class Question for dealing wiht the questions and a class answer for the answers. Each could contain an array with the their part of the content of the database table. As far as how to design it OO-style, I'd first urge you *not* to have separate classes managing lists of questions and answers. Say for example you query your db for questions, build up your array inside your questions class, and then while doing the same for your answers class, you inadvertently introduce a looping bug that drops one of the answers from the array, or possibly changes the order that you create your array, or any other number of possible mistakes (human or otherwise). Point is, in the end you'd have two out-of-synch classes that really should've been built separately to begin with. A single question and it's answer(s) are tied together, so keep it that way in your class abstraction. That said, I'd suggest building a question-answer *pair* as a class, and then you'd have an array of these question-answer pairs representing your entire list (which could be encapsulated into a container class if you wished). You could, to be even more abstract, create base question and answer classes to represent the most basic type of question or answer, and then hold individual, **related** instances of these within your question-answer pair class. Do you see the difference? You could even take it a step further and build derivatives of your base answer class to represent different types (string, multiple choice with one answer, multiple choice with many answers, etc)...But I'm sure I'm already getting far ahead of your original design. But David started it! :) HTH, John W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] design?
Hi there, I am starting a new, very small project. A simple question and answering form. In one screen, question and answer can be typed, the strings will be saved in a database table questions which holds question and answer (as there is only one answer to a question). There will be a webpage displaying all the questions, clickable to the webpage of the answer to the question clicked. I want to create a class Question for dealing wiht the questions and a class answer for the answers. Each could contain an array with the their part of the content of the database table. The class Question manages the class Answer, so when instantiating the Question, the Answer will follow. Beside of this I want to create a 'visual' component class that creates the lists as displayed on the webpage. Is this a good idea? Or should I not bother, and just create one class Question that also deals with the Answers. Thanxs! Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] get key of array (key function sucks?)
Hallo, I am adding a value to a session variable (an array). Then I want to place the key of the array in another session variable to keep it for later use (so I can return to the array to write data to it). The key function should work there, but it seems to be a bit strange. Imagine: $array = array(); $array[] = Yellow; $array[] = Geen; $array[] = Red; foreach ($array as $key=$value) { print (Key: . $key . has color . $value . | ); print (current key = . key($array) . br/); } If you run the loop the key value returned from key is one higher than the key in $key, and the last key is null? How do I get the present key without a problem?? Thanks!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array of checkbox values
Interesting way to solve the problem. I thought about checking whether the keys are present (if not the checkbox is set to N.) I wil definitily try this option as well. Thxs all! Sjef Al [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Sjef Janssen wrote: Hallo, I have a form with a number of checkboxes grouped together. The value of these boxes is stored in an array: $used[]. Now I found that the value of checked boxes (value = 'Y') are stored in the array while non checked boxes are not stored at all. This makes the array incomplete as I want to have all checkbox values in the array. For example: for 4 checkboxes the values are checkbox 1: array index = 0 value = Y checkbox 2: array index = 1 value = Y checkbox 3: value = N : it does not occur in the array checkbox 4: array index = 2 value = Y Is there a way to, as it were, complete the array and have all values stored, even the N values? So that array index 2 has a value of N, and array index 3 is Y. Thxs Sjef Seems like I recall solving this problem. It's been a long time, so you'll need to try it. For each checkbox set these two input type=hidden name=foo value=noinput type=checkbox name=foo value=yes You'll get $_POST[foo] as no or yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array of checkbox values
Hallo, I have a form with a number of checkboxes grouped together. The value of these boxes is stored in an array: $used[]. Now I found that the value of checked boxes (value = 'Y') are stored in the array while non checked boxes are not stored at all. This makes the array incomplete as I want to have all checkbox values in the array. For example: for 4 checkboxes the values are checkbox 1: array index = 0 value = Y checkbox 2: array index = 1 value = Y checkbox 3: value = N : it does not occur in the array checkbox 4: array index = 2 value = Y Is there a way to, as it were, complete the array and have all values stored, even the N values? So that array index 2 has a value of N, and array index 3 is Y. Thxs Sjef -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: array of checkbox values
Would it be enough to set a key for each checkbox, for example explicitly say: checkbox[1] checkbox[2] checkbox[3] then a non checked box will have an empty string as a value, whereas the checked ones will have a value of 'Y'. Sjef David Dorward [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Sjef Janssen wrote: I have a form with a number of checkboxes grouped together. The value of these boxes is stored in an array: $used[]. Now I found that the value of checked boxes (value = 'Y') are stored in the array while non checked boxes are not stored at all. This makes the array incomplete as I want to have all checkbox values in the array. That's how HTML forms work. The general solution is to set the value of the checkbox to describe what the checkbox is (for example, the row id of the database record that the checkbox is associated with). Then you can loop through and see which values were submitted. -- David Dorward http://blog.dorward.me.uk/ http://dorward.me.uk/ Home is where the ~/.bashrc is -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] complex arrays
Hallo there, I try to put a number of variables in an array as follows: input boxes gather info. This info is language dependent, so the info is put into an array vke with indexes NL and EN. The POST variable gives this array back. Then I want to add a variable to this array, 'gebruikt' (=used) with possible values J or N. The script looks something like so: ?php session_start(); if ($_POST['vkePlus']) { $waarden[] = array('gebruikt'='J',$_POST['vke']); foreach ($waarden as $i=$w) { if (is_array($w)) { foreach($w as $iw=$ww) { if (is_array($iw)) { //What happening here??? } else { echo stripslashes($iw) . : . stripslashes($ww) . br/; } } } else { echo stripslashes($i) . : . stripslashes($w) . br/; } } } print (h1Test/h1\n); print (form method=\post\ action=\ . $_SERVER['PHP_SELF'] . \\n); print (input type=\text\ size=\10\ name=\vke[NL]\ value=\ . $vke[NL] . \\n); print (input type=\text\ size=\10\ name=\vke[EN]\ value=\ . $vke[EN] . \\n); print (input type=\submit\ name=\vkePlus\ value=\GoGo\\n); print (/form\n); ? I have problems reading the contents of the arrays. Especially reading the second array seems impossible. After all this I want to add the contents of the array to a Session variable to keep it in furthwer steps (of a wizard). I hope any of you can 'make chocolat' of this ;-)) Thanks!! Sjef p.s. I use php 4. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: complex arrays
Oeps, it's already complex to explain this. The array that needs to be created and read is looking like this $vArray = array('uses'='J', $_POST['vke']); Maybe that will clear up thing a (tiny) bit). Thanks again, Sjef Sjef Janssen [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] Hallo there, I try to put a number of variables in an array as follows: input boxes gather info. This info is language dependent, so the info is put into an array vke with indexes NL and EN. The POST variable gives this array back. Then I want to add a variable to this array, 'gebruikt' (=used) with possible values J or N. The script looks something like so: ?php session_start(); if ($_POST['vkePlus']) { $waarden[] = array('gebruikt'='J',$_POST['vke']); foreach ($waarden as $i=$w) { if (is_array($w)) { foreach($w as $iw=$ww) { if (is_array($iw)) { //What happening here??? } else { echo stripslashes($iw) . : . stripslashes($ww) . br/; } } } else { echo stripslashes($i) . : . stripslashes($w) . br/; } } } print (h1Test/h1\n); print (form method=\post\ action=\ . $_SERVER['PHP_SELF'] . \\n); print (input type=\text\ size=\10\ name=\vke[NL]\ value=\ . $vke[NL] . \\n); print (input type=\text\ size=\10\ name=\vke[EN]\ value=\ . $vke[EN] . \\n); print (input type=\submit\ name=\vkePlus\ value=\GoGo\\n); print (/form\n); ? I have problems reading the contents of the arrays. Especially reading the second array seems impossible. After all this I want to add the contents of the array to a Session variable to keep it in furthwer steps (of a wizard). I hope any of you can 'make chocolat' of this ;-)) Thanks!! Sjef p.s. I use php 4. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php