RE: [PHP] Text Parser
?php $items = house , ball , door , roof , floor; $itemsexploded = Explode( , , $items); $itemsimploded = ' . implode(',',$itemsexploded) . '; ? That should do it. The only weird bit is adding the single quotes to the beginning and end of the final string. You could also do a str_replace() ? $items = house , ball , door , roof , floor; $finalitems = ' . Str_replace( , , ',', $items) . '; ? And of course you can do regex stuff, but I'm not good at that so I'll leave an example to someone else if they care to give one. Just remember, explode() creates an array out of items based on a set of characters you tell it are the divider. If you had a tab delimited text file, you'd want to break on \t (for tab). Implode() does the opposite. It takes an array and joins the items using the string you give it. This is good for things like what you're doing above, but in this case a simple str_replace() works just as good too. -TG -Original Message- From: Pablo D Marotta [mailto:[EMAIL PROTECTED] Sent: Thursday, December 02, 2004 10:12 AM To: [EMAIL PROTECTED] Subject: [PHP] Text Parser Hi there.. A newbie issue: I´m receiving this: house , ball , door , roof , floor And I want to obtain this: 'house','ball','door','roof','floor' Maybe, I should use implode or explode, but I just can´t figure out how.. Help? American Express made the following annotations on 12/02/04 08:13:28 -- ** This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you. ** == -- 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] Re: Browsing while downloading?
Yeah, this isn't a PHP specific problem, BUT, in the off chance that PHP could solve the problem (using a different method of sending to the browser, etc) then it becomes PHP relevant... So everyone give the guy a break on the relevance issue. If there were two ways of doing something and you only know one, wouldn't you want to ask if there was a second, better way, that didn't cause the problem you were having? Anyway.. Yeah, this might not be avoidable, although when you click on a link to download a file you can usually still continue browsing, so I'm guessing that there IS another way to do this. Couple of thoughts: 1. Have you tried smaller files just as a test (something that takes like 30 to 60 seconds to download maybe) just to see if you still have the problem? 2. Is it feasible to create the file and provide a click here to download or right-click and select SAVE AS.. to download? This might force the browser to handle it more like a standard download and not handle it as if it were loading a web page. 3. Speaking of loading as a web page, are you getting a download progress bar or does the browser just keep spinning with it's normal I'm loading a web page progress bar? If that was happening, it could be an issue of setting a good MIME type (what was it, like octet/stream or something that's a generic this is a binary file mime type?). If your browser thinks its downloading HTML, that could lock it up. 4. Lastly... I've noticed when my browser is locked up for whatever reason, that you can usually open another instance of the browser. Going to your desktop and double-clicking on the Internet Explorer icon again, etc. This second copy of IE seems to operate in a different memory space... As a different program. So if you crash or lock up the other instance, as long as you're not grinding your CPU or maxing out your memory, the second instance of IE or whatever should still work ok. I've had IE crash, with a End Program type propt and have other instances of IE be fine. But all the IE windows opened from the original window get nuked by the End Program function. Hope this helps at least a little. I'm guessing there's a way to make it download without freezing your IE and I'm guessing it may have something to do with your headers and/or MIME type. If that doesn't work, I'd investigate creating the file and letting the user click a link to download it, forcing the browser to handle it how it sees fit. Good luck! -TG -Original Message- From: adrian zaharia [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 6:42 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Browsing while downloading? Hi, Thanks for reply, yet: 1. i know has nothing to do with php but since now i am doing it in php i thought would be a good solution to post here 2. bad browser? hmm... i tried: IE, MozillaFirefox (Win+Linux), Opera(Win+Linux), Konqueror maybe there is still one better out there :P Thanks, Adrian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Free for commercial use?
Taken from http://www.php.net/license/: Note: the following questions and answers only apply to version 2.01 and 2.02 of the PHP license. Ignore for version 3.0. Q. What does the PHP license mean then, in simple words? A. (Note: This answer should in no way be taken to replace the PHP license, it is intended to give you a general impression of what the license means.) Essentially, the PHP license gives you the right to use, distribute and modify PHP as much as you want, for both commercial and non-commercial use. You just have to make it clear to the user that what you have distributed contains PHP. Q. The Zend license says I may not charge money for stuff I sell along with Zend. Does that mean I cannot sell PHP scripts or web sites that I build? A. No. Not at all. This clause only concerns software built around the Zend scripting engine library, not scripts that PHP executes, using that library. You are free to distribute PHP source code you write freely or commercially, without any concern about the PHP or Zend licenses. You may also package PHP as a whole with your commercial applications as much as you want. You just can't build commercial applications that use the Zend scripting engine library directly. The last two sentences should cover what you're looking for. Err.. Except that it only applies to PHP license 2.01 and 2.02, not the newest 3.0. Maybe I didn't find the answer you were looking for. Sorry. For full details, see the full license text at http://www.php.net/license/3_0.txt -Original Message- From: Brian Dunning [mailto:[EMAIL PROTECTED] Sent: Thursday, December 02, 2004 10:30 AM To: [EMAIL PROTECTED] Subject: [PHP] Free for commercial use? I thought I wouldn't have any trouble finding this. I'm trying to provide documentation that PHP is free for commercial use, and I can't find anything on php.net. Can anyone help me? - Brian -- 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] Days remaining? (years, months, days, hours, minutes, seconds..etc)
I don't know of a built-in function, but you're welcome to use my daydiff script below. It actually gives you year, month, day, hour, minute, second.. Not just days. But modify it as you desire. -TG ?php # Standard format dates and times $startdate = 04/12/04; $starttime = 13:05:01; $enddate = 10/14/04; $endtime = 13:05:01; # Break apart dates and times for mktime list($smonth,$sday,$syear) = explode(/,$startdate); list($emonth,$eday,$eyear) = explode(/,$enddate); list($shour,$sminute,$ssecond) = explode(:,$starttime); list($ehour,$eminute,$esecond) = explode(:,$endtime); # Number of seconds in each timeframe, 1 month = 30 days $secondsequiv = array(Years=31536000,Months=2592000,Days=86400,Hours=3600,M inutes=60); # How many seconds between two dates/times $daydiff = mktime($ehour,$eminute,$esecond,$emonth,$eday,$eyear) - mktime($shour,$sminute,$ssecond,$smonth,$sday,$syear); if ($daydiff 0) { $daydiff *= -1; $negative = TRUE; } # Just to make sure I didn't use $remainder somewhere else in my script and forgot if (isset($remainder)) unset($remainder); # Cycle through timeframes checking to see if number is large enough to be a full year/month/day/etc # If so, find out how many and store remainder for further processing # If not, set to zero and continue processing foreach ($secondsequiv as $timeframe=$seconds) { if (isset($remainder)) { $checkvalue = $remainder; } else { $checkvalue = $daydiff; } if ($checkvalue = $seconds) { $daydiffarr[$timeframe] = floor($checkvalue/$seconds); $remainder = $daydiff % $seconds; } else { $daydiffarr[$timeframe] = 0; } } # If $reminder is never used, then we're dealing with less than a minute's worth of time diff if (isset($remainder)) { $daydiffarr[Seconds] = $remainder; } else { $daydiffarr[Seconds] = $daydiff; } # Display results if ($negative) echo NEGATIVE!!br\n; foreach ($daydiffarr as $timeframe=$count) { echo $timeframe = $countbr\n; } ? -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: Thursday, December 02, 2004 11:38 AM To: [EMAIL PROTECTED] Subject: [PHP] Days remaining? Best groupmember, I have the date 2004-12-24 in a string, and 2004-11-05 in a other. Is there any date function that can assist in calculating the number of days left until 2004-12-24 when it is 2004-11-05. (the dates are just testdates) -- - Best Of Times /Peter Lauri -- 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] Page that checks if a user exists on a remote system
If it's a un*x system and you have permissions to connect to the SMTP server, you could use the VRFY command to check to see if their email address exists or not maybe: Example of Verifying a User Name Either S: VRFY Smith R: 250 Fred Smith [EMAIL PROTECTED] Or S: VRFY Smith R: 251 User not local; will forward to [EMAIL PROTECTED] Or S: VRFY Jones R: 550 String does not match anything. Or S: VRFY Jones R: 551 User not local; please try [EMAIL PROTECTED] Or S: VRFY Gourzenkyinplatz R: 553 User ambiguous. (examples taken from: http://www.ietf.org/rfc/rfc0821.txt Page 8) Just a thought. -TG -Original Message- From: news.php.net [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 7:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Page that checks if a user exists on a remote system I have two servers: ServerA and ServerB. One server serves web pages, the other serves mail. I am making a web page on ServerA that will access ServerB to find out if a users exists and if not then add that user to ServerB with information collected from the web page on ServerA. I have this in a php file: $idResults = `ssh [EMAIL PROTECTED] id bigbob 21`; echo id: (.$idResults.)\r\n.\r\n; if (ereg(no such user, $idResults)) { echo 'username is available!'; } When I access the page I get: Could not create directory '/nonexistent/.ssh'. Host key verification failed. This, of course, is because the script is being run as www who has no place to put ssl keys. Could this be solved by having www su to a user who has remote access privileges? Something like this: $idResults = `su admin | ssh [EMAIL PROTECTED] id bigbob 21`; echo id: (.$idResults.)\r\n.\r\n; if (ereg(no such user, $idResults)) { echo 'username is available!'; // function addUserToServerB(vars); } Anyone else doing or done something like this? Thanks, -- Jonathan Duncan http://www.nacnud.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Page that checks if a user exists on a remote system
Yeah, this is definitely a maybe solution and depends on a few things being right. But if the alteratives are using su ANYTHING commands and if just asking the SMTP server produces accurate results, then it seemed like it was worth mentioning. But the few people who have pointed out that this can possibly be flawed, you are perfectly correct. -TG -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, December 02, 2004 11:28 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Page that checks if a user exists on a remote system On Thursday 02 December 2004 23:32, Gryffyn, Trevor wrote: If it's a un*x system and you have permissions to connect to the SMTP server, you could use the VRFY command to check to see if their email address exists or not maybe: Just want to point out that this behaviour is dependent on the flavour of the SMTP server so YMMV. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* ...and scantily clad females, of course. Who cares if it's below zero outside. -- Linus Torvalds */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Manipulation
In addition to Matthew's response... Strtotime() and mktime() both return a serial date. That's the 1101945775 number you got. To get this back to a mmdd format that you seem to be trying to do with mktime(), you want to use date() as Matthew suggested. Again, I think examples help more than RTFM: date(Ymd,strtotime(now)); mktime() and strtotime() produce the same output which is not a human-readable date format. So basically, in your example below, you told it that you wanted: The serial date (mktime()) of hour Ymd (evaluates as 0 I believe), minute 1101945775, with seconds, month, day and year all empty. I think the leaving them empty is ok since they're optional from right to left, and the excessive number of minutes probably wouldn't be a big deal (unless it goes past the maximum date rate, which looks like what it's doing). Let's do a quick calc: Looks like the max number that mktime() can produce is: 2147483647 This is 1/18/2038 22:14:07 If you take your serial date 1101945775 and pipe it into the minutes section of mktime(), it'll produce that number times 60 (60 seconds in a minute) and try to get that date. This produces a number: 66116746500 Significantly bigger than the max serial date for Windows mentioned above. Long answer to maybe help you understand how it all works. Btw: The serial date is the number of seconds since the beginning of the Unix Epoch (# of secs since January 1, 1970 that is... Hey, time's gotta start somewhere eh?) Hope this helps clarify mktime(), strtotime() and date(). -TG -Original Message- From: Christopher Weaver [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 7:13 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Date Manipulation This code: echo strtotime(now); echo mktime(Ymd, strtotime(now)); is producing this result: 1101945775 Warning: mktime(): Windows does not support negative values for this function ... -1 What am I doing wrong? Thanks again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Date Manipulation
As was already mentioned, mktime() and strtotime() both return a serial date. I use mktime() a lot to add/subtract days and such. It automatically compensates for leap days and all that. Example: ?php $month = 1; $day = 31; $year = 2004; $serialdate = mktime(0,0,0,$month,$day + 1,$year); echo date(m/d/Y, $serialdate); ? This should output 2/1/2004 (unless I made a typo). The initial 0,0,0 are the hour, minute, second. It works equally well with any numbers you give it for any of those values and if you throw it back into the date() function, you can format the outputted date however you want. I know mktime and strtotime were already mentioned, but I think examples help too so pardon me for expanding on it. -TG -Original Message- From: Christopher Weaver [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 30, 2004 9:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Date Manipulation I've looked at the date functions in the manual but can't find what I need. All I want to do is add and subtract days without ending up with bogus date values. IOW, Nov. 29 + 7 days shouldn't be Nov. 36. Just a nod in the write direction would be great. Thanks. -- 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] Custom Open Tags
I think there's a way to redefine what tag PHP uses, but I think it globally resets it. I don't think you can say use !blah ! and also use ?php ?. I think that setting is in PHP.INI somewhere. It might be easier to change your to be executed later php tags to something else and before it's sent to it's final destination, do a string replace to change the tags. If you have two different servers, you might go into PHP.INI and set the following tag on the last server and turn it OFF on the first server: ; Allow ASP-style % % tags. asp_tags = Off I'm not sure, but that may allow you to use ?php ? AND % % tags at the same time. All in all, I think I'd try to find a better way than using two kinds of tags and trying to jury-rig PHP to only execute some of it. Even if it meant using a conditional on the tags to be executed later if (!$finalexecute) ... and just change that value at the top of your code or something. Sounds messy all around, but there seem to be a number of ways you could possibly do this. -TG -Original Message- From: Sven Schwyn [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 01, 2004 4:16 PM To: [EMAIL PROTECTED] Subject: [PHP] Custom Open Tags Hi folks Does anybody know whether there's a way to tell PHP to accept an alternative open tag like for instance ?mytag or ?mc along with the normal ?php tag? I'm looking for a way to have two kinds of PHP code in a page. The first kind tagged ?mc ... ? contains the PHP code to manage page elements (like includes, menus etc) while the second kind tagged ?php ... ? contains normal PHP code for dynamic pages (like DB stuff). A page resides on the Staging (Virtual) Host and contains both kind of tags. When viewing the page on the Staging Host, both open tags are executed. Yet when publishing a page to the Production (Virtual) Host, the mc-tags are executed (and thus complete the page design) while the php-tags are left untouched (as they contain the dynamic stuff). Sounds more complicated than it is :-) Thanks for your hints,-sven -- 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] [SPAM] RE: [PHP] [Off] - A way for PHP sites to get extreme Google rankings
Well, there is a 'briandunning.com' as #4 on Google searching for 'ebay motors'. Now the trick would be to get listed under awesome php scripts or something relevant to your site. If anyone sees it necessary to try this, try going to: http://www.digitalpoint.com/tools/ad-network/ Sorry Brian.. Thanks for the tip and all, but when it's obvious that you benefit from it somehow and your message is essentially spam meant to create status, money, etc for you, it's good for people (who may be legitimately interested in such things) to know how they can do it without giving spammers (like yourself) incentive to continue spamming. The bitch about spam though, is that enough people will click on the link without thinking to make it worth even this much attention. Please don't take offense by me calling you a spammer, but no matter how helpful you're attempting to be, this is spam. Plain and simple. You're benefitting from it in some way... Or have potential to do so.. And it's incredibly off-topic (I don't see how Completely free and easy to do (as long as your site is in PHP) is accurate in relation to PHP being required for any of this to happen. I'd recommend to the moderators to set your posting status to moderate to prevent further spamming. It would have come off a bit more altruistic if it didn't have a referred ID attached to the URL. -TG -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, November 29, 2004 2:46 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] [Off] - A way for PHP sites to get extreme Google rankings Brian Dunning wrote: Check it out, in 2 weeks I got to #4 on Google for ebay motors - which, as you may know, translates into major affiliate dollars. Completely free and easy to do (as long as your site is in PHP). It's all about backlinks generated from this free ad network: http://originalurldeleted I'm guessing s=174 is your referral ID. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- 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] Is there a shorthand way to...?
I didn't see this in any of the responses, and truthfully it's not the best way or most secure.. .basically it has a lot of flaws that you should watch out for (probably creates security issues more than any other thing) but another option for mass setting variables that are possible set or not is to use extract() Extract() will take all the array items and assign the values to the keys: $_POST['courses_list'] = 'Used'; Extract($_POST); Becomes... $courses_list == 'Used' But if $_POST['courses_list'] isn't set, then you get no $courses_set variable. If you do end up using this, pay attention to variables that you havn't used yet that might be used later on. If a variable isn't set, in this case, if $courses_list isn't set, then extract() will put the value of $_POST['courses_list'] into $courses_list. If it IS set, and you use one of the extract() parameters, you can make it NOT overwrite the current $courses_list. Which may be a good idea to prevent someone from over-writing one of your security related variables. I only mention this because I think it can be very useful. I wouldn't be as concerned with $_POST variables as I would with $_GET variables. You don't want to make it so someone can go: Yourscript.php?userauthneticated=1 Then do: Extract($_GET); Then you have... $userauthenticated == 1 If you then have something like: If ($userauthenticated) { # Some code that allows user to edit or view personal stuff, demographics, passwords # etc... Or even make changes to a database or other security related stuff } That would be bad. You may still end up having to do a isset($courses_list) to decide what to do with the info later, but if you end up with 100 $_POST variables, then extract() might help break those out for ya. -TG -Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: Monday, November 22, 2004 9:01 AM To: [EMAIL PROTECTED] Subject: [PHP] Is there a shorthand way to...? When handling $_POST[] values that may or may not be assigned, I am forever using: if((isset($_POST['courses_list']) AND $_POST['courses_list']== 'Used')) Is there a shorthand way of doing this without causing notice errors? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] IE title bug
This is probably more of a straight HTML/JS/something question. Do you happen to be using any kind of javascript or vbscript in your source that does any kind of application.caption or window.title or anything like that? I've used Application.Caption in VBA within Excel to update the title of a window so I could get a quick and dirty status of something being processed and I've seen odd things happen with that. If your title/title HTML tag looks ok, I'd try to look into any application. Or window. Stuff in Javascript or VBScript or some other browser based scripting stuff. Good luck! -TG -Original Message- From: Giles [mailto:[EMAIL PROTECTED] Sent: Monday, November 22, 2004 6:10 AM To: [EMAIL PROTECTED] Subject: [PHP] IE title bug Hello people I am making a movie browsing site. On one page I have a list of movies as links. When you click on the movie it goes to another page with the movie ID as an anchor in the page so that the browser scrolls to that movie. The title of the page is made up of the movie category name and the movie name. This all works fine in mozilla but in IE the title appears like this: Site Name - Category Name#3037#3037#3037#3037#3037#3037#3037#3037 Where #3037 is the ID of the movie and obviously appears at the end of the url. Looking at the source of the page the title tag is fine and does not contain any id's (or it would appear in mozilla as well). Also the title appears ok to begin with - the page has flash thumbnails of the movies in and as each of these swf's load into the page another #3037 appears in the title. We are using the satay method of flash embedding as this is required by the client. Possibly it is something to do with that? Anyone seen anything like this before or have any suggestions? Thanks Giles Roadnight http://giles.roadnight.name -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timezones
Then somewhere there has to be a cross reference between name and timezone info. I'm sorry I'm not running Apache here and don't have access to the same info that you're using, but I'd try digging into those config files and any database tables you can find that seem to relate to it. I'm sorry I can't be more help, but it's gotta be in there somewhere. Maybe someone else can give you a better idea. I'm re-posting this to PHP General in case someone has any addition info. Sorry for the long-winded response that didn't really help. Hah. I didn't even consider the whole alphabetical thing, I should have noticed. Good luck! -TG -Original Message- From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] Sent: Monday, November 22, 2004 11:24 AM To: Gryffyn, Trevor Subject: Re: [PHP] Timezones Hi Trevor, I am using Eclipse with a PHP plugin to modify my PHP system. Actually this system is based on the Source Forge but the guy that made all the modifications is not available any more and I am trying to understand it and perform some changes. The user.timezones field is modified by the user himself by selecting the appropriate TZ from the list attached in my previous mail. I am looking for a PHP function or script that would give me the offset of each TZ in respect of GMT. As input parameter it should have the string TZ_name and as result the time (in hours, minutes or seconds). Using Excel does not help because in the list I have 466 entries for 24 whole hours and some half hours. I cannot apply any logic to this list because it is sorted alphabetically. But my Apache/PHP knows perfectly what is the time offset between the server and the user. And this is based only on the TZ info stored in my apache config file and the user table. Kindest regards, Venelin Gryffyn, Trevor wrote: I did a quick search for some of the timezone names and didn't quickly find a list that included the GMT offset (also called the UTC offset sometimes.. I think GMT and UTC are the same). BUT.. In general the timezones go hour by hour so if you used something Excel (or some spreadsheet), created a list of your timezones, found the offset of the first one, then did a +1 on the next one... On down the list. That'd get you close to what you wanted. Then find a decent list of offsets and insert rows where you have stuff like Indiana or places that have a 1/2 hour offset. After that, I'd copy/paste the list into a good PHP editor that has macro functions (I use Crimson Editor http://www.crimsoneditor.com) and record a macro to format the lines in such a way that ends up building a new array in PHP. If you've never done this, it's easy. Say you start with some lines like this: $TZs[]='US/Alaska'; $TZs[]='US/Aleutian'; $TZs[]='US/Arizona'; You'd record a macro in Crimson Editor that does this: (1) place cursor here and start RECORD MACRO$TZs[]='US/Alaska'; (2) Hold CTRL-SHIFT and tap RIGHT ARROW until you get to just before the US and hit DELETE this is what you have nowUS/Alaska'; (3) hit END to go to the end of line and delete two characters US/Alaska You now have just your timezone... You may have a list like this already though. (4) hit the down arrow to put you at the beginning of the next line$TZs[]='US/Aleutian'; End macro recording. Now all you have to do is hold down (in Crimson Editor) the ALT-Macro# key (I reuse ALT-1 constantly) until it finishes doing these actions to all lines. (5) Copy and paste this list into Excel or something Now after you get your numbers in Excel and you've adjusted for the odd timezones. You'd do another macro like this: US/Alaska+1 US/Aleutian +2 US/Arizona +3 (when you paste from Excel into Crimson Editor, you should have TABs between the names and TZ #'s... Note, the TZ offsets listed above aren't accurate, just using numbers as examples. There's no way Alaska is 1 hour ahead of GMT) (1) position cursor at beginning of line againUS/Alaska+1 (2) Enter something like: $tz[ So you end up with: $tz[US/Alaska +1 (2) in this case, you can't just go to the END of the line and cursor back X # of characters or even tab back. +1 and +3.5 are too different tab-wise.. So maybe we'd do a FIND for + and hit DELETE to remove the +. (3) After you do the FIND and DELETE, your cursor should be just to the left of the number. Hit BACKSPACE to remove the tab, now you're in a good position to continue your array building: $tz[US/Alaskacursor is here1 (4) Enter some middle line stuff: $tz[US/Alaska] = cursor is here1 (5) Now finish the line. Hit END to take you to the end of the line, enter a semicolon, then cursor down and HOME to take you to the beginning of the next line so you can do it all over again. $tz[US/Alaska] = 1; cursor is now hereUS
RE: [PHP] getting the highest number in 3 db fields?
If we're trying to get the max value between 3 columns in a row like this: Prolog transmodal asian 1 2 3 We'd want to get the value 3 If you wanted to get the max out of three values in a row, you might do something like this: SELECT MAX(prolog, transmodal, asian) FROM sometable I think that'd work. But then there's mention of row1 vs row2 vs row3.. So I guess I'm confused. In which case, if we're looking at: NameValue - Prolog 1 Transmodal 2 Asian 3 Then you'd do something like this: SELECT Name, Max(Value) FROM sometable group by Name You can do this in PHP as well, but make the DB server do all the work. :) -TG -Original Message- From: Dennis Seavers [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 1:46 AM To: Louie Miranda Cc: [EMAIL PROTECTED] Subject: RE: [PHP] getting the highest number in 3 db fields? Try using the SQL aggregate function MAX() or the PHP function max() [Original Message] From: Louie Miranda [EMAIL PROTECTED] To: [EMAIL PROTECTED] Date: 11/18/2004 11:34:57 PM Subject: [PHP] getting the highest number in 3 db fields? I have a db field of 3. - prolog - transmodal - asian I wish to get the highest number of those three, in different fields. Im thingking of.. if (row0 = row1) ... how about row2? confused.. -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Timezones
Don't know if this helps, but this was a message regarding Windows based long timezone formats that was posted a little while ago by another user: --- Kim [EMAIL PROTECTED] Managed to find it It helps using just those right keywords after a million goes http://www.steltor.com/notes/corptime-server/5_4/refmanual/refappd.htm this is a list of all timezone notations. Thanks for your help. Thought about the long way but it was not a pleasant thought as you may imagine, was hoping to avoid at all costs. Hopefully this sorts it. --- You might want to build a table or a list in some way that'll return the GMT offset for you. Let us know what you end up doing. -TG -Original Message- From: Venelin Arnaudov [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 6:57 AM To: [EMAIL PROTECTED] Subject: [PHP] Timezones Hi, I have a legacy PHP3 system and a MySQL DB with two tables: user { user_id int, timezone varchar (like Europe/Brussels, US/Eastern, America/New_York, etc.) } and messages { msg_id int, user_id int, date int } When a user submits a message, my PHP script (using time() function) stores the submission time in messages.date field. However this value is not the server's system time but shifted according the users timezone. 1. How can I convert it to reflect my timezone (ex. GMT)? Is there a way to find the offset between two timezones given in long format as in my table? 2. I would appreciate any information on how the PHP/Apache handles the timezone offset when calculating the time. Which of the PHP date/time functions take into consideration the environment variable TZ (upon user login there is putenv('TZ='.user_get_timezone()); command)? Thank you in advance, Venelin -- 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] HTML form online
Sure, get whatever data you need into variables and just do something like this: ? $firstname = Trevor; $lastname = Gryffyn; $company = Air Cargo Inc; ? html headtitle/title/head body form action=process.php method=POST First Name: input type=text name=firstname value=?$firstname?br Last Name: input type=text name=lastname value=?$lastname?br Company: input type=text name=company value=?$company?br input type=submit value=Submit /form /body /html Basic HTML form pre-population, but using PHP variables. Makes it nice and dynamic, good for pre-populating query data that's already been run (searches and such) so the user can modify what they just did instead of re-typing it all. -TG -Original Message- From: Jerry Swanson [mailto:[EMAIL PROTECTED] Sent: Friday, November 19, 2004 2:40 PM To: PHP List Subject: [PHP] HTML form online I want to write php script that fill out HTML form online. Any ideas how to do it? -- 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] mp3 parsing
Nice script.. Short and concise. Havn't tested it yet, but I like short and concise. :) One thing to note.. This appears to handle ID3v1 tags (which are stored at the beginning of the file). ID3v2 tags are stored at the end of the MP3 and are a little trickier to deal with but they can hold a lot more information. Check out this: http://nyphp.mirrors.phpclasses.org/browse/package/640.html Havn't used it, but it's the first one I came across doing this search: http://search.yahoo.com/search?p=php+id3v2 I'm sure you can find a ton of ID3 parsers for PHP. Just wanted to point out that there are at least two standards for ID3 tags and that you should probably check into both if you want full compatibility. -TG -Original Message- From: Ron Stiemer [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 16, 2004 9:01 PM To: [EMAIL PROTECTED] Cc: Ryan King Subject: Re: [PHP] mp3 parsing Hi, maybe this wil help you...i made this some time ago... ?php function ShowID3( $mp3, $path ) { $file= $path . $mp3; $value = fopen( $file, r); $content = fread( $value, filesize ($file) ); $tag = str_replace( TAG,, strstr( $content, TAG ) ); $title = substr( $tag, 0, 30); $band= substr( $tag, 30, 30 ); $album = substr( $tag, 60, 30 ); $year= substr( $tag, 90, 4 ); $comment = substr( $tag, 94, 30 ); //$genre = substr( $tag, 124, 1 ); echo, bTitel/b: . $title . br . bBand/b: . $band . br . bAlbum/b: . $album . br . bJahr/b: . $year . br . bKommentar/b: . $comment . br; fclose( $value ); } ShowID3( test.mp3, ); ? Regards, Ron Am Mittwoch, 17. November 2004 01:58 schrieb Ryan King: Anyone out there have a way to read the header info out of an mp3 file? I'm able to parse out the id3 tags, but am having trouble finding a way to read the header info. The info I'm trying to get is the playtime and bitrate. thanks, ryan -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP-editor connected to FTP?
I use Crimson Editor which will save directly to an FTP location fairly easily. I'm not sure if they fixed this, but in earlier versions it wouldn't save a local backup copy and I ran into problems where it would fail to send via FTP, I'd have a zero byte file on the remote web server and would close Crimson Editor without testing first or something.. So I'd lose whatever edits I did since my last backup. So I stopped using the Save to FTP feature. I do believe that they do local backups now, but out of habit I don't use the FTP Feature. I bet Zend Studio will save remotely too. -TG -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Thursday, November 18, 2004 7:24 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP-editor connected to FTP? On Thu, 18 Nov 2004 09:41:53 +0100, Peter Lauri [EMAIL PROTECTED] wrote: What editor do you use when working with websites (php) connected directly to the FTP? Editplus has this ability. http://editplus.com/ -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP Supremacy...
Thanks for the link. Here's one relating to Yahoo's use of PHP: http://public.yahoo.com/~radwin/talks/yahoo-phpcon2002.htm Also, out of curiosity I recently did a search trying to find some numbers comparing ASP usage to PHP usage. Market dominance and penetration and such. I didn't look too long and didn't find any GREAT sites with hard numbers, but here's some random tidbits I came across. I don't have time to figure out which of the links I bookmarked I got the info from, so forgive the rough numbers and paraphrasing. There seemed to be a 2003 survey of IT professionals (as well as another source or two) that seemed to indicate the following: Roughly 1/3 of the web servers on the internet these days run IIS Roughly 2/3 run Apache in some fashion Ok, so I'm rounding a little.. There were a smattering of other web servers of course, but let's work with these numbers as an example. Roughly 40-50% of the Apache guys were running PHP as their primary scripting language (at least for web authoring). Assuming that 100% of the IIS guys run ASP or ASP.NET (which isn't a great assumption, but let's make it anyway). That'd put IIS + ASP at roughly 1/3 market penetration and Apache + PHP at roughly 1/3. When I think of Microsoft vs Other, especially open source, I feel like that even if it's close, it's going to be a 60/40 or 70/30 sort of split in MS's favor, not a dead 50/50 sort of deal. So these kind of stats are VERY encouraging for anyone who needs to make the argument to their boss regarding how popular PHP is, if it's going to be around for a while (see other responses for ammo on that argument, I agree with all of them so far) and if there are going to be people to support your PHP apps if you die, quit, get fired, join a monestary, etc. There can't be that many Apache + PHP based servers without a corresponding number of developers. There aren't 20 PHP developers doing all the work and 100,000 ASP developers doing the same amount of work in ASP. There was another thread earlier this week though talking about justifying the use of PHP and another great point was brought up. What do you use for your main servers currently... What do the other developers you possibly work with already know versus would have to learn, what other applications do you have an what languages are THEY written in, etc. There are a lot more questions that need to be asked in order to justify PHP development. If you have a bunch of .NET developers and already have some ASP.NET applications, then it might be more cost effective for you, a single person, to learn ASP.NET (I know, I'd hate to give up PHP too), then to have 5 other people learn PHP and then convert existing applications over to PHP, etc. ASP and ASP.NET are free, just like PHP.. If you already run MS servers. The good development tools might be another story, but if you have Windows XP (Pro I believe), then you have IIS and can run ASP and maybe ASP.NET. If you have Windows 95 or Windows 98, you have Personal Web Server which will do ASP. I think open source means a more guarenteed support base and backward compatibility compared ot MS's whim of the day deciding that things like J++ weren't viable to support, for example. Sure, there are still J++ developers and user groups and such, but it only lasts so long before someone says This is antiquated, we need to move to something else. Sure, eventually most of us will have to port our PHP4 stuff to PHP5 PHP changes too.. But it's less dramatic than going from J++ to C# or something. Anyway, I'm babbling now. Just some things to think about. Keep fighting the good fight. Keep asking the right questions. Good luck. -TG -Original Message- From: Jordi Canals [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 17, 2004 9:34 PM To: PHP List Subject: Re: [PHP] PHP Supremacy... On Wed, 17 Nov 2004 16:17:44 -0600, Pedro Irán Méndez Pérez [EMAIL PROTECTED] wrote: Hello my friends, I need your help in convince to my boss in adopt php for development of a tool for intranet in my office, he told me that php is open source and we don´t know if will disappear in a year, or if php have a support like .net. what arguments can I show for convince him to try PHP? You know that PHP will not disapear in a year, as it is Open Source and anybody can take it and do what he wants with the source code ... Also there are important companies that have PHP based bussines (Zend for example). Well, the first thing you must tell him is that Microsoft has demonstred that changes technologies at his own interests. When a new version is released you have to update if you want support. As the source code is closed, nobody else than MS can maintain the code, so you're married with them. And of course, any upgrade means lots of money. If you choose the MS platform, Microsoft will decide when you should upgrade, if you look
RE: Re[2]: [PHP] PHP Supremacy...
GT Roughly 1/3 of the web servers on the internet these days run IIS GT Roughly 2/3 run Apache in some fashion I know you said roughly, but it's less than 1/3 running IIS, quite a bit less infact. The latest Nov. 2004 Netstat survey puts it at well under a quarter (21.25% to be exact) with Apache at 67.77% http://news.netcraft.com/archives/2004/11/01/november_2004_web_server_su rvey.html Yeah.. roughly hah. I'm sticking to that phrase. :) And yes, Netcraft was one of the sites I was looking at for the information I mentioned earlier. Thanks for the link. Ok, let's also assume that 100% of the IIS sites out there use ASP, that's still only 11.9 million sites which doesn't give them an equal market share in my books :) Ahh.. What about +/- ?? % margin of error? (devil's advocate hah) The problem of course is that while all IIS hosted sites have the ABILITY to use ASP, I would be utterly stunned if anywhere near half of those actually did. Just in the same way that while all Apache servers *could* run PHP if they wanted, I'd be amazed if all site owners used it. There are millions and millions of static HTML sites out there, I don't think you can accurately gauge it on server software alone. I know that you weren't trying to, but I'm just saying. Agreed. Very good point. GT ASP and ASP.NET are free, just like PHP.. If you already run MS GT servers. The good development tools might be another story, It's the total cost of ownership though. True. Then let's look at average salary of a Windows server admin versus un*x server admin. I'd be curious to see how they stacked up. That'd have to be part of your total cost of ownership as well. Unless you were totally starting from scratch and were doing it all yourself (learning whatever tech you needed to learn to get it all done). Then you'd have to factor in how much maintenance time each OS required on a regular basis, etc. Too much math for me right now. But in general, I think it's fair to say that free OS + free scripting + free web server probably beast out pricey OS + free scripting + free web server. But something has to be factored in for we need this OS for other things/requirements too. That's a bigger and more complicated question. I don't know anyone who has set up a server specifically for web hosting and no other purpose (ok, before you jump on me about people having dedicated web servers... Chances are, they have other servers on the same network that handle ActiveDirectory, DNS, mail, etc and their web server choice was highly influenced by their choice in other servers.. Please take my above statement as one server, one function, no other influences or something. The phrasing I want isn't coming to me right now so I'm going to be lazy and send it out just like this.. Hah). In general I do agree though. Total cost of ownership is PROBABLY less with free OS + free scripting + free web server. Look at the number of IIS related security issues on Netcraft, Bugtraq, etc. Even with a 20% market share it's still got more holes than a piece of Swiss cheese, although I dare say the majority of those are down to using Windows as the host OS in the first place. True.. Not like other OS's DON'T have security issues though. Running Sendmail on your un*x box with Apache + PHP? Running SunOS or IRIX? How about the recent Mac OS X un*x based security issues? Again, devil's advocate I'm not a huge MS fan, but it's not like they're the only OS and general platform that provides security issues. PHP and Apache have had their share. Maybe MS has more in general, or maybe certain bits of MS's collection of apps have had more, but how does that add up to all the little ones that various un*x components have had? How do you quantify how vulnerable or unstable is your OS?? It seems like MS might be more vulnerable, but how would you honestly measure that? I'm not trying to start that holy platform war here, I'm just saying IIS could be the most awesome piece of coding ever, but it'll still always fall foul to that which it sits upon. Yup.. I agree. Again, I'm not trying to start any holy wars either. I use whatever OS or scripting language or whatever you put in front of me. I have my favorites, but there's good stuff in most systems. And I don't take your comments as being flaming or antagonistic at all. But the question remains in my mind, how does someone really, fairly, measure all this stuff and give an accurate comparison between the various system setups and configurations? I don't care to find out really. I let the evengelical users of one system or another go on about how great their system is (even PHP) and usually stay out of the discussions that I feel are more opinion based than hard-facts based. Whatever people choose to use is cool with me. I have my reasons for using what I use.. And so do they. Whatever gets the job done eh? Best regards, Richard Davey
RE: [PHP] Help: Database Search
You can't do WHERE Industry = 1, 2, 3 unless that's something you can do in MySQL but not the other DB's I've used. What you CAN do is us IN: WHERE Industry IN (1, 2, 3) Or.. WHERE Industry IN ('1','2','3') IN basically does a Industry = 1 OR Industry = 2 OR Industry = 3 type thing. If there's a more efficient way to do your query, I'd recommend it. IN or even the multiple OR statements can be very intensive on a database with a high load or tons of rows. But it's definitely the right answer for some solutions. If you have 8 categories for Industry and you're doing IN (1, 2, 3, 4, 5) then you might consider doing a 6, 7, 8 type thing (I'm guessing you can do NOT IN (6, 7, 8), just never done it). The fewer things you're checking in your WHERE clause, the less work your DB server has to do. HTH -TG -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: Saturday, November 13, 2004 1:16 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Help: Database Search I've changed my logic around but still running into a sql query error. I've tried a number of things with no success. Here is the error that returns on POST: SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE (VendorJobs.Industry = ''1','2','3''Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '1','2','3''' at line 2 . Here is the relevant code: $Ind = $HTTP_POST_VARS['Ind']; if (count($Ind) 0 AND is_array($Ind)) { $Ind = '.implode(',', $Ind).'; } $sql = SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs; //if ($Ind) $sql .= WHERE (VendorJobs.Industry = '$Ind'; I'm not trying to be a pain here. Either I'm not catching a syntax error or something else. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Hacking attempt
Sounds like someone replaced their INDEX.PHP with something else. Short answer: You can get the INDEX.PHP back if you restore it from a backup copy you should have. If you don't have a backup copy, then you can't get it back most likely (unless it's on a system that you can manage to undelete from, but chances are it's been over-written by now). The bigger question is How do we keep someone from replacing our PHP scripts again?. I'd do some research on PHP security. Cross Site Scripting vulnerabilities are big these days and many (all? Need to do more research) can be handled by the PHP developer by scrubbing user input sufficiently to make it impossible. Also, keep up with the latest versions of PHP as they tend to patch security issues that are known to exist (can't patch something that nobody's reported though). And the biggest must do Keep backups. If you gotta, you can always just copy over the hacked pages with a few copy of your latest/greatest PHP scripts. Good luck. -TG -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Sunday, November 14, 2004 8:51 AM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Hacking attempt and what exactly is a hacking attempt? The Doctor wrote: One of our customers how has Hacking attempt on their index.php instead of their regualr page. What caused this and how do we get the regualr page back? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] XML Parser doesn't work when moved....
Using PHP 4.2.1 as a development platform to run on a 4.3.7 production box? How strange. Haha Assuming you have zero control over this (otherwise, UPGRADE or something :) then I'm not sure what to tell you. Here are some articles you may have seen already, but passing them on anyway: Parsing non-well-formed XML documents in PHP 5.1 http://blog.bitflux.ch/archive/parsing_non_well_formed_xml_documents_in_ php.html Parsing RSS at all costs (some general ideas, not necessarily PHP oriented) http://www.xml.com/pub/a/2003/01/22/dive-into-xml.html Random comments at PHP Manual: http://ar.php.net/manual/en/ref.xml.php Random info from Zend: http://www.zend.com/zend/art/parsing.php need help with Sablotron parser error http://www.webmasterworld.com/forum88/2491.htm You also might try to pre-qualify/validate the XML and if it doesn't pass the well-formed test, to put it aside and notify you of a problem. Here's info on 'well-formedness': http://www.developer.com/lang/print.php/784621 http://www.phpfreaks.com/xmlmanual.php Hope this helps a little. -TG -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 4:18 PM To: Jay Blanchard; [EMAIL PROTECTED] Subject: RE: [PHP] XML Parser doesn't work when moved [snip] Having added the following line echo XML Error . xml_error_string(xml_get_error_code($covadParser)) . br\n; just after the xml_parse PHP is reporting not well-formed (invalid token) so I will have to explore. [/snip] Having beaten my head against the wall for severqal hours now, I am thouroughly stumped and have a major headache. I have turned over all of the rocks that I can and cannot even come up with a clean explanation of the error itself. Does anyone have anything that can help me clean this up? Unfortunately I have no control over the XML as it is a received document that I am trying to parse. -- 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] Column Totals
Because you don't technically 'need' it, unless you're trying to reference the results by column name and you're using an aggregate like that. :) And in most systems, you don't need the AS just a space and a new name: SELECT SUM(Revenue) Revenue FROM Sales Where. But all depends on your style. I don't think the SQL Server or Oracle server I deal with care if you put the AS in there or not. Again, it's not required unless you're relying on a name coming back with the result set, then you might want to be explict with an alias like that. Also, when you use aggregates, remember that they'll they group the non-aggregate functions based on uniqueness. This will happen even if you're not displaying the non-aggregate functions, so you may get repeats of some things that you can get rid of by using SELECT DISTINCT Sum(... But if there's anything non-unique in what you're using in SELECT or WHERE, it'll use that for grouping. This includes the hours, minutes and seconds in a date field sometimes. If the query below worked for you, then I guess it's enough for MySQL (is that what you're using?) but in some systems it may not be and you may get every row in the database non-SUM'd because the dates all have different seconds in the time. In that case, you'd need to section out the day/month/year and compare based on that or something. Just some pitfalls to watch out for when you're not used to aggregates and grouping. -TG -Original Message- From: Ben Miller [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 1:22 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Column Totals That did it perfectly. Why don't any of the stupid books tell you that you need the AS statement? -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Monday, November 15, 2004 11:16 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Column Totals [snip] The following query seems to return an empty string, which should only give me the total for the entire column anyway. $query = SELECT SUM(Revenue) FROM Sales WHERE Date='$Date'; [/snip] $query = SELECT SUM(Revenue) AS Revenue FROM Sales WHERE Date='$Date'; note the AS statement-^ $foo = mysql_query($query, $connection); $bar = mysql_fetch_array($foo); echo $bar['Revenue'] -- 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] Database search logic question
Did you take the time to think about what you were going to do before starting your application? Honestly , no I did not. What I did start out with is a belief that there wouldn't be a need to know php. I was using a RAD, that was sold as all encompassing. Fool me once. Yeah, that's always fun. You think you're getting something close to what you want, maybe with some tweaking, and what you end up with is really a giant spaghetti tangle of unusable code that you have no choice but to hack enough to get a functional product. Or re-write the whole thing by hand. Don't worry.. Questions are good, but do your best to untangle what you can, get all your questions together and hit the web sites and mailing lists. The more research you do and more helping yourself you do, the less RTFM and othe responses similar to what you got above. But hell... It's not like the rest of us have never ended up neck-deep in a mess that we needed as much help as we could get to untangle. If you are looking to have the SQL query string sent as POST vars but don't know how to get those out of the array, I would say you have some RTFMing to do, the same would go for sending the users to your results page AND ( you can do both POST and GET vars for a single page)adding a querystring to the url so that the user could bookmark the url and have a way to return to the same query they specified provided that the database query happens on/in the results page. Ok, I was not aware that both POST and GET can be used at the same time. Yeah, you can do that. GET requests are just where the info is passed via the URL. You don't even need a FORM to do GET variables. Just do scriptname.php?getvar1=Testgetvar2=Test2 Then use $_GET[getvar1] or whatever you named them. You can also use $_REQUEST[] to get any data put into $_GET, $_POST or $_COOKIE (superceding in that order I believe.. That is, it gets all the GET data first, and if there's a POST variable of the same name, it overwrites the GET version... And COOKIE overwrites POST). If that answers any of your questions, great, if not, try planning ahead a little instead of asking the list to write the functionality code for you. Okay, so showing me how something works is now wrong ? No one has shown you code or explained a better method at some function ? This particular post has went way passed its course. Thank you for your help. Probably...Understand that there are a lot of people on here who post a lot of responses and help a lot of people and they have bad days just like everyone else. So while you ask for patience and consideration for your questions, be sure to show some patience and consideration for those who bother to respond. It's a two-way street. I mean, if people got nasty every time someone asked a question that was answered with YOU HAVE REGISTER GLOBALS TURNED OFF NOW!! or other questions that we all probably ran into when we were starting out ourselves, then we'd have a lot of flaming going on here. This is a PHP General mailing list, it should be for general, newbie, etc sort of questions. But the expectation is that the questions being asked were researched some ahead of time as well. Although that's not always an option and that needs to be understood as well. Good luck, Stuart. -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copyright law, how to protect your investment, how to protect your work... Was - RE: [PHP-DB] Please point me in the right direction.......
I'm surprised I havn't seen this question come up before (might have just missed it) but it's an excellent question so forgive the crossposting as it's extremely relevant to coders and those purchasing services of coders. Anyone who's gotten married and hired a wedding photographer is probably familiar with the idea of You can't make your own reprints, the photos are owned by the photographer. What kind of BS is that eh? It was your wedding! You paid the guy, right? I read a really interesting article talking about this a while ago and found out that they key words you want to use (if you want to own what you pay for) are the words work for hire. Usually this would be put in the contract or even on the check you use to pay for the services.. Signing this check constitutes the payee's acknowledgement that the services performed and the final output/art/photos/etc is considered a Work for Hire or something like that. It's not good enough to say All copy rights transfer to the client apparently. How I understand it is this... Any artist (musician, coder, author, painter, etc) has an implicit copyright on whatever they make as soon as they make it. While in the process of making something, it's considered a Work in progress and has additional rights under certain laws (see the Steve Jackson case with the Secret Service about them seizing electronic copies of a game manual that was in progress as a suspected guide to hacking. The electronic copies weren't protected back then whereas a printed copy would have been.. But they may be protected from seizure in legal cases these days... Not sure). Anyway... So you write this code and you own it. Regardless of whether someone paid you to write it. Unless of course you have an intellectual property thing with the company you work for (like I do.. It says whatever I create for the company... On company time... Is theirs). So all those websites and PHP scripts that you set up for people... They're yours. Unless the client specifies that it's a work for hire in your contract or on the check you gotta sign to get your bucks. Now from the client's side of things.. Because we don't always write our own stuff.. It's important to know about this as well so you can protect your investment. I don't know that a coder can legally demand that you stop using their code, but it means that if you want to re-sell what you had developed, you need to clear it with the coder first. A lot of people don't know this stuff and it's hard to find out when someone's pirating code that technically belongs to you.. But it's good to know what rights you do have. Doing a quick search on Yahoo for work for hire and copyright, I found a TON of sites that seem to cover the subject. I don't have time to read them, but at a glance, some of these sounded like good things to check up on: http://www.weblawresources.com/Work-For-Hire-Clause.htm http://www.gigalaw.com/articles/2000/loc-2000-02.html http://www.copylaw.com/new_articles/wfh.html http://repositories.cdlib.org/boaltwp/55/ http://www.keytlaw.com/Copyrights/wfhire.htm http://www.copyright.gov/circs/circ1.html http://www.music-law.com/workforhire.html Hope this helps and maybe informs a few people. You can ask me questions if you want, but this is literally all I know about the subject. You're better off reading up on the sites above (and Googling for others) and talking to a copyright lawyer about the matter if you want more details. Good luck everyone! -TG -Original Message- From: Michael Cortes [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 10, 2004 2:12 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] Please point me in the right direction... I have a question about contracts or agreements. I am considering hiring a local company to do some coding for us in LAMP to augment what we have done already. I have a problem with the standard we own the code and copyright clause in thier service agreement. Can someone point me to the correct mailing list as I don't wish to start an inapropriate thread. Thank you. -- Michael Cortes Fort LeBoeuf School District 34 East Ninth Street PO Box 810 Waterford PA 16441-0810 814.796.4795 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] 'Code Snippets' you couldn't live without
I agree that shorthand is probably bad for, BUT... Greg is absolutely correct. The gist of the post was What do YOU use frequently. His examples were good enough to illustrate the idea. For me, I have a handful of includes that are in most/a lot of my scripts. I'm not going to paste them here because they're rather lengthy (which is why I have them as includes). They include the following: 1. ADOdb + a dbconnect include. I like using ADOdb because for a while I was using MySQL, Oracle AND SQL Server (now mostly just SQL Server, but some Oracle as well). Even though I don't really use ADOdb's full power, I like being able to write standard SQL and use a few prep variables and connect to whereever I need to. I have my connection strings defined in my 'dbconnect' and just say $database = Oracle. Pass the database, the sql string and I also send the report name (I use the APP=$reportname in my connection string so I can identify one of my scripts' processes looking at the process list on the database server). The results come back in an array that I use the same set of commands to parse when it's done.My dbconnect also logs db errors to a text file or alternately logs ALL sql queries (if I set a $verbosity variable). 2. dateconvert - I have a handful of functions to convert from one date format to another. This is helpful in so many ways. Nuff said 3. metrics - Logging script usage by snagging the NT username, user's IP address, time, date, script run, etc Those are the big ones. This kind of topic is kind of useful for the PHP development team as well because if there are functions that people keep writing themselves, then they may be good candidates to make into standard functions. I'm always amazed at how much PHP does already and I'm guessing a lot of those functions came out of someone saying Hey.. We all use this type of function CONSTANTLY.. Can it be built into PHP's core instead of us having to INCLUDE it all the time? -TG -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Wednesday, November 03, 2004 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] 'Code Snippets' you couldn't live without On Wed, 03 Nov 2004 20:22:14 +0100, Klaus Reimer [EMAIL PROTECTED] wrote: This may be ok for private projects but otherwise I don't think it's a good idea to create shorthand functions. Murray wasn't asking for your opinions on _his_ code, he was asking what code _you_ had that you couldn't live without, code that makes your life easier when reused from project to project. Criticism comes easy when you have nothing to contribute otherwise. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Php files with .html extension?
That's definitely a good point. I'm curious though, would it really be a significant performance issue? Even if a lot of HTML files are being processed by PHP? I mean, if the PHP parser goes through and never sees a ? Or ?php, does it do any more than just output the file? True, that's something, but is it anything really significant. The only thing I can think of that'd be an issue is, what happens if you have a bad compile of PHP, or what happens to a system after PHP is run 180,000 times? Small programming issues can create minute instability issues for systems. Or in the case of outright memory leaks, sometimes a major issue. That's the only thing that'd really concern me, but it's still definitely a good question to ask. -TG -Original Message- From: Graham Cossey [mailto:[EMAIL PROTECTED] Sent: Monday, October 25, 2004 11:30 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Php files with .html extension? Do not forget that if you do this ALL files with the .html extension will be parsed by PHP whether they are PHP scripts or not which could be something you need to consider from a performance perspective. -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: 25 October 2004 14:59 To: [EMAIL PROTECTED] Subject: RE: [PHP] Php files with .html extension? [snip] How can i do a php script with a html extensionsuch as http://www.blinds-wise.com/shop/p/blind/bid/1/venetian_blinds.html [/snip] You set it up in your httpd.conf You should have AddType application/x-httpd-php .php change it to AddType application/x-httpd-php .php .html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: Re[2]: [PHP] Php files with .html extension?
True, it doesn't do anything other than output the HTML. But it's that load - scan - determine - output that takes up CPU time and memory. Sure, on most sites it doesn't matter one bit. But on popular sites.. well, you can do the math I'm sure. I guess at the end of the day it comes down to don't do un-necessary things. That goes for your code as well as your server set-up, but it's true to say that if you don't actually need to parse HTML as PHP, then don't. Well yeah. I fully agree. Keep it simple, don't put any more load on a server than you have to, don't run anything you don't have to, don't provide any opportunity for the system to become unstable or slow... if you don't have to. Going on the assumption that someone might have a requirement to use .html, I was wondering what the impact would be. I could see someone wanting to use .html to obscure the fact that they were using PHP scripts (for various reason), but if that's intended as a security measure, then it's classic security through obscurity, which will fool some people, but not the people you really have to worry about. -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: ' (Single Quotes) in user inputs
Also, you probably want to do a string replace of some kind and make the single quote a double single-quote ' to '' I don't know if that's how MySQL does it, but that's how SQL Server escapes single quotes and I believe other DBs do as well. Just something to look into because I think the \' might not work on DBs that use ''. -TG -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, October 18, 2004 8:59 PM To: Jerry Swanson Cc: Christian Jul Jensen; [EMAIL PROTECTED] Subject: Re: [PHP] Re: ' (Single Quotes) in user inputs Jerry Swanson wrote: I'm not sure that stripslashes() are used for input. If you want to redisplay the input, then it would be used. addslashes() - to insert data into database stripslashes() - to get data from database and print it. You don't need stripslashes when pulling data unless you have magic_quotes_runtime enabled. If you find that you need to call stripslashes on your data, then you're escaping it twice before you insert it. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] constant tasks
It's possible to have a script running constantly, but Jay's right. CRON or some other task scheduler would probably be better. If you had something running constantly and there was some problem with your compile of PHP or something else that's getting used, there can be memory leaks or other issues that could cause complications. Running something periodically rather than constantly is probably better in most cases. -TG -Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Monday, October 18, 2004 1:09 PM To: Aaron Todd; [EMAIL PROTECTED] Subject: RE: [PHP] constant tasks [snip] I'm wondering if it is possible to have some kind of script running all the time. I have a site that collects data that users enter and emails certain people and does other various tasks with the data. Some of the information collected contains dates and times that could be up to three months from now. What I am trying to do is have something fire off an email to someone when that future date/time comes around so a follow-up can be done. Anyone know of anything I can look into for this. [/snip] You could use CRON to periodically run scripts. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] setting index of array as 1
In that case, you could do this: $x = 1; $query = mysql_query(select name from names order by date desc); while($result = mysql_fetch_array($query)) { $all_names[$x] = $result['name']; $x++; } -TG -Original Message- From: Afan Pasalic [mailto:[EMAIL PROTECTED] Sent: Monday, October 18, 2004 2:33 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] setting index of array as 1 It's not what I was looking for. Looks like I didn't explain very well :) look at this case: $query = mysql_query(select name from names order by date desc); while($result = mysql_fetch_array($query)) { $all_names[] = $result['name']; } in this case the array $all_names starts with index 0. I can't put $all_names[1] = $result['name']; because every next entry will get index 1 and overwrite old one and on the end I'll have an array of just one element :) -afan Matthew Sims wrote: when create an array using: $new_array[] = 'something'; first index of new array is 0 how can I though set that first index is 1 - except reorganize array after is created? thanks -afan $new_array = array(1 = 'first','second','third'); echo $new_array[1]; --- Will echo first -- 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] Advanced maths help (for GD image functionality)
Good questions.. Here's some stuff to play with: Heres my maths problems in 2 parts: Problem 1) I need to scale down an image (eg: example.jpg) to height of 120 pixels while maintaining the images proportions. eg: if i have an image of (height and width) 800x600 what would the dimensions be if the height was 120? Proportions can be figured out by doing cross multiplication. Say you're trying to figure out percentages, do something like this: x 75 -x --- 100 185 Multiple cross ways and you get: 185x = 7500 Divide both sides by 185 to get just an x = and you get 40.54. 75 is 40.54% of 185. You can use this to get your proportions for images too. It doesn't have to be 100 at the bottom of that one side. Say you have an image that's 1275 x 852 and you want to create a 120 x Thumbnail. 1275 w 120 w -- x --- 852 h x h 1275x = 102240 (1275 times x = 120 times 852) Divide both sides by 1275 and you get: X = 80.19 Which you might round to 80. So a 1275 x 852 image scale down to 120 x 80. Easy, right? :) Problem 2) After getting the above image now I need the x and y parameters to cut a h120 x w90 thumb *from the center of the image* eg: if from problem 1 the result is an image of 120 x 160 then x=35 and y=125 (I think, i told you i suck at maths.. :-D ) This one's even easier. Using the same 1275 x 852 image: 1275 w - 120 w = 1155 (difference in widths) 1155 / 2 = 577.5 (578 rounded let's say). That's how much space you'll have on either wide width-wise. That'll give you a 120w center cut Do the same with the height: 852 - 90 = 762 762 / 2 = 381 So your top-left pixel to start cutting would be at 578 x 381. Try it out and let us know how it worked. -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Advanced maths help (for GD image functionality)
Algebra! I aced that in 7th grade! (don't ask me about all the other years of math. Haha.. I think I just got bored and slept a lot or something) -TG -Original Message- From: Jonel Rienton [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 11:02 AM To: Gryffyn, Trevor Cc: php php; Mag Subject: Re: [PHP] Advanced maths help (for GD image functionality) it's algebra at work :) nicely done. On Oct 15, 2004, at 8:57 AM, Gryffyn, Trevor wrote: Good questions.. Here's some stuff to play with: Heres my maths problems in 2 parts: Problem 1) I need to scale down an image (eg: example.jpg) to height of 120 pixels while maintaining the images proportions. eg: if i have an image of (height and width) 800x600 what would the dimensions be if the height was 120? Proportions can be figured out by doing cross multiplication. Say you're trying to figure out percentages, do something like this: x 75 -x --- 100 185 Multiple cross ways and you get: 185x = 7500 Divide both sides by 185 to get just an x = and you get 40.54. 75 is 40.54% of 185. You can use this to get your proportions for images too. It doesn't have to be 100 at the bottom of that one side. Say you have an image that's 1275 x 852 and you want to create a 120 x Thumbnail. 1275 w 120 w -- x --- 852 h x h 1275x = 102240 (1275 times x = 120 times 852) Divide both sides by 1275 and you get: X = 80.19 Which you might round to 80. So a 1275 x 852 image scale down to 120 x 80. Easy, right? :) Problem 2) After getting the above image now I need the x and y parameters to cut a h120 x w90 thumb *from the center of the image* eg: if from problem 1 the result is an image of 120 x 160 then x=35 and y=125 (I think, i told you i suck at maths.. :-D ) This one's even easier. Using the same 1275 x 852 image: 1275 w - 120 w = 1155 (difference in widths) 1155 / 2 = 577.5 (578 rounded let's say). That's how much space you'll have on either wide width-wise. That'll give you a 120w center cut Do the same with the height: 852 - 90 = 762 762 / 2 = 381 So your top-left pixel to start cutting would be at 578 x 381. Try it out and let us know how it worked. -TG -- 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] Advanced maths help (part 2)
My interpretation of Problem 2 before was that you wanted to get a 120w x 90h (?) section of the original image, not of the thumbnail you generated by resizing the original. You seem to be working off of the adjusted height. Sorry, I didn't noodle all the way through this one, what I am missing? -TG -Original Message- From: Mag [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 12:45 PM To: php php Subject: [PHP] Advanced maths help (part 2) Hi again guys, :-) Thanks to the educated (and excellient) help of Chris and trevor I am now getting proportionate thumbs (which was problem 1, remember? ) Heres the code that i am using, if it may help anyone else: ** code start ** $src_img = imagecreatefromjpeg(tgp1.jpg); $img_dim = getimagesize(tgp1.jpg); $h_1 = $img_dim[1]; $w_1 = $img_dim[0]; $dst_h = 120; $dst_w = $w_1 * ($dst_h / $h_1); $dst_img = imagecreatetruecolor($dst_w,$dst_h); $src_w = imagesx($src_img); $src_h = imagesy($src_img); imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$sr c_w,$src_h); // problem 1 solved till here ** code end ** Then i am trying to work with problem 2, instead of starting all over again from the beginning of getting the images dimensions etc I am continueing and trying to get it straight from the above like so: ** code start problem 2** $dst_w = ($dst_w - 90) / 2; $dst_h = 0; // because the image is only 120px high imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$sr c_w,$src_h); ImageJPEG($dst_img,'test.jpg'); echo img src=test.jpgbrThe bitch works!; ** code end problem 2 ** When i check the output I am only getting the first parts output... is what i am doing even possible? or do I have to do everything from the start for problem 2 (eg: read from disk, calculate dimensions etc) Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. http://promotions.yahoo.com/new_mail -- 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] Advanced maths help (part 2)
No worries. But here's my thought: 1. You start with an image, getting it's current (original) proportions 2. You figure out the width and height proportions to resize it down to something small 3. Resize image (creating a new image.. At least to send to the browser if not in a file separate from the original..whichever works for you) 4. Take the original image (not the resized one) and clip a little section out of the middle of it to use as a thumbnail as well (or whatever). I think this is what you are aiming for because there are two theories regarding thumbnails: A. Take the original and scale it down.. But this can create an image that doesn't look like anything (if the original had a lot of detail and/or was huge) B. Take a portion of the original (like someone's face out of a scene that really shows their whole body). This can sometimes be fun because it shows a small portion of an image that can make people curious.. Like What the heck is that I'm seeing? I have to see more! I'm not sure if that's what you were planning to do or not. Why don't you detail your intentions and then maybe we can figure out how to best do that. -TG -Original Message- From: Mag [mailto:[EMAIL PROTECTED] Sent: Friday, October 15, 2004 2:00 PM To: Gryffyn, Trevor Cc: php php Subject: RE: [PHP] Advanced maths help (part 2) Hi Trevor, Sorry, am just a bit confused myself mostly because I am using a third party script to clip the 120x90 part out of the image...understanding the way the script is written is a little frustrating as it was written for something else and I am trying to adopt it. if you want to try your hand at it tell me and i'll zip up the script and send it to you. Thanks, Mag -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Exporting HTML to Excel
Philip Thompson wrote: - ?php header('Content-Type: application/ms-excel'); header('Content-Disposition: attachment; filename=project.xls'); ? table tr tdSomething/td /tdSomething else/td /tr /table - I just want it to have that content in the spreadsheet. Works for me... (Excel 2000) Something appears in A1 Something Else appears in B1. Worked for me too.. Even though I didn't think it would :) Seemed too simple. I'm running Excel 2002. -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there any way of knowing User Currently Logged On?
http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B324274 Here's a link that talks about how to do it in IIS for Windows Server 2003. It's for when you're logging into a domain though, are you doing that with all those different platforms? The client accessing the web server has to be logged into the domain for it to function. There might be something similar you can do if you're running a web server on a unix system and you're logged into another unix system. And if your web server is on a unix system, but your client is a Windows box with a domain authenticated user, you can probably still access the LOGON_USER variable. -TG -Original Message- From: Mulley, Nikhil [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 1:02 AM To: Gryffyn, Trevor; [EMAIL PROTECTED] Cc: John Holmes; Mulley, Nikhil Subject: RE: [PHP] Is there any way of knowing User Currently Logged On? How do I turn on the Integrated Authentication turned on. Ours is a mixed heterogenous network which has Windows,Linux,Solaris,BSD Lindows,Linspire and many other OS all together,So How Do I? -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 1:07 AM To: [EMAIL PROTECTED] Cc: John Holmes; Mulley, Nikhil Subject: RE: [PHP] Is there any way of knowing User Currently Logged On? It does and Windows Integrated Authentication has to be turned on (and Anonymous access turned off). I just got my company to configure that so my PHP scripts could grab the authenticated user for logging purposes. -TG -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, October 11, 2004 2:49 PM To: Mulley, Nikhil Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Is there any way of knowing User Currently Logged On? Mulley, Nikhil wrote: Is there any way of finding the current user logged on the remote system You can try $_SERVER['LOGON_USER'], but I think the remote computer has to be in the same domain as the server... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.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] folder creation in php
It's worth noting that if you're just generating HTML that creates just a regular old HREF pointing to a regular old file, that the web server will handle sending out the proper headers. For example: a href=filename.zipYour Download/a You don't need to do anything special with PHP to make this send correctly and PROBABLY (assuming the web server is configured properly for that filetype) trigger your web browser to do the whole Save As... Thing (again, assuming that your BROWSER is configured to ask what you want to do.. Firefox, for example, will automatically download to your desktop on a windows box by default). If, for example, you generated html like this though: a href=datasendscript.php?id=1234Your Download/a Then your datasendscript.php would have to generate the proper headers. -TG -Original Message- From: Dylan Barber [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 2:52 PM To: Gryffyn, Trevor Subject: RE: [PHP-DB] folder creation in php you need to send headers to tell the os what the page is like mime type etc. look on the PHP documentation -Original Message- From: Gryffyn, Trevor [EMAIL PROTECTED] Sent: Oct 12, 2004 1:34 PM To: [EMAIL PROTECTED] Cc: Adil [EMAIL PROTECTED] Subject: RE: [PHP-DB] folder creation in php The browser will automatically do this when you click on a link to a file that the web browser knows as a file that you download versus HTML or text being sent to the browser where it's just displayed instead of triggering the download prompt. Maybe that doesn't make much sense.. My head's a bit foggy right now. But the deal is, you just need to create a link that when clicked on, sends the browser something other than HTML or text or a known picture format (you might have to send headers declaring the MIME type too... Most likely do). The link itself is something that's just done in HTML. What happens when you click the link might be PHP driven, but in general this isn't a PHP or DB question unless there's something with the link that you're having trouble creating. -TG -Original Message- From: Adil [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 2:28 PM To: [EMAIL PROTECTED] Subject: [PHP-DB] folder creation in php Here's what i'm trying to do in php and a mySQL database: I want a button on a page that if clicked it launches the browser's or OS's Save As window, allowing me to specify where to save my file and/or create a new folder thx in advance Adil.. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php a href=mailto:[EMAIL PROTECTED]Dylan Barber/a Webmaster / Web Developer / Programing a href=http://codegalaxy.com;-codegalaxy.com-/a a href=http://summer-swim.com;-summer-swim.com-/a a href=http://clipurl.com;-clipurl.com-/a -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [PHP-DB] folder creation in php
Yeah, I mentioned some of those problems in my email. What I didn't consider was that the content disposition headers could get around the browser's configured behavior. I found this page: http://forums.devshed.com/t7307/s.html Which recommends using: header(Content-Type: application/octet-streamn); I guess if you give it a MIME type that the browser is almost always going to try to download instead of telling it (as the person initially did in this example): header(Content-Type: application/PDFfile); Where the browser might want to try to get clever and do something other than download it. Good things to keep in mind though. Sounds like all he wants to do really is to open a file dialog, not necessarily even download a file (??) In which case, the input type=file would actually work. I don't know.. Again, head foggy today. Good stuff to think about though. -TG -Original Message- From: Ben Ramsey [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 12, 2004 3:10 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: [PHP-DB] folder creation in php Trevor Gryffyn wrote: It's worth noting that if you're just generating HTML that creates just a regular old HREF pointing to a regular old file, that the web server will handle sending out the proper headers. This isn't always the case. If the file is a CSV file and you don't pass the proper headers (and the proper MIME types are not configured in your Web server), then it may try to display the file as plain text in the browser. I could list other examples. Also, depending on your browser (*ahem* IE), the browser will try to open many file types in the browser without prompting for download. Plus, if you use a PHP script to generate content and you want a user to download it, often times, they will end up downloading a file of the name generate-content.php for every single download. With the Content-Disposition header, you can avoid these situations and force the browser to prompt the user to download the file with the correct filename you specify. -- Regards, Ben Ramsey http://benramsey.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] textarea vs. type=text data difference?
Just wanted to point out something little. text types are all single-line data items. textarea can contain line breaks. Looks like you may have solved your problem already, but wanted to fill in some info that didn't seem to be mentioned. -TG -Original Message- From: Sam Smith [mailto:[EMAIL PROTECTED] Sent: Sunday, October 10, 2004 3:29 PM To: PHP Subject: [PHP] textarea vs. type=text data difference? I have a form with both textarea and text type fields. I submit it and do some processing on identical data and get different results. What's up with that. Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP gurus...how are they doing this?
I can't check this out from work (for obvious reasons) but web server logs should record all the incoming requests and what hosts requested what files. Also, search engines like Google provide an API for programmers that could potentially be used to get data like how many people are linked to this page. Or it could be like what was already mentioned, a middle-man thing, or deals using cookies or.. What did they call them? BrowserBugs or something? Little things that keep track of where your browse. There are lots of little tricks for recording incoming and outgoing requests and links. -TG -Original Message- From: Mag [mailto:[EMAIL PROTECTED] Sent: Sunday, October 10, 2004 7:18 PM To: php php Subject: [PHP] PHP gurus...how are they doing this? Hi, Am totally puzzled as to how they are doing this. The site is at http://www.teeniesxxx.com/madtgp/submit.php (please note its an adult site so you might not want to go there, also note I am in NO way connected with that site...AT ALL) once a person submits a site, they are doing 2 things that totally puzzle me, 1.showing the number of outgoing links 2. counting the number of linked to pictures (eg: href='blah.jpg') and movies (eg: href='blah,mpg') and also giving the size of each movie (this i figured out) and the resulation!! I would like to do the same thing for a cartoon site, can anybody tell me where to begin or some sample code? Thanks, Mag = -- - The faulty interface lies between the chair and the keyboard. - Creativity is great, but plagiarism is faster! - Smile, everyone loves a moron. :-) __ Do you Yahoo!? Y! Messenger - Communicate in real time. Download now. http://messenger.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Is there any way of knowing User Currently Logged On?
It does and Windows Integrated Authentication has to be turned on (and Anonymous access turned off). I just got my company to configure that so my PHP scripts could grab the authenticated user for logging purposes. -TG -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, October 11, 2004 2:49 PM To: Mulley, Nikhil Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Is there any way of knowing User Currently Logged On? Mulley, Nikhil wrote: Is there any way of finding the current user logged on the remote system You can try $_SERVER['LOGON_USER'], but I think the remote computer has to be in the same domain as the server... -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals - www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Two people working on the same app / script?
CVS is definitely something to check into. In addition to the Mac product mentioned before, Zend Studio and many other IDEs and editors have CVS compatibility built into them. CVS is similar to (but of course has differences to) Microsoft's Source Safe, if you're familiar with that product. (yeah, someone's going to hang me for making the comparison, but they serve the same function so I'm drawing a parallel). -TG -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: Thursday, September 30, 2004 4:38 AM To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Two people working on the same app / script? --- Dave Carrera [EMAIL PROTECTED] wrote: Is there a simple solution for two or more people to work on the same php app /script without it turning into a mess of many tar / zip files with contributed additions. Any version control system that supports concurrent development will work for this. For example, Concurrent Versions System, CVS. :-) Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly HTTP Developer's Handbook - Sams Coming December 2004http://httphandbook.org/ -- 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] I have a really stupid question, just trying to debug a script though.
Can you connect to the same address from the same machine with a web browser? That should help troubleshoot this. If you can and you're still getting the error, maybe post a section of your code and maybe we can get a better idea if why it's failing. -TG -Original Message- From: Brent Clements [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 9:42 AM To: [EMAIL PROTECTED] Subject: [PHP] I have a really stupid question, just trying to debug a script though. I know what this means, but what are some reasons why we would get this error? Warning: fsockopen(): unable to connect to 128.42.244.20:80 Thanks, Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] I have a really stupid question, just trying to debug a script though.
Permission denied could also probably indicate (in addition to what's already been mentioned) that there's authentication needed. If you connect with a web browser, do you get a login prompt window pop up? Not an HTML one, but one of the the basic HTML Auth type stuff? Try pointing your script to a site that you know doesn't have anything funky with it and see if you get the same issue. -TG -Original Message- From: Brent Clements [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 9:49 AM To: Brent Clements; [EMAIL PROTECTED] Subject: Re: [PHP] I have a really stupid question, just trying to debug a script though. I'm going to change this question up a bit. The error is this one: Warning: fsockopen(): unable to connect to www.example.com:80 in /home/u5/lentesta/html/socket.php on line 2 Permission denied (13) What are some reasons we'd get this? Would a firewall or local system tcp/ip filtering prevent socket operations from occuring? Thanks, Brent - Original Message - From: Brent Clements [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, September 29, 2004 8:41 AM Subject: [PHP] I have a really stupid question, just trying to debug a script though. I know what this means, but what are some reasons why we would get this error? Warning: fsockopen(): unable to connect to 128.42.244.20:80 Thanks, Brent -- 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] Re: grabbing information from websites
The URL that you're grabbing there is a frameset, it's probably not the page you want to look at. When you right-click on the page you want to parse and select View Source and get the information you posted below, do the same thing but right-click and select Properties (in IE at least) and it'll tell you the URL that you're really looking at. My guess is that you're really parsing this source: htmlhead titleRuneScape - the massive online adventure game by Jagex Ltd/title meta name=Description content=RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. meta name=Keywords content=Runescape, Jagex, free, games, online, multiplayer, magic, spells, java, MMORPG, MPORPG, gaming link rel=shortcut icon href=/favicon.ico type=image/x-icon / /head frameset cols=* frameborder=0 border=0 noframes body bgcolor=black text=white h3RuneScape/h3 RuneScape is a massive 3d multiplayer adventure, with monsters to kill, quests to complete, and treasure to win. You control your own character who will improve and become more powerful the more you play. pThis site uses frames, but your browser doesn't support them./p pTo play Runescape and browse our website, please download a recent web browser such as a href='http://www.microsoft.com'Microsoft Internet Explorer/a or a href='http://www.netscape.com'Netscape/a./p brbr pThe Jagex Team./p /body /noframes !--frame src=none.html noresize scrolling=no-- frame src=frame2.cgi?page=title.html noresize scrolling=auto !--frame src=none.html noresize scrolling=no-- /frameset /html Try echo'ing $line and looking at the data you're parsing. I bet it's what you see above. -TG -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 28, 2004 9:47 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: grabbing information from websites i said i was learning this and didnt really understand it. so going by what has been said i have come up with the following but still doesnt want to work. heres what i have: ?php $file = fopen (http://hiscore.runescape.com/aff/runescape/hiscorepersonal.c gi?username=champinoman,r); $line = fgets ($file, 1024); if (preg_match('#username=champinomancategory=13.*align=right (.*)/td#mi',$line,$out)) { $rune = $out; } fclose($file); print $rune; ? and the source it is looking at is: trtdimg src=http://www.runescape.com/img/hiscores/crafting.gif; valign=bottom width=16 height=16 //tdtdnbsp;/td tda href=hiscoreuser.cgi?username=champinomancategory=13 class=cCrafting/a/td td align=right70,277/tdtd align=right 43 /tdtd align=right 53,630 /td/tr I want it to get the 70,277 and store as $rune if someone can tell me where im wrong i would be extremely grateful thank you for your ongoing support. -- M. Sokolewicz [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] ugh, obviously I'm a bad typer :) The code should be: preg_match('#username=champinomancategory=13.*align=right( .*)/td#mi', $text, $out); Or using any other patterndelimiter... ;) M. Sokolewicz wrote: I thought I clearly stated that for the m modifier you need to use PCRE functions! eg: preg_match('/username=champinomancategory=13.*align=right( .*)/td/mi', $text, $out); Champinoman wrote: so does this look right: eregi (username=champinomancategory=13.*align=\right\(.*)/td m,$line,$out)) is that where i am ment to put the 'm' modifier? or am i still off on the wrong track? Graham Cossey [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] From http://gnosis.cx/publish/programming/regular_expressions.html: Sometimes you have a programming problem and it seems like the best solution is to use regular expressions; now you have two problems. To me regular expressions are some kind of black art, I've been programming for 20 years and until recently have pretty much managed to avoid them. The above URL is a pretty good tutorial. HTH Graham -Original Message- From: champinoman [mailto:[EMAIL PROTECTED] Sent: 28 September 2004 09:35 To: [EMAIL PROTECTED] Subject: [PHP] Re: grabbing information from websites instead of the POSIX regexp, tr using PERL style RegExps (www.php.net/pcre) Once you've done that, you can add the pattern modifier 'm' to allow multilines . i think im lost now. i had a look at the site but im not sure what im looking at. any chance u could make a mock script up so i can see what your explaining? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List
RE: [PHP] Missing $_POST data from a Outlook Express email form
But Outlook Express, like most Microsoft products, use an embedded version of IE to display HTML documents. Which makes sense, no sense having two HTML rendering engines on the same box. I'm not sure why it WOULDN'T send the post data if the HTML form in email was properly set up with form action=http://www.server.com/scriptname.php; method=POST Passing it via the URL, as suggested, would fix the problem. You'd retrieve the data with $_GET then. But what would someone do if they didn't have access to the script receiving the information, is the real question. -TG -Original Message- From: Curt Zirzow [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 11:48 PM To: php Subject: Re: [PHP] Missing $_POST data from a Outlook Express email form * Thus wrote Eric Wood: This is bizarre. I send html forms (web orders) to my email client. From there I plug in extra info and submit it to a php script which launches IE or Firefox to see the results of the submit (writing data back to the ecommerce site). ... Did something cripple Outlook Express? I even tried Thunderbird with same missing data problem. Email clients are not web browsers.. simply provide a link like: http://server.com/showorder?id=1234 Curt -- The above comments may offend you. flame at will. -- 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] Newbie array problem
I definitely think implode() is the better way to do this, but if you DID have to loop through an array, isn't it easier to do Foreach ($array as $item)? In this case, requiring the ; between them (and choosing not to use implode) you could do something like this: Foreach ($array as $count=$item){ if ($count == 0) { $display = $item; } else { $display = ;$item; } } If you were using an associative array, you could use a $i type counter to determine if you're at the first element or not. Much less code and I never saw the point in using a while loop for arrays. Just something to think about. Both ways work fine and as much as things come down to style, they are also equally weighted by what the programmer is familiar with and confortable with. -TG -Original Message- From: Kevin Waterson [mailto:[EMAIL PROTECTED] Sent: Thursday, September 23, 2004 6:34 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie array problem This one time, at band camp, Phpu [EMAIL PROTECTED] wrote: If i have an array $array = array(1, 2, 3, 4, 5, 6, 7) How can i display the array element sepparated by (;) like this $display = 1;2;3;4;5;6;7 $i=0; $arraySize = sizeof($array); while($i $arraySize){ echo $array[$i]; if($i ($arraySize-1)){ echo ';'; } $i++; } Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] thumbnail of webpage
Some great recommendations, but my first thought is wondering if you can interface with IE via COM or something. Or open the URL via IE and use the Windows API to do a PRINT SCREEN or ALT-PRINT SCREEN to capture it to the clipboard and do something funny that way. If I had time right now, I'd love to dig into this, but I wanted to at least share the thought in case it helped. Good luck! Let us know if you find a good way to do this via PHP. -TG -Original Message- From: Michael Mao [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 7:54 PM To: [EMAIL PROTECTED] Subject: [PHP] thumbnail of webpage Is there a way to capture a snapshot of a html page and save it as a jpg using php? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] thumbnail of webpage
True, you'd have to run it on the web client end, but you can run IE on the server to access the HTML the server is err..serving. The server can also be a client, in other words. So your server can generate a thumbnail of what it's serving out by acting as a client for a second. As long as their security allows them to execute IE or interface with it and possibly the windows API. There are complexities, but it's the path I would explore if I had to create my own thumbnailing system (in the absence of some quick and easy utility that already did it). -TG -Original Message- From: raditha dissanayake [mailto:[EMAIL PROTECTED] Sent: Monday, September 20, 2004 12:28 PM Cc: [EMAIL PROTECTED] Subject: Re: [PHP] thumbnail of webpage Gryffyn, Trevor wrote: Some great recommendations, but my first thought is wondering if you can interface with IE via COM or something. Or open the URL via IE and use the Windows API to do a PRINT SCREEN or ALT-PRINT SCREEN to capture it to the clipboard and do something funny that way. Good ideas but then you would need to run PHP on the client side and not on the server (assuming of course that the original poster is not runnig his server on an OS that does not have any security features). There was a similar question on 'the list' and someone suggested and image magick would be able to do this. -- Raditha Dissanayake. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Novice PHP Variable/Link Question
Alternately, you can do it the lazy way like me: a href=?=$url??=$url?/a ? Echo $url; ? Is the same as... ?=$url? I also think that's a little easier to read. But that's my preference in style. -TG -Original Message- From: Greg Donald [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 6:02 PM To: revDAVE Cc: PHP Subject: Re: [PHP] Novice PHP Variable/Link Question On Thu, 16 Sep 2004 14:54:34 -0700, revDAVE [EMAIL PROTECTED] wrote: How can I use a PHP variable as the destination for a link? ? $mylink = 'thispage.htm' a href=thispage.htmgo here/a With var...? How do I write this? a href=??? $mylink ???go here/a a href=?php echo $url;??php echo $url;?/a -- Greg Donald http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: A native Windows binding for PHP - released
On 09/16/2004 09:01 PM, Rubem Pechansky wrote: I have designed and successfully prototyped a native Windows binding for PHP. This binding is very lightweight and it is already capable of doing dialogs, controls, and a lot more with a few dozen lines of code. PHP can thus be used as a tool for quick development of native Windows applications. I have just released this project to the public as Open Source at http://winbinder.sourceforge.net/. Although it is still a work in progress, you can take a look at the source code, download a working demo and play with it a little bit. Your ideas, comments, criticisms and suggestions are very welcome. This looks EXCELLENT! I just got around to downloading PHP-GTK and was kind of put off by it's clunky interface. Reminded me of old-school xwindows stuff or something. Not a very fluid or functional feel. And I started wondering if anyone had done a more Windows-like GUI (or a direct interface to the Windows window system) for PHP. I look forward to the development of this product. Definitely submit it to PECL! Thanks Rubem! -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Host for Mod PHP5
I use DixieSys.com. They seem to have fairly reasonable rates and good speed. They have a very personable support staff that you can reach via their IRC server, ICQ or through conventional email, trouble tickets, etc. They'd big and well equipped but still have a down home manner that I really enjoy. They don't run PHP5 yet, but I posted a suggestion to set it up side by side with PHP4 for people who want to use one or the other. Disk space and bandwidth are cheap and you can add services a la carte depending on your needs. When asking for unlimited disk space and lots of bandwidth, you might be over-estimating your needs. You might also find a good balance in hosting a PHP-enabled website with less space/bandwidth and going with a file hosting service for the actual songs that are planned on being posted. Some places specialize in file serving and not actual web hosting, per se. I have seen some free hosting services that claim unlimited space and such, but you get what you pay for. -TG -Original Message- From: Burhan Khalid [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 10:40 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Host for Mod PHP5 [EMAIL PROTECTED] wrote: I know this is going to be tough but I need a hosting company that supports PHP5, has unlimited disk space and a good amount of bandwidth with a decently fast connection for a decent price. I realize that this might be rare, but is anyone offering such a package like this anywhere? My client doesn't want a dedicated server because it costs too much for him at the moment. He wants to build a music website where people can download free music from. The music is recorded by him and he has artists that are eager to get their music out there into the public. Any suggestions on a temporary shared hosting company for him? Any help would be appreciated. 1. There is no such thing as unlimited disk space. When have you heard of an unlimited disk? 2. Decently fast connection -- this could be my home DSL at 512/512 Get more realistic expectations, then hop on over to http://www.webhostingtalk.com full_disclosure I'm a Community Guide at webhostingtalk, but I have no other interests in the board /full_disclosure -- 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] Re: A native Windows binding for PHP - released
Thanks! The themes for GTK are definitely worth noting. The problem for me is that that seems to accommodate the look, but what about the feel of the interface. It still looks like the functionality and general feel isn't going to be what I'm looking for. A true native Windows API is really what I want, and it looks like WinBinder will provide that. I'm not trying to belittle the efforts of the GTK guys. It still seems to be the de facto standard in GUI interfacing for many scripting langauges and has tons of support and good stuff for it. I just want something a little different. -TG -Original Message- From: Marek Kilimajer [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 11:10 AM To: Gryffyn, Trevor Cc: PHP List Subject: Re: [PHP] Re: A native Windows binding for PHP - released Gryffyn, Trevor wrote: On 09/16/2004 09:01 PM, Rubem Pechansky wrote: I have designed and successfully prototyped a native Windows binding for PHP. This binding is very lightweight and it is already capable of doing dialogs, controls, and a lot more with a few dozen lines of code. PHP can thus be used as a tool for quick development of native Windows applications. I have just released this project to the public as Open Source at http://winbinder.sourceforge.net/. Although it is still a work in progress, you can take a look at the source code, download a working demo and play with it a little bit. Your ideas, comments, criticisms and suggestions are very welcome. This looks EXCELLENT! I just got around to downloading PHP-GTK and was kind of put off by it's clunky interface. http://themes.freshmeat.net/browse/923/ particularly http://themes.freshmeat.net/projects/1in1-xp-gtk/ as you like windows so much -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Highest Key in an Array
Or... $highestkey = max(array_keys($arr)); -Original Message- From: Martin Holm [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 11:11 AM To: Daniel Schierbeck Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Highest Key in an Array Daniel Schierbeck wrote: I've been looking at php.net, but i couldn't find what i'm searching for. I have a numeric array, and i'd like to get the highest key. E.g. $arr = array(3 = foo, 7 = bar, 43 = foobar); What i want is a function that, in this case, returns 43. Daniel Schierbeck $arr = array(3 = foo, 7 = bar, 43 = foobar); krsort($arr); $highestkey = key($arr); -- 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] Microsoft Support - RE: [PHP] Instal or config this package UnxUtils.zip under windows
First let me say that I'm a Microsoft product fan. Yeah, I do like their products. I like many *nix products and Mac products as well. Basically I'll use whatever's in front of me, but I prefer Microsoft products in a lot of cases, with all of it's flaws and whatnot. (as an avid Firefox user, PHP developer and user of many non-Microsoft products as well) With all that said.. I have to relay a joke I heard once (commence groaning): A helicopter was flying around above Seattle yesterday when an electrical malfunction disabled all of the aircraft's electronic navigation and communications equipment. The pilot was now unable to determine the helicopter's position and course to steer to the airport. He saw a tall building, flew toward it, circled, drew a handwritten sign, and held it against the helicopter's window. The pilot's sign said WHERE AM I? in large letters. People in the tall building quickly responded to the aircraft, by drawing a large sign and holding it up in the building window. Their sign said YOU ARE IN A HELICOPTER. The pilot smiled, waved, looked at his map, determined the course to steer to the Seattle airport, and landed safely. After they were on the ground, the co-pilot asked the pilot how that sign helped determine their position. The pilot responded, I knew that had to be the MICROSOFT building in Redmond, because they gave me a technically correct, but completely useless answer. (copied without explicit permission from http://www.literatepackrat.com/Sections/Gags/Airport.html to save me some typing, much apologies) Had to share. :) -TG -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 12:10 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Instal or config this package UnxUtils.zip under windows raditha dissanayake wrote: someone in the microsoft support mailing list might know. ^ Now there's an oxymoron. ;) -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] reading from files
I usually use file(): http://www.php.net/manual/en/function.file.php -TG -Original Message- From: Merlin [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 4:17 PM To: [EMAIL PROTECTED] Subject: [PHP] reading from files Hi there, I am wondering how to read lines from a file to a php array? I would like to integrate a logfile into a html site. Is it possible to read line by line and to check how many lines there are in total? Thank you for any hint on that, Merlin -- 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] checking multiple URL parameters
I could have sworn that there was a function that dropped ALL GET values into an associative array. Kind of the inverse of http_build_query. At any rate, you can keep doing (isset($_REQUEST['mov']) AND isset($_REQUEST['year'])) and such. Is that your question? How do you do AND and OR operations? -TG -Original Message- From: Dustin Krysak [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 7:33 PM To: PHP Subject: [PHP] checking multiple URL parameters Hi there, I am currently using the following code to display content based on the URL parameters ?php if (isset($_REQUEST['mov'])) { $movie = ($_REQUEST['mov']) ? HTML CONTENT ?php } else { ? OTHER HTML CONTENT ?php } ? now what I need to do is modify the code so that the script checks 2 URL parameters, and has 2 variables defined (from the URL parameter)... So I need to also check if $_REQUEST['year'] is set as well as the original (both need to be set to get the first HTML content) AND I also need to set the variable of $year = ($_REQUEST['year'] direction? d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] checking multiple URL parameters
That's it! Thanks! Beautiful! :) Worth noting is the extract() function mentioned at the bottom of that page too, used for importing any array into the global space. Thank you very much, Andrew. I knew I had seen that somewhere. -TG -Original Message- From: Andrew Kreps [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 1:55 PM To: PHP Subject: Re: [PHP] checking multiple URL parameters On Thu, 16 Sep 2004 11:15:13 -0400, Gryffyn, Trevor [EMAIL PROTECTED] wrote: I could have sworn that there was a function that dropped ALL GET values into an associative array. Kind of the inverse of http_build_query. I believe you're thinking of import_request_variables (). http://us2.php.net/manual/en/function.import-request-variables.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] checking multiple URL parameters
You're right though, $_GET and $_POST and such are already an associative array. I actually think I was thinking of a function that parsed a URL itself, regardless of whether it was submitted or not. I'm all kinds of mixed up today, so I apologize for being kind of scrambled in the brain. Is there a function that'll take http://www.server.com/scriptname.php?someparam=somedatasomeparam2=some data2 and produce: $someparam == somedata $someparam2 == somedata2 ?? You understand I'm talking about parsing the URL, not juggling $_GET data, right? I know you could write a short script that would do it, but I think I saw a built-in function that did it as well. -TG -Original Message- From: Chris Shiflett [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:19 PM To: Andrew Kreps; PHP Subject: Re: [PHP] checking multiple URL parameters --- Andrew Kreps [EMAIL PROTECTED] wrote: --- Trevor Gryffyn [EMAIL PROTECTED] wrote: I could have sworn that there was a function that dropped ALL GET values into an associative array. Kind of the inverse of http_build_query. I believe you're thinking of import_request_variables That imports variables into the global scope individually. He's probably just thinking about $_GET, which is already an associative array that contains all GET data. No function is necessary. Chris = Chris Shiflett - http://shiflett.org/ PHP Security - O'Reilly Coming December 2004 HTTP Developer's Handbook - Sams http://httphandbook.org/ PHP Community Site http://phpcommunity.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] MySQL query for average records per day
Select date1,count(date1) group by date1 where date1 '$today' That'll get you the count of how many records were done on each day (excluding today). I don't know what you're trying to average, but you can probably figure it out from there. -TG -Original Message- From: Jeff Oien [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:35 PM To: PHP Subject: [PHP] MySQL query for average records per day I have a database with a date field in this format 20041016 I'd like to count how many records were made on each day (except today) and average them. Can I do this in one query or will I need to do some more PHP stuff after I get some results? Thanks. Bare bones so far: $sql = select date1 from $table_name where date1 != '$today'; Jeff -- 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] checking multiple URL parameters
This makes absolutely no sense to me. What do you mean by submitted? How would a PHP script be executed at all if the browser never sends a request? Hah.. I should just let this all go, go home, get some sleep, and start confusing people again tomorrow, but I want to clarify a little bit. Imaging you have a URL in a string and you want to find out what parameters are going to be passed to the script if the URL were to be called. ?php $targeturl = http://www.server.com/script.php?somevar=somevalsomevar2=someval2;; ? Regardless of how this script is called, is there, or is there not a function that will take that string and pull the values after the ? and toss them into an associative array? You understand I'm talking about parsing the URL, not juggling $_GET data, right? GET data is passed in the query string of the URL. This is what you're asking: Is there a way to access GET data? Yes, I know about $_GET, but I don't want PHP's help - I want to parse the query string myself. Can PHP help me do this? I'm not sure how else to explain it, but it seems like you might be confused about the GET request method. Is there a reason why you don't want to use $_GET? Did I really type that indented bit? Yeah, I am kind of out of it today. Read above. Maybe that'll clarify my question. Thanks :) -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] checking multiple URL parameters
Ahh.. Andrew has read my confused mind. Yeah, that's what I was getting at. Solution Accepted or something. :) Ok, I'm going to go home now before I cause any more problems. -TG -Original Message- From: Andrew Kreps [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 4:31 PM To: PHP Subject: Re: [PHP] checking multiple URL parameters On Thu, 16 Sep 2004 12:47:26 -0700 (PDT), Chris Shiflett [EMAIL PROTECTED] wrote: This makes absolutely no sense to me. What do you mean by submitted? How would a PHP script be executed at all if the browser never sends a request? PHP can be run from the command line, in which case the GET and POST arrays wouldn't exist. I use this functionality so that I can take advantage of Pear's DataObjects when I need to do a flat file data load. Also, imagine if you had a database of URL's that you wanted to dissect for it's component information? That being said, I'm not aware of a PHP function that performs this operation for you. I remember writing a similar one in Perl many years ago, that was something like: (sorry for the pseudocode, I figure completely wrong is better than almost right) array = regexp_split (/[=]/, uri) // where uri is everything after the ? for (i = 0; i count(array); i += 2) { url_var[array[i]] = array[i+1] // You may want to do a urldecode here } I believe php lets you name vars by adding an additional $ before the name, such as: $varname = thing; $$varname = data; echo $thing // Produces 'data' This may be a good starting point. -- 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] OK ... WHY does this work ?????
Read over some of the examples at: http://us4.php.net/types.array If you don't set a key, PHP starts with '0' and increments as you add more elements to the array. If you have NOTICEs turned on, I believe you'll get a notice saying that $arrlevels[99] doesn't exist. It's not a fatal error, so PHP just passes over it and doesn't say anything unless you tell it to. # One dimensional array $arrlevels = array(1,2,3); # Three dimensional array. $lvl_guest is a key and 'levelname' is a key $arrlevels[$lvl_guest]['levelname']; -TG On Tue, 14 Sep 2004 22:32:54 +0200, -{ Rene Brehmer }- [EMAIL PROTECTED] wrote: Unless I misunderstand how PHP make unspecified arrays (and I probably do since this works), when you have an array of 3 elements on the first dimenstion like I do, and then ask for $arrlevels[$lvl_guest]['levelname'], which in this case actually means it asks for $arrlevels[99]['levelname'] how come it pick the correct element, and not error out that element 99 don't exist ?? My only conclusion (based on the fact that this actually works) is that PHP makes the key the same as the value if the key isn't specified. But is this actually correct Or is there something going on that I don't know about ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Image question
Jason Paschal posted this link a while ago, regarding storing and retriving images from MySQL: http://www.dailymedication.com/modules.php?name=Forumsfile=viewtopict= 15 -TG -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 8:44 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Image question Oop... spoke too soon. I was able to store the image into the database, but now I can't pull it back out and manipulate it with the gd image functions. Instead of using the imagejpeg function, I can just echo the field and the image will display in a browser window. How do I restore the data from the database in a way that I can continue to manipulate it with the image functions, like imagejpeg($data)? Thanks, Ed -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 5:20 PM To: 'Jason Wong'; [EMAIL PROTECTED] Subject: RE: [PHP] Image question Got it. Thanks Jason. -Original Message- Imagejpeg($im); // successfully displays image Use the ob_*() functions to capture the output. See archives for details. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] iguanahost - anyone else being plagued?
Yeah, I get tons of them too. Ideally, someone should identify which user subscribed to the list is the culprit and remove their address. -TG -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 11:53 AM To: php-general Subject: [PHP] iguanahost - anyone else being plagued? Anyone else getting these infuriating italian messages about some muppet that doesnt exist? 'desintione non existente'? I've written to [EMAIL PROTECTED] but no joy, everytime i post on the php list i get half a dozen of the damn things... -- Nick W -- 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] iguanahost - anyone else being plagued?
It appears to be a user not found type error..'desintione non existente' looks a lot like destination doesn't exist. The guys that manage the PHP-General list need to be made aware so they can remove the offending email address. There's not a lot these iguana guys can do if a user no longer exists on their system except to maybe ADD the account back in so it doesn't return an autoresponder or something. -TG -Original Message- From: Dan Joseph [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 1:37 PM To: 'php-general' Subject: RE: [PHP] iguanahost - anyone else being plagued? I've done the same thing. Most likely its an auto-response msg from them after we reply to anything on this list. I can't read the language its in personally. I wrote abuse several times, I get the same msg back. -Dan Joseph -Original Message- From: Nick Wilson [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 11:53 AM To: php-general Subject: [PHP] iguanahost - anyone else being plagued? Anyone else getting these infuriating italian messages about some muppet that doesnt exist? 'desintione non existente'? I've written to [EMAIL PROTECTED] but no joy, everytime i post on the php list i get half a dozen of the damn things... -- Nick W -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] iguanahost - anyone else being plagued?
Fair enough. -Original Message- From: Ron Guerin [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 15, 2004 3:04 PM To: Gryffyn, Trevor Cc: php-general; Dan Joseph Subject: Re: [PHP] iguanahost - anyone else being plagued? Gryffyn, Trevor wrote: It appears to be a user not found type error..'desintione non existente' looks a lot like destination doesn't exist. The guys that manage the PHP-General list need to be made aware so they can remove the offending email address. There's not a lot these iguana guys can do if a user no longer exists on their system except to maybe ADD the account back in so it doesn't return an autoresponder or something. They're sending autoreplies to mailing list mail. By definition, they've got a problem to fix. - Ron -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] convert degrees to heading
Very nice solution, Dave. I like simple, elegant and effective solutions like this. I was wracking my brain yesterday to come up with something like this, but my brain wasn't working. Hah. Good job! I think your compass directions are a bit off though.hah. West shouldn't be 0 degrees, it should be 270 normally (unless someone's using a compass system that I'm not familiar with). Here's a variation of your script that displays all 360 degrees (for validation purposes): $compass = array(N,NNE,NE,NEE,E,SEE,SE,SSE,S,SSW,SW,SWW,W ,NWW,NW,NNW); for ($degrees=0;$degrees360;$degrees++) { $compcount = round($degrees / 22.5); $compdir = $compass[$compcount]; echo $degrees degrees is roughly $compdir on the compassbr\n; } Yeah, I don't know what east of northeast is, so I just labeled it NEE :) Great thinking though. You still get the prize on this one. -TG -Original Message- From: Dave Restall - System Administrator,,, [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 4:14 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; Gryffyn, Trevor Subject: Re: [PHP] convert degrees to heading Hi, Alternatively, try :- $Compass = array('West', 'North Westerly', 'North', 'North Easterly', 'East', 'South Easterly', 'South', 'South Westerly'); print $Compass[round($Degrees / 45)] . \n; This can be expanded easily by adding 'North North West' etc. at the relevant points in the array and changing the 45 to 22.5. No messy horrible switches :-) TTFN, Dave php/2004-09-14.tx [EMAIL PROTECTED], php-general,[EMAIL PROTECTED] +- ---+ | Dave Restall, IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. | | Tel. 0845 10 80 151Mob. +44 (0) 7973 831245 Int. +44 (0) 1287 653003 | | email : [EMAIL PROTECTED] [EMAIL PROTECTED] Web : http://www.iirc.net | +--- -+ | One picture is worth more than ten thousand words. | | -- Chinese proverb | +--- -+ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Communicate with Outlook
Ok, so I was bored.. Attached below is a PHP script that will connect to Outlook via COM and go through all the items in the Calendar, displaying the appointment name, location, FROM and TO date/times (adjusting for the weird assed MS timestamp.. Apparently # of seconds since some time in 1970), and whether it's recurring and/or all-day. I didn't snag the information about recurrence, but you can probably figure it out. Here's the MS Data Model for Outlook. Semi-helpful, although not organized very well: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000 /html/olobjApplication.asp Also, excuse the sloppy coding, just wanted to see if I could do this real quick. I have multiple mailboxes on my Outlook at work here, so I have it cycle through all mailboxes and all folders until it finds the right mailbox and correct calendar. There's probably a more direct way to do this. But this doesn't really add much overhead, so if it works, it works eh? Feel free to share any better way you might find. Code attached to the bottom -TG -Original Message- From: Shaun [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 11:17 AM To: [EMAIL PROTECTED] Subject: [PHP] Communicate with Outlook Hi, Is it possible for a PHP application to communicate with an Outlook calendar? I would like to create a web based application that shows staff availability... Thanks for any advice offered. ?php $comobjOutlook = new COM(outlook.application) or die(Unable to instantiate outlook); $comobjOutlook - Activate; $targetmailboxname = Mailbox - LastName, FirstName; $targetfoldername = Calendar; $objNamespace = $comobjOutlook-GetNameSpace(MAPI); $objFolders = $objNamespace-Folders(); $mailboxcount = $objFolders - Count(); $foundmailbox = FALSE; for ($i=1; $i=$mailboxcount; $i++) { $folderitem = $objFolders -Item($i); if ($folderitem - Name == $targetmailboxname) { $objMailbox = $folderitem; $foundmailbox = TRUE; } } $foundcal = FALSE; if ($foundmailbox) { $objFolders = $objMailbox-Folders(); $foldercount = $objFolders - Count(); for ($i=1; $i=$foldercount; $i++) { $folderitem = $objFolders - Item($i); if ($folderitem - Name == $targetfoldername) { $objCalendar = $folderitem; $foundcal = TRUE; } } if ($foundcal) { $objItems = $objCalendar-Items(); $itemcount = $objItems-Count(); for ($i=1; $i=$itemcount; $i++) { $apptitem = $objItems - Item($i); $apptstart = $apptitem - Start(); $apptend = $apptitem - End(); $apptallday = $apptitem - AllDayEvent(); $apptrecur = $apptitem - IsRecurring(); $apptsubject = $apptitem - Subject(); $apptlocation = $apptitem - Location(); $secondsadj = $apptstart - 14400; $startadj = date(m/d/Y H:i:s, mktime(0,0,$secondsadj,1,1,1970)); $secondsadj = $apptend - 14400; $endadj = date(m/d/Y H:i:s, mktime(0,0,$secondsadj,1,1,1970)); if($apptallday) { $allday = All Day; } else { $allday = ; } if($apptrecur) { $recurring = Recurring; } else { $recurring = ; } echo $apptsubject @ $apptlocation\r\nFrom: $startadj To: $endadj\r\n; if ($allday OR $recurring ) echo $allday $recurring\r\n; echo \r\n\r\n; } } else { die (Did not find calendar folder); } } else { die(Did not find target mailbox: $targetmailboxname); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert textarea post data from plain text to html using php..how?
I stand corrected. Nl2br() is still useful when dealing with outputting data from textarea form elements... If you're outputting to a browser at least. But yes, it only inserts a br \ where there's a \n, it doesn't replace \n and doesn't do anything with \r's. -TG -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, September 13, 2004 3:35 PM To: [EMAIL PROTECTED]; M. Sokolewicz Subject: Re: [PHP] Convert textarea post data from plain text to html using php..how? From: M. Sokolewicz [EMAIL PROTECTED] 1. nl2br($posteddata) - This converts all the \r\n's to br's so that it comes out with the same carriage returns as the person who inputed it gave it It doesn't change \r\n to br, it only changes \n to br / It doesn't change anything, actually. It just inserts the br /. ?php $str = asdf\nasdf\nasdf\nasdf; $n = nl2br($str); if(strstr($n,\n)) { echo 'Newlines present'; } else { echo 'Newlines not present'; } ? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Benchmarking a script
You will still get the benchmark of the functions, you just declare them outside of your benchmarking loop so they don't get re-declared. Pardon my syntax, I'm just going to try to demonstrate (using the getmicrotime function from the PHP manual): ?php Function dosomething ($somevar) { echo $somevar; return 1; } Function dosomethingelse ($somevar) { echo $somevar; return 1; } function getmicrotime() { list($usec, $sec) = explode( , microtime()); return ((float)$usec + (float)$sec); } # Benchmark here $time_start = getmicrotime(); For ($i=0; $i = 10; $i++) { $retval = dosomething($i); $retval2 = dosomethingelse($i); } $time_end = getmicrotime(); $time = $time_end - $time_start; # end benchmarking ? Every time you call dosomething and dosomethingelse, it executes the function, it just doesn't delare it over again. So even though your functions are declared outside of your benchmark loop, they still get executed inside the loop, therefore you get the time needed to execute 100,000 calls of both functions (in this case). The only thing you're not benchmarking here is the time to declare the functions once, which is extremely minimal. Does that clarify it a bit for you? -TG -Original Message- From: Cristian Lavaque [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 14, 2004 1:18 PM To: Gryffyn, Trevor Subject: Re: [PHP] Benchmarking a script Hello Trevor, I really appreciate your reply! In fact I haven't found a way to do it yet. I can't really do it the way you suggest cause part of what I want to benchmark is defining the functions. Someone suggested benching it from Apache, but I'm not sure how to do that. Thank you very much for taking the time to drop me an email. :) Regards, Cristian Gryffyn, Trevor wrote: Doesn't look like anyone responded to this (publicly at least). I wasn't sure if you were still having a problme, but something you might try is putting the function definitions outside of the loop. They'll get called once, and still be executed within the loop. Good luck! -TG __ _ This message has been checked by mks_vir mail scanner ( http://www.mks.com.pl ) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Can I name a session variable using another variable?
Ok, assuming everything's working correctly except for the use of $prevtime in the SESSION, then here's one answer: Yes, you can name a session the way you described. If you're having trouble with doing the concatenation of values inside $_SESSION, then try combining them outside: $roomname=sampleroom; $sessionname = $roomname . $prevtime; $_SESSION[$sessionname]=time(); Secondly, looks like you forgot a $ on prevtime below: $_SESSION[$roomname . prevtime]=time(); Thirdly, you can store arrays in $_SESSION as well, so you could divide the rooms up that way: $_SESSION[$roomname][PrevTime] = $prevtime; -TG -Original Message- From: John Gostick [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 5:47 PM To: PHP General Subject: [PHP] Can I name a session variable using another variable? Hi, I've encountered a problem I can't seem to find much reference to on the web, so I was wondering if anyone here could help me... Fisrt a brief background: I am building a fairly simple PHP/MySQL chat system with multiple rooms. Each room is loaded from the main chat page by clicking on a link that uses JavaScript to open and size a new window, and also passes the roomname as a variable to the new chat window. Messages sent from a room are tagged with the roomname, and the window refreshes periodically to look for new messages(rows) in the database that have that rooms name. In this way a room only recieves messages meant for it. So far so good. However, to determine what messages are new, a SESSION variable $prevtime is set each time the script checks for new messages, so that next time it checks, it will only download messages posted SINCE the time given in $prevtime. This was not a problem with a single room, but when multiple rooms are open they are sharing the same session variable $prevtime because they are all using the same session as they were all opened from the same window. This leads to 'skipping' of messages and not all messages being picked up by each room. I've stratched my head over this, and decided to try and generate a unique SESSION variable for each room, named using the string 'prevtime' prefixed with the value of the variable $roomname (the name of the current room). However I can't seem to get this to work. To summarise my problem: Can I name/create a session variable like this?: $roomname=sampleroom; $_SESSION[$roomname . prevtime]=time(); With the aim of making a session variable named 'sampleroomprevtime'. It is possible to use a variable in naming a session this way? I would really appreciate any help anyone could give me in making this work, or any suggestions of a better way from people with a much better knowledge of sessions than myself! Thanks in advance, John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Clear HTTP POST value
I don't see why that wouldn't work. It's not in a conditional or something where the unset command isn't being executed? If that fails still, maybe try: $_POST[var] = ; -TG -Original Message- From: Nicklas Bondesson [mailto:[EMAIL PROTECTED] Sent: Monday, August 23, 2004 5:36 AM To: [EMAIL PROTECTED] Subject: [PHP] Clear HTTP POST value Hi! Is there a smooth way to clear a posted value on a page? I have tried the following without sucess. unset($_POST[var]); unset($HTTP_POST_VARS[var]); Nicke -- 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] Communicate with Outlook
If you have an Outlook client running on the same machine as PHP, you should be able to use COM calls to access the data. Here's MS's Outlook Object Model site for Outlook Item Objects including MeetingItem: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/off2000 /html/olmscOutlookItemObjects.asp I've done this in VBA and I've access MapPoint via PHP through a COM call, but havn't done Outlook via PHP yet. But that's probably how I'd do it if I could get it to work right and had to use PHP for it. It's probably 'cleaner' but maybe more difficult to access the server directly and/or parse a .PST file (which isn't going to be available if you have everything on the server side.. Unless you have Work Offline mode enabled). -TG -Original Message- From: Shaun [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 11:17 AM To: [EMAIL PROTECTED] Subject: [PHP] Communicate with Outlook Hi, Is it possible for a PHP application to communicate with an Outlook calendar? I would like to create a web based application that shows staff availability... Thanks for any advice offered. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] convert degrees to heading
The cleanest looking multiple if scenario is to use a Switch statement. Unfortunately I don't believe PHP's switch will do varied conditions, only equality statements: $j = 5; switch ($j) { case 6: echo first; break; case 6: echo second; break; case 5: echo third; break; default: echo fourth; break; } This breaks at case 6. Removing the second condition, the switch statement echos third since $j == 5. In some other languages, you could put your range of values in the case statements, but not PHP I guess. I think in this case, you're stuck with a bunch of if/elseif statements. Only 16 of them though, right? :) -TG -Original Message- From: René Fournier [mailto:[EMAIL PROTECTED] Sent: Friday, July 16, 2004 6:20 PM To: php Subject: [PHP] convert degrees to heading I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: from: 135 degrees to: NW Now, I was planning to write a series of if statements to evaluate e.g., if ($heading_degrees 112.5 $heading_degrees 67.5) { $heading_compass = N; } The works, but it will require N, NNW, NNE, NE, NW, ENE, NWW... many IF statements. Can anyone think of a programatically more elegant and efficient way of converting this type of data? (I suppose this is not really a problem, just a curiosity.) ...Rene -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Convert textarea post data from plain text to html using php..how?
Two options: 1. nl2br($posteddata) - This converts all the \r\n's to br's so that it comes out with the same carriage returns as the person who inputed it gave it 2. Use HTML pre tabs to do the same thing. I think that's the trickiest thing about using textarea to input then regurgitate the data. Everything else should come out pretty much the same. -TG -Original Message- From: Brent Clements [mailto:[EMAIL PROTECTED] Sent: Saturday, September 11, 2004 7:02 PM To: [EMAIL PROTECTED] Subject: [PHP] Convert textarea post data from plain text to html using php..how? Do you guys happen to have an easy easy to do this? I need to convert plain text submitted via a textarea form field to html formatted text. Is there a way to do this with php? Thanks, Brent -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] convert degrees to heading
Nice! I didn't know you could do that with switch. I was wondering why conditionals were left out of PHP's switch statement, but hoped someone would prove me wrong. Thanks John! Very helpful! -TG -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED] Sent: Monday, September 13, 2004 3:26 PM To: Gryffyn, Trevor; php Cc: René Fournier Subject: Re: [PHP] convert degrees to heading I have to write a little function to convert a direction from degrees to a compass -type heading. 0 = West. 90 = North. E.g.: Something like this... it'll account for 360 degrees, too. No different that a bunch of IF statements, though... ?php $dir = 378; switch($dir = $dir%360) { case 0 = $dir $dir 90: echo 'northeasterly'; break; case 90 = $dir $dir 180: echo 'southeasterly'; break; case 180 = $dir $dir 270: echo 'southwesterly'; break; case 270 = $dir $dir 360: echo 'northwesterly'; break; } ? ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [PHP-GEN] Check Boxes
You got it right, except you're going to have it blow up on you if someone doesn't select something Try these changes: $a1 = $_POST['ch1']; $a2 = $_POST['ch2']; $a3 = $_POST['ch3']; # Add this bit If (isset($_POST['ch1')) { $collist .= ,$a1; } If (isset($_POST['ch2')) { if ($collist == ) { $collist = $a2; } else { $collist .= ,$a2; } }If (isset($_POST['ch3')) { if ($collist == ) { $collist = $a3; } else { $collist .= ,$a3; } } # Make slight changes here if ($collist ) { $query = SELECT $collist FROM form; [EMAIL PROTECTED] ($query); } Enter_Dateinput type=checkbox name=ch1 value=Enter_Date Opening_Unitsinput type=checkbox name=ch2 value=Opening_Units Unit_Consumedinput type=checkbox name=ch3 value=Unit_Consumed -Original Message- From: balwantsingh [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 18, 2004 5:33 AM To: [EMAIL PROTECTED] Subject: [PHP] [PHP-GEN] Check Boxes balwantsingh wrote: can somebody advise me i want to use checkboxes on my website, i want that if user selects some checkboxes (there will be more than 20 checkboxes), checkbox's value will be stored in variables and than SELECT query command will be run using these variables through PHP. but my problem is that in SELECT query command after each column name comma (,) is required and if i use the same than it is displaying You have an error in your SQL syntax near 'FROM form' at line 1 i am using following coding $a1 = $_POST['ch1']; $a2 = $_POST['ch2']; $a3 = $_POST['ch3']; if ($a1 or $a2 or $a3) { $query = SELECT $a1, $a2, $a3 FROM form; [EMAIL PROTECTED] ($query); } Enter_Dateinput type=checkbox name=ch1 value=Enter_Date Opening_Unitsinput type=checkbox name=ch2 value=Opening_Units Unit_Consumedinput type=checkbox name=ch3 value=Unit_Consumed balwant -- 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] A follow up on my question about good coding practice [isset]
For reference: http://www.blueshoes.org/en/developer/php_cheat_sheet/ -Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: Sunday, June 06, 2004 7:47 PM To: [EMAIL PROTECTED] Subject: [PHP] A follow up on my question about good coding practice [isset] I could use one additional clarification regarding good practice. As I understand the php manual the following is acceptable. $foo= TRUE; if($foo) do.. ; where $foo is a binary; but not a variable. Use isset($var) for variables and be careful with $var= ' '; etc. because $var is assigned, i.e., set. -- 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] Active windows
Check into the Javascript events onfocus and onblur (forgive my syntax). Focus is when a window becomes 'active' and Blur is when it becomes 'non active'. -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 15, 2004 10:07 PM To: PHP general Subject: [PHP] Active windows I am trying to get my website to refresh when the window becomes active. This is needed so when a user downloads a report and the PDF is displayed, there is now a new state in the previously active window. However, the page needs to refresh to regenerate the new page. Any ideas on how to do this? Can one send header information to a separate window, or discern between active and non active windows? I know this is a stretch but I thought I¹d ask /T -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] adding *** on email address upon view
One simple way to do it would be: List($username,$domain) = explode(@,$emailaddress); $newemailaddress = [EMAIL PROTECTED]; Maybe I just use list/explode too much. :) -TG -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED] Sent: Thursday, July 22, 2004 6:09 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] adding *** on email address upon view On Thursday 22 July 2004 16:09, Louie Miranda wrote: What command in php? can i convert certain text ex the [EMAIL PROTECTED] to [EMAIL PROTECTED] If this is to protect people's email addresses then make it easy on yourself and just discard the whole domain. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Never say no -- Murphy's Laws on Sex n45 */ -- 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] Adding +7 more days on date() value problem
I disagree on the strtotime recommendations that everyone else gave. The mktime() function itself will compensate for leap years, day = 36 type stuff and all of that. ?php $curdate = date(Y-m-d); $plus7 = date(Y-m-d,mktime(0,0,0,date(m),date(d)+7,date(Y))); Echo Current Date: $curdatebr; Echo +7 Dats Date: $plus7; ? Simple as that! -TG -Original Message- From: Louie Miranda [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 11:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Adding +7 more days on date() value problem I can't figure how could i add +7 more days on the DD (Day) value. My problem is, when the day is close on the end of the month like 07/29/2004 when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. And im creating a program below, to explode it and maybe just add +. But i think its useless if im just going to do + on the DD (Day) value. Hmm :? ## ?php $curdate = date(Y-m-d); $plus7 = explode(-, $curdate); print ( pcut: .$plus7[0]. .$plus7[1]. .$plus7[2]. /p Current Date: $curdatebr +7 Dats Date: $plus7 ); ? ## -- Louie Miranda http://www.axishift.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adding +7 more days on date() value problem
Because $now+(7*24*60*60) isn't very intuitive to a human. Why would you do it that way instead of: $days = 24*60*60; $now = time(); $plus7 = $now+(7*$days); echo 'Current Date: '.date('Y-m-d', $now); echo 'Date in 7 days: '.date('Y-m-d', $plus7); Maybe you think like a machine, but the way I did it avoids the whole *24*60*60 nonesense that just makes the code seem cluttered to me. And what happens if I make a typo and do *70 or *25? I've made plenty of typos in my day and I'm sure everyone else has. Why risk a slight miscalculation that could give you inaccurate results when PHP is happy to help? Maybe you'd say, What if you mistype the 7 as a 9? well, then I'm screwed either way. But I've gone from 4 potential typo problems to one. Sounds like a good improvement to me. This is mostly a matter of style. Your way works as well as mine. I just like mine better. People can decide which way they'd prefer. Your example is good to help people realize how they can manually do the calculations if they should need to though, so thanks for posting it! -TG -Original Message- From: M. Sokolewicz [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 4:08 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Adding +7 more days on date() value problem Why would you do such strange things? It's a lot more simple :P $now = time(); $plus7 = $now+(7*24*60*60); // 7 days, containing 24 hours each, containing 60 minutes each, containing 60 seconds each. echo 'Current Date: '.date('Y-m-d', $now); echo 'Date in 7 days: '.date('Y-m-d', $plus7); now isn't that easier ;) Trevor Gryffyn wrote: I disagree on the strtotime recommendations that everyone else gave. The mktime() function itself will compensate for leap years, day = 36 type stuff and all of that. ?php $curdate = date(Y-m-d); $plus7 = date(Y-m-d,mktime(0,0,0,date(m),date(d)+7,date(Y))); Echo Current Date: $curdatebr; Echo +7 Dats Date: $plus7; ? Simple as that! -TG -Original Message- From: Louie Miranda [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 11:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Adding +7 more days on date() value problem I can't figure how could i add +7 more days on the DD (Day) value. My problem is, when the day is close on the end of the month like 07/29/2004 when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. And im creating a program below, to explode it and maybe just add +. But i think its useless if im just going to do + on the DD (Day) value. Hmm :? ## ?php $curdate = date(Y-m-d); $plus7 = explode(-, $curdate); print ( pcut: .$plus7[0]. .$plus7[1]. .$plus7[2]. /p Current Date: $curdatebr +7 Dats Date: $plus7 ); ? ## -- Louie Miranda http://www.axishift.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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Adding +7 more days on date() value problem
Yes, it does! That's why I find it so useful. :) http://www.php.he.net/manual/en/function.mktime.php Quoted: mktime() is useful for doing date arithmetic and validation, as it will automatically calculate the correct value for out-of-range input. For example, each of the following lines produces the string Jan-01-1998. Example 1. mktime() example ?php echo date(M-d-Y, mktime(0, 0, 0, 12, 32, 1997)); echo date(M-d-Y, mktime(0, 0, 0, 13, 1, 1997)); echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 1998)); echo date(M-d-Y, mktime(0, 0, 0, 1, 1, 98)); ? Year may be a two or four digit value, with values between 0-69 mapping to 2000-2069 and 70-99 to 1970-1999 (on systems where time_t is a 32bit signed integer, as most common today, the valid range for year is somewhere between 1901 and 2038). Windows: Negative timestamps are not supported under any known version of Windows. Therefore the range of valid years includes only 1970 through 2038. Another tidbit regarding mktime: The last day of any given month can be expressed as the 0 day of the next month, not the -1 day. Both of the following examples will produce the string The last day in Feb 2000 is: 29. Example 2. Last day of next month ?php $lastday = mktime(0, 0, 0, 3, 0, 2000); echo strftime(Last day in Feb 2000 is: %d, $lastday); $lastday = mktime(0, 0, 0, 4, -31, 2000); echo strftime(Last day in Feb 2000 is: %d, $lastday); ? Kind of goofy, but good stuff. -TG -Original Message- From: Vail, Warren [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 4:47 PM To: Gryffyn, Trevor; [EMAIL PROTECTED] Cc: Louie Miranda Subject: RE: [PHP] Adding +7 more days on date() value problem So if this is run on the 30th of the month, you are saying this handles a month with day 37 correctly? Warren Vail -Original Message- From: Gryffyn, Trevor [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:58 AM To: [EMAIL PROTECTED] Cc: Louie Miranda Subject: RE: [PHP] Adding +7 more days on date() value problem I disagree on the strtotime recommendations that everyone else gave. The mktime() function itself will compensate for leap years, day = 36 type stuff and all of that. ?php $curdate = date(Y-m-d); $plus7 = date(Y-m-d,mktime(0,0,0,date(m),date(d)+7,date(Y))); Echo Current Date: $curdatebr; Echo +7 Dats Date: $plus7; ? Simple as that! -TG -Original Message- From: Louie Miranda [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 11:31 PM To: [EMAIL PROTECTED] Subject: [PHP] Adding +7 more days on date() value problem I can't figure how could i add +7 more days on the DD (Day) value. My problem is, when the day is close on the end of the month like 07/29/2004 when i add +7 on 29 = 36, its obvious we dont have 36 on the calendar. And im creating a program below, to explode it and maybe just add +. But i think its useless if im just going to do + on the DD (Day) value. Hmm :? ## ?php $curdate = date(Y-m-d); $plus7 = explode(-, $curdate); print ( pcut: .$plus7[0]. .$plus7[1]. .$plus7[2]. /p Current Date: $curdatebr +7 Dats Date: $plus7 ); ? ## -- Louie Miranda http://www.axishift.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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Unable to open word document.
Another thing to keep in mind is that Office products can run invisible. Sometimes you'll get COM failures and can't understand why and it turns out that Word or Excel or whatever is still running, just not visible. Pull up your Task Manager and look for the process and kill it. The property in VBA is applicationobjectname.Visible = True (or False) I forget the exact syntax for PHP, but you get the idea. There's also a .UserControl T/F property that tells the application whether it's allowed to auto-close when the COM call is done or if it needs to stay open for the user to manipulate. TRUE means to stay open (even if it's not visible). -TG -Original Message- From: M. Sokolewicz [mailto:[EMAIL PROTECTED] Sent: Saturday, September 04, 2004 8:19 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Unable to open word document. Cbharadwaj wrote: Hi, I am asked to generate reports on MS WORD. OFFICE 2000 is installed in mechine. when I am calling a PHP page containin this code. $word = new COM(word.application) ; I am getting following error. Warning: (null)(): Unable to obtain IDispatch interface for CLSID {000209FF---C000-0046}: The message filter indicated that the application is busy your valuable help is needed. Bharadwaj. try closing word and running the script again... Also, which version of PHP are you using? Because asof PHP5 the COM section has been thoroughly rewritten and is much easier to use (aswell as quicker, more stable, etc). Besides that, could you PLEASE adjust your system time, it's miles ahead and your messages don't order right in my mailclient. Thank you :) - Tul -- 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-WIN] i need help
If the format is consistantly the same, try this: $somedata = [i:aslkdfj]; $insidedata = substr($somedata,3,strlen($somedata)-4); -TG -Original Message- From: Student [mailto:[EMAIL PROTECTED] Sent: Monday, May 17, 2004 11:42 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: [PHP-WIN] i need help Hi i was hoping if someone can help; I want to trim the following text [i:abcdef] but the inside text is different at time eg abcdef, bcdefg, etc etc how can i trim [i:(some text here)] so that i can replace them with nothing. eg these are to be trimmed. [i:abcdef] [i:bcdefg] [i:xyzab] [i:priftds] how can i trim them.. thanks -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Control structure - easier way than repeating conditions in IF?
You could do something like this: $valuesarr = array($a,$b,$c,$d); If (in_array($x,$valuesarr)) { # do something } Or I guess even: If (in_array($x,array($a,$b,$c,$d))) { # do something } I don't know if your method or this method have better performance but it's a little easier to read I guess. -TG -Original Message- From: BOOT [mailto:[EMAIL PROTECTED] Sent: Friday, April 30, 2004 11:49 AM To: [EMAIL PROTECTED] Subject: [PHP] Control structure - easier way than repeating conditions in IF? Hello! Can anyone tell me if there is an easier/shorthand for: if (($x == $a) || ($x == $b) || ($x == $c) || ($x == $d) ... ) {;} I understand the logic of why the following does not work: if ($x == ($a || $b || $c || $d)) {;} Thanks! -- 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: Re[2]: [PHP] Browser Detection another page
mycb Sure, but why would a user want to fake their browser signature? They might do it without even knowing. Opera will identify itself as IE6 for example if you select that in the Preferences. Other browsers/packages can do it as standard. Although I can't give a specific example, I bet there are some firewalls out there that filter this information out too. When I ran Opera, I all but HAD to set it as IE5 (Opera 6.05 I think was the last version I ran) because if I didn't, many websites would, for lack of a better term, discriminate against the non IE header info and pass you to a page that was very stripped of features and layout and sometimes was barely thrown together, much less 'developed'. And if you went to a site like Hotmail.com, you lost a LOT of functionality. Assuming that Microsoft didn't do this out of spite, the basic assumption was Oh, you're not running Internet Explorer.. You must not be capable of doing CSS or whatever. Opera functioned just fine on these sites if you told it to impersonate IE. I saw a response letting you know how to do this, but I would recommend not sending people to different pages based on which browser/OS they're using. mycb Why not? Isn't that what most of the big web sites do? Actually yes, lots of them do. So I agree with you here :) Many big sites do this, but as illustrated in the example I gave above, it's not always justified or welcome. I personally hate designing too many different pages to suit all the needs of the browsers, so I try to work with what most of the browsers will handle right off. True, that's not going to take into account Lynx users or whatever, but if I don't OVER design what I'm working on, then it still shouldn't turn out too bad. There are always exceptions though. Thankfully, designing primarily for an internal corporate environment right now, I have some insight into what people are using and some control over what they NEED to use in order to make use of the functions that I implement. mycb What about obsolete browsers that don't handle CSS too well (or not at all)? We I think his point was that there are other ways to handle browser display issues besides 2 versions of a site and a user_agent test. True. You know.. Browsers really need to be able to talk more to scripts to let them know what their capabilities are. You can do this to some degree, but I think we should be able to ask the browser itself if it knows tag x and it can respond 'yea' or 'nay'. Then, if there's a known issue with the implementation of that tag in that browser (glitches, bugs and such) then we can use the browser identification to decide if it's worth using that tag or not. Handle it all programatically. No sense having 95% functional HTML and having 5% blow up when we can toggle the use of that 5% via PHP depending on certain conditions. Ok, I'm rambling.. Excuse me. I'm making like 3 or 4 different points at once. -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Weird question - environment data from windows
-Original Message- From: Martin [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 10:26 AM To: [EMAIL PROTECTED] Subject: [PHP] Weird question - environment data from windows When you've stopped laughing - is it at all possible to pass Windows environment data from a Windows workstation to an PHP application running on a Linux server? You might be able to use Javascript to get some information off of the client browser and maybe populate some form elements or something, but I don't know of any way to automatically send environment information to your linux server. I know Javascript has functions built into it for getting screen height and width and such. Probably other things as well. On the server itself you can use the $_ENV superglobal to get it's environment information (see the listing in phpinfo()), but getting it from the browser is a little trickier. Some things can be obtained in other ways. For example, a hack/workaround for getting a user's login name on a Windows network (with a Windows server) is to put this into your code: $ipaddress = $_SERVER[REMOTE_ADDR]; $nbtstat = nbtstat -A . $ipaddress; exec ($nbtstat,$result); foreach ($result as $row) { if (strpos($row,03)) $username = strtok($row, ); } Basically this uses the IP address of the client, does an nbtstat on it and parses all the entries containing 03 to get the username. This works ok.. Unless the person is logged into more than one machine at a time, then you usually get the machine name instead. Not great, but if it's your only way of snagging a username, then so be it. Maybe if you tell us what environment information you're trying to pass to the server, someone has a workaround like this specifically for that variable. If it's for just some userset variable, then I'm really not sure how you'd do that. If you do find a way, please share! Could be useful to lots of people. Good luck! -TG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions not working.
Random thought.. Did you check your PHP.INI on the 'bad' server to make sure that it's configured the same as the 'good' server? Some things to check: Session.use_cookies = 1 Session.auto_start = 0 // This is the first one I'd check. If you have it set to =1 on the good server and aren't doing a session_start(), that could do it I think There are a bunch of other Session related parameters in PHP.INI.. Default timeout value.. If that's set too low, the session might vaporize before you get a chance to see the info, etc. Good luck! -TG -Original Message- From: Jeff McKeon [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 7:44 PM To: [EMAIL PROTECTED] Subject: [PHP] Sessions not working. Pulling my hair out here. I've got an IIS5 webserver running a php website just fine. I created another web for a dev version of the first website. Installed PHP ect... When I load up the old websites files on the new site sessions won't work on the new site. For some reason on the new site's phpinfo.php page, there is no HTTP_COOKIE variable set under the environmental section. Also, under the PHP Variables section, there is no _REQUEST[PHPSESSID] or _COOKIE[PHPSESSID] variable. What have I missed!??? Here is a section of the phpinfo() for both sites. Good Site: Environment Variable Value ALLUSERSPROFILE C:\Documents and Settings\All Users CommonProgramFiles C:\Program Files\Common Files COMPUTERNAME WS02TC07927 ComSpec C:\WINNT\system32\cmd.exe CONTENT_LENGTH 0 GATEWAY_INTERFACE CGI/1.1 HTTPS off HTTP_ACCEPT */* HTTP_ACCEPT_LANGUAGE en-us HTTP_CONNECTION Keep-Alive HTTP_HOST opsup.telaurus.net HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) HTTP_COOKIE PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f HTTP_ACCEPT_ENCODING gzip, deflate INSTANCE_ID 3 LOCAL_ADDR 10.16.1.21 NUMBER_OF_PROCESSORS 1 Os2LibPath C:\WINNT\system32\os2\dll; OS Windows_NT Path C:\WINNT\system32;C:\WINNT;C:\WINNT\System32\Wbem PATHEXT .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH PATH_INFO /phpinfo.php PATH_TRANSLATED C:\Inetpub\wwwOpSup\phpinfo.php PROCESSOR_ARCHITECTURE x86 PROCESSOR_IDENTIFIER x86 Family 6 Model 8 Stepping 10, GenuineIntel PROCESSOR_LEVEL 6 PROCESSOR_REVISION 080a ProgramFiles C:\Program Files REMOTE_ADDR 10.16.2.55 REMOTE_HOST 10.16.2.55 REQUEST_METHOD GET SCRIPT_NAME /phpinfo.php SERVER_NAME opsup.telaurus.net SERVER_PORT 80 SERVER_PORT_SECURE 0 SERVER_PROTOCOL HTTP/1.1 SERVER_SOFTWARE Microsoft-IIS/5.0 SystemDrive C: SystemRoot C:\WINNT TEMP C:\WINNT\TEMP TMP C:\WINNT\TEMP USERPROFILE C:\Documents and Settings\NetShowServices windir C:\WINNT PHP Variables Variable Value _REQUEST[PHPSESSID] ed09aa7b20d4032a3553c16a8f4a782f _COOKIE[PHPSESSID] ed09aa7b20d4032a3553c16a8f4a782f _SERVER[ALLUSERSPROFILE] C:\\Documents and Settings\\All Users _SERVER[CommonProgramFiles] C:\\Program Files\\Common Files _SERVER[COMPUTERNAME] WS02TC07927 _SERVER[ComSpec] C:\\WINNT\\system32\\cmd.exe _SERVER[CONTENT_LENGTH] 0 _SERVER[GATEWAY_INTERFACE] CGI/1.1 _SERVER[HTTPS] off _SERVER[HTTP_ACCEPT] */* _SERVER[HTTP_ACCEPT_LANGUAGE] en-us _SERVER[HTTP_CONNECTION] Keep-Alive _SERVER[HTTP_HOST] opsup.telaurus.net _SERVER[HTTP_USER_AGENT] Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) _SERVER[HTTP_COOKIE] PHPSESSID=ed09aa7b20d4032a3553c16a8f4a782f _SERVER[HTTP_ACCEPT_ENCODING] gzip, deflate _SERVER[INSTANCE_ID] 3 _SERVER[LOCAL_ADDR] 10.16.1.21 _SERVER[NUMBER_OF_PROCESSORS] 1 _SERVER[Os2LibPath] C:\\WINNT\\system32\\os2\\dll; _SERVER[OS] Windows_NT _SERVER[Path] C:\\WINNT\\system32;C:\\WINNT;C:\\WINNT\\System32\\Wbem _SERVER[PATHEXT] .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH _SERVER[PATH_INFO] /phpinfo.php _SERVER[PATH_TRANSLATED] C:\\Inetpub\\wwwOpSup\\phpinfo.php _SERVER[PROCESSOR_ARCHITECTURE] x86 _SERVER[PROCESSOR_IDENTIFIER] x86 Family 6 Model 8 Stepping 10, GenuineIntel _SERVER[PROCESSOR_LEVEL] 6 _SERVER[PROCESSOR_REVISION] 080a _SERVER[ProgramFiles] C:\\Program Files _SERVER[REMOTE_ADDR] 10.16.2.55 _SERVER[REMOTE_HOST] 10.16.2.55 _SERVER[REQUEST_METHOD] GET _SERVER[SCRIPT_NAME] /phpinfo.php _SERVER[SERVER_NAME] opsup.telaurus.net _SERVER[SERVER_PORT] 80 _SERVER[SERVER_PORT_SECURE] 0 _SERVER[SERVER_PROTOCOL] HTTP/1.1 _SERVER[SERVER_SOFTWARE] Microsoft-IIS/5.0 _SERVER[SystemDrive] C: _SERVER[SystemRoot] C:\\WINNT _SERVER[TEMP] C:\\WINNT\\TEMP _SERVER[TMP] C:\\WINNT\\TEMP _SERVER[USERPROFILE] C:\\Documents and Settings\\NetShowServices _SERVER[windir] C:\\WINNT _SERVER[PHP_SELF] /phpinfo.php _SERVER[argv] Array ( ) _SERVER[argc] 0 _ENV[ALLUSERSPROFILE] C:\\Documents and Settings\\All Users _ENV[CommonProgramFiles] C:\\Program Files\\Common Files _ENV[COMPUTERNAME]
RE: [PHP] Spell checker in PHP
There are a lot of words in the spelling checking in Microsoft products that isn't part of what you'd consider a standard 'dictionary', like city names and such. I think for spell checking, using the internal spell check in Word would be best, but if you ever decided to work on Word-PHP integration, look into COM. I havn't played around with it a lot, but someone at my work doubted I could use PHP to control Microsoft MapPoint. I got just far enough to prove them wrong before getting busy. $mappoint = new COM(mappoint.application) or die(Unable to instanciate mappoint); print Loaded mappoint, version {$mappoint-Version}\n; $map = new COM(mappoint.map) or die (Unable to instanciate map); $map = $mappoint-NewMap or die (Unable to NewMap); $map-Name = Test or die (Unable to Name);; $mappoint-Visible = 1; You should be able to do similar things with almost all the latest Microsoft applications, even if they don't have an obvious VBA editor built in like Access and Excel do. -TG -Original Message- From: Alex King [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 1:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Spell checker in PHP Justin, I don't know what version of Word you have, but XP seems to do fine with correcting city names. Alex Justin French [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Saturday, January 10, 2004, at 06:57 AM, Robin Kopetzky wrote: Good afternoon! I know aspell and pspell are available but pspell won't work in my Windows environment. Does anyone know how to tie into Word's spell checker using php or another spell check option? What I need is a way to check spelling on city/state names and select the most appropriate if the user mangles the words. U, does is Word actually capable of City/State names? To the best of my knowledge (I don't use Word), Word checks against a dictionary (US/UK/AU English, etc)... I wouldn't think these dictionaries would extend as far as all City State names applicable for that dictionary. That's insane. Although technically, you *could* add them all to Word's dictionary. However, my point is, Spell-checking of City State names isn't common, because it's too hard for the dictionaries to keep up with the list. So, if Word can't offer this feature, why would your web application need it? Also, given the global nature of the web, you'd have a LOT of data entry to do :) Justin French -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Integration between ASP PHP.
Define integrate? Using both ASP and PHP within the same physical file/script like: ?php Phpcodehere; ? html body % Aspcodehere %? /body /html ?? ...or going from ASP pages to PHP pages? That is, Default.asp calls menu.php or something like that? In the first case, I'm not sure if it's possible since the web server passes the script to an interpreter based on what kinda of file it is. .ASP and .ASPX are going to get sent to an ASP interpreter and .PHP, etc are going to get sent to a PHP interpreter. Not sure if you can get it to do both in the same file without some tricky work. Good luck though! I'm curious to see if anyone knows of a way, but I'm not sure I'd ever want to mix code like that. -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 3:19 AM To: [EMAIL PROTECTED] Subject: [PHP] Integration between ASP PHP. Importance: High Hi all, is possible to integrate script in ASP with script in PHP? How can I do this? All helps are precious. Best regards. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] index page not running and other woes (0t?)
I'd check the permissions of your files as well as any .htaccess settings you may need to set allowances on the files and folders involved. Also check your 'default document' name in your configuration and make sure that it's looking for index.html at all. Although that wouldn't affect it if you implicitly spelled out http://ipnumber/index.html;. That sounds more like a permissions issue. That should be in conf/httpd.conf for Apache if I remember right. And again, check to see if you have a .htaccess file or NEED one in the folder(s) in question. -TG -Original Message- From: Ryan A [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 11:11 AM To: [EMAIL PROTECTED] Subject: [PHP] index page not running and other woes (0t?) Hi, I think this is a bit off topic, but i'm sure some of you guys must be running ensim so might be able to help me. We reciently took a dedicated server to work with, it came with ensim installed, its a Linux machine P4 2.6 running Apache. Problem: 1)As I go to the IP address assigned to our box, it rolls out the ensim login screen instead! it does not run the index.html page 2)when i put a phpinfo.php page there, and call that like so http://ipnumber/phpinfo.php it runs perfectly, but after that i made a folder members and tried calling that http://ipnumber/members/ it gives me a page not found... i even tried calling the index file like so: http://ipnumber/index.html and it gives me a page not found... whats wrong? and what setting do i have to change? Thanks, -Ryan -- 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] Integration between ASP PHP.
I'd just do the crypt functions in ASP, that's going to probably be a lot less nightmare than trying to blend the two. Here's a page that seems to have some useful information on crypt and md5 type functions for ASP: http://www.aspin.com/home/components/security?pg=4order=desc As for sharing variables.. Good luck. I guess you could save it out to a cookie and read it back in to the other language, but I'm not sure that you can share session data or anything like that. There's ALWAYS a 'way'.. But you have to ask yourself it's easier or more time efficient to bite the bullet and pick a language. -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 5:35 PM To: Gryffyn, Trevor Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Integration between ASP PHP. Importance: High OK, my problem is to use the crypt function (like md5(),sha1(),mcrypt(),crypt()) of PHP language in an ASP script. For example: % First part of script in ASP language % ?php script PHP ? % Second part of script in ASP language % I don't know if this code is correct I don't try to use it, but this is what I want to do. Finally I want to share variables between the two languages (I hope!!). Best regards, Frank www.automationsoft.biz - Original Message - From: Gryffyn, Trevor [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, January 29, 2004 9:30 PM Subject: RE: [PHP] Integration between ASP PHP. Define integrate? Using both ASP and PHP within the same physical file/script like: ?php Phpcodehere; ? html body % Aspcodehere %? /body /html ?? ...or going from ASP pages to PHP pages? That is, Default.asp calls menu.php or something like that? In the first case, I'm not sure if it's possible since the web server passes the script to an interpreter based on what kinda of file it is. .ASP and .ASPX are going to get sent to an ASP interpreter and .PHP, etc are going to get sent to a PHP interpreter. Not sure if you can get it to do both in the same file without some tricky work. Good luck though! I'm curious to see if anyone knows of a way, but I'm not sure I'd ever want to mix code like that. -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 3:19 AM To: [EMAIL PROTECTED] Subject: [PHP] Integration between ASP PHP. Importance: High Hi all, is possible to integrate script in ASP with script in PHP? How can I do this? All helps are precious. Best regards. -- 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] sending a hex string as it is?
Ahh.. Since you're not declaring what data type $var is, it must be treating it as a string, even though I'd think it'd take it as an int if you didn't put quotes around it. That's one thing I like about PHP.. You can be as strict or lax as you want with the types. But I can see in this case where it'd cause an issue. Well, you could try: Intval($var) That should force it to be an integer. You know what, I think the real question here is how are you sending it over the wire. Sounds like you're sending it in some manner that transmits it as text. In which case you WILL get 32 30 for a 20.. And if you convert the 20 to an INT, you'll still get it because of the way you're transmitting. You're probably going to have to open a binary connection to whatever you're doing. Look into socket_create() Sounds like you need something a little more low-level than what you're using. -TG -Original Message- From: Khoa Nguyen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 8:51 AM To: David OBrien; [EMAIL PROTECTED] Subject: RE: [PHP] sending a hex string as it is? I guess I confused the matter by mentioning hex. The problem is the same with decimal number; for example ?php $var = 20; echo $var; // This will send 32 30 over the wire, not 14 (hex value of decimal 20) // How do I make it send 14? ? I guess echo function treats $var as a string. Maybe I am looking for a function that will sends a data stream as it is Thanks, Khoa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] sending a hex string as it is?
But I think he'll still have an issue when he goes to transmit it. Whatever data you have is going to be interpreted by the function doing the sending unless it's a binary safe function that's going to send raw binary. Thanks for the tip on pack though. Havn't needed it yet, but always good to know. And PHP has so many functions (I'm constantly amazed that it usually has a function for whatever I need). -TG -Original Message- From: DvDmanDT [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 6:58 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] sending a hex string as it is? No need to ge that deep (socket_create and stuff).. To send the HEX number 20 (also a space), you can do the following: \x20; chr(0x20); chr(hexdec('20')); pack('C',0x20); All of those _should_ create a space... -- // DvDmanDT MSN: dvdmandt¤hotmail.com Mail: dvdmandt¤telia.com Trevor Gryffyn [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] RCARGO.COM... Ahh.. Since you're not declaring what data type $var is, it must be treating it as a string, even though I'd think it'd take it as an int if you didn't put quotes around it. That's one thing I like about PHP.. You can be as strict or lax as you want with the types. But I can see in this case where it'd cause an issue. Well, you could try: Intval($var) That should force it to be an integer. You know what, I think the real question here is how are you sending it over the wire. Sounds like you're sending it in some manner that transmits it as text. In which case you WILL get 32 30 for a 20.. And if you convert the 20 to an INT, you'll still get it because of the way you're transmitting. You're probably going to have to open a binary connection to whatever you're doing. Look into socket_create() Sounds like you need something a little more low-level than what you're using. -TG -Original Message- From: Khoa Nguyen [mailto:[EMAIL PROTECTED] Sent: Thursday, January 29, 2004 8:51 AM To: David OBrien; [EMAIL PROTECTED] Subject: RE: [PHP] sending a hex string as it is? I guess I confused the matter by mentioning hex. The problem is the same with decimal number; for example ?php $var = 20; echo $var; // This will send 32 30 over the wire, not 14 (hex value of decimal 20) // How do I make it send 14? ? I guess echo function treats $var as a string. Maybe I am looking for a function that will sends a data stream as it is Thanks, Khoa -- 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] Zend Studio ESC key issue?
First, let me apologize for this not being a specific PHP question, but I can't find the answer and I'm hoping someone else here has run into this. Maybe I'm just blind, blond or stupid today. :) In Zend Studio (Zend Development Environment) for Windows (on Windows 2000 fyi), when I hit the ESC key, it hides my Messages, Debug and Output windows. This might be nice sometimes, but I find myself hitting ESC (sometimes for no rational reason) and it's driving me nuts that it hides the three windows I WANT to see and not the File Manager window, which I really don't use that much currently. Hah Is there somewhere to customize this or is there another key that brings them back quickly? I prefer keyboard use to mouse use and would prefer not to have these windows disappear in the first place, but if it were a matter of hitting ESC to temporarily hide and hitting ESC again to bring them back, that'd be acceptable. I promise to post more directly PHP related messages later, just gotta take care of this one project first. Thanks in advance! -Trevor Gryffyn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP EDITORS
Up until recently, I've used Crimson Editor (http://www.crimsoneditor.com) which does a great job with syntax highlighting and is a great all around editor I think. I'm surprised I don't see it mentioned more often when I see lists of PHP-happy editors. Right not I'm evaluating Zend Studio ($200-$250) which is PHENOMEMAL!.. But of course that's money.. Not free. Since my boss said he might foot the bill if I found a good commercial editor, I'm giving Zend a shot. I did install and fool around with PHPEdit briefly and for a free system, it looks really great. For what I'm doing though, I really wanted something a little more powerful (and not necessarily free). I really didn't dig into PHPEdit very deeply. If Zend turns out to have major problems, I'll give PHPEdit a more honest look. First glance it appeared fairly functional though. Much more so than Crimson Editor. But CE is still my favorite basic free code and text editor. -TG -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 28, 2004 8:41 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP EDITORS Hello John, On 28 Jan 2004 at 0:10, John Jensen wrote: Hello everyone. I am new to PhP and MySQL. I was wondering what a good (Or Free) Php Editor is? If you want something nice and simple to start with, try WinSyntax (http://www.winsyntax.com). If you want a very nice and configurable editor that has loads of great plugins for other technologies (such as XML/XSLT), go straight to jEdit (http://www.jedit.org). If you want a nice IDE with lots of menus and helpers, try either PHPEdit (http://www.phpedit.org) or Maguma Studio (http://www.maguma.com/products.php?article=free). My suggestion is that you download them all, have a go at each one and keep the one you find more intuitive and feel most comfortable with. Good luck, Erik -- 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