[PHP] Boolean Search Interpreter
Is there an algorithm in PHP or pseudo-code, or any other language that could help me write an algorithm to take a Boolean search string and parse it and convert it into SQL? I can convert it to SQL just fine, I just need help parsing the string and figuring out what they want (AND, NOT, OR). Thanks for any and all help!
[PHP] One Session ID, Multiple Domains
Is it possible to have one session ID and access it from two domains? Here's the situation: I have an online store. I use sessions to track the shopping cart. When I go to checkout and switch to SSL, it's on another domain (but still on the same machine). I need to access the session data from the non-SSL domain for checkout. How can I go about doing this? Passing the session ID through POST and GET didn't work, PHP just ignored it. Any help is greatly appreciated!
[PHP] .htaccess to change browscap setting
AllowOverride is set to All in apache, and when I put this in a .htaccess file, it changes the value: IfModule mod_php4.c php_value upload_max_filesize 750 /IfModule however, when I put php_value browscap /home/user/php/browscap.ini in there, it doesn't change the setting. Is browscap not changeable from .htaccess, or am I doing something wrong? Thanks for the help!
[PHP] sprintf() question
I read the manual page on sprintf, but I still don't understand exactly how the format string works. $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output 123.1; $formatted = sprintf(%01.2f, $money); // echo $formatted will output 123.10 How does that work? What part of the string corresponds to what? Thanks for any and all help!
[PHP] PHP Acronym: What does it mean to you?http://phpacronym.coolfreepage.com
Visit http://phpacronym.coolfreepage.com http://phpacronym.coolfreepage.com/ and submit what the PHP acronym means to you!
[PHP] TOC protocol (AOL Instant Messenger)
I'm interested in coding something in PHP which uses the TOC protocol to connect to AOL Instant Messenger (AIM). Has there been anything done like this in PHP? I'm also looking for more information on the TOC protocol. I have the protocol specs, but it doesn't say where the server is to connect to (same server as normal AIM, possibly?). Anyone who knows ANYTHING about this, please help.I don't know much ;-) Thanks for any and all replies.
[PHP] Build-up of MySQL Sessions
I'm running windows 2000 and the latest releases of PHP and MySQL. All database connections are made with mysql_pconnect(). Connections build up, however. The only person connecting to this webserver at the moment is myself. It seems that it opens connections and keeps them open, but doesn't always reuse them, thus causing it to open new ones. Is this a bug in mysql_pconnect()? Should I just use mysql_connect()? Any and all help is appreciated.
[PHP] Annoying GD problem (imagecopy) ---- SOMEONE PLEASE HELP!!!!!!
I have two images, for the sake of clarity, call them image A and image B. Image B is smaller than A, and it has a yellow background with a black foreground. Image A is just a color image, nothing special. When I use imagecopy() and put B on top of A, image B loses its yellow background. Both are jpeg images, and I'm outputting them as jpegs. If I don't use imagecopy() and output the images after reading them, they remain intact. What's going on? Thanks for the help!
RE: [PHP] PHP Boolean Interpreter - Need to search a mySQL database
This is no good because it doesn't check for single or double quotes. Inputting anything with quotes gives ugly ugly errors. Plus, Boolean interpreters should group quoted words as a single term. It doesn't check for malicious code input at all. I tried editing it to make it better, but after lots and lots of work, I didn't get very far. If you can fix it up, let me know =) -Original Message- From: Richard Archer [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 12, 2002 8:04 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP Boolean Interpreter - Need to search a mySQL database At 4:50 PM -0400 12/5/02, SpamSucks86 wrote: I was wondering if anyone knew of any good Boolean interpreters (NOT, AND, OR, +, -, |, )? I've found three, but they're VERY buggy and I wouldn't put them into production. Frankly, I don't have the time, patience, or ability to write a good one from scratch. Here are the three I've found in case anyone's interested: http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_My SQL/18/15665/index.html Thanks for that link... that's a great piece of code! With error reporting cranked right up it throws a few warnings, but no errors. It certainly performs as described. The only thing it doesn't seem to do is check for +. But adding that is a 30 second task. If this isn't good enough for you, just what are you looking for? ...R. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Boolean Interpreter - Need to search a mySQL database
I was wondering if anyone knew of any good Boolean interpreters (NOT, AND, OR, +, -, |, )? I've found three, but they're VERY buggy and I wouldn't put them into production. Frankly, I don't have the time, patience, or ability to write a good one from scratch. Here are the three I've found in case anyone's interested: http://www.evolt.org/article/Boolean_Fulltext_Searching_with_PHP_and_MyS QL/18/15665/index.html http://www.phpbuilder.com/snippet/detail.php?type=snippet http://www.phpbuilder.com/snippet/detail.php?type=snippetid=474 id=474 http://sourceforge.net/projects/phpsqlbool/ Thanks to anyone and everyone! =)
[PHP] Search Engine With Boolean Support --Please help
I need to have an internal search engine for my site. It needs to support Boolean (not, or, and). Are there any fairly simple scripts out there that will help me with this? Even if it's just to give me an idea of where to start. I'm using mySQL, and Boolean support isn't implemented until v4.0. Thanks for any and all help! =)
RE: [PHP] Search Engine With Boolean Support --Please help
I don't want to use a module though. I just want to take what a person types and parse it so I can put it into a mysql query and search my database of data. I share the server and I can't get mnoGoSearch compiled in with PHP, so unless there's PHP code I can borrow from it, I don't think it will help me. -Original Message- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 11, 2002 2:23 PM To: SpamSucks86 Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Search Engine With Boolean Support --Please help On Sat, 11 May 2002, SpamSucks86 wrote: I need to have an internal search engine for my site. It needs to support Boolean (not, or, and). Are there any fairly simple scripts out there that will help me with this? Even if it's just to give me an idea of where to start. I'm using mySQL, and Boolean support isn't implemented until v4.0. Thanks for any and all help! =) Have a look at http://mnogosearch.ru/ and the accompanying functions in the PHP manual. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] POST form File Upload Progress Bar?
I have a POST form with a file upload field. Users will be uploading pictures. What would be the most professional way to tell them their file is uploading and to please wait? Since the action page won't execute until after the image is done uploading, is there a way to have an intermediary page load telling them to please wait, and that page will take the image and upload it? Or should I just put a note in the upload form warning them about the long upload times and gray out the submit button with javascript after it's clicked?
[PHP] $HTTP_SESSION_VARS with unset()
when someone logs in, it sets $HTTP_SESSION_VARS with the appropriate information. to log them out, I tried just using unset($HTTP_SESSION_VARS['valid_user']) but it doesn't actually remove it from the session. it will only work if valid_user was set on the same script call (for example, if it logs me in and then immediately logs me out without making another call to the script). How come $HTTP_SESSION_VARS won't destroy session variables unless they're created during the same script call? Or maybe it just has to do with if $HTTP_SESSION_VARS creates any variable before it deletes any. Thanks for your help =)
[PHP] HTTP Request Headers - PUHLEASE HELP!
I have an infinitely annoying problem. I coded a script which tracks who viewed my profile in AOL Instant Messenger. When they click on a link (AIM inserts their screen name into the URL) the script records it. However, it does not replace spaces in their screen name with %20 like a normal browser would. IIS hates this and just returns bad request. Apache handles it a bit more gracefully, but everything after the space is lost. When I went to phpinfo() however, it displayed the GET header (GET blah.php?blah=wow wow HTTP/1.1). How can my script access the GET header? getallheaders() returns the headers but it excludes the GET line. Thankyou for your help!
RE: [PHP] regexp on user supplied link
I absolutely hate regular expressions because I suck at writing them...but I can help you with the logic. I was thinking search for a pattern which matches HREF= + any number of characters + . Your match would be HREF=blahblahblah. Then, you could go and chop off the HREF= and the lagging , and then you are left with just a URL. Then, you can use that built in url parser function (I forget its name, I think it might be urlparse()). Then, see if there is no host, it's obviously a relative link, otherwise, you can just see if the host matches or not. This should work well. Good luck -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 6:59 PM To: '[EMAIL PROTECTED]'; php Subject: RE: [PHP] regexp on user supplied link reg.ex. something like (not tested): a[^]* this would give you the entire anchor tag, then go from there? or what about using the XML parsing routines, get it to find the anchors and give you it's attributes, then go from there? Martin -Original Message- From: Justin French [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 20, 2002 10:46 AM To: php Subject: [PHP] regexp on user supplied link Hi, I have a website which is based purely on user-added content. The problem with this is that some areas allow users to use links in the text, and it's difficult to ensure that they all have a decent knowledge of attributes such as tartget=_new, etc etc. So, I'd like a script that... 1. looks at $text for any link tags, and for each tag, does the following: 2. throws out everything except the HREF eg: A HREF=http://www.somesite.com; target=_newclick/a becomes http://www.somesite.com A HREF=javascript:something(); becomes javascript:something(); 3. prefixe the url with A HREF= 4. establish if it's an internal or external link: so how do we establish if it's an external link? well it'd be easy if we just say anything begining with http:// is not relative, but because this content is user-driven, I'd like to be a little safer, and say anything that begins with http://www.mysite.com OR http://mysite.com; is an external link. 5. if it's an external link, suffix the URL with TARGET=_new, or if it's internal, suffix it with Anyway, that'd be a great start. From there, I might like to prex each external link to go thru a program called out.php to log affiliate activity, and I might like to retain onmouseover, onclick, onmouseout etc etc properties in the tag, I might like to ensure a session ID is found within each internal link, and stripped from each external link, ensure that the A has a matching /A etc etc, but the above would be a great start. Any help, especially with steps 1, 2 4, would be much appreciated. Thanks in advance, Justin French http://indent.com.au http://soundpimps.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
[PHP] RE: [PHP-DB] I cant get the logic for this...
I had this same problem. It's very aggravating. Jason G's solution won't work, because $oRow will always be true as long as there is more results, NOT if there are less than 3 results left. Why don't you true something like this ?php $nWidth = 3; $numrows = mysql_num_rows($result); //Now take the number of rows and figure out the number of extra cells not divisible by $nWidth $tmp = $numrows % $nWidth; //Cut off the extra number of cells $numevenrows = $numrows - $tmp; //Let's bring the number down to something easier to work with (number of even rows) $numevenrows = $numevenrows/$nWidth; //$tmp still contains the number of cells which don't fall evenly into a row while ($numevenrows 0) { //echo your row with 3 cells $numevenrows = $numevenrows - 1; } if ($numrows == 2) { //Write the last row with only two cells. You might want to just close the old table and make a new one and center it so that those two cells are centered, or you could use colspan=2 in the HTML so that one of the cells spans more. } elseif ($numrows == 1) { //same thing } ? This code is definitely untested, but I think you should understand the logic behind it, I did more commenting than I did coding. -Original Message- From: Jason G. [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 9:11 AM To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP-DB] I cant get the logic for this... $nWidth = 3; $oRow = TRUE; while($oRow) { //Write tr here for($i=0; $i$nWidth; $i++) { $oRow = mysql_fetch_object($dbResult); //Write td/td here } //write /tr here } At 12:06 PM 2/18/2002 +, you wrote: Hi all, I want to display return results from my query (which works fine) In I tidy way on screen. So my result returns say seven results, I have a table, and I want to show 3 results per row of the table... I.e.: Table TR TD = result1 /TD TD result2 /TD TD = result3 /TD /TD /TR TR TD = result4 /TD TD result5 /TD TD = result6 /TD /TD /TR TR TD = result7 /TD TD resultempty /TD TD = resultempty /TD /TD /TR /table The last two td in row 3 are empty because result found 7 results. This cant be fixed so echo statements wont work as the result could Be 3 or 10 or 56 or whatever. As Always your help and or guidance in this matter is appreciated. Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database 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] RE: [PHP-DB] I cant get the logic for this...
I had this same problem. It's very aggravating. Jason G's solution won't work, because $oRow will always be true as long as there is more results, NOT if there are less than 3 results left. Why don't you true something like this ?php $nWidth = 3; $numrows = mysql_num_rows($result); //Now take the number of rows and figure out the number of extra cells not divisible by $nWidth $tmp = $numrows % $nWidth; //Cut off the extra number of cells $numevenrows = $numrows - $tmp; //Let's bring the number down to something easier to work with (number of even rows) $numevenrows = $numevenrows/$nWidth; //$tmp still contains the number of cells which don't fall evenly into a row while ($numevenrows 0) { //echo your row with 3 cells $numevenrows = $numevenrows - 1; } if ($numrows == 2) { //Write the last row with only two cells. You might want to just close the old table and make a new one and center it so that those two cells are centered, or you could use colspan=2 in the HTML so that one of the cells spans more. } elseif ($numrows == 1) { //same thing } ? This code is definitely untested, but I think you should understand the logic behind it, I did more commenting than I did coding. -Original Message- From: Jason G. [mailto:[EMAIL PROTECTED]] Sent: Monday, February 18, 2002 9:11 AM To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP-DB] I cant get the logic for this... $nWidth = 3; $oRow = TRUE; while($oRow) { //Write tr here for($i=0; $i$nWidth; $i++) { $oRow = mysql_fetch_object($dbResult); //Write td/td here } //write /tr here } At 12:06 PM 2/18/2002 +, you wrote: Hi all, I want to display return results from my query (which works fine) In I tidy way on screen. So my result returns say seven results, I have a table, and I want to show 3 results per row of the table... I.e.: Table TR TD = result1 /TD TD result2 /TD TD = result3 /TD /TD /TR TR TD = result4 /TD TD result5 /TD TD = result6 /TD /TD /TR TR TD = result7 /TD TD resultempty /TD TD = resultempty /TD /TD /TR /table The last two td in row 3 are empty because result found 7 results. This cant be fixed so echo statements wont work as the result could Be 3 or 10 or 56 or whatever. As Always your help and or guidance in this matter is appreciated. Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database 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] RE: Sessions that last for ever
I think changing a setting in php.ini will do it, I'm just not sure which one. session.cache_expire seems like it might do something, or maybe session.gc_maxlifetime. Look them up in the manual -Original Message- From: Nigel Gilbert [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 16, 2002 7:44 AM To: [EMAIL PROTECTED] Subject: Sessions that last for ever By default, a session (created with session_register) seems to last just as long as the user has their browser open. If a user quits the browser, the session is automatically destroyed. I want a session to last indefinitely (or until my program destroys it). There are some hints about how this could be done with cookies in the documentation, but not a clear recipe. What sequence of PHP statements should I use to achieve this? Thanks for any help, Nigel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] How to keep form inputs from being cleared
With --enable-trans-sid the problem still exists. For example, a user logs in and cookies are disabled. He browses to a page which doesn't load the session. Then from there he goes to a page that does use sessions. Unless I'm mistaken, --enable-trans-sid won't add the session ID unless the session is started on the page. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 07, 2002 11:24 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] How to keep form inputs from being cleared On Friday 08 February 2002 04:33, CompMan86 wrote: I posted about this a few days ago. I received several responses but none of them were very helpful (thanks for the effort though). I finally figured out what it was by process of elimination. At the top of my registration form, I put session_start() just like I did for all my other scripts. Well it turns out that by doing this, for some reason, it clears the form. I have a hunch that the cookie request by session_start() has something to do with it. Well, the only reason someone would be at the registration form would be if he/she was not a member, therefore the session ID would be pointless. This is the major flaw of PHP's built in sessions imho: If a user disables cookies, the session functions assign the session ID to the constant SID. However, if the SID is not passed on religiously, a new session will be made. In an instance like this where session_start() cannot be used, you can't pass on the SID. It seems like I'm just going to resort to requiring that my users enable session cookies. The hastle of making the code to use both SID and/or cookies just doesn't seem worth it. If anyone has any ideas of a resolution to this problem, feel free to post here or email me. If you have full access to your server you can recompile php with the --enable-trans-sid option. Once this is done the SID will be *automagically* be propagated via the URL or hidden form elements. An extremely useful feature if you need sessions and cannot rely on the user having enabled cookies. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Type louder, please. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] How do I keep form inputs from being cleared - Please Help!
I have a registration form and if a user enters bad information and the php script generates an error, I want the user to be able to hit back and have his inputs still there. Most websites I've ever used do this, but for some reason, my form loses all its data when the back button is pushed. This doesn't seem like something unique to PHP, but I thought maybe you guys could shed some light. Maybe a header which instructs the browser to cache it? Btw, I plan on having the script reprint the form with the old values anyway, but for reference I'd really like to know because I haven't been able to figure it out. Thanks for any help! =) -Me
RE: [PHP] Need opinion On sessions - Cookies mandatory?
The idea of building a website is largely to accommodate as large a portion of your visitors as possible. I'm not worried about people bookmarking sessionID's, but what if someone copy/pastes the URL to a friend and they use the section. My friend gave me an excellent idea, and that is to check their IP and store the IP in the session. If the IP doesn't match, then start a new session. This would be perfect, because there's a double check. If someone disconnects to the internet but never closes their browser, I don't think they should be allowed to continue their session anyway, they should be required to login again. -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED]] Sent: Wednesday, January 23, 2002 3:35 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Need opinion On sessions - Cookies mandatory? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Jason G. blurted If cookies do not work, then you must have a session_id appended to the URL. HTTP is a stateless protocol. So every time you make a request via HTTP, you must let PHP know what the session_id is either through cookies, or url query strings (or possibly posted with a form). Yep, now I'm with you. The amount of times you'd see that kind of ugly URL would be fairly minimal in most situations as most users these days aren't even aware they *can* disable cookies. disable cookies, but appending the session ID could be a security risk. Consider this: Someone is viewing a page and says oh cool, I want Joe to see this. He then copy/pastes the URL, sessionID and all, to Joe, who then loads up the page using his friend's SessionID. With cookies, this would not happen. Not a problem. The session is *destroyed* as soon as a user closes the browser. A session will only be *destroyed* if it uses a cookie. PHP never knows when you close the browser, but the browser will remove the cookie. Next time you fire up the browser, it will not send the cookie, and a different session will be started. Sure. But there is some kind of clean on the host machine right? You couldn't expect to continue a session a week later because you've bookmarked a URL containind a SID. I think this is controlled by something like a timeout var in the php.ini. In my personal experience, using cookies only has not proven to be a problem. Your call. When you say using cookies only do you mean 'requiring' the user to have cookies enabled? - -- Nick Wilson Tel:+45 3325 0688 Fax:+45 3325 0677 Web:www.explodingnet.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.6 (GNU/Linux) iD8DBQE8TnW3HpvrrTa6L5oRAthOAJ0WOpUWC5fFMokhYF2QsaQaQolp+wCfQWHL 03BrqRN2kLf+VWC/tzDSHho= =Gek0 -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Basic Authentication with IIS
With apache, you can easily match up a L/P to an htpasswd file. With IIS, the user has to be created as the windows level. I'm moving a site from an apache server to an IIS server, and need to figure out an easy way to do basic authentication. I guess putting a chunk of code at the top of every script to check headers would be appropriate, but that would be a lot of work for this site, plus I have PHP scripts that I didn't write and are very complex and trying to edit them in order to accomplish this would be hell. What other alternatives do I have for basic authentication on IIS? Is there a way maybe to make users on the O/S and just give them minimal permissions? If there's an article somewhere on this, just give me the link =) Thanks for your help!