Re: [PHP] Credit card storing, for processing
HI Richard, thanks for the info. With regard to the setup it will be something more or less like this: I want to generate my own keypair. The private key I keep secure, offline, on the machine that does the admin (charging, refunds etc). The public key is used on the server to encrypt card details the minute they arrive on the server (even using SSL, the data will arrive unencrypted because the web server decrypts it). Encrypted card details are written to file, and moved off the server overnight by a cron job. On the admin machine, offline, the details get decrypted when needed to perform transactions, using the private key. The admin box is on ADSL, but behind a firewall with no services or ports open to the internet. I.e it can initiate a connection to the server on the internet, but not the other way around. Does this setup sound secure enough and a solution that can work? What kind of encryption should I be using? Point out any areas where you think I might be missing something or going wrong. Thanks in advance. Angelo >>> "Richard Lynch" <[EMAIL PROTECTED]> 01/31/05 8:37 PM >>> Angelo Zanetti wrote: > this might be slightly OT but I know that the list has quite a > knowledgable crowd =) So here is my situation: > > I have a client who I have developed a site for in PHP it provides > various models for shares forecasts, the way it works is that people > register for free (with their credit card details-https) now if they > are > not satisfied after a month they must just unsubscribe. If they have > not > unsubscribed after the first month they become a customer and each > month > their credit card is charged the relevant amount depending on what > they > have subscribed for. > > Now our the complication is as follows: I know that storing client's > credit card details online is a big NONO, so we would have to move the > credit card details offline when they register. Im not sure how to go > about this. Whether to save the details in text files somewhere else > on > the server or save to text files not on the server but another > location. > > Can anyone recommend/advise the best way to do this, also what type of > encryption should I be using for the credit card info? The SIMPLEST way to do this is to charge their credit card with a recurring charge when they sign up, and then just THROW AWAY their credit card number. Your credit card processing vendor then has to remember their credit card number, not you. You'll get a one-time transaction identification from the credit card server that you can use to manage their account -- You can then use THAT one-time transaction number to cancel their account, issue refunds, etc. without remembering their credit card number at all. You MIGHT even be able to set this recurring charge to not start until a month later, so you're all set. Given the sheer number of sites and services that have a free trial period, it's very very very likely that the credit card vendors are already all set up to handle this for you. If not, you can almost for sure set the recurring charge, then reverse out the first month's transaction, leaving the rest intact, so they get their free month. You do *NOT* want to store their credit card info *ANYWHERE* at all, period, if you can avoid it. For sure, you do *NOT* store it in a text file on that server, and probably not even in a text file on some other server. If you absolutely MUST store their credit card info, re-post again, explaning WHY, and you'll get some advice. Be warned that that advice will probably involve buying more computer hardware, and hours and hours of setup, as well as a physically secure location, and an independent audit by a security expert, and ... Let's just say "Lots of time and money" Go read the credit card vendor's manual -- I'm willing to bet you can have a solution in hours that doesn't involve you storing credit card numbers. -- Like Music? http://l-i-e.com/artists.htm Disclaimer This e-mail transmission contains confidential information, which is the property of the sender. The information in this e-mail or attachments thereto is intended for the attention and use only of the addressee. Should you have received this e-mail in error, please delete and destroy it and any attachments thereto immediately. Under no circumstances will the Cape Peninsula University of Technology or the sender of this e-mail be liable to any party for any direct, indirect, special or other consequential damages for any use of this e-mail. For the detailed e-mail disclaimer please refer to http://www.ctech.ac.za/polic or call +27 (0)21 460 3911 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail problem at interland
Does PEAR installed in most Linux hosting box? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail problem at interland
Does PEAR installed in most Linux hosting box? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Required the speakers for LAMP at HYD on 18th or 19th for OU and LUG HYD EVENT
hello geeks, Linux User Group, Hyderabad and Osmanina University College of Enginnering in together are condcuting the follwing events. And about the events: Lug Festiva( linux workshop) Literati quest (paper presentation) Promethean (project contest) Bugs maze ( debugging contest) Kloning(code duplicator) Brookz law (this is a half an hour event) Erudites world (panel discussion) Tech Gyan ( expert talk) Acuity Revival (Online Programming Contest ) IT Quiz Gaming zone I am enclosing a brochure with this mail, in which we have the details of the events that we are proposed to organize and more. For more info visit http://infinity2k5.cseouce.ac.in The LUG Festiva is completly sponsered by LUG and we need speakers for Lamp. so if any of u guys are willing to be part of that event pls get back to me. we need speakers For Lamp allotted time is 1hr. so pls get back to us if anybody is intrested. hoping to see positive response from ur end. regards sasi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
Hi James, http://uk.php.net/manual/en/function.function-exists.php, should help you on your way. hth Jarratt On Tue, 1 Feb 2005 18:57:12 -0600, James Kaufman <[EMAIL PROTECTED]> wrote: > On Tue, Feb 01, 2005 at 08:47:29PM +, Ben Edwards wrote: > > I have been implementing a system on a different ISP than I normally use > > and have got:- > > > > Fatal error: Call to undefined function: cal_days_in_month() > > in > > /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php > > on line 134 > > > > I found a reference to this an the web and it seems PHP is not compiled > > with calender support. > > > > "recompile php with the "--enable-calendar" option." > > > > Cant see being able to get the to re-compile PHP so I guess I am going > > to have to disable the feature. I seem to remember a while ago seeing a > > function to test weather a function exists in PHP. That way I can have > > the relevant validation skipped if the function is missing (I will tell > > the client if they get decent hosting it will start working). > > > > So something like > > > > function_exists( cal_days_in_month() ) > > > > Anyone know what the function is called. > > > > Ben > > > > I do this: > > if (!extension_loaded('calendar')) > { > /* > * cal_days_in_month($month, $year) > * Returns the number of days in a given month and year, > * taking into account leap years. > * > * $month: numeric month (integers 1-12) > * $year: numeric year (any integer) > * > * Prec: $month is an integer between 1 and 12, inclusive > * $year is an integer. > * Post: none > */ > function cal_days_in_month($month, $year) > { > return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30); > } > } > > -- > Jim Kaufman > Linux Evangelist > public key 0x6D802619, CISSP# 65668 > http://www.linuxforbusiness.net > --- > The shortest distance between two points is through Hell. > --Brian Clark > > -- > 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] cal_days_in_month() missing, how can I tell if it exists
On Tue, Feb 01, 2005 at 08:47:29PM +, Ben Edwards wrote: > I have been implementing a system on a different ISP than I normally use > and have got:- > > Fatal error: Call to undefined function: cal_days_in_month() > in > /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php > on line 134 > > I found a reference to this an the web and it seems PHP is not compiled > with calender support. > > "recompile php with the "--enable-calendar" option." > > Cant see being able to get the to re-compile PHP so I guess I am going > to have to disable the feature. I seem to remember a while ago seeing a > function to test weather a function exists in PHP. That way I can have > the relevant validation skipped if the function is missing (I will tell > the client if they get decent hosting it will start working). > > So something like > > function_exists( cal_days_in_month() ) > > Anyone know what the function is called. > > Ben > I do this: if (!extension_loaded('calendar')) { /* * cal_days_in_month($month, $year) * Returns the number of days in a given month and year, * taking into account leap years. * * $month: numeric month (integers 1-12) * $year: numeric year (any integer) * * Prec: $month is an integer between 1 and 12, inclusive * $year is an integer. * Post: none */ function cal_days_in_month($month, $year) { return $month == 2 ? $year % 4 ? 28 : 29 : ($month % 7 % 2 ? 31 : 30); } } -- Jim Kaufman Linux Evangelist public key 0x6D802619, CISSP# 65668 http://www.linuxforbusiness.net --- The shortest distance between two points is through Hell. --Brian Clark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Switch Form
Lancer Emotion 16 wrote: > > > > > > > Now, in page.php is possible to do a switch of form name? Something like > this : > > Switch ($_POST['form'] { > 'form1' : ... > 'form2' : ... > } > > If this is possible,i dont know how to call it, can you help me please? The NAME attribute on a FORM tag is not sent via HTTP by any browser. W3C HTML 4.01 spec says it's only there "style sheets or scripts" but is only there for compatibility and you should use id attribute -- which is ALSO not sent by any browser I know of. Perhaps the spec should read "client scripts" since clearly these are useless for server scripts dealing with the submitted form, if you read the form submission specification. Assuming you can stay awake enough to read that sucker... :-) To solve your problem, you'll need to have on the first form and use form2 on the second form. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload difference between browsers
Graham Cossey wrote: I have a problem uploading a file in IE6 or Firefox1.0 but it works fine using Opera7.54. The problem is that I want to ensure that the file being uploaded is a CSV file, so I test the $_FILES['file']['type'] value. In Firefox & IE it is returned as "application/octet-stream" but in Opera it is returned as "text/comma-separated-values", the latter being what I would expect. The posting form has: enctype="multipart/form-data" Can anyone offer some advice on how I can reliably test for a valid CSV file? (At least I have some security built-in, in so much as you have to use Opera to upload files !!) In Mozilla, you can go to Preferences -> Naviator -> Helper Applications. Then click "New Type", fill in MIME type, description and extension, and that should be it. And then ask everyone to do that :) Or better don't rely on client supplied values. You can use mime_content_type() to find out the real mime type. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML-RPC problem with array
Bambero wrote: > Hello > > I have compiled my php with --with-xmlrpc option to use xmlrpc server. > Everything works fine, but there is one problem. > > Array (indexed from 0): > $array[0] > $array[1] > $array[2] > is changed to xmlrpc 'array' type - thats ok. > > Array (with string indexes): > $array['ad'] > $array['sd'] > $array['rd'] > is changed to xmlrpc 'struct' type - thats ok too. > > But array (indexed from 1): > $array[1] > $array[2] > $array[3] > is changed to xmlrpc 'array' type. > > Is it possible to change this type to xmlrpc 'struct' type ? I'll bet that if you did: $array['1'] = 'whatever'; it would turn into a struct. The crucial difference being that your KEYS are strings in the ones that get turned into struct. I bet that you only need to set *ONE* array element key to a string if you can't change all of them: No promise on what ORDER the key/values will come out if you do that -- If you care about order, you're gonna have to re-do the whole array, almost for sure. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File upload difference between browsers
Graham Cossey wrote: > The problem is that I want to ensure that the file being uploaded is a > CSV file, so I test the $_FILES['file']['type'] value. That only ensures that somebody else can forge the type header being sent to you. Anybody with half a clue (okay, a clue and a half) could do that: telnet example.com 80 POST /your_form.php HTTP/1.1 Host: example.com Content-type: text/comma-separated-values INSERT FAVORITE TROJAN WORM HERE So it's pretty useless as a security measure... > In Firefox & IE it is returned as "application/octet-stream" but in > Opera it is returned as "text/comma-separated-values", the latter > being what I would expect. Plus, as you have discovered, the browser manufacturers have absolutely no concept of "standards" when it comes to setting Content-type: on an uploaded file. > Can anyone offer some advice on how I can reliably test for a valid CSV > file? Actually, you're very lucky on this one, in that you can use http://php.net/fgetcsv on it, repeatedly, and either PHP has an error, or PHP doesn't, and then you KNOW it parses as a valid CSV file, from beginning to end. So, what you *MIGHT* do would be something like this: You may not be able to READ $_FILE['file']['tmpname'], so you'd have to move_uploaded_file() it to a staging area first, and then read that. You might want to play around with the error_reporting setting a bit, and a bunch of CSV test files from different sources. You may want to rule that ANY output (strlen($php_output)) is indicative of an error, rather than checking for 'Error' 'Warning' 'Notice' as I did... In fact, that would probably be better. If the files might be large, you may want to cache the CSV data you read, and then you can use it later in your script, after you've read the whole thing in and you know it's kosher... Course, if it's REALLY large, you'll want to cache that in something like a temp table in MySQL or something, just so you won't fill up RAM with some monster Array in PHP... For a small CSV file, it really won't matter that much if you read it twice -- It will probably be in the File System cache for you anyway, depending on server load. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
Al wrote: > I can't use a bad URL because the fopen fails. Sorry, that was silly of me. > I assumed from reading the manual that if I started stream_set_timeout() > it > would monitor the stream and do something when it reached the timeout, > either > truncate my data stream or show up as [timed_out] => true. It doesn't > appear to > do anything. > > I can set the timeout down to microseconds and/or read a 4mb remote file > and > nothing appears to happen. The 4mb file is read fully and [timed_out] => > never > changes for small or large files, microseconds or 600 seconds. > > I did a function_exists() on stream_set_timeout() and it's fine and I have > all > errors on and nothing unusual shows up. > > php version is 4.3.10 But the timeout ONLY happens when the remote server *FAILS* to deliver the data in the time-frame specified. File size is irrelevant, if the connection is good and solid, and the remote server is not busy/interrupted. Setting it to microseconds, and trying to get something over a slow connection would maybe (MAYBE) be a valid test. Or, if you really think a large file will cause the time-out, then use a LARGE file. 4Mb is not a large file. 400Mb is a large file. :-) Or, if you control a development server, connect to your own server and start a big download, and UNPLUG the ethernet cable from the "remote" server half-way through download. If it still doesn't crap out, then there's something wrong. Actually, it would be very magical, wonderful, and nice if you could make it still work with the cable unplugged :-) My point is that you haven't tested anything if the data comes through all right -- Everything "works" is not an indication of a problem. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] File upload difference between browsers
I have a problem uploading a file in IE6 or Firefox1.0 but it works fine using Opera7.54. The problem is that I want to ensure that the file being uploaded is a CSV file, so I test the $_FILES['file']['type'] value. In Firefox & IE it is returned as "application/octet-stream" but in Opera it is returned as "text/comma-separated-values", the latter being what I would expect. The posting form has: enctype="multipart/form-data" Can anyone offer some advice on how I can reliably test for a valid CSV file? (At least I have some security built-in, in so much as you have to use Opera to upload files !!) -- Graham -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Problem with SELECT SQL_CALC_FOUND_ROWS
Matt Babineau wrote: > Ok I installed PHP 4.3.10 and it still has not fixed the problem. If I > remove the SQL_CALC_FOUND_ROWS from the query, it works no problems! This > is > very strange behavior! Not really that strange, I think... While you might want to read this: http://us4.php.net/manual/en/faq.databases.php#faq.databases.upgraded It sounds like your problem is more closely related to this: http://bugs.php.net/bug.php?id=16906&edit=1 paying particular attention to this bit: [1 Oct 2002 4:37am CEST] g at firebolt dot com I was able to solve this bug by doing the following... granted, the bug only existed for me once I had a table with > 9 rows. Run a: SET SQL_BIG_TABLES=1; And MySQL will utilize more memory and be able to save the result set. Optionally, when done, do this: SET SQL_BIG_TABLES=0; (tip courtesy of: http://www.faqts.com/knowledge_base/view.phtml/aid/9824) Keep in mind that when you do SQL_CALC_FOUND_ROWS MySQL has to do a BUNCH more work and MySQL and PHP have to save a TON of temporary somewhere for a large table. So if your tables are large, or if you are doing a JOIN between two moderate sized tables, it seems quite possible to me that SQL_CALC_FOUND_ROWS will trigger a problem with running out of storage space, when the same query without it won't trigger that problem. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Escaped characters
Brian Dunning wrote: > I am storing some text from forms into MySQL as base64_encode(). So far > this has worked well at dealing with weird characters. But when I > output it, everything is escaped with \. I can't replace those out with > '' since sometimes they are supposed to be in there. What's the best > way to output this text from the database and not have the \ visible? The problem is, almost for sure, that your data had http://php.net/addslashes called on it, possibly because "magic quotes gpc" was turned on. So when you then base64_encode() it, the extra slashes that are there for MySQL to "know" what is data rather than syntax are *ALSO* turned into data in your base64-encoded content. Your choices are: Fix the original source code that called *both* addslashes (directory or indirectly through magic quotes) Or, be stuck with bogus data and always have to remember to call http://php.net/stripslashes on it after you base64_decode() it. The first solution is preferrable, but you'll need to: Record the record number where the data is currently bogus. Fix the source to NOT call addslashes + base64_encode Copy out all the bogus records. Call base64_decode/strip_slashes/base64_encode and store that result back in In the short-sighted view, it looks easier to just do the second solution -- but every time you come back to this data, you'll curse yourself for that... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] XML-RPC problem with array
Hello I have compiled my php with --with-xmlrpc option to use xmlrpc server. Everything works fine, but there is one problem. Array (indexed from 0): $array[0] $array[1] $array[2] is changed to xmlrpc 'array' type - thats ok. Array (with string indexes): $array['ad'] $array['sd'] $array['rd'] is changed to xmlrpc 'struct' type - thats ok too. But array (indexed from 1): $array[1] $array[2] $array[3] is changed to xmlrpc 'array' type. Is it possible to change this type to xmlrpc 'struct' type ? Sorry, my english is not well. Thanks, Bambero -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
I can't use a bad URL because the fopen fails. I assumed from reading the manual that if I started stream_set_timeout() it would monitor the stream and do something when it reached the timeout, either truncate my data stream or show up as [timed_out] => true. It doesn't appear to do anything. I can set the timeout down to microseconds and/or read a 4mb remote file and nothing appears to happen. The 4mb file is read fully and [timed_out] => never changes for small or large files, microseconds or 600 seconds. I did a function_exists() on stream_set_timeout() and it's fine and I have all errors on and nothing unusual shows up. php version is 4.3.10 Richard Lynch wrote: Al wrote: Hi Richard, thanks for the help. Note I have the timeout set for 1 microsec, have tried several values, eg, 100ms, 1 sec, etc. I even used a 4mb file and it did nothing. It seems as if stream_set_timeout() does nothing. Note in socket_get_status(), [timed_out] => is always false. v timed_out ^ / \ / \ Lost data because your time-out expired Possibly you have such a good connection, it never times out. Try connection to something that's not there -- Like: $URL_full = 'http://example.com'; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Problem with SELECT SQL_CALC_FOUND_ROWS
Ok I installed PHP 4.3.10 and it still has not fixed the problem. If I remove the SQL_CALC_FOUND_ROWS from the query, it works no problems! This is very strange behavior! Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] -Original Message- From: Matt Babineau [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 12:52 PM To: 'Michael Dykman' Cc: 'MySQL General' Subject: RE: Problem with SELECT SQL_CALC_FOUND_ROWS Weird thing is that I am running PHP 4.3.9I guess I can upgrade and see what happens? Matt Babineau Criticalcode w: http://www.criticalcode.com p: 858.733.0160 e: [EMAIL PROTECTED] -Original Message- From: Michael Dykman [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 01, 2005 12:47 PM To: Matt Babineau Cc: 'MySQL General' Subject: Re: Problem with SELECT SQL_CALC_FOUND_ROWS Matt, I suspect your problem is PHP, not MySQL. refer to http://bugs.php.net/bug.php?id=16906&edit=1 On Tue, 2005-02-01 at 15:20, Matt Babineau wrote: > Hi All- > > I'm running a query that uses SQL_CALC_FOUND_ROWS for my search engine > on a real estate site. The problem is that I get an error when I run > my query: > > "Warning mysql_query(): Unable to save result set in /clients/search.php" > > My Query is: > > SELECT SQL_CALC_FOUND_ROWS propertyData.*, > propertyDataBulk.propertyDesc FROM propertyData LEFT JOIN > propertyDataBulk ON propertyData.id = propertyDataBulk.propertyID > WHERE state = 'CA' limit 0, 5 > > Very odd that this happens, I am running MySQL 4.1.9 > > Thanks, > > Matt Babineau > Criticalcode > w: http://www.criticalcode.com > p: 858.733.0160 > e: [EMAIL PROTECTED] -- - michael dykman - [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
Richard Lynch wrote: Al wrote: Hi Richard, thanks for the help. Note I have the timeout set for 1 microsec, have tried several values, eg, 100ms, 1 sec, etc. I even used a 4mb file and it did nothing. It seems as if stream_set_timeout() does nothing. Note in socket_get_status(), [timed_out] => is always false. v timed_out ^ / \ / \ Lost data because your time-out expired Possibly you have such a good connection, it never times out. Try connection to something that's not there -- Like: $URL_full = 'http://example.com'; hey Richard, example.com is alive :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cal_days_in_month() missing, how can I tell if it exists
Ben Edwards wrote: I have been implementing a system on a different ISP than I normally use and have got:- Fatal error: Call to undefined function: cal_days_in_month() in /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php on line 134 I found a reference to this an the web and it seems PHP is not compiled with calender support. "recompile php with the "--enable-calendar" option." Cant see being able to get the to re-compile PHP so I guess I am going to have to disable the feature. I seem to remember a while ago seeing a function to test weather a function exists in PHP. That way I can have the relevant validation skipped if the function is missing (I will tell the client if they get decent hosting it will start working). So something like function_exists( cal_days_in_month() ) oi Ben nice guess mate ;-) only function_exists() take a string as a arg: if (function_exists('cal_days_in_month')) { /*.. */ } Anyone know what the function is called. Ben -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Escaped characters
I am storing some text from forms into MySQL as base64_encode(). So far this has worked well at dealing with weird characters. But when I output it, everything is escaped with \. I can't replace those out with '' since sometimes they are supposed to be in there. What's the best way to output this text from the database and not have the \ visible? Thanks, - Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cal_days_in_month() missing, how can I tell if it exists
I have been implementing a system on a different ISP than I normally use and have got:- Fatal error: Call to undefined function: cal_days_in_month() in /home/hosted/www.menublackboard.com/public_html/dev/classes/validator.class.php on line 134 I found a reference to this an the web and it seems PHP is not compiled with calender support. "recompile php with the "--enable-calendar" option." Cant see being able to get the to re-compile PHP so I guess I am going to have to disable the feature. I seem to remember a while ago seeing a function to test weather a function exists in PHP. That way I can have the relevant validation skipped if the function is missing (I will tell the client if they get decent hosting it will start working). So something like function_exists( cal_days_in_month() ) Anyone know what the function is called. Ben -- Ben Edwards - Poole, UK, England WARNING:This email contained partisan views - dont ever accuse me of using the veneer of objectivity If you have a problem emailing me use http://www.gurtlush.org.uk/profiles.php?uid=4 (email address this email is sent from may be defunct) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SOLVED - trouble with JCal Class
I was able to figure out the problem. If there is anyone else out there that is using it and needs the solution let me know and I will pass it on. -- Blessed Be Phillip "Phillip S. Baker" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I am posting this here, as it is a bug in the application and I awanted to > see if anyone else is using this and has come up with a solution. > If not and after I figure out more in the code what is going on, if I cannot > figure it out I will give you all a block of code. (Oh and I have emailed > the author, I was just planning on launching this site today and need a > solution ASAP) > > I downloaded this calendar application from PHP Classes, called JCal. It is > a calendar with a tie in to a DB. > Functions exactly how I need it , however we just discovered a significant > bug today. > > This is what I wrote the author: > >Start > On the first few days of the month things get real screwy. > > This is hitting our stage site. > So I downloaded a clean install and loaded it locally and found the same > bug. > Doing some testing with the dates on my machine I discovered the following. > > It has something to do with Sunday's or something. > So February 2005 starts on a Tuesday. It will display the 1st over and over > till the first sunday. Then it begins cycling just fine. IE It shows the 1st > 6 times till the first sunday. > You move on to April which starts on Friday. It will show the 1st 3 times > till it hits that sunday then cycles fine. > It will also do this for each day thereafter till that first Sunday it hit. > > IE in Febraury it shows the 1st 6 times, the 2nd 5 times, the 3rd 4times > etc. > After that first sunday it works fine. > > I tried switch the day on the computer to other years and every month. > Same bug appears. > >End > > Anyone else using this and found this problem? > Most importantly you come up with a solution? > > -- > Blessed Be > > Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Switch Form
[snip] Hi list,I have 2 forms : Now, in page.php is possible to do a switch of form name? Something like this : Switch ($_POST['form'] { 'form1' : ... 'form2' : ... } If this is possible,i dont know how to call it, can you help me please? [/snip] Do this... switch ($_POST['action]){ case "Button 1": ...stuff... break; case "Button 2"; ...stuff... break; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Switch Form
Hi list,I have 2 forms : Now, in page.php is possible to do a switch of form name? Something like this : Switch ($_POST['form'] { 'form1' : ... 'form2' : ... } If this is possible,i dont know how to call it, can you help me please? Thanks in advance. -- lancer emotion 16 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
Al wrote: > Hi Richard, thanks for the help. > > Note I have the timeout set for 1 microsec, have tried several values, eg, > 100ms, 1 sec, etc. I even used a 4mb file and it did nothing. > > It seems as if stream_set_timeout() does nothing. > > Note in socket_get_status(), [timed_out] => is always false. v timed_out ^ / \ / \ Lost data because your time-out expired Possibly you have such a good connection, it never times out. Try connection to something that's not there -- Like: $URL_full = 'http://example.com'; -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help: trouble with JCal Class
I am posting this here, as it is a bug in the application and I awanted to see if anyone else is using this and has come up with a solution. If not and after I figure out more in the code what is going on, if I cannot figure it out I will give you all a block of code. (Oh and I have emailed the author, I was just planning on launching this site today and need a solution ASAP) I downloaded this calendar application from PHP Classes, called JCal. It is a calendar with a tie in to a DB. Functions exactly how I need it , however we just discovered a significant bug today. This is what I wrote the author: >Start On the first few days of the month things get real screwy. This is hitting our stage site. So I downloaded a clean install and loaded it locally and found the same bug. Doing some testing with the dates on my machine I discovered the following. It has something to do with Sunday's or something. So February 2005 starts on a Tuesday. It will display the 1st over and over till the first sunday. Then it begins cycling just fine. IE It shows the 1st 6 times till the first sunday. You move on to April which starts on Friday. It will show the 1st 3 times till it hits that sunday then cycles fine. It will also do this for each day thereafter till that first Sunday it hit. IE in Febraury it shows the 1st 6 times, the 2nd 5 times, the 3rd 4times etc. After that first sunday it works fine. I tried switch the day on the computer to other years and every month. Same bug appears. >End Anyone else using this and found this problem? Most importantly you come up with a solution? -- Blessed Be Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
Todd Cary wrote: Jochem - Sorry! The prior message was incorrect. Here it is corrected. er ok, no probs. although you needn't have bothered sending the correction as someone has already pointed out the mistake in the function, namely your use of HTML entities instead of normal LT ang GT brackets. if you want a link or any other tag to be recognized by the browser you must use the literal chars i.e.: < and > if you wish to display these chars in your page (which is exactly what was happening) then you should use: < and > --- hope that is clear. Here is the executing code: $page_string = make_page_string($page_string, "Search"); $script_string = make_script_string($script_string, "search.php"); print("Page_string: " . $page_string . ""); print("Script_string: " . $script_string . ""); print("Url: " . $url . ""); $page_path = make_page_path($page_string, $script_string, $url); print($page_path); \ ... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function and interface in parameter list?
Marco Schuler wrote: Am Dienstag, 1. Februar 2005 16:07 schrieb Marco Schuler: Am Dienstag, 1. Februar 2005 15:50 schrieb Jochem Maas: Marco Schuler wrote: Hi I found a function declaration in an open source project (in php5) and I could not find documantation for this. The function declaration is: public function registerComp(IComp $comp) Is it a kind of typecast? no its a type declaration (is that the correct term). it states that $comp must be an object of class IComp (or a subclass of it). if $comp is not anj IComp object you get a fatal error. Found it out: It is called "Type Hinting". ah yes! although ClassType Hinting would be more truthful http://ch2.php.net/manual/en/language.oop5.typehinting.php There is a user contributed note on that page: "Type hinting allows not to specify a required interface to be supported for the object being passed. Beware, the interpreter will not give an error for that." Is it a bug in php or what is the reason? I don't even understand what the guy was trying to say in the user comments - let alone if its a bug or a feature! with regard to type hinting with Interfaces - I have no idea offhand, but by using my hands I found out in about 30 seconds... I wrote the bit of code below, if you run it you will find out for yourself whether is works ;-) php -r ' interface MyInt { function doIt(); } class MyObj implements MyInt { function doIt() { echo "boo"; } } function goGo(MyInt $x) { $x->doIt(); } goGo(new MyObj); ' -- Cheers! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP SOAP Client question
PHPDiscuss - PHP Newsgroups and mailing lists wrote: The following wsdl file was provided to me. http://64.122.63.81:5454/IfxService.wsdl I first attempted to genrate the PHP classes using the following code... require_once('SOAP/Client.php'); $wsdl=new SOAP_WSDL('http://64.122.63.81:5454/IfxService.wsdl); // Look at the generated code... echo ( $wsdl->generateProxyCode() ); ?> -- I was expecting this code to generate a code makes use of the underlying SOAP_Client class - that is I was expecting to see each functions. It does make use of the underlying SOAP_Client class. the generated class is a subclass of the SOAP_Client class a subclass inherited all methods from its superclass, unless these methods need different functionality in the subclass they are not (should not) be overloaded (or whatever the correct f** term is in PHPland). But what I found is this: class WebService_IfxService_IfxService extends SOAP_Client ^--- the important bit! it means that WebService_IfxService_IfxService is a SOAP_Client class and has all the methods available for use that are defined in the class definition for SOAP_Client. { function WebService_IfxService_IfxService() { $this->SOAP_Client("http://64.122.63.81:5454/IfxService.asmx";, 0); } function &IfxRequest($IFX) { $IFX =& new SOAP_Value('{}IFX','',$IFX); return $this->call("IfxRequest", $v = array("IFX"=>$IFX), array('namespace'=>'https://www.cashsystemsinc.com/ifx/150/bindings', 'soapaction'=>'https://www.cashsystemsinc.com/ifx/150/WebService/IfxRequest', 'style'=>'document', 'use'=>'literal' )); } } Any Idea what is going on here? think I do (although I have never touched SOAP and have little experience with code generators!) I hope that my comments give you a little insight too :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
Hi Richard, thanks for the help. Note I have the timeout set for 1 microsec, have tried several values, eg, 100ms, 1 sec, etc. I even used a 4mb file and it did nothing. It seems as if stream_set_timeout() does nothing. Note in socket_get_status(), [timed_out] => is always false. Richard Lynch wrote: Al wrote: Anyone see why stream_set_timeout() / socket_get_status() don't work? Perhaps you should explain what you think isn't working... Cuz it sure looks good to me... $fp= fopen($URL_full, 'r'); stream_set_timeout($fp, 0, 1); tried other values for microseconds $procque_str= fread($fp, 8096); print_r(socket_get_status($fp)) ; Print_r is: Array ( [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Date: Tue, 01 Feb 2005 15:45:12 GMT [2] => Server: Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7d PowWeb/1.1 [3] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [5] => Pragma: no-cache [6] => X-Powered-By: PHP/4.3.10 [7] => Set-Cookie: PHPSESSID=d253e66f43edf09f0d461709db95b178; path=/ [8] => Connection: close [9] => Content-Type: text/html ) [wrapper_type] => HTTP [stream_type] => socket [unread_bytes] => 0 [timed_out] => [blocked] => 1 [eof] => ) -- 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] best flow for this project
Dustin Krysak wrote: > -a user adds their email address, name, etc to a database. > -a responder sends an email to them to confirm their email address > (within 72 hrs). > -upon confirmation of their email address, a script will generate a > store coupon with a random coupon id # in the browser (which they can > print at that time). > > Now I guess my question relates more to the email confirmation. How > would you go about this? Store it in a database? Every-time the script > is run it also checks to see which requests are more than 72 hrs old > and removes their request from the database? And those that are > confirmed, a flag is added to the database so they are not removed? > > Just looking more for ideas on the script flow to accomplish this. If you WANT them to get the coupon and carry out the transaction to make the sale, I'd have the response email just go out as part of the registration process using: http://php.net/mail (unless you need *TONS* of email to go out, and should upgrade to SMTP using a class from http://phpclasses.org) If you HOPE they don't turn in the coupon (rebate) you'd want to send it out as late as possible while not violating your 72 hour promise, so you'd use a cron job to do it. To delete records older than 72 hours with no confirmation, I'd just run a cron job. Google for "man 5 crontab" and "cron PHP" to learn more about how to work cron and PHP together. If you're on Windows, just substitute "scheduled task" for cron. Same thing, but MS can't use industry-standard terminology. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload error
Tom wrote: > Thanks for the replies. My manual was out of date, not that it would > have made any difference to this anyway as . > upload_tmp_dir variable was correctly set in the php.ini file, and I'd > restarted the web server several times. It seems however that the file > is getting cached somehow, and is not re-read until I restart the entire > box. Anyone out there know why this may be, or a slightly better way of > getting around it than rebooting? > (By the way, the upload functionality is fine after the reboot :)) Several possibilities here... First, you can ERADICATE the idea that the file was getting cached, at least by Apache or PHP. Maybe you've got something really funky in your file-system to cache it, but that's also incredibly unlikely. On to the possible scenarios: 1. You only *THOUGHT* you re-started Apache, but the script you use to stop/start Apache, or Apache itself, failed to inform you that it didn't stop and then start correctly. 2. You *DID* re-start Apache, but the script you used is telling Apache to read a DIFFERENT httpd.conf from the one that gets read by your boot processing script (/etc/rc.init/[apache|httpd] probably, on Linux). That different httpd.conf, in turn, points to a DIFFERENT php.ini and/or mod_php.so getting loaded, so the php.ini you *thought* was getting re-loaded when you restarted Apache, was not the one really getting loaded. You can easily confirm/deny #2 by looking at after a re-boot, then re-starting Apache, then looking at again. The same php.ini file should be listed near the top in both cases, or you'll quickly find out which php.ini file[s] are being read. For #1, you can try your Apache re-start again, and use http://localhost/server-status (or is that server_status) to see Apache's up-time, if you have mod_status installed. Or you could use "ps auxwww | grep httpd" to see how long Apache has been runing. Or maybe use "top" to find out if you really really re-started Apache. Hopefully, this is a development machine so you can re-start and re-boot as needed to track down what is or isn't happening. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] stream_set_timeout() mystery
Al wrote: > Anyone see why stream_set_timeout() / socket_get_status() don't work? Perhaps you should explain what you think isn't working... Cuz it sure looks good to me... > $fp= fopen($URL_full, 'r'); > > stream_set_timeout($fp, 0, 1); tried other values for microseconds > > $procque_str= fread($fp, 8096); > > print_r(socket_get_status($fp)) ; > > > Print_r is: > >> Array >> ( >> [wrapper_data] => Array >> ( >> [0] => HTTP/1.1 200 OK >> [1] => Date: Tue, 01 Feb 2005 15:45:12 GMT >> [2] => Server: Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 >> mod_ssl/2.8.22 OpenSSL/0.9.7d PowWeb/1.1 >> [3] => Cache-Control: no-store, no-cache, must-revalidate, >> post-check=0, pre-check=0 >> [4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT >> [5] => Pragma: no-cache >> [6] => X-Powered-By: PHP/4.3.10 >> [7] => Set-Cookie: >> PHPSESSID=d253e66f43edf09f0d461709db95b178; path=/ >> [8] => Connection: close >> [9] => Content-Type: text/html >> ) >> >> [wrapper_type] => HTTP >> [stream_type] => socket >> [unread_bytes] => 0 >> [timed_out] => >> [blocked] => 1 >> [eof] => >> ) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Homebrew fulltext search function (help)
Jason Morehouse wrote: > within a sqlite call. This pases matched content to a function, where > the function needs to pass back a score: > > sqlite_create_function($sDB, 'fulltext', 'fulltext_step',2); > > function fulltext_step($title, $content) { > $words = explode(' ', strtolower('php books')); $words = explode(' ' , strtolower($title)); > $content = explode(' ',strtolower($content)); > $content = array_intersect($content,$words); > foreach($content as $wordpos => $word) { > print "$wordpos - $word"; > } return count($content); > } That's a crude first take. You could also add mega-points for, say, stristr($title, $content) for an exact match, or more points for proximity of $word within $content (which you'd need to do a different algorithm than above) or... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fsockopen
pete M wrote: > am not having a lot of success with opening a socket to a secure domain > (php 4.3.8 - apache - openSSL) > > $fp = fsockopen($url , 443 ,$errno, $errstr, 30); You would need to do S much work to get this going, generating complementary two-way encryption keys... Just use curl: http://php.net/curl -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inserting utf8 from PHP to MySQL makes text unreadable [SOLVED]
Marek, Thank you for your advice. I've wrapped my variable like so: htmlspecialchars( $HTTP_POST_VARS['introJ'], ENT_COMPAT, "UTF-8") and that seems to have made the variables store and display okay. I actually have no idea what the "ENT_COMPAT" bit is doing, but experimentation has taught me that it won't fly without it. Thanks for taking the time to help! -- Dave Gutteridge [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
You are using html entity code for brackets and such. When you use < instead of <, the web browser prints it literally as a < rather than interpreting it as an html symbol to mark the start of an anchor (or whatever). Replace the entity code with their 'regular' equivalents and you're print problem will go away. -Matt Todd Cary wrote: Jochem - Here is the function: /* Make page path */ function make_page_path($page_string, $script_name) { $parts = explode('|', $page_string); for ($i = 0; $i < count($parts); $i++) { if ($i == 0) { $page_path = '' . $parts[$i] . ''; } else { $page_path = $page_path . '->' . '' . $parts[$i] . ''; } } //print("Page_path: " . $page_path . ""); return $page_path; } Here is the executing code: $page_string = make_page_string($page_string, "Search"); $script_string = make_script_string($script_string, "search.php"); print("Page_string: " . $page_string . ""); print("Script_string: " . $script_string . ""); print("Url: " . $url . ""); $page_path = make_page_path($page_string, $script_string, $url); print($page_path); To see it execute, this URL will do it: http://209.204.172.137/casesearch/php/search.php?search_text=***&page_string=Home&script_string=home.php The Title area contains The function that creates the link(s) is /* Make page path */ function make_page_path($page_string, $script_string, $path) { $scripts = explode('|', $script_string); $pages = explode('|', $page_string); for ($i = 0; $i < count($scripts); $i++) { if ($i < count($scripts) - 1) { if ($i == 0) { $page_path = '' . $pages[$i] . ''; } else { $page_path = $page_path . '->' . '' . $pages[$i] . ''; } } else { if ($i == 0) { $page_path = $pages[$i]; } else { $page_path = $page_path . '->' . $pages[$i]; } } } //print("Page_path: " . $page_path . ""); return $page_path; } Thank you for your help... Todd Jochem Maas wrote: Todd Cary wrote: OK...I am close, but still missing something. The string returned by the function is $page_path and it contains http://209.204.172.137/casesearch/php/search.php";>Home-> ^ what ever else you function is doing this is probably not correct http://209.204.172.137/casesearch/php/search.php";>Search And here is how the function is used: funny thing is you don't show the code for the function - AND i willing to bet money that the function uses html_entities() - or an equivelant... you say the function returns: http://209.204.172.137/casesearch/php/home.php";>Home but that is bullshit (if everything else you say it true, namely a direct echo of the return value does not show a link), if you bother to look at your own source, then you will see that the string that is output is: Home; actually I noticed that the site had changed a little since I happened to look yesterday. today you are dumping some debug output at the top of the page, where as yesterday you we outputting the borked link next to the logo (the home link there now works - I suspect that this is because you have reverted to functionality there?) post the code for the make_page_path() function! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fsockopen
am not having a lot of success with opening a socket to a secure domain (php 4.3.8 - apache - openSSL) $fp = fsockopen($url , 443 ,$errno, $errstr, 30); have tried the following $urls --- $url = 'domain.net'; Bad Request Your browser sent a request that this server could not understand. Reason: You're speaking plain HTTP to an SSL-enabled server port. Instead use the HTTPS scheme to access this URL, please. -- $url = 'https://domain.net'; Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known -- $url = 'ssl://domain.net'; Bad Request Your browser sent a request that this server could not understand. Client sent malformed Host header --- $url = 'tls://domain.net'; Bad Request Your browser sent a request that this server could not understand. Client sent malformed Host header Am I missing the obvious as I cannot thing of any other options ;-(( tia pete -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
Jochem - Sorry! The prior message was incorrect. Here it is corrected. Here is the executing code: $page_string = make_page_string($page_string, "Search"); $script_string = make_script_string($script_string, "search.php"); print("Page_string: " . $page_string . ""); print("Script_string: " . $script_string . ""); print("Url: " . $url . ""); $page_path = make_page_path($page_string, $script_string, $url); print($page_path); To see it execute, this URL will do it: http://209.204.172.137/casesearch/php/search.php?search_text=***&page_string=Home&script_string=home.php The Title area contains The function that creates the link(s) is /* Make page path */ function make_page_path($page_string, $script_string, $path) { $scripts = explode('|', $script_string); $pages = explode('|', $page_string); for ($i = 0; $i < count($scripts); $i++) { if ($i < count($scripts) - 1) { if ($i == 0) { $page_path = '' . $pages[$i] . ''; } else { $page_path = $page_path . '->' . '' . $pages[$i] . ''; } } else { if ($i == 0) { $page_path = $pages[$i]; } else { $page_path = $page_path . '->' . $pages[$i]; } } } //print("Page_path: " . $page_path . ""); return $page_path; } Thank you for your help... Todd Jochem Maas wrote: Todd Cary wrote: OK...I am close, but still missing something. The string returned by the function is $page_path and it contains http://209.204.172.137/casesearch/php/search.php";>Home-> ^ what ever else you function is doing this is probably not correct http://209.204.172.137/casesearch/php/search.php";>Search And here is how the function is used: funny thing is you don't show the code for the function - AND i willing to bet money that the function uses html_entities() - or an equivelant... you say the function returns: http://209.204.172.137/casesearch/php/home.php";>Home but that is bullshit (if everything else you say it true, namely a direct echo of the return value does not show a link), if you bother to look at your own source, then you will see that the string that is output is: Home; actually I noticed that the site had changed a little since I happened to look yesterday. today you are dumping some debug output at the top of the page, where as yesterday you we outputting the borked link next to the logo (the home link there now works - I suspect that this is because you have reverted to functionality there?) post the code for the make_page_path() function! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
Jochem - Here is the function: /* Make page path */ function make_page_path($page_string, $script_name) { $parts = explode('|', $page_string); for ($i = 0; $i < count($parts); $i++) { if ($i == 0) { $page_path = '' . $parts[$i] . ''; } else { $page_path = $page_path . '->' . '' . $parts[$i] . ''; } } //print("Page_path: " . $page_path . ""); return $page_path; } Here is the executing code: $page_string = make_page_string($page_string, "Search"); $script_string = make_script_string($script_string, "search.php"); print("Page_string: " . $page_string . ""); print("Script_string: " . $script_string . ""); print("Url: " . $url . ""); $page_path = make_page_path($page_string, $script_string, $url); print($page_path); To see it execute, this URL will do it: http://209.204.172.137/casesearch/php/search.php?search_text=***&page_string=Home&script_string=home.php The Title area contains The function that creates the link(s) is /* Make page path */ function make_page_path($page_string, $script_string, $path) { $scripts = explode('|', $script_string); $pages = explode('|', $page_string); for ($i = 0; $i < count($scripts); $i++) { if ($i < count($scripts) - 1) { if ($i == 0) { $page_path = '' . $pages[$i] . ''; } else { $page_path = $page_path . '->' . '' . $pages[$i] . ''; } } else { if ($i == 0) { $page_path = $pages[$i]; } else { $page_path = $page_path . '->' . $pages[$i]; } } } //print("Page_path: " . $page_path . ""); return $page_path; } Thank you for your help... Todd Jochem Maas wrote: Todd Cary wrote: OK...I am close, but still missing something. The string returned by the function is $page_path and it contains http://209.204.172.137/casesearch/php/search.php";>Home-> ^ what ever else you function is doing this is probably not correct http://209.204.172.137/casesearch/php/search.php";>Search And here is how the function is used: funny thing is you don't show the code for the function - AND i willing to bet money that the function uses html_entities() - or an equivelant... you say the function returns: http://209.204.172.137/casesearch/php/home.php";>Home but that is bullshit (if everything else you say it true, namely a direct echo of the return value does not show a link), if you bother to look at your own source, then you will see that the string that is output is: Home; actually I noticed that the site had changed a little since I happened to look yesterday. today you are dumping some debug output at the top of the page, where as yesterday you we outputting the borked link next to the logo (the home link there now works - I suspect that this is because you have reverted to functionality there?) post the code for the make_page_path() function! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] stream_set_timeout() mystery
Anyone see why stream_set_timeout() / socket_get_status() don't work? $fp= fopen($URL_full, 'r'); stream_set_timeout($fp, 0, 1); tried other values for microseconds $procque_str= fread($fp, 8096); print_r(socket_get_status($fp)) ; Print_r is: Array ( [wrapper_data] => Array ( [0] => HTTP/1.1 200 OK [1] => Date: Tue, 01 Feb 2005 15:45:12 GMT [2] => Server: Apache/1.3.33 (Unix) FrontPage/5.0.2.2635 mod_ssl/2.8.22 OpenSSL/0.9.7d PowWeb/1.1 [3] => Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 [4] => Expires: Thu, 19 Nov 1981 08:52:00 GMT [5] => Pragma: no-cache [6] => X-Powered-By: PHP/4.3.10 [7] => Set-Cookie: PHPSESSID=d253e66f43edf09f0d461709db95b178; path=/ [8] => Connection: close [9] => Content-Type: text/html ) [wrapper_type] => HTTP [stream_type] => socket [unread_bytes] => 0 [timed_out] => [blocked] => 1 [eof] => ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Homebrew fulltext search function (help)
Hello, I'm trying to make up for the lack full text searching in sqlite by passing the search off to php with sqlite_create_function. The parsing part works fine, but I'm a little lost with the scoring, if anyone perhaps a little better @ math than I am, may be of assistance! The parsing code below, basically allows you to use a php function within a sqlite call. This pases matched content to a function, where the function needs to pass back a score: sqlite_create_function($sDB, 'fulltext', 'fulltext_step',2); function fulltext_step($title, $content) { $words = explode(' ', strtolower('php books')); $content = explode(' ',strtolower($content)); $content = array_intersect($content,$words); foreach($content as $wordpos => $word) { print "$wordpos - $word"; } } sqlite_create_function($sDB, 'fulltext', 'fulltext_step',1); $rs = sqlite_query($sDB,"select title fulltext(content) score from page where content like '%php%books%' order by score"); while($data = sqlite_fetch_array($rs)) { print "$data[score] $data[title]"; } So basically... the fulltext step builds and array, of how many times a word is matched, and at what word position (broken into an array for each word)... eg: array('php'=>2,'php'=>30,'php'=>55) array('books'=>3,'books'=>130); The word php is at position 2, and the word books is at position 3... and so on. What is the best way to return a single score for this page? It's a bit confusing I suppose, but thanks! As a side, on a 90meg text table, the parsing function above runs in about 0.061858177185059 ms... mysql does in about 0.0039310455322266 ms. I'm fine by that. -Jason -- Jason Morehouse Vendorama - Create your own online store http://www.vendorama.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function and interface in parameter list?
Am Dienstag, 1. Februar 2005 16:07 schrieb Marco Schuler: > Am Dienstag, 1. Februar 2005 15:50 schrieb Jochem Maas: > > Marco Schuler wrote: > > > Hi > > > > > > I found a function declaration in an open source project (in > > > php5) and I could not find documantation for this. The function > > > declaration is: > > > > > > public function registerComp(IComp $comp) > > > > > > Is it a kind of typecast? > > > > no its a type declaration (is that the correct term). it states > > that $comp must be an object of class IComp (or a subclass of > > it). if $comp is not anj IComp object you get a fatal error. Found it out: It is called "Type Hinting". http://ch2.php.net/manual/en/language.oop5.typehinting.php There is a user contributed note on that page: "Type hinting allows not to specify a required interface to be supported for the object being passed. Beware, the interpreter will not give an error for that." Is it a bug in php or what is the reason? -- Cheers! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function and interface in parameter list?
Hi Am Dienstag, 1. Februar 2005 15:50 schrieb Jochem Maas: > Marco Schuler wrote: > > Hi > > > > I found a function declaration in an open source project (in > > php5) and I could not find documantation for this. The function > > declaration is: > > > > public function registerComp(IComp $comp) > > > > Is it a kind of typecast? > > no its a type declaration (is that the correct term). it states > that $comp must be an object of class IComp (or a subclass of it). > if $comp is not anj IComp object you get a fatal error. Where can I find this in the manual? IComp can also be an interface, right? > this only works for classes. and it does not work in conjunction > with optional params e.g: > > public function registerComp(IComp $comp = null) { /**/ } With optional params you mean actually the variable initialisation within the declaration, right? -- Cheers! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function and interface in parameter list?
Marco Schuler wrote: Hi I found a function declaration in an open source project (in php5) and I could not find documantation for this. The function declaration is: public function registerComp(IComp $comp) Is it a kind of typecast? no its a type declaration (is that the correct term). it states that $comp must be an object of class IComp (or a subclass of it). if $comp is not anj IComp object you get a fatal error. this only works for classes. and it does not work in conjunction with optional params e.g: public function registerComp(IComp $comp = null) { /**/ } (which IMHO sucks but hey c'est la vie! :-) ) -- Cheers! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fopen, fsockopen on my virtual host
Richard Lynch wrote: Al wrote: Richard Lynch wrote: Al wrote: I've got a script that fetches a stream from a file on our virtual host. Its been working fine; but, yesterday they changed something and it no longer works. Can you define "no longer works" a bit more clearly... Error messages? Just times out? What? $fp= fsockopen("www.oursite.org", 80, $errno, $errstr, 30); I can use any remote site and fscockopen works fine. Anyone have a suggestion as to how I deal with this problem? if ($errno){ error_log("fsockopen errored out with # $errno: $errstr"); } Here is my error report: Warning: fsockopen(): unable to connect to www.restonrunners.org:80 in /www/r/reston/htdocs/phpList/PQ/PQutility.php on line 364 Operation timed out (60) fsockopen() works fine with remote URLs and even "localhost"; but, not with our own URL. I'd use "localhost" but, I need to attach some GET arguments and I can't figure out a way to do it. e.g., $str= file_get_contents(localhost?page=processqueue&login=Pmin&password=x) Put some quotes on that, and http:// on the front, and it should work as-is. Your own domain not working is a symptom of something else though... Can you ping restonrunners.org? What happens if you try to do this in a shell: telnet restonrunners.org 80 GET / HTTP/1.0 Host: restonrunners.org Hit 'return' twice after the 'Host:' line. You should get your homepage. You may have some firewall mis-configured, or DNS issues, or /etc/hosts might be messed up or... Many things *could* be wrong to cause this, but none of them are really PHP-related. You are correct, the problem is due to the host switching to "load balancing" servers. Required syntax is now fsockopen("localhost.domain.com", port, time) and $string= file_get_contents("http://localhost.domain.com/path";). Thanks again -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] function and interface in parameter list?
Hi I found a function declaration in an open source project (in php5) and I could not find documantation for this. The function declaration is: public function registerComp(IComp $comp) Is it a kind of typecast? -- Cheers! Marco -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
Todd Cary wrote: OK...I am close, but still missing something. The string returned by the function is $page_path and it contains http://209.204.172.137/casesearch/php/search.php";>Home-> ^ what ever else you function is doing this is probably not correct http://209.204.172.137/casesearch/php/search.php";>Search And here is how the function is used: funny thing is you don't show the code for the function - AND i willing to bet money that the function uses html_entities() - or an equivelant... you say the function returns: http://209.204.172.137/casesearch/php/home.php";>Home but that is bullshit (if everything else you say it true, namely a direct echo of the return value does not show a link), if you bother to look at your own source, then you will see that the string that is output is: Home; actually I noticed that the site had changed a little since I happened to look yesterday. today you are dumping some debug output at the top of the page, where as yesterday you we outputting the borked link next to the logo (the home link there now works - I suspect that this is because you have reverted to functionality there?) post the code for the make_page_path() function! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Displaying a html line as html
OK...I am close, but still missing something. The string returned by the function is $page_path and it contains http://209.204.172.137/casesearch/php/search.php";>Home-> http://209.204.172.137/casesearch/php/search.php";>Search And here is how the function is used: $page_path = make_page_path($page_string, $fullscriptname); print($page_path); It is not printing the string as a link, and print("'" . $page_path . "'"); just prints the literal string with apotrophies added. I tried $page_path = "'" . make_page_path($page_string, $fullscriptname) . "'"; with the same results. Todd Justin French wrote: On 01/02/2005, at 1:05 PM, Todd Cary wrote: I have the following: $p = http://209.204.172.137/casesearch/php/home.php";>Home try $p = 'http://209.204.172.137/casesearch/php/home.php";>Home'; echo $p; --- Justin French, Indent.com.au [EMAIL PROTECTED] Web Application Development & Graphic Design -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP SOAP Client question
The following wsdl file was provided to me. http://64.122.63.81:5454/IfxService.wsdl I first attempted to genrate the PHP classes using the following code... http://64.122.63.81:5454/IfxService.wsdl); // Look at the generated code... echo ( $wsdl->generateProxyCode() ); ?> -- I was expecting this code to generate a code makes use of the underlying SOAP_Client class - that is I was expecting to see each functions. But what I found is this: class WebService_IfxService_IfxService extends SOAP_Client { function WebService_IfxService_IfxService() { $this->SOAP_Client("http://64.122.63.81:5454/IfxService.asmx";, 0); } function &IfxRequest($IFX) { $IFX =& new SOAP_Value('{}IFX','',$IFX); return $this->call("IfxRequest", $v = array("IFX"=>$IFX), array('namespace'=>'https://www.cashsystemsinc.com/ifx/150/bindings', 'soapaction'=>'https://www.cashsystemsinc.com/ifx/150/WebService/IfxRequest', 'style'=>'document', 'use'=>'literal' )); } } Any Idea what is going on here? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload error
Thanks for the replies. My manual was out of date, not that it would have made any difference to this anyway as . upload_tmp_dir variable was correctly set in the php.ini file, and I'd restarted the web server several times. It seems however that the file is getting cached somehow, and is not re-read until I restart the entire box. Anyone out there know why this may be, or a slightly better way of getting around it than rebooting? (By the way, the upload functionality is fine after the reboot :)) Ta Tom Marek Kilimajer wrote: Tom wrote: Hi I have a very simple file upload form and script to handle it (copied verbatim from the php manual, except for the file target location and the script name). However, it always fails, with an error code in the _FILE array or 6. Does anyone know what this error is or what I am likely to have set wrong? All that I can find in the docs are errors from 0 to 4 :-( It's there: http://sk.php.net/manual/en/features.file-upload.errors.php UPLOAD_ERR_NO_TMP_DIR Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3. Note: These became PHP constants in PHP 4.3.0. Set the correct upload_tmp_dir in php.ini and restart webserver -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inserting utf8 from PHP to MySQL makes text unreadable
Dave wrote: PHP General, The Situation: I am creating a form for users to enter text into a MySQL 3.23 database. The text is often in Japanese, encoded in utf-8 format. The Problem: When the utf-8 encoded text is inserted into the database, it becomes random ASCII gibberish. What I've Tried So Far: I've noticed that it is possible to save utf-8 encoded text in the database. When I insert Japanese text into the database using phpMyAdmin, it stores okay, and I can access the text via PHP for placement on web pages. So my speculation is that there is something wrong with my script. My search on the web for information has turned up indication that it should be possible to simply store utf-8 text without the need for modifications. Some places suggest that it might be best to store the Japanese text as binary. But since I can enter utf-8 text into fields and store them as text successfully in phpMyAdmin, I am sure there must be a way for getting around binary storage. I'd like to avoid binary storage if possible, for a variety of reasons. The difference between text and binary in mysql is that text column type takes into account character set for stuff like case insensitive comparition and the likes. Character set is set per server basis in mysql < 4.1, so if your mysql is set to use iso-8859-1, it's better to store utf-8 in binary to get rid of the transformations. The Question: How can I preserve the text so that it does not become garbled when written to the database? For Reference: Here is the form and the PHP script that it accesses. $showData is obtained by querying the database and seeing what is already stored there. The main part is missing here - section of your page. It must contain else it will default to iso-8859-1. English (256 characters) (Japanese)(256 Characters) Use htmlspecialchars() to display $showData['introJ'] if (isset ($HTTP_POST_VARS['introE']) || isset ($HTTP_POST_VARS['introJ'])) { $updateQuery = "UPDATE events SET introE='" . $HTTP_POST_VARS['introE'] . "', introJ='" . $HTTP_POST_VARS['introJ'] . "' WHERE eventid = " . $show; $updateResult = mysql_query($updateQuery); } ?> Any help much appreciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php