Re: [PHP-DB] Google Style Search Results
Sure, Firstly, thank you for the credit, that was only my second mid-scale project, coded ground up in Textpad 4 ;-) enough patting my own back, onto business.. http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC Notice some changes?? You've just sparked a interest in me to revise and rewrite some of the code for that page this lovely 33 degree celcius summer Friday afternoon here in Australia.. :-) Previously, it was only really just pumping out the first sentence or so of text from the matched query.. Now though it is actually going through each query word and matching a set number of words surrounding it [in this case I've made it five] and throwing that out in the extraction field... with each of these said matches being seperated by a ellipsis [...] All I did was conjure up a regular expression that basically just matches words :-) haha ironically.. Here it is: $extract_result=; preg_match_all(/((?:[\w]+ ?){0,5})[\w \.\,\-\;]((?:.join(|,$q_arr).))([\w]*)[\w \.\,\-\;]((?:[\w]+ ?){0,5})/i,$row[content],$ext_matches,PREG_SET_ORDER); foreach($ext_matches as $ext_arr) { $extract_result .= $ext_arr[1]. B.$ext_arr[2]./B.$ext_arr[3]. .$ext_arr[4]. ... ; } Are you familiar with regex? It really shouldn't be hard to implement a similiar concept with whatever your current search system does.. My system as can be seen from this above code actually breaks up the query string sent via the form on search page into each word.. therefore you have an array [$q_arr] that looks like Array( sufficient, large) .. Hence in that regex above i just did a join using the | pipe symbol.. I use this so when it joins all the words together they come out as: word1|word2|word3 meaning regex will match 5 or less words before and after any of the given words. the | symbol means bitwise OR, for example: run(ning|ner) will match running or runner but not runs Sorry if you already know some of this I am just trying to make sure I explain myself fully as I am unawares as to your experience level. Anyway, so yes I simply use the handy preg_match_all function which will run this regex statement upon the entire $row[content] which in my case is just the entire content of the post which it found to match words in.. and from that it simply matches these certain given keywords and their surrounding word/s.. I then use a foreach structure to simply iterate over each of the matches and create the lovely string you see before you, it does this simply by reprinting the original matched string, creating a B/B bold effect on the given search word and adding an ellipsis at the end for simple athestic reasons.. If you want any more examples or clarification please feel free to ask.. Enjoy ;-) ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: [EMAIL PROTECTED] To: Julien Bonastre [EMAIL PROTECTED] Sent: Friday, December 09, 2005 12:42 AM Subject: Re: [PHP-DB] Google Style Search Results Great site, Julien! Probably more involved than we need for our project, but very, very impressive. I really like the CSS styling in particular. If you could tell me how you are displaying the content within the extract field, that would be very helpful. Regards, David David P. Giragosian, Psy.D. Database and Software Developer 713-798-7898 |-+-- | | | | | | | | Julien Bonastre| | | [EMAIL PROTECTED]| | | | | | | | | | | | 12/08/2005 05:23 AM| | | Please respond to Julien| | | Bonastre| | | | | | | |-+-- -| | | | | |
Re: [PHP-DB] Google Style Search Results
On 12/9/05, Julien Bonastre [EMAIL PROTECTED] wrote: snip http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC snip All I did was conjure up a regular expression that basically just matches words :-) haha ironically.. Here it is: $extract_result=; preg_match_all(/((?:[\w]+ ?){0,5})[\w \.\,\-\;]((?:.join(|,$q_arr).))([\w]*)[\w \.\,\-\;]((?:[\w]+ ?){0,5})/i,$row[content],$ext_matches,PREG_SET_ORDER); foreach($ext_matches as $ext_arr) { $extract_result .= $ext_arr[1]. B.$ext_arr[2]./B.$ext_arr[3]. .$ext_arr[4]. ... ; } Are you familiar with regex? snip I'm not very familiar with regex at all and was wondering if you could tell me how your regex would handle two matched search strings that exist within a few words of each other in the text. For example A larger server would be sufficient I think. Also in the link you provided (reproduced below) the first matched word is surrounded by 4 words and the second by 5 words, is there a reason for this? An example of a larger post can be found ... we were to add a sufficient amount of text than we ... Thank you. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] inserting data into Oracle tables
Is there a standard for inserting data into Oracle tables from a user input field in PHP? Most Oracle tables will have a limit on the amount characters such as Name VARCHAR2(60 BYTE) - this means the maximum amount of characters allowed is 60. If you use special characters in PHP such as entering the following into a input box ¬!£$%^*()[EMAIL PROTECTED]?|\,./;'#][=-¦abcdefghijklmnopqrstuvwxyzA When this gets passed to Oracle it takes the overall characters in the insert statement to 64, which then fails because it is over the Oracle table limit. Is there a standard way of dealing with something like this. Regards, David -- David Skyers Support Analyst Management Systems, UCL [EMAIL PROTECTED] 020 7679 1849 (internal 41849) -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] Quick question
On 08 December 2005 20:53, Chris Payne wrote: Hi there everyone, How do I set the following items with ini_set()? I looked at the manual but when I try nothing happens: * file_uploads * upload_max_filesize * max_input_time * memory_limit * max_execution_time * post_max_size Apart from max_execution_time, the things affected by those settings all take place before your script even gains control -- so changing them in the script can never have any useful effect. To do any good, they must be set in an appropriate config file (php.ini, httpd.conf, .htaccess, etc.) as permitted. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Manipulating text
Quite right.. BU: and I quote: $variable = play_time; how may I remove play_ from $variable and just have $variable equal to time? To me, that is asking to strip or remove the string play_ from the string play_time Am I wrong? Especially when reinforced with and just have the $variable equal to 'time'? Sorry, I wasn't aiming to create a problem or disorder, but I was merely stating the way I thought most effective to get the end result it seemed that at the time you wanted from that question. Sure an array is ONE possibility, while we're on the same track I could also convert the string to binary and let you manipulate it that way.. Hey same result, just different method. Glad to know you've found a way to get around it anyway, thats what these lists are for.. ;-) Regards ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Ron Piggott (PHP) [EMAIL PROTECTED] To: Julien Bonastre [EMAIL PROTECTED] Sent: Friday, December 09, 2005 8:43 PM Subject: Re: [PHP-DB] Manipulating text There may some merit in an array for a response --- I didn't say what I was going to do with this once I had my single word. Ron On Fri, 2005-12-09 at 18:33 +1000, Julien Bonastre wrote: Alternatively you may again use a regex statement [Aside] Is it just me? Or does nobody know how to use or of the existence of Regular Expressions?? Why does nobody suggest them??? I find them not only a God send, but more of a primitive form of God[or Allah/Buddah/insert deity here]'s very first most useful creation ever. I find water less important than that of Regular Expressions.. Ok so I have exaggerated as usual, but do you get my point?? blah! [/Aside] $str = this_word; $clean_str = preg_replace(/.*_([\w]+)$/i,$1,$str); That would work as well... Plus the advantage is that you don't return with an array, not that arrays are all that bad, my first child will be named Arrarius.. Ok.. more bullcrap.. haha, nevertheless, depending on the situation, you may WANT to have an array returned in which will simply be exploding, or spliting the elements of the string seperated by the _ underscore character in an array.. If you are simply wanting to strip any word before and including the underscore character and return with a clean string, then my method is great for that. I just seem to have read your question and obviously intepreted it differently than the others?? Let me know what you prefer. ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Ron Piggott (PHP) [EMAIL PROTECTED] To: [EMAIL PROTECTED]; PHP DB php-db@lists.php.net Sent: Friday, December 09, 2005 2:13 PM Subject: Re: [PHP-DB] Manipulating text Thanks for telling me the 'explode' command. Ron On Fri, 2005-12-09 at 08:07 +0530, Amol Hatwar wrote: On Thu, 2005-12-08 at 21:25 -0500, Ron Piggott (PHP) wrote: If I have $variable = play_time; how may I remove play_ from $variable and just have $variable equal to time? If you are hinting at '_' as a delimitter, you can use explode(). Learn more about it here: http://php.net/explode Regards, ah -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Google Style Search Results
Yay, Questionnaire time I love this part of the game a) I'm not very familiar with regex at all and was wondering if you could tell me how your regex would handle two matched search strings that exist within a few words of each other in the text. For example A larger server would be sufficient I think. Answer: As I think I may have mentioned All I did was conjure up a regular expression True, I didn't imply I wrote that regex in under 32 seconds...But I'm sure I was trying to come across with the fact that with improvement it could be much more powerful. Like this example: http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=were%2Baddst=postsb%5B%5D=*maxres=25ob=datetimeot=DESC Is that better?? multiple words within the same piece of string.. Again, much much much more work can be done, this was a very quick stub example to show the flexibility of regex.. Now a new issue that has been presented is if you DO have multiple words close together it will only grab x amount of words to the before and after that central word, including perhaps another keyword.. as you can see on above link.. Again, give me another 3 minutes in the code and I'm sure I'll work that one too.. b)Also in the link you provided (reproduced below) the first matched word is surrounded by 4 words and the second by 5 words, is there a reason for this? Answer: Ooh this is my favourite :-) Yes, great reason why when you conduct a search such as this: http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC You received the 4 word and 5 word output.. Why don't you head over to the link that is generated on that search result entry?? Look around at the actual content of that forum entry and you will soon see that the first match occurs on a line that physically only has 9 words, therefore it can only really match what exists. Good point though, for a split second I actually thought to myself there might be something wrong, but as usual and until I'm proved wrong; I'm right again. PHP and REGEX have never failed me. I'm sure you all are well aware already of the saying that describes how there is no such thing as computer errors, only stupid humans. And that is precisely it, I have been and still am a stupid human, and I will usually sit there for quite a while reloading and running a regex in my head to ensure it runs and parses as it should. Simple ones like this don't take too much planning, but they can get hairy :-) Hopefully that answers your queries Graham.. Kindest Regards to everybody! Julien Bonastre ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Graham Cossey [EMAIL PROTECTED] To: Julien Bonastre [EMAIL PROTECTED]; php-db@lists.php.net Sent: Friday, December 09, 2005 7:10 PM Subject: Re: [PHP-DB] Google Style Search Results On 12/9/05, Julien Bonastre [EMAIL PROTECTED] wrote: snip http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC snip All I did was conjure up a regular expression that basically just matches words :-) haha ironically.. Here it is: $extract_result=; preg_match_all(/((?:[\w]+ ?){0,5})[\w \.\,\-\;]((?:.join(|,$q_arr).))([\w]*)[\w \.\,\-\;]((?:[\w]+ ?){0,5})/i,$row[content],$ext_matches,PREG_SET_ORDER); foreach($ext_matches as $ext_arr) { $extract_result .= $ext_arr[1]. B.$ext_arr[2]./B.$ext_arr[3]. .$ext_arr[4]. ... ; } Are you familiar with regex? snip I'm not very familiar with regex at all and was wondering if you could tell me how your regex would handle two matched search strings that exist within a few words of each other in the text. For example A larger server would be sufficient I think. Also in the link you provided (reproduced below) the first matched word is surrounded by 4 words and the second by 5 words, is there a reason for this? An example of a larger post can be found ... we were to add a sufficient amount of text than we ... Thank you. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Google Style Search Results
On 12/9/05, Julien Bonastre [EMAIL PROTECTED] wrote: Yay, Questionnaire time I love this part of the game a) I'm not very familiar with regex at all and was wondering if you could tell me how your regex would handle two matched search strings that exist within a few words of each other in the text. For example A larger server would be sufficient I think. Answer: As I think I may have mentioned All I did was conjure up a regular expression True, I didn't imply I wrote that regex in under 32 seconds...But I'm sure I was trying to come across with the fact that with improvement it could be much more powerful. Like this example: http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=were%2Baddst=postsb%5B%5D=*maxres=25ob=datetimeot=DESC Is that better?? multiple words within the same piece of string.. Again, much much much more work can be done, this was a very quick stub example to show the flexibility of regex.. Now a new issue that has been presented is if you DO have multiple words close together it will only grab x amount of words to the before and after that central word, including perhaps another keyword.. as you can see on above link.. Again, give me another 3 minutes in the code and I'm sure I'll work that one too.. b)Also in the link you provided (reproduced below) the first matched word is surrounded by 4 words and the second by 5 words, is there a reason for this? Answer: Ooh this is my favourite :-) Yes, great reason why when you conduct a search such as this: http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC You received the 4 word and 5 word output.. Why don't you head over to the link that is generated on that search result entry?? Look around at the actual content of that forum entry and you will soon see that the first match occurs on a line that physically only has 9 words, therefore it can only really match what exists. Good point though, for a split second I actually thought to myself there might be something wrong, but as usual and until I'm proved wrong; I'm right again. PHP and REGEX have never failed me. I'm sure you all are well aware already of the saying that describes how there is no such thing as computer errors, only stupid humans. And that is precisely it, I have been and still am a stupid human, and I will usually sit there for quite a while reloading and running a regex in my head to ensure it runs and parses as it should. Simple ones like this don't take too much planning, but they can get hairy :-) Hopefully that answers your queries Graham.. Kindest Regards to everybody! Julien Bonastre snip Thanks for that Julien, I really must find the time to look more into Regexs. -- Graham -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Google Style Search Results
Thats ok, sorry to have come across a bit 'narky' in that response by the way I was just under some pressure at the time, I should really compose myself more before trying to lend a hand or some advice and head to the deep end in my ramblings.. haha There really isn't much to Regex to be honest, whilst some patterns can look awfully complicated, and I will admit, generally you can't really neaten up long patterns as it just looks unreadable after wards.. For example: // Parse input string via forum URL substitution method.. $parsedBodyStr = preg_replace(/\[URL(?:\=*([^\]]*))\]([^\[]*)\[\/URL\]/sie,'A HREF=\'.forumFormatPostURL(\$2\).'\ TARGET=_BLANK'.(strlen(\$1\) 0 ? \$1\ : \$2\).'/A',$parsedBodyStr); It is simply a line that is designed to convert custom forum embedded hyperlink anchors into functional HTML standard anchors.. Whilst somewhat ugly to look at, it works 100% everytime. see my forum, like many other similiar class PHP forums, only allows url's to be entered via some custom structure: [url]http://the-spectrum.org[/url] and as a small feature I also add the title parameter, [url=The Religion of Gurus!]http://php.net[/url] These would be respectively entered in the code when someone views that forum page and its messages as: http://the-spectrum.org and The Religion of Gurus! Now, trying to neaten that: // Parse input string via forum URL substitution method.. $parsedBodyStr = preg_replace( /\[URL(?:\=*([^\]]*))\]([^\[]*)\[\/URL\]/sie, 'A HREF=\'.forumFormatPostURL(\$2\).'\ TARGET=_BLANK'.(strlen(\$1\) 0 ? \$1\ : \$2\).'/A', $parsedBodyStr ); Not much of an improvement.. Unfortunately you can't really go about entering spaces and so forth in your patterns otherwise it will render them unfunctional. You can go around it different ways.. I neaten my code and enhance reusability by simply conquering a particular pattern, and then that is just placed in a global $SYSTEM[REGEX_FILTER] array which I can access later on in a shorthand version, keeps code legible Particular if you are going to be using either a lot of patterns or even using one single pattern very often, Remember this does nothing for perfomance, purely asthetics only.. The easiest way to learn, just as I learnt mastering php, mysql, apache2 and picking up unix/bsd, c++, object pascal, and the list goes on.. Is to teach yourself.. I never paid a cent to learn php/mysql, never went to a single tutor/lecture/seminar etc.. Just hop on the net, you'll find tonnes of resources if you want examples, or better yet, invent a problem you want to solve with some kind of manipulation with a string, and try to code a pattern for it.. I guarantee you there will be a pattern for virtually any problem you could imagine needing a fix for.. I have never encountered a problem yet where a regex pattern can't pull me out of trouble Believe this or not, but I learnt the basics of regex patterns in Perl, but it wasn't till I hit the PHP PCRE [Perl-Compliant Reg Exp] references which refer to the pattern modifiers and syntax that I really picked up on it.. That syntax guide along with the modifier page are excellent to start working off.. Very specific, short examples given for many different aspects.. I personally love it anyway.. Well, enjoy.. ta ta for now! ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Graham Cossey [EMAIL PROTECTED] To: Julien Bonastre [EMAIL PROTECTED] Cc: php-db@lists.php.net Sent: Saturday, December 10, 2005 12:42 AM Subject: Re: [PHP-DB] Google Style Search Results On 12/9/05, Julien Bonastre [EMAIL PROTECTED] wrote: Yay, Questionnaire time I love this part of the game a) I'm not very familiar with regex at all and was wondering if you could tell me how your regex would handle two matched search strings that exist within a few words of each other in the text. For example A larger server would be sufficient I think. Answer: As I think I may have mentioned All I did was conjure up a regular expression True, I didn't imply I wrote that regex in under 32 seconds...But I'm sure I was trying to come across with the fact that with improvement it could be much more powerful. Like this example: http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=were%2Baddst=postsb%5B%5D=*maxres=25ob=datetimeot=DESC Is that better?? multiple words within the same piece of string.. Again, much much much more work can be done, this was a very quick stub example to show the flexibility of regex.. Now a new issue that has been
[PHP-DB] php5 with imap
I'm trying to build and install php-5.1.1 on My Mac OS X 10.4.3 I can build it with out imap but can't get it to work when I enter it in: ./configure --prefix=/usr/local/php --with-apxs --enable-force-cgi- reidirect --enable-fast-cgi --with-openssl=/usr --with-dom=/usr/local/ php --with-gd --with-mysql --with-mysql-socket=/tmp/mysql.sock -- enable-sockets --enable-wddx --enable-xslt --with-zlib=/usr --with- xml --with-xmlrpc --enable-exif --enable-wddx --enable-ftp --enable- mbstring -enable-xslt --with-ldap --with-xml --with-xmlrpc --with- iodbc=/usr --enable-sockets --enable-dbx --enable-dbase --enable- trans-sid --with-dom=/usr/local/php --with-dom-xslt=/usr/local/php -- with-dom-exslt=/usr/local/php --with-xslt-sablot=/usr/local/php -- enable-zend-multibyte --enable-maintainer-zts --with-openssl=/usr -- with-jpeg-dir=/usr/local/php --with-imap-ssl=/usr --with-imap=../ imap-2004g I already ran make osx in imap-2004g When building I get: checking whether build with IMAP works... no configure: error: build test failed. Please check the config.log for details. config.log configure:47438: checking whether build with IMAP works configure:47476: gcc -o conftest -DBIND_8_COMPAT=1 -DEAPI -O3 -no- cpp-precomp -L/usr/local/php/lib -L/usr/local/php/lib -L/usr/local/ lib -L/usr/local/lib -L/Users/badams/Desktop/imap-2004g/c-client -L/ Users/badams/Desktop/imap-2004g/c-client conftest.c -lc-client - lssl -lcrypto -lpam -lpng -lz -ljpeg -lssl -lcrypto -lz -lssl - lcrypto -lm -lxml2 -lz -liconv -lm -lxml2 -lz -liconv -lm 15 /usr/bin/ld: Undefined symbols: _gss_accept_sec_context _gss_acquire_cred _gss_delete_sec_context _gss_display_name _gss_display_status _gss_import_name _gss_init_sec_context _gss_nt_service_name _gss_release_buffer _gss_release_cred _gss_release_name _gss_unwrap _gss_wrap _krb5_aname_to_localname _krb5_free_context _krb5_free_principal _krb5_init_context _krb5_kt_close _krb5_kt_default _krb5_kt_start_seq_get _krb5_parse_name collect2: ld returned 1 exit status configure: failed program was: #line 47449 configure #include confdefs.h void mm_log(void){} void mm_dlog(void){} void mm_flags(void){} void mm_fatal(void){} void mm_critical(void){} void mm_nocritical(void){} void mm_notify(void){} void mm_login(void){} void mm_diskerror(void){} void mm_status(void){} void mm_lsub(void){} void mm_list(void){} void mm_exists(void){} void mm_searched(void){} void mm_expunged(void){} char mail_newbody(); int main() { mail_newbody(); return 0; } -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Ending session
How do you actually end $_session variables so the session actually ends? I found the session_write_close() command. I am not sure if this is the correct command or not. One prime example I am using is a $_session variable to track which user account is active. I want to have a log off button which closes the session off. Ron -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Ending session
At 05:30 PM 12/9/2005, Ron Piggott (PHP) wrote: How do you actually end $_session variables so the session actually ends? I found the session_write_close() command. I am not sure if this is the correct command or not. One prime example I am using is a $_session variable to track which user account is active. I want to have a log off button which closes the session off. Ron Ron, This may be overkill, but on a failed login I did not want the ckval variable hanging around in any form, hence: session_unregister( ckval ); unset($_SESSION[ckval]); unset( $ckval ); session_destroy(); Hope this helps - Miles -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP-DB] Google Style Search Results
- Original Message - From: Ming Xiao To: Julien Bonastre Sent: Friday, December 09, 2005 7:04 PM Subject: Re: [PHP-DB] Google Style Search Results hello everybody who knows ajax , I want to make a website use ajax technolgy. thanks,everybody! 2005/12/9, Julien Bonastre [EMAIL PROTECTED]: Sure, Firstly, thank you for the credit, that was only my second mid-scale project, coded ground up in Textpad 4 ;-) enough patting my own back, onto business.. http://aries.the-spectrum.org/webdev/wawd/forums/search.php?q=sufficient%2Blargest=postsb%5B%5D=*maxres=25ob=datetimeot=DESC Notice some changes?? You've just sparked a interest in me to revise and rewrite some of the code for that page this lovely 33 degree celcius summer Friday afternoon here in Australia.. :-) Previously, it was only really just pumping out the first sentence or so of text from the matched query.. Now though it is actually going through each query word and matching a set number of words surrounding it [in this case I've made it five] and throwing that out in the extraction field... with each of these said matches being seperated by a ellipsis [...] All I did was conjure up a regular expression that basically just matches words :-) haha ironically.. Here it is: $extract_result=; preg_match_all(/((?:[\w]+ ?){0,5})[\w \.\,\-\;]((?:.join(|,$q_arr).))([\w]*)[\w \.\,\-\;]((?:[\w]+ ?){0,5})/i,$row[content],$ext_matches,PREG_SET_ORDER); foreach($ext_matches as $ext_arr) { $extract_result .= $ext_arr[1]. B.$ext_arr[2]./B.$ext_arr[3]. .$ext_arr[4]. ... ; } Are you familiar with regex? It really shouldn't be hard to implement a similiar concept with whatever your current search system does.. My system as can be seen from this above code actually breaks up the query string sent via the form on search page into each word.. therefore you have an array [$q_arr] that looks like Array( sufficient, large) .. Hence in that regex above i just did a join using the | pipe symbol.. I use this so when it joins all the words together they come out as: word1|word2|word3 meaning regex will match 5 or less words before and after any of the given words. the | symbol means bitwise OR, for example: run(ning|ner) will match running or runner but not runs Sorry if you already know some of this I am just trying to make sure I explain myself fully as I am unawares as to your experience level. Anyway, so yes I simply use the handy preg_match_all function which will run this regex statement upon the entire $row[content] which in my case is just the entire content of the post which it found to match words in.. and from that it simply matches these certain given keywords and their surrounding word/s.. I then use a foreach structure to simply iterate over each of the matches and create the lovely string you see before you, it does this simply by reprinting the original matched string, creating a B/B bold effect on the given search word and adding an ellipsis at the end for simple athestic reasons.. If you want any more examples or clarification please feel free to ask.. Enjoy ;-) ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: [EMAIL PROTECTED] To: Julien Bonastre [EMAIL PROTECTED] Sent: Friday, December 09, 2005 12:42 AM Subject: Re: [PHP-DB] Google Style Search Results Great site, Julien! Probably more involved than we need for our project, but very, very impressive. I really like the CSS styling in particular. If you could tell me how you are displaying the content within the extract field, that would be very helpful. Regards, David David P. Giragosian, Psy.D. Database and Software Developer 713-798-7898 |-+-- | | | | | | | | Julien Bonastre| | | [EMAIL PROTECTED]| | | | | | | | | | | | 12/08/2005 05:23 AM| | | Please respond to Julien| | | Bonastre| | | | | | |
Re: [PHP-DB] Ending session
Wow Miles You certainly want to kill that session !! Well done ;-) Well I must admit I use a similiar tactic for user-leech session cookies: function sessionKill() { global $SYSTEM,$DB; mysql_query(delete from sys_activity where user_name='.$MEMBER[user_name].',$DB); session_unset(); } I used to do all that seperate unset'ing of session var's, but then learnt it's useless and redundant. Unset()'ing the session unregisters all attached variables.. hence what I want it to do. The mysql element is a system I use to track users logged into site.. Every page that they request on the system will insert a row into a table listing their user_name, page they are on and time they last hit that request. That way I can display in their profile a list of last viewed pages, and also I can run a timeout cron like php job which purges out these activity entries after a set period [mine is 10 mins] which removes that entry from the table, that way the table only holds the most recent pages you have visited or been too.. In addition to this, I can also display when the user was last 'active' on the system by using the most recent timestamp in these entries.. As for the logout principle, I actually use that function above, with just a simple few lines in header source as follows: if(isset($_GET[logout])) { sessionKill(); header(Location: http://.$_SERVER[HTTP_HOST].$SYSTEM[WWW_ROOT;]); exit(); //Purely a safe-guard, there is no reason the header function wouldn't work, but we don't want them to continue on regardless.. } I use a fairly high integration of header and library files to generate content, and there is no non-dynamic page on the site, all of them refer to the headers, and various dozen or more include libraries so therefore they all parse a session.lib.php library that runs that above code and functions for handling, manipulating sessions etc.. Therefore any page you goto on the site regardless of existing GET or POST requests, as soon as a logout variable is set in the request URI then my system will pick it up before any further processing [my session handling lib is of course positioned fairly close to the start of the header initialisation as session functions obviously require sending HTTP header statements before content is generated to the HTTP client.] and simply kill the session and redirect them to a front page.. I use this in conjunction with a simple button on the login form [once you are logged in] or even a simple html anchor such as: [ A HREF=?=$_SERVER[PHP_SELF]??logout=1Logout/A ] provides an easy escape. One click they're out.. And as I mentioned above, because the session will be unset all variables freed BEFORE any further processing, the header can continue initialising and when it reaches the content generation and layout formatting it will try accessing the now unset variables and draw up the default layouts [ie login form instead of post-login form, etc] So smooth and elegant ;-) Enjoy.. ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Miles Thompson [EMAIL PROTECTED] To: PHP DB php-db@lists.php.net Sent: Saturday, December 10, 2005 8:44 AM Subject: Re: [PHP-DB] Ending session At 05:30 PM 12/9/2005, Ron Piggott (PHP) wrote: How do you actually end $_session variables so the session actually ends? I found the session_write_close() command. I am not sure if this is the correct command or not. One prime example I am using is a $_session variable to track which user account is active. I want to have a log off button which closes the session off. Ron Ron, This may be overkill, but on a failed login I did not want the ckval variable hanging around in any form, hence: session_unregister( ckval ); unset($_SESSION[ckval]); unset( $ckval ); session_destroy(); Hope this helps - Miles -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Emails Bouncing
I have the same issue :-) And I recently noticed another email address popped up in the error too.. Should we really be getting these mail daemon errors? or should the list bot?? Has this always been the case? I'm only new to this list... Ciao! ---oOo--- Allowing users to execute CGI scripts in any directory should only be considered if: ... a.. You have no users, and nobody ever visits your server. ... Extracted Quote: Security Tips - Apache HTTP Server ---oOo--- --oOo---oOo-- Julien Bonastre [The_RadiX] The-Spectrum Network CEO ABN: 64 235 749 494 [EMAIL PROTECTED] www.the-spectrum.org --oOo---oOo-- - Original Message - From: Joseph Crawford [EMAIL PROTECTED] To: [PHP-DB] Mailing List php-db@lists.php.net Sent: Friday, December 09, 2005 7:13 AM Subject: [PHP-DB] Emails Bouncing I keep getting the following, can someone from the staff rectify this please Your message To: Subject: Re: [PHP-DB] Restricting What's Retreived Sent: Thu Dec 08 09:56:44 2005 did not reach the following recipient(s): [EMAIL PROTECTED] on Thu Dec 08 09:56:44 2005 The e-mail account does not exist at the organization this message was sent to. Check the e-mail address, or contact the recipient directly to find out the correct address. grisu.itxnet.local #5.1.1 Thanks, -- Joseph Crawford Jr. Zend Certified Engineer Codebowl Solutions, Inc. 1-802-671-2021 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php