RE: [PHP]SOLVED convert date to reversed date
Thx All -Oorspronkelijk bericht- Van: Jim Lucas [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 30 januari 2007 16:52 Aan: Jim Lucas CC: Arpad Ray; [EMAIL PROTECTED]; php-general@lists.php.net Onderwerp: Re: [PHP] convert date to reversed date Jim Lucas wrote: > Arpad Ray wrote: >> $filename = implode(array_reverse(explode('/', $value))); I should have checked before I wrote. It does work, but through me off, didn't realize that the first arg was optional. Sorry > I think you ment > > $filename = implode('', array_reverse(explode('/', $value))); > >> >> Arpad >> >> Reinhart Viane wrote: >>> Is this a good way to convert 01/02/2007 to 20070201 >>> >>> >>> >>> $value='01/02/2007'; >>> >>> list($day, $month, $year) = split('[/.-]', $value); >>> >>> $filename=$year.''.$month.''.$day; >>> >>> >>> >>> It does work but i would like to verify if there are no better, more >>> logical >>> ways to do this. >>> >>> Thanks in advance >>> >>> >>> >> > > -- Enjoy, Jim Lucas Different eyes see different things. Different hearts beat on different strings. But there are times for you and me when all such things agree. - Rush -- 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] convert date to reversed date
I suppose you mean strtotime -Oorspronkelijk bericht- Van: Fredrik Thunberg [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 30 januari 2007 16:36 CC: php-general@lists.php.net Onderwerp: Re: [PHP] convert date to reversed date > date("Ymd", strotodate( $value )); > Of course I mean: date( "Ydm", strtodate( $value )); -- 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] convert date to reversed date
Is this a good way to convert 01/02/2007 to 20070201 $value='01/02/2007'; list($day, $month, $year) = split('[/.-]', $value); $filename=$year.''.$month.''.$day; It does work but i would like to verify if there are no better, more logical ways to do this. Thanks in advance
RE: [PHP] Re: sessions vs domain problem
Something like: http://www.groep6049.ksjnet.be/ it does not work anymore (appearently the cookie domain is not recognized anymore). Any other ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions vs domain problem
Hello, I have the folowing problem : Hosting of my site is at http://www.groep6049.ksjnet.be <http://www.groep6049.ksjnet.be/> My domainname is www.ksachiropoelkapelle.be <http://www.ksachiropoelkapelle.be/> I have forwarded www.ksachiropoelkapelle.be <http://www.ksachiropoelkapelle.be/> towards http://www.groep6049.ksjnet.be/index.php I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar) Now people can log in on that site: $sql="select * from users where user_firstname='$firstname' and user_password='$password'"; $result=mysql_query($sql) or die(mysql_error()); $count=mysql_num_rows($result); if ($count>0) { $row=mysql_fetch_array($result); $userid=$row["user_id"]; $gebruikersnaam=$row["user_firstname"]; //set the session variables $_SESSION['userid']=$userid; $_SESSION['gebruikersnaam']=$gebruikersnaam; header("Location: http://www.ksachiropoelkapelle.be/index.php";); } The problem is: When I surf directly to http://www.ksachiropoelkapelle.be <http://www.ksachiropoelkapelle.be/> and try to login nothing happens. The script is executed successfully but it does not seem to recognize the $_SESSION to show that I'm logged in. When I surf to http://www.groep6049.ksjnet.be/index.php and try to login it works perfectly. Is it possible to set something extra in my php session variables to make it work when surfing directly to http://www.ksachiropoelkapelle.be <http://www.ksachiropoelkapelle.be/> ? Or do I have to disable the cloaking? Thanks in advance, Reinhart Viane
RE: [PHP] does magic_quotes_gpc prevents sql injection through forms?
>I think the more likely attack is actually due to how annoying >magic_quotes is. You have to remove it to do any work, then you have to >remember to put it back on because you aren't escaping your sql. >David What exactly do you mean by ' You have to remove it to do any work '? Seems that the only and best way to prevent mysql injection is the combination of mysql_real_escape_string combined with value validation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] does magic_quotes_gpc prevents sql injection through forms?(SOLVED)
Thx a lot -Oorspronkelijk bericht- Van: Dave Goodchild [mailto:[EMAIL PROTECTED] Verzonden: maandag 11 september 2006 14:10 Aan: Reinhart Viane CC: php-general@lists.php.net Onderwerp: Re: [PHP] does magic_quotes_gpc prevents sql injection through forms? Yes. Always treat incoming data as if it were tainted. How rigorous you are is up to you, but check for required fields, then validate them (type, size etc) and finally escape before database entry. > > http://www.projectkarma.co.uk > > -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] does magic_quotes_gpc prevents sql injection through forms?
So, if I understand correct mysql_real_escape_string is the way to prevent sql injection. Is there still need (as in both good coding and security) for variable validation at that point? Like a hidden field id that must only be an int? Van: Dave Goodchild [mailto:[EMAIL PROTECTED] Verzonden: maandag 11 september 2006 13:04 Aan: [EMAIL PROTECTED] CC: php-general@lists.php.net Onderwerp: Re: [PHP] does magic_quotes_gpc prevents sql injection through forms? I don't think so. What if magic_quotes_gpc gets turned off or you move to another environment. Best practice is to turn if off (if you can) and so gain fine control over your data. You can either compromise and use a function that checks whether the setting is enabled and either add your own slashes or do nothing. To ensure the best level of control over escaping data before it goes into your db, check out mysql_real_escape_string. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- http://www.web-buddha.co.uk http://www.projectkarma.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] does magic_quotes_gpc prevents sql injection through forms?
After some comments on my code I went on a 'fieldtrip' to learn about sql injection... Now after testing some examples with single and double quotes and mysql comment (--) I haven't find any way to insert edit or delete any data in the database. The loginscript is rather simple: $query="SELECT FROM persons WHERE login='$login' AND password='$password'"; $result=mysql_query($query) or die(mysql_error()); The form has action POST. Now magic_quotes_gpc escapes every quote I insert. Does this mean with magic_quotes_gpc on I am secured enough concerning mysql-injection through forms? Thx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] loop structure(SOLVED)
Thx, it works like a charm I think the mysql_fetch_assoc was the thing I was looking for. -Oorspronkelijk bericht- Van: Robert Cummings [mailto:[EMAIL PROTECTED] Verzonden: zaterdag 9 september 2006 17:36 Aan: [EMAIL PROTECTED] CC: php-general@lists.php.net Onderwerp: Re: [PHP] loop structure Untested... ... ... ' .$item['picture'] .'' .'' .' ' .''; } } } } ?> Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] loop structure
I've been experimenting some time now but i can't get it right. I have a database in which I have a table with a list of photo_url Table: photos Id photo_url 1 photos/boeket_s40.jpg 2 photos/boeket_k12.jpg 3 photos/boeket_z23.jpg ... I get this out of the database with this query: $sqlphoto="select * from photos where photo_type='$category'"; $exephoto=mysql_query($sqlphoto) or die (mysql_error()); Now I need a loop so that the photos are put into a table: PICTURE HERE PICTURE HERE PICTURE HERE The first must be looped as long as there are photos in the array (so something like #lines in array/3, with ceil()) In each there are 3 pictures in it's tags: so maybe something like for ($i=1;$i<3;$i++){ PICTURE HERE } I have tried several thing and I'm able to create the correct amount of rows and the loop for the 3 cells in the row. Unfortunately it always only shows the first picture from the array in each of those cells. Can someone help me out? THX -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] replace single and double quotes
Ok 'ill give this a shot together with the guidelines from jochen. Thx afan. -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 29 augustus 2006 15:28 Aan: [EMAIL PROTECTED] CC: php-general@lists.php.net Onderwerp: Re: [PHP] replace single and double quotes since I had something similar as a problem, let m etry to anser ang see did I get it correct :) first, and most important: never store in DB row submitted string $act_extra = mysql_real_escape_string($_POST[editextra]); $act_extra_fr = mysql_real_escape_string($_POST[editextrafr]) $act_id = mysql_real_escape_string($_POST[editid]); then: $sqledit = " update activities set act_extra='".$act_extra."', act_extra_fr = '".$act_extra_fr."' where act_id = '".$act_id."'"; to check: echo $sqledit; it should work now. hope this helped. -afan > This is the code is use to insert/update text into a database field: > > $sqledit="update activities set act_extra='$_POST[editextra]', > act_extra_fr='$_POST[editextrafr]' where act_id=$_POST[editid]"; > > Now both $_POST[editextra] and $_POST[editextrafr] can contain single or > double quotes. > So the query almost always gives me an error. > > I know I have to replace " with ", but I do not know how to replace > the > single quote so it is shown as a single quote on a webpage when I get it > from the database > > I have been looking into str_replace and preg_replace. But what I really > need is a solution that 'replaces' single quotes, double quotes en curly > quotes so I tackle all possible problems and the same text as it was > inputed > in the textarea is shown on the webpage. > > Thx in advance > > -- > 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] replace single and double quotes
About the language remark: I believe you try to say I need to find a way that the client can add 25 languages without me having to change the database layout or the coding? Well I can assure you this will not be the fact. The client only needs these two languages but maybe I should look into it anyway About SQl injection: I must say this is very interesting. I always wondered what are does and donts when inserting data from a form into a database and how to check someone did not enter any php code. Besides the google lookup is there maybe an site or paper dedicated to this? Thx again, didn't think this question was about to bring up what I was looking for in the back of my head -Oorspronkelijk bericht- Van: Jochem Maas [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 29 augustus 2006 15:37 Aan: [EMAIL PROTECTED] CC: php-general@lists.php.net Onderwerp: Re: [PHP] replace single and double quotes Reinhart Viane wrote: > This is the code is use to insert/update text into a database field: > > $sqledit="update activities set act_extra='$_POST[editextra]', > act_extra_fr='$_POST[editextrafr]' where act_id=$_POST[editid]"; this indicates 'bad' database design ... because adding a language involves having to change the database schema. I personally think that there should be no need to change the database schema and/or queries and/or code just because the client wants an extra language. it also indicates that you have a glaring SQL injection problem. what happens when I craft a POST request that contains an 'editid' parameter with the following in it: '1 OR 1' or '1; DELETE * FROM activities' google 'SQL injection', do some reading and get into the habit of sanitizing your user input. > > Now both $_POST[editextra] and $_POST[editextrafr] can contain single or > double quotes. > So the query almost always gives me an error. > > I know I have to replace " with ", but I do not know how to replace the WRONG - you only replace " with " when you OUTPUTTING the string as part of a webpage. the database should contain the actual > single quote so it is shown as a single quote on a webpage when I get it > from the database mysql_real_escape_string() search this archive; there is plenty of discussion about escaping data so that it can be inserted into a database (mostly concerning MySQL). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] replace single and double quotes
This is the code is use to insert/update text into a database field: $sqledit="update activities set act_extra='$_POST[editextra]', act_extra_fr='$_POST[editextrafr]' where act_id=$_POST[editid]"; Now both $_POST[editextra] and $_POST[editextrafr] can contain single or double quotes. So the query almost always gives me an error. I know I have to replace " with ", but I do not know how to replace the single quote so it is shown as a single quote on a webpage when I get it from the database I have been looking into str_replace and preg_replace. But what I really need is a solution that 'replaces' single quotes, double quotes en curly quotes so I tackle all possible problems and the same text as it was inputed in the textarea is shown on the webpage. Thx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] break up variable and put each element in an array
Actually, I know that it's browser/OS dependent, cuz I had a bunch of Mac users who sent only \r all the time. This may be true only of OS 9, and you may not care about them anymore, but there it is. I also would not be so quick to claim that Linux sends \r\n -- It could be dependent on the browser, the OS version, the OS distro, some OS settings, ... Better safe than sorry, and I *know* I ran into this with some Mac users. Plus I hate trying to edit the text chunks in vi with those icky \r thingies that turn into ^M :-) What would you suggest to use then? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] loop in horizontal direction (php-html)
Hey, I've been wondering. I know it's possible to make a php loop that each time generates a new . In that case the results are stored under eachother. Now I want to know if I can do the same in a horizontal direction. The result should be something like this, I loop through available projects: Project1Project2Project3Project4... 1 45 89 5 8 2 23 9 65 31 3 23 91 55 73 4 11 90 82 38 The first column is fixed, but I have an unkown amount of projects Hope this aint to much html related. Thanks in advance, Reinhart Viane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] break up variable and put each element in an array
Thx all -Oorspronkelijk bericht- Van: Ivo F.A.C. Fokkema [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 8 augustus 2006 16:17 Aan: Reinhart Viane CC: php-general@lists.php.net Onderwerp: RE: [PHP] break up variable and put each element in an array On Tue, 2006-08-08 at 16:06 +0200, Reinhart Viane wrote: > > try this: > > > > $string = "3/01/2005 29/12/2005 2/01/2006 20/02/2006 28/12/2006 1/01/2007 > > 15/02/2007"; > > $array = explode(' ', $string); > > foreach ($array as $value) echo "Date: $value"; > > If the user separates the dates by an enter in the textarea, you need to > explode on "\r\n". To be able to handle both, you need to use split() or > preg_split(). > > > When I use > $datelist=$_POST[datelist]; > $string=explode('\r\n',$datelist); > echo $string; > foreach ($string as $value) { > echo "Date: $value\n"; > > this is what I get: > ArrayDate: 24/12/2018 26/12/2018 31/12/2018 14/02/2019 14/03/2019 20/06/2019 > 24/06/2019 26/06/2019 27/06/2019 27/06/2019 You'll need to use "\r\n", with double quotes. Single quotes don't interpret the \r\n the same. > This solved the issue, although I find it rather bizar: > $datelist=$_POST[datelist]; > $string=preg_split('/\r\n/', $datelist, -1, PREG_SPLIT_OFFSET_CAPTURE); > echo $string; > foreach ($string as $value) { >echo "Date: $value\n"; > } > > Btw the input is a copy/paste from within a program > Thx all You might also want to try: $string=preg_split('/\s+/', $datelist); which would split on any (one or more) whitespace character(s). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] break up variable and put each element in an array
> try this: > > $string = "3/01/2005 29/12/2005 2/01/2006 20/02/2006 28/12/2006 1/01/2007 > 15/02/2007"; > $array = explode(' ', $string); > foreach ($array as $value) echo "Date: $value"; If the user separates the dates by an enter in the textarea, you need to explode on "\r\n". To be able to handle both, you need to use split() or preg_split(). When I use $datelist=$_POST[datelist]; $string=explode('\r\n',$datelist); echo $string; foreach ($string as $value) { echo "Date: $value\n"; this is what I get: ArrayDate: 24/12/2018 26/12/2018 31/12/2018 14/02/2019 14/03/2019 20/06/2019 24/06/2019 26/06/2019 27/06/2019 27/06/2019 This solved the issue, although I find it rather bizar: $datelist=$_POST[datelist]; $string=preg_split('/\r\n/', $datelist, -1, PREG_SPLIT_OFFSET_CAPTURE); echo $string; foreach ($string as $value) { echo "Date: $value\n"; } Btw the input is a copy/paste from within a program Thx all -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] break up variable and put each element in an array
A. I have a page on which people can supply dates in a text area. Dates are entered like this: 3/01/2005 29/12/2005 2/01/2006 20/02/2006 28/12/2006 1/01/2007 15/02/2007 B. Now I need this Post element to be broken into pieces (per date) and each of those pieces should be put into a text so the outcome (echo on screen) would be like this: Date=3/01/2005 Date=29/12/2005 Date=2/01/2006 Date=20/02/2006 Date=28/12/2006 Date=1/01/2007 Date=15/02/2007 The posted variable from A looks like this (when written on screen): 3/01/2005 29/12/2005 2/01/2006 20/02/2006 28/12/2006 1/01/2007 15/02/2007 So I need break this up and store any individual date into a key of an array Afterwards I need to loop through this array and use the value of each key to be printed after 'Date=' Can anyone help me on this? Thx in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] print page from php
Thx Miles and Jay -Oorspronkelijk bericht- Van: Miles Thompson [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 17 maart 2006 22:35 Aan: php-general@lists.php.net Onderwerp: Re: [PHP] print page from php At 09:57 AM 3/17/2006, Reinhart Viane wrote: >All, > >I have a web page with the results from several database queries. >Now this page has an undefined horizontal and vertical size. > >Does anyone know if there is a php script available that will automatically >split the webpage into parts that can fit on an A4 page? > >Or do I have to set boundaries on the size of the tables the queried data >will be shown in. > >Hope this makes any sense, > >Thanks in advance, > >Reinhart Viane > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php CSS is probably the best solution http://www.w3.org/TR/REC-CSS2/page.html#q16 found whle googling http://www.google.ca/search?hl=en&q=printing+CSS+media&btnG=Google+Search This is a good article: http://css-discuss.incutio.com/?page=PrintStylesheets and as always, A List Apart has CSS Design: going to Print at http://www.alistapart.com/stories/goingtoprint/ I have seen examples of two-column pages, but do not know if the pages broke correctly when the matter was longer than one page. Alternately, display in tables and make certain you have a so your header can repeat. Hope this steers you in the right direction - Miles. -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006 -- 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] print page from php
All, I have a web page with the results from several database queries. Now this page has an undefined horizontal and vertical size. Does anyone know if there is a php script available that will automatically split the webpage into parts that can fit on an A4 page? Or do I have to set boundaries on the size of the tables the queried data will be shown in. Hope this makes any sense, Thanks in advance, Reinhart Viane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seraching / indexing in php
Thanks everyone, Time to dig myself in and see what is best for my purpose. :) -Oorspronkelijk bericht- Van: Chris Ramsay [mailto:[EMAIL PROTECTED] Verzonden: woensdag 23 maart 2005 9:53 Aan: php list general Onderwerp: Re: [PHP] seraching / indexing in php If you are using Apache you also have the option of using the rewrite rule to change your urls - for example http://www.mydomain.com/index.php?a=foo&b=bar to http://www.mydomain.com/foo/bar If you are interested there is plenty of info on the net about the apache rewrite rule... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] seraching / indexing in php
Thanks Frank, One question: on most of these search engines I can't seem to find if the index and search dynamically generated pages. The intention is to make a site where several users have one page each which they can edit on there own. Do you think most of those engines can index pages like that? Or should I create an index every time a page is updated / made? Greetings -Oorspronkelijk bericht- Van: Frank Arensmeier [mailto:[EMAIL PROTECTED] Verzonden: dinsdag 22 maart 2005 15:54 Aan: php list general Onderwerp: Re: [PHP] seraching / indexing in php Hello! I suggest you take a look at: http://www.phpdig.net/ Regards, Frank 2005-03-22 kl. 15.47 skrev Reinhart Viane: > I'm looking for a script which indexes the pages of a site (dynamic > pages) > in a dbase and makes it possible to search the site based on > keywords/sentences/etc. > > Does anyone has any experience with such scripts and which do they > recommend? > > > > Thx in advance > > Reinhart > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Internal Virus Database is out-of-date. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 15/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] seraching / indexing in php
I'm looking for a script which indexes the pages of a site (dynamic pages) in a dbase and makes it possible to search the site based on keywords/sentences/etc. Does anyone has any experience with such scripts and which do they recommend? Thx in advance Reinhart
RE: [PHP] Re: check to see if a string contains sudden elements
$ret = explode('|', $_GET['id']); if(count($ret) > 1) { $id = $ret[1]; } else { $id = $ret[0]; } Suberb, This indeed did the trick. Aargh I hate when things are this simple and I just can't seem to find them... Thx! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] check to see if a string contains sudden elements
I have a page which gets the id of a user from the url. $_GET[id] Now this id can have two forms: Normal: page.php?id=1 Not so normal: page.php?id=whatever|1 I can explode the second string so I only have the number (1). Explode ("|", $_GET(id)) But this command fails my query in case we have a normal value Is there a way to check the $_GET(id) to see if there is a | in it and in that case explode it? Thx in advance. Reinhart
RE: [PHP] Re: mass emailing on windows server
Strange, I did not send any attachement with the message. Maybe by anti virus software automatically attached something -Oorspronkelijk bericht- Van: Jason Barnett [mailto:[EMAIL PROTECTED] Verzonden: vrijdag 4 maart 2005 17:37 Aan: php-general@lists.php.net Onderwerp: [PHP] Re: mass emailing on windows server Please do not send attachments to the list... feel free to post source code on the web though, and we will take a look at what you have. Actually, I'm afraid that I personally can't help you with this problem, but we try to keep code at pastebin websites and/or simplified code in your actual email message. -- Teach a man to fish... NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plug ins -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mass emailing on windows server
I use a while loop and the mail function to send email to all subscribers of a site. This works fine for 50 users but I know there can be some problems when you do it like this for 1000 users. Eg. Limit of page execution is exceeded and even server crashes because each time a mail is send a socket is opened and closed again. Now I have found some functions (fsock_open of an SMTP service) and some pear classes Unfortunately I have a windows server hosting that site. Anyone knows how to do mass email on a windows server? Thx in advance Reinhart No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mass email with php on a windows server
I use a while loop and the mail function to send email to all subscribers of a site. This works fine for 50 users but I know there can be some problems when you do it like this for 1000 users. Eg. Limit of page execution is exceeded and even server crashes because each time a mail is send a socket is opened and closed again. Now I have found some functions (fsock_open of an SMTP service) and some pear classes Unfortunately I have a windows server hosting that site. Anyone knows how to do mass email on a windows server? Thx in advance Reinhart No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.5.7 - Release Date: 1/03/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] help me
This is how I would do it, don't know if it is the best way. A. get the date out of the database Let's say $maindate is that date you retrieved from the database B. split up the date into several parts for day month and year The day as a number (dd): $day=date ("j", strtotime($maindate)); The month as a number (mm): $month= date ("m", strtotime($maindate)); The month as a number (yy): $year= date ("Y", strtotime($maindate)); C. Now in your combobox you must do something like: '.$aday.''); } ?> That should do the trick Greetz Reinhart -Oorspronkelijk bericht- Van: K Karthik [mailto:[EMAIL PROTECTED] Verzonden: woensdag 23 februari 2005 13:41 Aan: php-general@lists.php.net Onderwerp: [PHP] help me dear sir, i'd like to get a date from my database(mysql).and then show a combobox of calendar(date-month-year) with the retrieved data selected. can you help me doing this?? am new to php. thanks, karthikeyan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] while loop
Well I'm able to do that, there are only 4 different types, but the 4 queries have exactly the same syntax so I think it's better to combine them. Not? -Oorspronkelijk bericht- Van: Justin Lilly [mailto:[EMAIL PROTECTED] Verzonden: woensdag 23 februari 2005 18:57 Aan: php-general@lists.php.net Onderwerp: Re: [PHP] while loop Perhaps it is just me, but wouldn't it be easier to make individual mysql queries for each different act type? That would make the sorting -much- easier. I'm not sure if that's an option, but if it is, I'd consider exploring it. select * from activities where act_date >= NOW() && act_type_id = 1 or something of that nature. -justin On Wed, 23 Feb 2005 13:05:53 +0100, Reinhart Viane <[EMAIL PROTECTED]> wrote: > > > Hey list > > > > I have a mysql table like this: > > > > Act_name Act_type_id Act_date > > Heyhey 1 22-06-05 > > Aloha2 22-06-05 > > Tralala 2 22-06-05 > > Wuhu1 22-06-05 > > Hehe 3 22-06-05 > > Olalal3 22-06-05 > > Pompom 1 22-06-05 > > Wuhu2 22-06-05 > > > > Now I retrieve all activities happening in the future with this query: > > $sqlact="select * from activities where act_date >= NOW() order by > act_type_id"; > > $getact=mysql_query($sqlact) > > > > What I'm trying to do now is: > > From the result array, pick from every different act_type_id the two > activities that will happen first and put them in 2 variables > > Eg. > > The two act_date with act_type_id 1 > > Should be stored in > > $Act1result1 and $act1result2 > > > > The two act_date with act_type_id 2 > > Should be stored in > > $Act2result1 and $act2result2 > > > > I think this can be done with a loop in a loop but I always manage to create > some errors causing my apache to crash (infinite loop I suppose) > > Can someone help me on this? > > > > Thx in advance > > > > Reinhart > > > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Justin Lilly University of South Carolina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] while loop
Hey list I have a mysql table like this: Act_name Act_type_id Act_date Heyhey 1 22-06-05 Aloha 2 22-06-05 Tralala 2 22-06-05 Wuhu 1 22-06-05 Hehe 3 22-06-05 Olalal 3 22-06-05 Pompom 1 22-06-05 Wuhu 2 22-06-05 Now I retrieve all activities happening in the future with this query: $sqlact="select * from activities where act_date >= NOW() order by act_type_id”; $getact=mysql_query($sqlact) What I’m trying to do now is: From the result array, pick from every different act_type_id the two activities that will happen first and put them in 2 variables Eg. The two act_date with act_type_id 1 Should be stored in $Act1result1 and $act1result2 The two act_date with act_type_id 2 Should be stored in $Act2result1 and $act2result2 I think this can be done with a loop in a loop but I always manage to create some errors causing my apache to crash (infinite loop I suppose) Can someone help me on this? Thx in advance Reinhart No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22/02/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Script stuck on final ?>
Probably because you forgot to use a closing } somewhere or you forgot a ; somewhere Greetings -Oorspronkelijk bericht- Van: Alp [mailto:[EMAIL PROTECTED] Verzonden: donderdag 3 februari 2005 12:36 Aan: php-general@lists.php.net Onderwerp: [PHP] Script stuck on final ?> Why would a php script get stuck at the ver last line of code in php/mysql combination? I'm getting a parse error at the very last line. Thanks in advance for your help. Alp -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 1/02/2005 -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.300 / Virus Database: 265.8.4 - Release Date: 1/02/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MYSQL Query question
First, since it was a combined question of php and mysql I thought of sending it here. Secondly, this is my standard footer. My appologizes if my question irritates you -Original Message- From: Raditha Dissanayake [mailto:[EMAIL PROTECTED] Sent: donderdag 9 december 2004 14:14 To: [EMAIL PROTECTED] Subject: Re: [PHP] MYSQL Query question >Reinhart Viane wrote: >And a last question: >I always seem to get stuck on mysql queries when scripting. mysql.com >gives me a headache whens earching something. Does someone know a good >mysql manual site or a good mysql book? > > >That does not mean mysql questions should be posted on php mailing lists. > > > >STRICTLY PERSONAL AND CONFIDENTIAL >This message may contain confidential and proprietary material for the >sole use of the intended >recipient. Any review or distribution by others is strictly prohibited. >If you are not the intended >recipient please contact the sender and delete all copies. > > >Do you know that mailing lists are automatically archived at thousands >of websites? > > > > -- Raditha Dissanayake. -- http://www.radinks.com/print/card-designer/ | Card Designer Applet http://www.radinks.com/upload/ | Drag and Drop Upload -- 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 question
Table chat_online: session (varchar) activity (datetime) Table persons persons_region_int(int) Table regions region_id region_name On a page i list all persons which are in the chat_online dbase and within a certain period: $limit_time = time() - 130; // 2 Minutes time out. 60 * 2 = 120 $sqlchatonline = "SELECT * FROM chat_online WHERE UNIX_TIMESTAMP(activity) >= $limit_time AND (sessionid!='".session_id()."')"; $resultchatonline=mysql_query($sqlchatonline) or die (mysql_error()); $chatvisits = mysql_num_rows($resultchatonline); while($rowchatonline = mysql_fetch_object($resultchatonline)){ $chattersessionid=$rowchatonline->sessionid; //get the username, userid, mainpicid from the online chatter $getinfo= "select * from persons where person_session_id='$chattersessionid'"; $resultgetinfo = mysql_query($getinfo) or die (mysql_error()); $rowgetinfo= mysql_fetch_array($resultgetinfo); echo $rowgetinfo['person_nick']; } Now i want these online chatters to be listed by person_region_int: something like: region A chatter1 chatter2 region B none region C chatter3 chatter4 How do i do this? And a second question: I have created a menu box which lists all regions, if a option is selected by the user, i only want to show the online chatters of the selected region (selecting an option defines a variable $region which holds the region_id) Something like: if ($region) { $sqlchatonline = "SELECT * FROM chat_online, persons WHERE UNIX_TIMESTAMP(chat_online.activity) >= $limit_time AND (chat_online.sessionid!='".session_id()."' AND (persons.persons_region_int='$region')"; } This doe not give me the correct result: it shows all online chatters * total amount of users of that region. It should be all online chatters from that specified region And a last question: I always seem to get stuck on mysql queries when scripting. mysql.com gives me a headache whens earching something. Does someone know a good mysql manual site or a good mysql book? Thx in advance Reinhart _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
RE: [PHP] Very fresh to php
I think it was Darth Moeder "PHP, I am your mother, *heavely breathing*" (for those who don't speak dutch: Vader is 'father' and Moeder is 'mother') -Original Message- From: Santa [mailto:[EMAIL PROTECTED] Sent: woensdag 1 december 2004 9:29 To: [EMAIL PROTECTED] Subject: Re: [PHP] Very fresh to php В сообщении от Среда 01 Декабрь 2004 07:45 suneel написал(a): > Hi...guys, > > I'm a new bee to php. Could any one tell me that who is > the father of php? > > take care guys, and who is mother? 8) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mysql query with exclude
Little correction: So something like: select * from chat c1, chat_online c2 where UNIX_TIMESTAMP(c2.activity)>=$limit_time and c2.session_id = (c2.user2_sessionid if (c1.user1_sessionid = $thisuser)) or (c2.user1_sessionid if(c1.user2_sessionid = $thisuser)); I dunno if this is good sql, but I don't think it is. >>Well >>That was indeed what I was searching for but. If I read it out loud, I think with this query I only check if the current user is still onlien and not his conversation partner. >>In the chat table is store the session_id's of both the chatters of the conversation. There is no way to tell if $thisuser is the user1_sessionid record or user2_sessionid record. So I check them both. >>After that I have all results where (user1_sessionid record = $thisuser or user2_sessionid record = $thisuser) I need to get the other field. In the first case the users of which the time needs to be >>>checked is user2_sessionid, in the second case user1_sessionid. >>So something like: >>select * from chat c1, >> chat_online c2 >>where >> UNIX_TIMESTAMP(c2.activity)>=$limit_time and >> c2.session_id = (c2.user1_sessionid if (c1.user1_sessionid = >>$thisuser)) or (c2.user1_sessionid if(c1.user2_sessionid = $thisuser)); >>Can I do something like this? >>-Original Message- >>From: Ligaya Turmelle [mailto:[EMAIL PROTECTED] >>Sent: zondag 28 november 2004 2:25 >>To: [EMAIL PROTECTED] >>Cc: [EMAIL PROTECTED] >>Subject: Re: [PHP] mysql query with exclude >>Sounds like you need a join. Maybe something like: >> >>select * from chat c1, >> chat_online c2 >>where >> UNIX_TIMESTAMP(c2.activity)=$limit_time and >> c2.session_id = $thisuser and >> ((c1.user1_sessionid = $thisuser) or >> c1.user2_sessionid = $thisuser)); >>Respectfully, >>Ligaya Turmelle >>Reinhart Viane wrote: > Hey all, > > Hope you all have fun this saturday evening :) > I'm sure i'm having fun except i'm kinda stuck... > > Ok here goes... > > I have 2 tables, one with the people online (chat_online): session_id > activity > > > And a second one where i keep the conversations between people(chat): > user1_sessionid user2_sessionid > chat_conv > > To see what chatter are still online during the last 2 minutes i do a > check like this on the chat_online table: $limit_time= time()-130; > $sqlchatonline="select * from chat_online where UNIX_TIMESTAMP(activity) > >>=$limit_time"; > > > ok, on my page i also do a query to see what conversations are going > on with the user: $thisuser=session_id(); > $getchatlist="select * from chat where (user1_sessionid=$thisuser) or > (user2_sessionid=$thisuser)"; > > This selects all the conversations which this user has been/or is > into. I list all the chatpartners of thisuser. Off course it is > possible that other chatters who had a conversation with this user are > not online anymore. So i need to combine those two queries in a way... > > this is what i think it should be: > $getchatlist=select * from chat where (user1_sessionid=$thisuser) or > (user2_sessionid=$thisuser); > $resultchatlist=mysql_query($getchatlist); > while ($row=mysql_fetch_array($resultchatlist)) { > get the second chattersessionid in each conversation and check > if this chatter was still online in the last two minutes. > if he is not, exclude him from the array and do not show him > in the list (optional delete the record in the database) } > > or maybe i can combine those two queries in one? > > Can someone help me out on this? > > Thx in advance, > Reinhart > > > > > > _ > > Reinhart Viane > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > Domos || D-Studio > Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- > fax +32 15 43 25 26 > > > STRICTLY PERSONAL AND CONFIDENTIAL > This message may contain confidential and proprietary material for the > sole use of the intended > recipient. Any review or distribution by others is strictly prohibited. > If you are not the intended > recipient please contact the sender and delete all copies. > > > -- 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] mysql query with exclude
Well That was indeed what I was searching for but. If I read it out loud, I think with this query I only check if the current user is still onlien and not his conversation partner. In the chat table is store the session_id's of both the chatters of the conversation. There is no way to tell if $thisuser is the user1_sessionid record or user2_sessionid record. So I check them both. After that I have all results where (user1_sessionid record = $thisuser or user2_sessionid record = $thisuser) I need to get the other field. In the first case the users of which the time needs to be checked is user2_sessionid, in the second case user1_sessionid. So something like: select * from chat c1, chat_online c2 where UNIX_TIMESTAMP(c2.activity)>=$limit_time and c2.session_id = (c2.user1_sessionid if (c1.user1_sessionid = $thisuser)) or (c2.user1_sessionid if(c1.user2_sessionid = $thisuser)); Can I do something like this? >>-Original Message- >>From: Ligaya Turmelle [mailto:[EMAIL PROTECTED] >>Sent: zondag 28 november 2004 2:25 >>To: [EMAIL PROTECTED] >>Cc: [EMAIL PROTECTED] >>Subject: Re: [PHP] mysql query with exclude >>Sounds like you need a join. Maybe something like: >> >>select * from chat c1, >> chat_online c2 >>where >> UNIX_TIMESTAMP(c2.activity)=$limit_time and >> c2.session_id = $thisuser and >> ((c1.user1_sessionid = $thisuser) or >> c1.user2_sessionid = $thisuser)); >>Respectfully, >>Ligaya Turmelle >>Reinhart Viane wrote: > Hey all, > > Hope you all have fun this saturday evening :) > I'm sure i'm having fun except i'm kinda stuck... > > Ok here goes... > > I have 2 tables, one with the people online (chat_online): session_id > activity > > > And a second one where i keep the conversations between people(chat): > user1_sessionid user2_sessionid > chat_conv > > To see what chatter are still online during the last 2 minutes i do a > check like this on the chat_online table: $limit_time= time()-130; > $sqlchatonline="select * from chat_online where UNIX_TIMESTAMP(activity) > >>=$limit_time"; > > > ok, on my page i also do a query to see what conversations are going > on with the user: $thisuser=session_id(); > $getchatlist="select * from chat where (user1_sessionid=$thisuser) or > (user2_sessionid=$thisuser)"; > > This selects all the conversations which this user has been/or is > into. I list all the chatpartners of thisuser. Off course it is > possible that other chatters who had a conversation with this user are > not online anymore. So i need to combine those two queries in a way... > > this is what i think it should be: > $getchatlist=select * from chat where (user1_sessionid=$thisuser) or > (user2_sessionid=$thisuser); > $resultchatlist=mysql_query($getchatlist); > while ($row=mysql_fetch_array($resultchatlist)) { > get the second chattersessionid in each conversation and check > if this chatter was still online in the last two minutes. > if he is not, exclude him from the array and do not show him > in the list (optional delete the record in the database) } > > or maybe i can combine those two queries in one? > > Can someone help me out on this? > > Thx in advance, > Reinhart > > > > > > _ > > Reinhart Viane > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > Domos || D-Studio > Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- > fax +32 15 43 25 26 > > > STRICTLY PERSONAL AND CONFIDENTIAL > This message may contain confidential and proprietary material for the > sole use of the intended > recipient. Any review or distribution by others is strictly prohibited. > If you are not the intended > recipient please contact the sender and delete all copies. > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
FW: [PHP] get image dimensions
-Original Message- From: Reinhart Viane [mailto:[EMAIL PROTECTED] Sent: zaterdag 27 november 2004 23:24 To: 'Dustin Krysak' Subject: RE: [PHP] get image dimensions $dimensions=getimagesize($image_url); $dimensions[0]=width $dimensions[1]=height Hope this helps -Original Message- From: Dustin Krysak [mailto:[EMAIL PROTECTED] Sent: zaterdag 27 november 2004 23:17 To: PHP Subject: [PHP] get image dimensions Hi there - I was wondering if there was a way to get PHP to get the dimensions of an image? I want to be able to have PHP dynamically write the image size (of the IMG tag) so that my pages validate when displaying a dynamic image. Thanks in advance! d -- 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 with exclude
Hey all, Hope you all have fun this saturday evening :) I'm sure i'm having fun except i'm kinda stuck... Ok here goes... I have 2 tables, one with the people online (chat_online): session_id activity And a second one where i keep the conversations between people(chat): user1_sessionid user2_sessionid chat_conv To see what chatter are still online during the last 2 minutes i do a check like this on the chat_online table: $limit_time= time()-130; $sqlchatonline="select * from chat_online where UNIX_TIMESTAMP(activity) >=$limit_time"; ok, on my page i also do a query to see what conversations are going on with the user: $thisuser=session_id(); $getchatlist="select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser)"; This selects all the conversations which this user has been/or is into. I list all the chatpartners of thisuser. Off course it is possible that other chatters who had a conversation with this user are not online anymore. So i need to combine those two queries in a way... this is what i think it should be: $getchatlist=select * from chat where (user1_sessionid=$thisuser) or (user2_sessionid=$thisuser); $resultchatlist=mysql_query($getchatlist); while ($row=mysql_fetch_array($resultchatlist)) { get the second chattersessionid in each conversation and check if this chatter was still online in the last two minutes. if he is not, exclude him from the array and do not show him in the list (optional delete the record in the database) } or maybe i can combine those two queries in one? Can someone help me out on this? Thx in advance, Reinhart _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
[PHP] splitting arrays
hey all, I have a question concerning arrays. Folowing situation: usertable $sql="select * from users"; $result="mysql_query($sql) or die (mysql_error()); $array=mysql_fetch_array($result); Now this give me an array, i can get specific information with array['username'] What i need to do now is to split up this information so i have new arrays, or results which i can use in javascript. Say array1 loops all usernames and puts them in a new array while another array2 is builed up with all pictures url's of every user. array1[0]=John array1[1]=Mike array1[3]=Pete and the other array is array2[0]=picture of John array2[1]=picture of Mike array2[3]=picture of Pete Target is to populate a combobox with the usernames and to show there pictures when the names are clicked (with javascript / no page refresh). Can someone help me on this? Thx in advance Reinhart _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
RE: [PHP] Javascript and php
Thank you very much, After some small adjustements to make it work with the rest of the javascript it works like a charm!! Have a nice Sunday :) Greetings, Reinhart -Original Message- From: Bruno B B Magalhães [mailto:[EMAIL PROTECTED] Sent: zondag 7 november 2004 12:33 To: [EMAIL PROTECTED] Subject: Re: [PHP] Javascript and php Reinhart, picture_url.'"'; if($i <= mysql_num_rows($result)-2) { echo ','; } } ?> Here is how I do in my developments. Regards, Bruno B B Magalhães On Nov 7, 2004, at 8:44 AM, Reinhart Viane wrote: > Hey all, > Hope some of you also work on sundays :) > > I have a little javascript which displays a images (with previous / > next > thing) > Now, i populate the javascript array with an php array: > > > > <!-- Begin > NewImg = new Array ( > <?php > while($row = mysql_fetch_object($result)){ > echo "\"".$row->picture_url."\","; > } > ?> > "../pictures/7_stripper3.jpg", > "../pictures/7_stripper2.jpg" > ); > var ImgNum = 0; > var ImgLength = NewImg.length - 1; > ... > > > As you can see i echo the url of the picture. > After each picture url there needs to be a ',' > But not after the last picture. > At this moment all pictures have the ',' after there url, even the > last one. Any way to determine if the url is the url of the last > picture and thus not printing a ',' behind that last one? > > Thx in advance, > > Reinhart > > _ > > Reinhart Viane > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > Domos || D-Studio > Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 > -- > fax +32 15 43 25 26 > > > STRICTLY PERSONAL AND CONFIDENTIAL > This message may contain confidential and proprietary material for the > sole use of the intended recipient. Any review or distribution by > others is strictly prohibited. > If you are not the intended > recipient please contact the sender and delete all copies. > > -- 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] Javascript and php
Hey all, Hope some of you also work on sundays :) I have a little javascript which displays a images (with previous / next thing) Now, i populate the javascript array with an php array: <!-- Begin NewImg = new Array ( <?php while($row = mysql_fetch_object($result)){ echo "\"".$row->picture_url."\","; } ?> "../pictures/7_stripper3.jpg", "../pictures/7_stripper2.jpg" ); var ImgNum = 0; var ImgLength = NewImg.length - 1; ... As you can see i echo the url of the picture. After each picture url there needs to be a ',' But not after the last picture. At this moment all pictures have the ',' after there url, even the last one. Any way to determine if the url is the url of the last picture and thus not printing a ',' behind that last one? Thx in advance, Reinhart _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
RE: [PHP] using require or include?
That indeed did the trick. global $username; global $userstatus; $username=$row['user_name']; $userstatus=$row['user_status']; Thx very much -Original Message- From: Graham Cossey [mailto:[EMAIL PROTECTED] Sent: vrijdag 5 november 2004 0:47 To: Php-General; [EMAIL PROTECTED] Subject: RE: [PHP] using require or include? Have you looked at the GLOBAL keyword? http://uk.php.net/manual/en/language.variables.scope.php > -Original Message- > From: Reinhart Viane [mailto:[EMAIL PROTECTED] > Sent: 04 November 2004 23:02 > To: [EMAIL PROTECTED] > Subject: [PHP] using require or include? > > > i have made a page (overall.php) in which several elements are > defined: the connection with the database a function called > session_checker to check if users are logged in and a last > function(function getuserinfo()) that substracts values from the > database based on the session variables of the logged in user > > Now this last function sets 2 variables eg. > $username=$row['user_name']; $userstatus=$row['user_status']; > like this i do not have to recall this script on every page but i just > can do the function at the top of every page > > Now on every page of my site I require this file require(overall.php); > > But it seems that i cannot get the variables outta this file. So i can > not use $username or $userstatus on the pages. > > I think it has something to do with require not passing the variables? > Off course i can repeat the function script on the top of every page, > but that's stupid i think. Can i use a include without any problems? > Or is there a significant difference in use and security? > > Thx in advance > Reinhart > > > _ > > Reinhart Viane > <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] > Domos || D-Studio > Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- > fax +32 15 43 25 26 > > > STRICTLY PERSONAL AND CONFIDENTIAL > This message may contain confidential and proprietary material for the > sole use of the intended > recipient. Any review or distribution by others is strictly prohibited. > If you are not the intended > recipient please contact the sender and delete all copies. > > > -- 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] using require or include?
i have made a page (overall.php) in which several elements are defined: the connection with the database a function called session_checker to check if users are logged in and a last function(function getuserinfo()) that substracts values from the database based on the session variables of the logged in user Now this last function sets 2 variables eg. $username=$row['user_name']; $userstatus=$row['user_status']; like this i do not have to recall this script on every page but i just can do the function at the top of every page Now on every page of my site I require this file require(overall.php); But it seems that i cannot get the variables outta this file. So i can not use $username or $userstatus on the pages. I think it has something to do with require not passing the variables? Off course i can repeat the function script on the top of every page, but that's stupid i think. Can i use a include without any problems? Or is there a significant difference in use and security? Thx in advance Reinhart _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
RE: [PHP] Lost session variables still confounding me
Also, it seems my messages are posted slower then the ones of Richard... So I have given the same answer as he did for the second time. My apoligizes. Greetings, Reinhart -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: donderdag 4 november 2004 11:03 To: Richard Davey; [EMAIL PROTECTED] Subject: Re: [PHP] Lost session variables still confounding me --- Richard Davey <[EMAIL PROTECTED]> wrote: > Unless I'm mistaken - you are redirecting back to > Page 2 upon an > error, right? Well according to the code posted, the > second you hit > Page 2 again, you are over-writing whatever is in > the f1a session > variable with the contents of the $_POST var, which > naturally will not > exist, hence you'll blank it out every single time. > Your not mistaken. That is what's happening. I just don't know how to fix it . Stuart -- 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] Lost session variables still confounding me
Why not, on page 2: //Set the session variable, input on Page 1 If ($_POST['ListingName']) { $_SESSION['f1a'] = $_POST['ListingName']; } If there is a POST value, it will be used, else $_SESSION['f1a'] will keep it's value. -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: donderdag 4 november 2004 11:03 To: Richard Davey; [EMAIL PROTECTED] Subject: Re: [PHP] Lost session variables still confounding me --- Richard Davey <[EMAIL PROTECTED]> wrote: > Unless I'm mistaken - you are redirecting back to > Page 2 upon an > error, right? Well according to the code posted, the > second you hit > Page 2 again, you are over-writing whatever is in > the f1a session > variable with the contents of the $_POST var, which > naturally will not > exist, hence you'll blank it out every single time. > Your not mistaken. That is what's happening. I just don't know how to fix it . Stuart -- 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] Lost session variables still confounding me
>>Page 1: >>//Start the Session - begin Block >>@session_start(); >> >>>/> Is it necesarry to start the session here? Maybe it is if they have to be logged in or something Normally I only start the session when I indeed can assign some session variables in the same page >>Page 2: >>//Start the Session - begin Block >>@session_start(); >>//Set the session variable, input on Page 1 >>$_SESSION['f1a'] = $_POST['ListingName']; //Set the session variable, input on Page 1 session_register('f1a'); $_SESSION['f1a'] = $_POST['ListingName']; >>Page 3: >>//ON this page, I check that f1a still exist using an >>echo - generally it does unless : >>//Start the Session - begin Block >>@session_start(); >>if (count($myarray) > 5) { >>$_SESSION['arrayerr'] = "you have selected too many industries"; header ("Location: Page2.php"); exit; } If the validation above passes, no problem. But if it >>doesn't, once it redirects, the session variable , f1a is bye bye. Why do you put the error message in a session variable? Also you will get an error (header already sent) I suppose since you first send some text and then do a header. Also if you rederict to page2.php, at the beginning of that page you set $_SESSION('f1a')= $_POST['ListingName']; Since there are no POST values (you are coming from page3) $_SESSION('f1a') will get an empty value... Maybe this causes the loss... I dunno if this will help, I'm not that good at php. Greetings, Reinhart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] standard ini settings
Can someone point me out the best ini settings? Which are nowadays used as standards when scripts are writte? I wanna make sure the codes i (try to) write meet this standards Thx _ Reinhart Viane <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies.
RE: [PHP] Re: Bug-Tracking-System in PHP ?
Hmmm No email support?? When a bug is posted, updated, a bug note is added, etc everyone who subscribed to this 'topic' will receive a email on it We use it in our firm and it works like a charm :) -Original Message- From: Michelle Konzack [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 16:51 To: [EMAIL PROTECTED] Subject: [PHP] Re: Bug-Tracking-System in PHP ? Am 2004-10-29 09:48:32, schrieb Reinhart Viane: > Dunno if this is ok: > http://www.mantisbt.org/ Nice features and 1.0 support postgresql (can not use MySQL because some tools conflicts with postgresql) Unfortunatly no E-Mail support... :-( Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code help on a multi select list
It is not my intention to start a discussion on this, however, some things, as you surely know, are better handled with javascript. If you turn it the way you say now, I can follow your idea and thus you are correct. It has te be very closed it seems. Will look into it :) -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 15:29 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Code help on a multi select list --- Reinhart Viane <[EMAIL PROTECTED]> wrote: > I would choose javascript to to check this > This response I don't understand. There are 50 options and the intent is to allow 3 of those 50. Then some "genius" comes along and turns off javascripting and chooses all 50. I KNOW it will happen. I wouldn't even dare to dream that it may not. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Code help on a multi select list
I would choose javascript to to check this -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 15:13 To: [EMAIL PROTECTED] Subject: [PHP] Code help on a multi select list I want to do a server side trap if a user selects more from a mult select list then allowed. Just unsure and didn't find any examples. Seems people rely more on javascript these days. So here is how I grab the array: if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] = array_unique( array_merge( $_SESSION['l_industry'], $_REQUEST['LurkerIndustry'] ) ); } here is my somewhat hazy notion: if ( is_array( $_REQUEST['LurkerIndustry'] ) ) { $_SESSION['l_industry'] = array_unique( if $l_industry > 5 ( Here I'm guess I need to redirect back to page with and error message) else array_merge( $_SESSION['l_industry'], $_REQUEST['LurkerIndustry'] ) ); } -- 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] trying 2 pull data out table and populate a list box
Try this: And then to populate the list: select one '.$rijladders["$x"]["laddername"].''); } ?> -Original Message- From: Garth Hapgood - Strickland [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 12:36 To: [EMAIL PROTECTED] Subject: Re: [PHP] trying 2 pull data out table and populate a list box Thanx so much Reinhart It works fine now. Ok so i have my list populated now. IF I want to diplay "select one" at the top of the list box, not as an option, but just so that the user knows to select an item. How will I put that in the code? Greets Garth -- 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] trying 2 pull data out table and populate a list box
>if ( mysql_num_rows( $rsladders ) ) >{ >while ( $rijladders = mysql_fetch_array( $rsladders ) ) >{ >echo <<$rijladders[laddername] >EOF; >} >} >Like I wrote above, I tend to use heredoc syntax for stuff like this. This indeed seems to be a faster way. Can you point me out the <
RE: [PHP] trying 2 pull data out table and populate a list box
I always do this with a script like this: $sql="select * from ladders order by laddername"; $rsladders=mysql_query($sql); $aantal_ladders=mysql_num_rows($rsladders); for($x=0;$x<$aantal_ladders;$x++) { $rijladders["$x"]=mysql_fetch_array($rsladders); } And then to populate the list: '.$rijladders["$x"]["laddername"].''); } ?> This works but I don't know if this is good coding Greetz Reinhart -Original Message- From: Garth Hapgood - Strickland [mailto:[EMAIL PROTECTED] Sent: donderdag 28 oktober 2004 17:19 To: [EMAIL PROTECTED] Subject: [PHP] trying 2 pull data out table and populate a list box I am trying to pull all data out of a table called "province" which has 2 fields "ProvinceID" and "Description" respectively. Now I want to populate a list with all the data in the "descriptions" field. Many thanx -- 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] Bug-Tracking-System in PHP ?
Dunno if this is ok: http://www.mantisbt.org/ -Original Message- From: Michelle Konzack [mailto:[EMAIL PROTECTED] Sent: vrijdag 29 oktober 2004 5:31 To: [EMAIL PROTECTED] Subject: [PHP] Bug-Tracking-System in PHP ? Hello, Curently I create my website and I need for my development project a BTS like this one from . I have only around 20 Debian Packages, so I do not need a big one of BTS. Curently I use E-Mails from my Provider like: [EMAIL PROTECTED] with procmail and some BASH scripts :-) Does anyone know a better solution in PHP4 ? Maybe Webinterface included ? The BASH scripts are working fine, but they are too heavy Greetings Michelle -- Linux-User #280138 with the Linux Counter, http://counter.li.org/ Michelle Konzack Apt. 917 ICQ #328449886 50, rue de Soultz MSM LinuxMichi 0033/3/8845235667100 Strasbourg/France IRC #Debian (irc.icq.com) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Sessions problem bug
On the server i use: Session.auto_start is off Session.use_cookie is on Session.use_trans_sid is 1 I do not set the session id myself All pages that requite the sessions have session_start() at the very first line -Original Message- From: Jason Barnett [mailto:[EMAIL PROTECTED] Sent: woensdag 27 oktober 2004 11:41 To: [EMAIL PROTECTED] Subject: [PHP] Re: Sessions problem bug Are you using cookie-based sessions? Thus sayeth the manual: Note: When using session cookies, specifying an id for session_id() will always send a new cookie when session_start() is called, regardless if the current session id is identical to the one being set. Thanks google. Reinhart Viane wrote: > Some days ago I asked some questions concerning php and sessions > > Apparently it seems to be a bug: > 'When you use a session name that has only numbers, each call to > session_start seems to regenerate a new session id, so the session > does not persist.' > > http://bugs.php.net/search.php?search_for=session&boolean=0&limit=10&o > rd > er_by=&direction=ASC&cmd=display&status=Open&bug_type%5B%5D=Session+rela > ted&php_os=&phpver=&assign=&author_email=&bug_age=0 > > And there you pick bug with ID 27688 > > Just to let everyone know. > Greetz, > > Reinhart Viane > > > > Reinhart Viane > [EMAIL PROTECTED] > Domos || D-Studio > Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- > fax +32 15 43 25 26 > > STRICTLY PERSONAL AND CONFIDENTIAL > This message may contain confidential and proprietary material for the > sole use of the intended > recipient. Any review or distribution by others is strictly prohibited. > If you are not the intended > recipient please contact the sender and delete all copies. -- 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_start generates a new session_id
Instead of: Try this: //unregister the sessions $_SESSION['validlogin']=""; $_SESSION['username']=""; $_SESSION['password']=""; //destroy the sessions array $_SESSION = array(); //destroy the session session_destroy(); Greetings Reinhart Viane -- 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
[PHP] Sessions problem bug
Some days ago I asked some questions concerning php and sessions Apparently it seems to be a bug: 'When you use a session name that has only numbers, each call to session_start seems to regenerate a new session id, so the session does not persist.' http://bugs.php.net/search.php?search_for=session&boolean=0&limit=10&ord er_by=&direction=ASC&cmd=display&status=Open&bug_type%5B%5D=Session+rela ted&php_os=&phpver=&assign=&author_email=&bug_age=0 And there you pick bug with ID 27688 Just to let everyone know. Greetz, Reinhart Viane Reinhart Viane [EMAIL PROTECTED] Domos || D-Studio Graaf Van Egmontstraat 15/3 -- B 2800 Mechelen -- tel +32 15 44 89 01 -- fax +32 15 43 25 26 STRICTLY PERSONAL AND CONFIDENTIAL This message may contain confidential and proprietary material for the sole use of the intended recipient. Any review or distribution by others is strictly prohibited. If you are not the intended recipient please contact the sender and delete all copies. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions question
Owkee here goes: * Removing the foreach loop only supplied me with not being able to log in. But again I dunnot think this is the problem. The variables are stored correctly. At certain times the user_id sessions were just swapped... * Now I've seen that session_register('email'); $_SESSION['email'] = $email; Did not supply any output when listing my session variables with echo "\n"; print_r($_SESSION); echo "\n"; When I removed this line (and I am testing 2 hours already now) I have not ecountered any problems so far. Could this be logical? Could a session variable with no value at all cause the earlier mentioned problems? * Also when a file was uploaded and it's parameters were inputed in the database I used this code to do it: //get the id of the current logged in user $submit_user_id=$_SESSION['user_id']; //set the file url $url= ("documents/".$file_name); $sql4 = "insert into documents (document_name, document_description, document_submit_date, document_submitter_user_id, document_folder_id, document_url, document_ext, document_author) values ('$_POST [documentname]', '$_POST[documentdescription]', '$inputdate', '$submit_user_id', '$_POST[folderid]', '$url', '$ext', '$_POST[documentauthor]' )"; Which I now changed into: //get the id of the current logged in user //$submit_user_id=$_SESSION['user_id']; //set the file url $url= ("documents/".$file_name); $sql4 = "insert into documents (document_name, document_description, document_submit_date, document_submitter_user_id, document_folder_id, document_url, document_ext, document_author) values ('$_POST [documentname]', '$_POST[documentdescription]', '$inputdate', $_SESSION['user_id'], '$_POST[folderid]', '$url', '$ext', '$_POST[documentauthor]' )"; Maybe for some bizarre reason sometimes the value of the last $submit_user_id was given to $_SESSION[user_id]. As you can see I'm getting very suspecious about everything hehe. * Secondly I now use this: $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('user_id'); $_SESSION['user_id'] = $user_id; session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; //session_register('email'); //$_SESSION['email'] = $email; session_register('user_level'); $_SESSION['user_level'] = $user_level; } should it be better when I use this?? $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ // Register some session variables! session_register('user_id'); $_SESSION['user_id'] = $row->user_id; session_register('first_name'); $_SESSION['first_name'] = $row->first_name; session_register('last_name'); $_SESSION['last_name'] = $row->last_name; //session_register('email'); //$_SESSION['email'] = $email; session_register('user_level'); $_SESSION['user_level'] = $row->user_level; } * last question. Very soon I will need a good and secure usersystem preferabbly with no cookies. So I think sessions are the way to go. Maybe you can supply me with some good tutorials or scripts which can help me create a well closed usersystem. After these encounters with security problems, I'm not really sure no more what to use or to do. Thx again for all the efforts you are doing to help me out. It's highly appreciated (if I would be a girl I would give you a kiss). Greetings, Reinhart Viane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions question
I do not think this causes the problem. It's just redundant. Thx anyway -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: donderdag 21 oktober 2004 22:11 To: [EMAIL PROTECTED] Subject: Re: [PHP] Sessions question * Thus wrote Reinhart Viane: > PHP Code > // Register some session variables! > session_register('userid'); > $_SESSION['userid'] = $userid; Do not use session_register with $_SESSION. http://php.net/session-register Curt -- Quoth the Raven, "Nevermore." -- 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 sessions question
>I normally do as you have suggested here - but why do you suggest that >this method is better? > > One reason is for security. You cannot ever rule out the possibility of a user injecting someone else's data into the session to get access to information that he should not have. Of course he can fake the userid too. That's why each time you retrieve the userid from the session you should check if that id has been logged in. I do this (so do many others) by keeping two column table with session id and userid in it. -- Raditha Dissanayake. Do you have an example or dou you know of any tutorials where this method is used? Thx Reinhart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions question
Thanks Greg, I'll try this, but I do not think this will solve the issue since at first hand the session variables are correctly made. The problem arrises (I think) whenever two or more users are logged in and one closes the pages (so his session is killed I suppose). Sometimes after that, the other users seem to get other values for the user_id session variable. Strange thing is the other session (like first_name or last_name) variables of the user stay correct. Only the user_id session variable is changed. I don't know if this can be caused by the fact register_globals seem to be 'on' on the server (btw PHP Version 4.2.3) Thx for the advice, I hope I can sort it out soon Greetz Reinhart -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: donderdag 21 oktober 2004 15:47 To: [EMAIL PROTECTED] Subject: Re: [PHP] Sessions question On Thu, 21 Oct 2004 14:43:45 +0200, Reinhart Viane <[EMAIL PROTECTED]> wrote: > Hey Mike, > > After some intensive testing it seemed that $user_id did not solve the > isue > > I hereby give the script to get the $user_id: > > // check if the user info validates the db > ($username and $password are the POST values of username and password > given in on a form) $sql = mysql_query("SELECT * FROM users WHERE > username='$username' AND password='$password' AND activated='1'"); > $login_check = mysql_num_rows($sql); > > if($login_check > 0){ > while($row = mysql_fetch_array($sql)){ > foreach( $row AS $key => $val ){ Your select * query above is probably pulling more than two fields, so a $key and $val in the foreach() will only work with two of those fields, the other fields will be unhandled. You might want to ditch the foreach() loop and just use the while() loop by itself since you can easily access all the fields from your query in the $row array. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.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] Sessions question
Hey Mike, After some intensive testing it seemed that $user_id did not solve the isue I hereby give the script to get the $user_id: // check if the user info validates the db ($username and $password are the POST values of username and password given in on a form) $sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'"); $login_check = mysql_num_rows($sql); if($login_check > 0){ while($row = mysql_fetch_array($sql)){ foreach( $row AS $key => $val ){ $$key = stripslashes( $val ); } // Register some session variables! session_register('user_id'); $_SESSION['user_id'] = $user_id; session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; session_register('email_address'); $_SESSION['email_address'] = $email_address; session_register('user_level'); $_SESSION['user_level'] = $user_level; mysql_query("UPDATE users SET last_login=now() WHERE user_id='$user_id'"); header("Location: main.php"); } Now this is my conclusion till now: All other session items are correctly displayed, except the $_SESSION['user_id'] I'm trying to find the way when this happens since it does not seem to happen in a strict order The method mentioned b4: '>Now let's say user 1 logs in, his session is registered (with userid > from database is 5 and first_name is XXX) Then another user logs in, > again his session is registered (with userid from database is 1 and > first_name is YYY)' is not always faulty. I've checked everything I know and the last thing I've done is putted: session_start(); On the first line instead of after this: mailto:[EMAIL PROTECTED] Sent: donderdag 21 oktober 2004 13:28 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Sessions question On Thu, 21 Oct 2004 11:39:23 +0200, Reinhart Viane <[EMAIL PROTECTED]> wrote: > Hey all, i'm new to this list so forgive me if i make any huge > mistakes. I'm in a beginning stage of learning php and i hope you guys > can help me out with this question: > > in a file named checkuser i do this when a users logs in: > PHP Code > // Register some session variables! > session_register('userid'); > $_SESSION['userid'] = $userid; > session_register('first_name'); > $_SESSION['first_name'] = $first_name; > session_register('last_name'); > $_SESSION['last_name'] = $last_name; > session_register('email_address'); > $_SESSION['email_address'] = $email_address; > session_register('user_level'); > $_SESSION['user_level'] = $user_level; > > Now let's say user 1 logs in, his session is registered (with userid > from database is 5 and first_name is XXX) Then another user logs in, > again his session is registered (with userid from database is 1 and > first_name is YYY) > > Now user 1 leaves the pages (closes the browser) and user 2 uploads a > document (with my own script). > > When the document is succesfully uploaded i display this: > PHP Code > echo ($_SESSION['first_name']).", the document has been succesfully > added"; echo ($_SESSION['userid']); > > This results in the folowing output: > YYY, the document has been succesfully added > 5 > > Meaning the $_SESSION['first_name'] is correct, but the > $_SESSION['userid'] is the one of the user who logged out... > > Now when using user_id in all places it seems to work correctly... > > Is userid something that is defined by the server when making > sessions? > > If not, i don't have any clue what is going wrong... > Can someone help me on this? So i know what is wrong? > > Thx in advance > > Reinhart Viane > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Where does the value $userid come from is it the result of a query i.e. SELECT userid FROM users WHERE username='$_POST['username']' AND passwd='$_POST['password']' or do you have a form (text/hidden) with that value? You mention userid and user_id maybe a typo, but those would be different. You can see all session variables (for testing) by adding: echo "\n"; print_r($_SESSION); echo "\n"; -- 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] Sessions question
Hey all, i'm new to this list so forgive me if i make any huge mistakes. I'm in a beginning stage of learning php and i hope you guys can help me out with this question: in a file named checkuser i do this when a users logs in: PHP Code // Register some session variables! session_register('userid'); $_SESSION['userid'] = $userid; session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; session_register('email_address'); $_SESSION['email_address'] = $email_address; session_register('user_level'); $_SESSION['user_level'] = $user_level; Now let's say user 1 logs in, his session is registered (with userid from database is 5 and first_name is XXX) Then another user logs in, again his session is registered (with userid from database is 1 and first_name is YYY) Now user 1 leaves the pages (closes the browser) and user 2 uploads a document (with my own script). When the document is succesfully uploaded i display this: PHP Code echo ($_SESSION['first_name']).", the document has been succesfully added"; echo ($_SESSION['userid']); This results in the folowing output: YYY, the document has been succesfully added 5 Meaning the $_SESSION['first_name'] is correct, but the $_SESSION['userid'] is the one of the user who logged out... Now when using user_id in all places it seems to work correctly... Is userid something that is defined by the server when making sessions? If not, i don't have any clue what is going wrong... Can someone help me on this? So i know what is wrong? Thx in advance Reinhart Viane -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php sessions question
in a page checkuser i do this after the user is logged in: PHP Code // Register some session variables! session_register('userid'); $_SESSION['userid'] = $userid; session_register('first_name'); $_SESSION['first_name'] = $first_name; session_register('last_name'); $_SESSION['last_name'] = $last_name; session_register('email_address'); $_SESSION['email_address'] = $email_address; session_register('user_level'); $_SESSION['user_level'] = $user_level; Now let's say user 1 logs in, his session is registered (with userid from database is 5 and first_name is XXX) Then another user logs in, again his session is registered (with userid from database is 1 and first_name is YYY) Now user 1 leaves the pages (closes the browser) and user 2 uploads a document (with my own script). When the document is succesfully uploaded i display this: PHP Code echo ($_SESSION['first_name']).", the document has been succesfully added"; echo ($_SESSION['userid']); This results in the folowing output: YYY, the document has been succesfully added 5 Meaning the $_SESSION['first_name'] is correct, but the $_SESSION['userid'] is the one of the user who logged out... Now when using user_id in all places it seems to work correctly... Is userid something that is defined by the server when making sessions? If not, i don't have any clue what is going wrong... Can someone help me on this? So i know what is wrong? Thx in advance Pout -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php