[PHP] Re: Newsgroup Server?
Clete Rivers Blackwell 2 wrote: > Is there a newsgroup server for this mailing list? news.php.net -- Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
php-general@lists.php.net
James Taylor wrote: > Where can I read more about this? I'm not sure that I understand why > 4 & 4 == 4. http://se.php.net/manual/en/language.operators.bitwise.php Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [RegExp] extracting anchors
Jens Lehmann wrote: > Hello, > > I want to extract the "name"-attribute of all anchors out of an > HTML-source-code which don't have the "href"-attribute. I can use this > code to get the "name"-attribute: > > preg_match_all('/]*?)name=[ \'\"](.*?)[ > \'\"](.*?)>/is',$src,$ar); > > The name-attributes are now in $ar[2]. How can I exclude all links > which have the href-attribute? I didn't find an easy way how to say > that a string must _not_ be part of a pattern match. I hope you can > give me some advise. > > Jens This is one lousy solution but hey - it's a solution after all; you can simply remove all tags containing href before doing the preg_match_all()-call, something like this below should do it I think. $src = preg_replace('/]*?href=[^>]*?>/is', '', $src); Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP newbie ... function with several returns ?
Robert Dyke wrote: > Hi ... PHP newbie here. > > I'm migrating from ASP/vbScript. > > I'd like to set up a subroutine that will change several variables at > once. > > In VB, I can say: > > Private Sub Change_Variables ($variable1, $variable2) > $variable1 = "Something different from it's original value" > $variable2 = "I'm changed also!!" > End Sub > > // in my code I can call it like this: > $My_variable1 = "This is the original value of variable1" > $My_variable2 = "This is the original value of variable2" > > Call Change_Variables ($My_variable1, $My_variable2) > > // after calling this subroutine the variables are changed: > > print $My_variable1 // yeilds: "Something different from it's > original value" > print $My_variable2 // yields: "I'm changed also!!" > > I try to convert this to PHP, and I'm getting stuck. I'm sure > there's a kind of function that can do this. > > Any ideas? VB defaults to pass by reference while PHP defaults to pass by value. Read more at: http://www.php.net/manual/en/language.references.pass.php Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] counting words.
Justin French wrote: > It depends on what you define as a word, but let's take the simple > approach of stripping HTML et al, and exploding the string on the > spaces, then counting the array of words: > > $str = "This is my text that I want to count"; > $words = explode(' ', strip_tags($str)); > $count = count($words); I believe substr_count() is faster than that method. http://www.php.net/manual/en/function.substr-count.php Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date() Problem
> Hi, im making a tab/lyric portal, and for viewing tabs i want to display the > time the lyric/tab was submitted. So I retrive it from a MySQL database (as > a timestamp) and format it using the date function. The problem is, that the > date: 19-01-2038 04:14:07 is allways returned, even though in the `date` > field the timestamp says (as an actual example) 20020723200919. > > Here is a shortened version of the script: > > $submitdate"); ?> > Hi Tony, the date() function in PHP does _only_ take UNIX timestamps as an argument which means that you can not run such a timestamp as the above. I recommend that you have a look at http://www.mysql.com/doc/D/a/Date_and_time_functions.html which describes the built-in functions for date-handling in MySQL. A function to look at could be DATE_FORMAT(). Regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date() Problem
> Yeh, ive allready looked at that before, but where and when do i use > DATE_FORMAT() ? When im inserting the row or selecting it? > Replace your existent query with this one and try: SELECT `artist_id`,`title`,`content`,`user_id`,DATE_FORMAT(date,'%d-%m-%Y %H:%i:%s'),`type`,`views` FROM `resources` WHERE `id` = $id Regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Public Scripts in a commercial product
> If someone is going to be using scripts that they grabbed > from a public forum (PHP Builder, PHPClasses, etc) in a > commercial product (that is going to be compiled with the > Zend encoder and released), what is the protocol, if any? > Do you have to get permission from the author or anything? That depends on the type of license (of course). Some licenes are pretty hard to understand and you may have to ask a lawyer. However, there is an easy way: just ask the author of the script you're thinking about including in your product. He can probably tell you real quick (and free of charge) if you can use it in your commercial product. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Encrypting Passwords - Is it really necessary??
> Is it really necessary to store passwords encrypted in a mySQL DB for a > membership site if you're not storing sensitive info such as credit card > numbers? How much security does that offer, really, and for whom? The most important reason in my humble opinion is that users may use the same password for serveral sites and therefor he or she can feel safe that his password isn't abused, even if a hacker grabs the database. For passwords under 128 chars, md5() is a pretty good solution. > The reason I ask is because I'm trying to implement a "forgot password" > feature on a membership site. But if I store passwords encrypted, I can't > just send the password to their e-mail address, I have to generate a new one > before sending it, which essentially locks that member out of the site until > they get their new password. This has the potential to be abused by a > vindictive person. All they need to know is the member's username or e-mail > address and they can keep re-generating new passwords (locking the member > out of their own account) for a member to annoy them. > > If the password wasn't encrypted, I could just e-mail their existing > password. The only annoyance then would be someone sending this password > over and over to another user, but, at least they won't get 20 new passwords > and be locked out of their account as a result. This can be more or less resolved, there's almost impossible to fully protect your site from abuse but you could for example implement something like max one new password per day. Another way could be to add an additional detail, like postal code or something which is easy for user to determine but (probably) not for other people. My $0.02 -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Auto Increment Problems....
> my primary key column ("id") is set to auto_increment as usual which is very > handy. But when I delete a row, the auto_increment just keeps incrementing > and there's this 'hole' left where I deleted the row! This is the way it should be, and it's like that for a reason - if you have other tables with relations to the ID in the original table, you may cause some headaches when the holes are filled up by new rows and they become related to those other tables. > Apart from this looking ugly, it poses another problem. In my PHP script > where I can add new rows, I query the table, checking how many rows in the > table altogether and set the new id as the next number, but this doesnt work > if theres 'holes' in the id field, as the new record tries to overwrite > another id. You may find the function mysql_insert_id() useful. If you'd like to count the number of rows in a table you can SELECT COUNT(*) FROM table; > 1) Can the next auto_increment value be 'set' by a SQL query That's done automagically, and it's probably best to leave it that way. > 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in the ID > column?? It's possible but not recommended, you can just search through the rows and see where there's a hole. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: OT - javascript question..
>Is there any way, when the upload window is closed, to force a reload of the other page, so the dynamic pop-up reflects >the recent upload? This link may help some: http://www.hwg.org/resources/faqs/jsFAQ.html#popup-talk Please don't poste OT-questions though, there is better mailing lists if you want to find javascript-gurus. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP4 and MS Excel?
> I would like to give my users the ability to send (to my website) a > Microsoft Excel file, and then have my server (PHP code) extract that data > and turn it into a TAB Delimited Text file -- is this possible with PHP? http://groups.google.com/groups?hl=sv&lr=&ie=ISO-8859-1&q=data+from+excel+ph p Google is your friend. -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: e-mail to mysql database?
> In Short: What I need is a php script that reads an email file and split its > data to a mysql file. > A bit longer if you are still interested > > For the following project: > http://www.crossing-africa.com, a journey I am going to make on a bike. > What are the plans: > > I am taking a satilite phone and SMS my possition with GPS coordinates like: > N50.34.234 E006.45.34 on 23-feb-2003 > I already have a script that translates that sms to an e-mail that looks the > same. > Then what: > This e-mail needs to be split up like this: > N50.34.234 > E006.45.34 > 23-feb-2003 > and then be insterted into a mysql database. > The result then is that my exact location is know everyday and will be > plotted on the web. > > The website runs on a cobalt server > > As my php knowledge is very limited and I searched the web for a script to > do so I havent found it, could any of you help, as it must be out there! > Thanks for any helpfull contribution. Hi Frank, if you got the above in a string, your best shoot is to use explode, for example like below: Read more on php.net/explode, there's also plenty of other string functions there that may help. Regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Can i send post variable thur header?
> I want to redirect to another page and pass some post variables to that > page. > I know how to pass get variables ( just include at the end of url) > But i have no idea how to pass post variables, is it possible ? You cannot do a redirect but you can send POST variables to a page without a form. Check out the URL below. http://www.faqts.com/knowledge_base/view.phtml/aid/12039/fid/51 -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: turn register_globals on
> Hello I am working on a PHP server which has register_globals off. In my > script is there anyway to turn it on, just for my script? ini_set("register_globals", 1); at the top of your script. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: turn register_globals on
> So, is this allowable to set in user scripts? Or is the dosumentation > correct in saying it cannot? My bad, you (and the documentation) are correct. :-) Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Count in PHP
> I am wanting to do a count in PHP. I want to be able to count the number of > records from a given database and display this count on the page. Can this > be done using PHP or is the sql thing? If you're using MySQL - I don't know if COUNT() is a part of SQL'92 - you can use SELECT COUNT(*) FROM table like this: The two zeros at the end means that mysql_result is to fetch the first row, the first column of the result. (Also, it'll be much faster than mysql_num_rows(mysql_query("SELECT * FROM table")) Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Text from web form
> Hello PHP Guru's! > > After successfully installing PHP and viewing the phpinfo page, I decided to > create a simple web-form. Just a basic "Name" "Message" web-form, when the > form is complete it is emailed to an account. Everything works, except I > don't see the filled in contents in the email message. I don't see the what > the person filled out. But I see "Name:" ane "Message:" > > Any ideas? Could this be an register_globals issue? Read on http://www.php.net/manual/en/language.variables.predefined.php#language.vari ables.superglobals - it may resolve your problem. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Image resolution and php
> I need to get resolution information (dpi) from any > image of jpg, gif or png formats. > > It would be sufficient to obtain pixel and inches > dimension of such images and calculate resolution by > simply dividing but I haven't found any function that > gets effective dimensions in inches. http://www.php.net/manual/en/function.getimagesize.php I'm sligthly confused about what you're looking for, but the above URL *could* be something. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: image wrapper - graphs
> Does anyone know of image creation libraries that will generate graphs? http://www.aditus.nu/jpgraph/ Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: stuck n00b
> echo $HTTP_SERVER_VARS['userName']; > ?> Make it $_POST['userName'] (or $HTTP_POST_VARS['userName'], but that's deprecated). Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Math problem (222)
> What is wrong with it? Any help at all is greatly apreciated. Consider the differences between my code below and yours. And as far as I can see, there's no combination higher than eleven, lower than 987 which doesn't work out. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sending post without a form
> Did the individual trying to send post(ed) data without the use of a > form succeed? I tried doing this before and didn't have any luck with > it... And I eventually gave up. Check out Rasmus' solution: http://www.php-faq.com/postToHost.html Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: IP addresses
>I've been away for a while but I'm back and have a question about IP addresses. >How do I retrieve / capture a users IP? I need to have it to process electronic payments. $_SERVER['REMOTE_ADDR'] Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Minutes to hours/days/monthes/years?
> OK...I wrote this...is this what you want? > > > return english_time("64925149"); > > function english_time($minutes) > { > while ($minutes>=525600) {$years++;$minutes-=525600;} > while ($minutes>=1440) {$days++;$minutes-=1440;} > while ($minutes>=60) {$hours++;$minutes-=60;} > if ($years) { $string[] = ( $years == 1) ? "1 year" : "$years years"; } > if ($days) { $string[] = ( $days == 1) ? "1 day" : "$days days"; } > if ($hours) { $string[] = ( $hours == 1) ? "1 hour" : "$hours hours"; } > if ($minutes) { $string[] = ( $minutes == 1) ? "1 minute" : "$minutes > minutes"; } > return implode(", ",$string); > } I wrote a solution to the same problem, available at http://www.phpcoded.com/?DO=viewCode&ID=88 I do believe that my solution is more efficent, considering that I use modulus. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Expert Paid Help Needed
> I have been working on a program and have come up to a block. A lot of > people on the PHP list have been able to help me for free already. But > what I have left to do would probably be to much to ask for someone to do > for free. Are their any EXPERT PHP (with MySQL) programers out there that > would be willing to help? If so, please send me privately the following: I think you would help yourself some by specifying what kind of work this is. Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: recusive functions
"Alexander Ross" <[EMAIL PROTECTED]> skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does exit() in a recursive function exit the entire function, of does it > only exit that iteration of teh function?? Thanks exit terminas the whole script and not just a function. Read more on http://php.net/exit -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Animated GIFs
"Peter" <[EMAIL PROTECTED]> skrev i meddelandet [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I know GIF support was dropped from the GD library, but can you make > animated GIFs in any version of GD? I think your best shoot would be to combine GD with ImageMagick which has a function called combine, to create animated gifs. ImageMagick can be found on this URL: http://www.imagemagick.org/ -Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Script Execution Time
> I have a php script that returns about 1.5Mb of data in text format to the > user. I am wondering if there is a way for php to display the time it took > to execute the script at the end of the file. Put this at the top of the script: function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); ..and this at the end: $time_end = getmicrotime(); $time = $time_end - $time_start; $foo = round ($time, 2); echo "Execution took $foo seconds."; Hope this helps. Best regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sessions and linking
I'm programming an easy webmail and I've tried to use sessions. It works perfectly with cookies activated in the browser but I want it to be able for people which doesn't like cookies. If I've understood this correctly I should be able to fetch the sessiondata if I link something like theinbox.php?PHPSESSID=thesessionid - it won't work tho. I use session_start() in theinbox.php Anyone who has any idea about what I'm doing wrong? Should I define the session id for session_start or something? Best regards, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] mail with html
Here is an example that I use myself for sending HTML code via email. 127 || ord($char) == "61") $result .= sprintf("=%X", ord($char)); else $result .= $char; } return $result; } $content = ""; $content = qp_encode($content); mail("email","subject",$content,"From: someone@someone\nMime-Version: 1.0\nContent-Type: text/html; charset=\"iso-8859-1\"\nContent-Transfer-Encoding: quoted-printable\n"); ?> This encodes the content so email readers like Microsoft Outlook can read the mail. Best regards, Jome - Original Message - From: "Adrian D'Costa" <[EMAIL PROTECTED]> To: "php general list" <[EMAIL PROTECTED]> Sent: Monday, July 23, 2001 12:08 PM Subject: [PHP] mail with html > Hi, > > I know this subject had been discussed here before. Tried searching in > list.php.net, I get a message search not setup (or something). > > I want to send html mails thru php using mail(). Could someone tell me > where I can study some scripts or tutorials. > > TIA > > Adrian > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Speeding up MySQL querys
Hello, for the moment I'm trying to write searchengine kind-of-thing in PHP using MySQL, however MySQL tend to be very slow when searching. My table is about 100 mb and the query is SELECT * FROM search WHERE search.content LIKE '%$keyword%' OR search.filnamn LIKE '%$keyword%' I've tried setting INDEX but it didn't work out since I'm using BLOB-fields. Is there any other way than using INDEX? Thanks, Jome -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] IMAP and Attachments
> How can I check to see if a email has an attachment? Then download it if the > user clicks on it? I've been working on a webmail for POP3 but I guess the idea is about the same. To check if a an email has attachments you use the function imap_fetchstructure() and then you can do something like this: $struc = imap_fetchstructure(); count($struc->parts); if ($no_of_parts > 0) { echo "the message has attachments."; } This is my way of doing it, the 'bad' thing with this kind of code is that it also includes HTML-messages. This can be prevented with some extra code though. For downloading you use the same kind of thing, I guess it slightly more advanced and you have to do some decoding of the message. Best regards, Jome (looking for php-jobs, coding for $15/hour) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sending alots of mail
I have done this, and it's not a bad idea as long as you aren't sending spam. It's rather easy to do this, just do a mysql_query() from the database where you select the subscribers field and then do a while which sends out emails via the mail()-function. You may experience problem with max execution time if you're using a bad mailserver but it can be solved by simply extending the max execution time in php.ini or in just the specific script. Best regards, Jome - Original Message - From: "Jimmy Bäckström" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, August 16, 2001 6:29 PM Subject: [PHP] Sending alots of mail Hi list! I'm about to write an application that takes about 5000 mailadresses from a database, and then sends a mail to each one of them. I haven't done this kind of apps before, so I don't know if it's a good idea. Does anyone have any suggestions? /Jimmy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] regexp appears to be faulty!?
"Henry Grech-Cini" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > Thanks for that Mike, > > I was getting lost. > > Is there anyway to say > > Any characters excluding the sequence > > so I could do something like > > /]*)>(.* whilst not <\/fieldset>)<\/fieldset>/i > > Or alternatively is there a switch to say get the smallest sequence > ? is what you're looking for. i.e.: .*? instead of just .* /j -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php