Re: [PHP] Sending htm as it's being generated
On ÐÐÐ, 2005-05-08 at 17:17 -0300, Kirsten wrote: > This scripts does not work: It only shows 0,1,2,3[29] when the timeout > limit is reached. > Any ideas? Yes, take a look at the AJAX method. For a beginning, the following link http://www.adaptivepath.com/publications/essays/archives/000385.php would be fine. Google for more, there are tons of AJAX articles out there ;-) Hope this helps, Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] select statement
On ÐÐÐ, 2005-05-08 at 23:16 +0200, Andy Pieters wrote: > Notes: > * just because it comes from SESSION doesn't mean that it cannot be spoofed. > That's why you should escape uname before including it in a query. Is there something I do not know ? :). As far as I know, it can be spoofed only if you have access to session data, which is held on the server-side, so only someone with server access can spoof. Any other way of doing it ? Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shared library in php
On ÐÑÐ, 2005-04-12 at 14:37 +0200, Josip Dzolonga wrote: > On ÐÐÐ, 2005-04-11 at 19:34 -0300, Ãngelo A. Camargo wrote: > > > If you have NONE of those, you probably are trying to violate some kind of > > > license. Don't do that. :-v > > Do not pay, to some reverse engineering :-) s/to/do , damn keyboard :) Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mail problem with PEAR
On ÐÑÐ, 2005-04-12 at 12:15 +0200, marc serra wrote: > Hi, i want to send an email with an attached file using PEAR classes. I > succeed to do it with one recipients and more. > > I use an external SMTP to send it. My problem is that when i want to > send an email with for example 4 recipients and 1 attached file, the > mail is send 4 times to the SMTP server. Is it possible to use PEAR mail > function to send it 1 time to SMTP server and after that SMTP server > send it to the 4 recipients ? Yes, set mail headers for CC and BCC. I'm not very familiar with PEAR's package for sending mail, but I'm more than sure that it has feature to set headers. Looking at the manual ( www.php.net/mail ) would be also an excellent idea, since there are this kind of code examples. Hope this helps, Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there any other place to start php module?
On ÐÐÐ, 2005-04-11 at 20:57 -0400, Teng Wang wrote: > So I guess there is some other place to start php4 already. > Where can I find it? PHP is probably installed as a static module. For disabling PHP support I think you'll need to recompile Apache. Hope this helps, Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shared library in php
On ÐÐÐ, 2005-04-11 at 19:34 -0300, Ãngelo A. Camargo wrote: > > If you have NONE of those, you probably are trying to violate some kind of > > license. Don't do that. :-v Do not pay, to some reverse engineering :-) Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Can't Delete File Using Unlink
On ÐÐÐ, 2005-04-11 at 14:28 -0400, Ben Ramsey wrote: > The webserver needs to have permission to modify the file that you are > trying to delete. Check the file and directory permissions by > right-clicking the directory and going to properties. You will probably > need to give the user that controls apache either "full" or "modify" > permissions to the Web directory. That's correct. And also, are you using double slashes \\ instead of a single slash / ? Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] deleting $_SESSION
On ÐÐÐ, 2005-04-11 at 15:43 +0100, AndreaD wrote: > I have a session variable called > > $_SESSION['total'] the problem is I can't delete/reset it. I have tried > > $_SESSION['total']= 0; > > $_SESSION['total']= ""; www.php.net/unset , unset($_SESSION['total']); Josip Dzolonga, http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about fsockopen
[EMAIL PROTECTED] wrote: Dear list, I have several IP in one interface (eth0) in my server and I want make connection to another server (check email, etc) using different ip for every mail server. I was read the document, and there is no way how to make this happen. Any idea? Thank you Take a look here : http://sourceforge.net/projects/snoopy/ , I'm not much sure but I think that it has that feature. -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Viewing a specific item within a php web-page?
Carlos Palomino wrote: I have a document entitled: articles.php Within this document, I want to store various written articles which are headed by a string value - example: $post_040905 = "text for April 9th 2005"; print($post_040905); $post_041005 = "article for April 10th 2005"; print($post_041005); That's a _really_ bad idea. It is better to store all of them in a database (MySQL is a simple one and works perfectly with PHP) ordered by an id. So the script can take a numerical argument ID which will hold the ID of the text which shall be shown. The argument can be passed as a GET variable (script.php?variable=value&second=second_value) and you can get it with $_GET['variable_name']. Take a better look here http://www.php.net/manual/en/reserved.variables.php#reserved.variables.get . However don't forget to filter than input argument first, to prevent SQL Injections : $id = $_GET['id']; if($id == strval(intval($id))) { /* Okay, do the query */ } else die('Looser !'); Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Including class of Exception in exception message
On ÑÐÐ, 2005-04-09 at 11:27 -0400, C Drozdowski wrote: > where CODE is some php code that refers to the class of the exception > being thrown. Take a look at magic constants [ http://www.php.net/manual/en/language.constants.predefined.php ]. Hope this helps, Josip Dzolonga http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing password in cookie
On ÑÐÐ, 2005-04-09 at 22:56 +0800, Jason Wong wrote: > > Sorry, I don't agree. There are very few absolute rules in software > > development. > > But in this case there really is no reason *why* you need to store a > password (encrypted or otherwise). IMO storing the password hash (md5,sha1, whatever:)) in a Cookie is not smart. Some of the browsers (read IE) have some security holes so getting the value of the cookie won't be a really hard job (this can be dine with cross site scripting and DNS hacking too). When the attackers have the hash of the password, in most of the cases they're brute forcing , so if the user has an easy-to-guess password, it _can_ be revelead (brute-forcing numbers, dictionary words). I don't get the point, _why_ to store a password hash on the client-side as a cookie, when you can do it on the server-side. Josip Dzolonga, http://josip.dotgeek.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: AW: [PHP] Re: pasring complex string question
Webmaster wrote: Thank you very much. If anybody has some good links to ereg tutorials, I would love to get that teached. Thanks Mirco Blitz http://www.regular-expressions.info/ have a good article, however there's a great book on this topic (IIRC 'Mastering Regular Expressions', too lazy to google now :)), search Amazon. -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variable Passing
Brad Brevet wrote: Hi, I am curious how to pass a variable without using something like id=321. I have seen sites that have something like http://www.website.com/something/321 and the variable is passed how exactly is that done? And is it called something specific so I know how to refer to it in the future? That's done with a little bit of Apache's mod_rewrite magic ;). I suggest you to read this article [ http://www.sitepoint.com/article/guide-url-rewriting ] which is of a great help, however checking the manual reference ( google for 'mod_rewrite' ) will help you a lot too. If you get stuck somewhere, state your questions here :) Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file
Chris Blake wrote: wget was the first thing I thought of :) You thought wrong :-) Are you are going to parse the file after you've downloaded it ? See this function, http://www.php.net/file_get_contents , if allow_url_fopen is set to TRUE in your php.ini, there will be no problems opening a URL, so $contents = file_get_contents($url); is going to to the job perfectly ! Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php wget: Return an empty file
Chris Blake wrote: Greetings PHP(eople), I have a wget process that runs to download a file from a web site, Why would you do that ? There're bultin functions in PHP for doing it. -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] class constructor & polymorphism
[EMAIL PROTECTED] wrote: Hi to all, I'm a C++ programmer and I've to convert some simple classes from C++ to PHP. My toolbar_button class must have two or more constructors so I ask you if this is possible with PHP: You can't overload a constructor, I mean a function in PHP. Maybe extending two classes from the base would be a good work-around. Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] noob need help for sessions
Jeff Weinberger wrote: I am well warned about the dangers of passing session IDs in URLs, but for my purposes, there is no sensitive data in the session, and I want to be able to do it only in the case where the visitor does not accept cookies. Better for you to be warned :-)session_start(); session_register("abc"); $abc = "Test Session String"; Replace it with $_SESSION['abc'] = 'The Session String'; page2.php: print $abc; That will work only with register_globals set to TRUE, so better replace it with print($_SERVER['abc']); I also suggest you to take a look here [ http://www.php.net/session ] and here [ http://www.php.net/session ]. Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Alert Message then Redirect?
Ryan A wrote: Meta refresh too would do the job quite nicely Cheers, Ryan Yes it will, but he will still have to use JavaScript in order to show that message box ( the alert function ) ;-) -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple Alert Message then Redirect?
PartyPosters wrote: Hello I want to display an alert message then after users click ok I want to automatically goto a URL if ($var_stock_count == 0){ alert("Message") redirect("http://www.google.co.uk";); } This should be done with JavaScript, not PHP, so something like : alert("Message"); window.location = "<a href="http://www.google.com"">http://www.google.com"</a>;; should do the work ;-). Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] File_get_contents()
Jeff McKeon wrote: Does anyone know if it's possible to have file_get_contents() accept a file handle? Why would you need that ? -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] zipfile problems
Ken wrote: On Apr 7, 2005 1:54 PM, George Pitcher <[EMAIL PROTECTED]> wrote : That's not really an error... that's just a notice... I think everything should be fine with the script. You might want to try turning off error_reporting in php.ini... Or from .htaccess, or directly from the script, take a look at this function www.php.net/error_reporting , just don't forget to put that on top of the script ;-) -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com
Re: [PHP] Simple array question, part 2
Ryan A wrote: what function should i lookup/use? Thanks, Ryan This will do the job : $array = array_values($array); Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple array question, array delete
Ryan A wrote: Hey, I have a $data_recs array like this: 12 445 45655 4 343 etc when the user gives me a number, i have to check if its in the array and delete that entry...how do i do that? I have looked at the manual but have gotten confused with array pop,splice,array_key_exists etc Thanks, Ryan The code follows : if (in_array($number, $data_recs)) { $key = array_search($number, $data_recs); // Get the key unset($data_recs[$key]); // Unset the variable } -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Call a Function Held in a $_GET Var
Shaun wrote: Hi, If I have a function name held in a $_GET variable for example ...&func=print_user_list how can I call the function dynamically? ie. $_GET['func']() Thanks for your help Well, call_user_func() [ http://www.php.net/call_user_func ] will do the job. But that is really bad, because you can get hacked really easy. Here's a small example www.url.com/file.php?func=evilfunction So that is _bad_ coding and not a good practise at all, but if that is the _only_ option be more than sure that you do some checking first. An example follows : $allowed = array('first_func', 'second_func', 'third_func') { if(in_array($_GET['func'], $allowed) { /* it's okay */ call_user_func($_GET['func']); } else { die('Next time, sucker'; } } Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing automated account creation
[EMAIL PROTECTED] wrote: Hi, I have been investigating ways of preventing automated account creation on the e-commerce system I am currently working on. Obviously I have seen the graphical solutions to this problem, a small image containing several letters and numbers which must be typed in by the user to confirm account creation. However, this (it seems to me) is a bit overkill for what is a pretty small client, I'm not entirely sure it's a good use of time to create this script solely for them, does anyone know of anything pre-packaged? Furthermore is it really worth doing this, what risks do automated account creation present to an e-commerce site? Tom Williams, Digital Data Well, CAPTCHA ( http://en.wikipedia.org/wiki/Captcha) is a pretty neat solution ( http://www.pear.php.net/package/Text_CAPTCHA ). You can also generate random numbers (www.php.net/rand www.php.net/mt_rand) and combining it with this PEAR package http://www.pear.php.net/package/Numbers_Words which is also a good solution. The pass-string if I can call it so is best to be kept as a session variable, since it's stored on the server-side and the user can't view it. Storing its hash in a cookie can be also pretty fine, but storing it in a GET variable is more than stupid. Hope this helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what are {} used for in php?
Jacques wrote: I have often seen php code included inside braces. What does this mean or do? Jacques A code block, rtfm :-) -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Q] mail() & security
Eric Gorr wrote: Shouldn't strip_tags be enough? What dangerous/annoying things might happen if I replaced htmlentities with strip_tags in the above function and then passed the body text to the mail() function? Nothing, but with htmlentities() you can be sure if the user has tried to inject something malicious :-). -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Q] mail() & security
Eric Gorr wrote: Any other suggestions? Well see this example : function clean_body($body_text) { if(ini_get('magic_quotes_gpc')) $body_text = stripslashes($body_text); // If magic_quotes are on, strip the extra-added slashes return htmlentities($body_text); // Return the value } This is a good way to start, I think. Filtering the input first would be a nice idea too, especeally if there're more input fields ;-) -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to call a static class and method dynamically
Dan Rossi wrote: I was wonderiing how I would go about something like this $class = 'classname'; return $class::staticMethod(); , not happy isnt working. Any ideas lemme know. class MyClass { function static_method() { echo 'I'm in static_method !'; } } You can call the function statically using the double colon ( :: ) operator : MyClass::static_method(); I suggest you to take a good look here http://www.php.net/manual/en/keyword.paamayim-nekudotayim.php -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] HUMAN CHECK without url/session cookie/hidden input, etc.
nime wrote: A kind of :-) https://nokiags.wdsglobal.com/bookmarkmanual?contractId=191&phoneId=408&captchaEnabled=true&step=details.vm&bookmarkManualName=&bookmarkManualURL=&captchaKey=&mobileNumber=&siteLanguageId=118 I mean what sort of data remembers the pass code here? I see no hidden input value/url value/session cookie/nothing. It means telepathy! Well take a look at www.php.net/gd for generating images also here http://pear.php.net/package/Numbers_Words . See this random number generating function http://www.php.net/mt_rand too :-) Too many links, nah ? :) Store the number in a session variable and check if both match or not (you can store the md5 value too in a Cookie). Hope that helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to insert and select images from postgres db
Well take a look here http://www.php.net/base64_encode and here http://www.php.net/base64_decode , so before you put the image in database encode it first to get a string (with base64_encode), and when you pull the image from the MySQL database, after you get the string value decode it with base64_decode . -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] image_type
William Stokes wrote: > I was under impression that php automatically gives values to image_type and > image_name if one tries to upload image from a web form if the name of the > uploaded image field is image. You mean it automatically gives values to variables $image_type and $image_name ? No, it doesn't. You can get the type (MIME) and the name of the file with $_FILES['filename']['type'] for the MIME-type and $_FILES['filename']['name'] for the filename. I encourage you to take a better look here : http://www.php.net/features.file-upload and you can also print_r/var_dump($_FILES); Hope that helps, -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eregi problem
[EMAIL PROTECTED] wrote: if((eregi("[^a-zA-Z0-9]",$GP[sifre]) I think that the ^ anchor is your problem, it shall be out of the brackets : if (eregi("^[a-zA-Z0-9]+$", $GP['sifre'])) echo 'true'; else echo 'false'; (the above is tested and works perfect) P.S. Take a look here http://www.php.net/manual/en/language.types.array.php#language.types.array.donts -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple CMS program
Todd Cary wrote: When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Also, it would be nice if it was written in PHP and use MySQL for the server DB. Has anyone had experience with such a CMS? Todd http://www.cmsmatrix.org/ -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: filtering uploaded files
You can check this function too : http://www.php.net/mime_content_type . It's not platform specific :). Btw, mime_magic extension has to be enabled. Hope that this helped. -- Josip Dzolonga http://josip.dotgeek.org jdzolonga[at]gmail.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] rss feeder using php?
On Fri, 2005-01-28 at 11:49 +, Chris Ramsay wrote: > [snip] > we are looking for a RSS feeder implemented in php. > > Is there anything good out there (something you have tried + tested). > [/snip] I used to code a PHP5 rss-parsing class some time ago, but I haven't finished it (stopped at caching and atom support) because I haven't got enough free time (the school-term has ended ;-(). Take a look at MagpieRSS ( http://magpierss.sourceforge.net/ ). -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE] Trying to create a function from an existing script
On Fri, 2005-01-28 at 14:41 +0900, Dave wrote: > if ( move_uploaded_file($HTTP_POST_FILES[$name]['tmp_name'], $store_dir > . basename($HTTP_POST_FILES[$name]['name']) ) Try echoing $store_dir . basename($HTTP_POST_FILES[$name]['name'] before uploading the file (before the move_uploaded_file function). It might _NOT_ contain a slash between $store_dir and $HTTP_POST_FILES["$name"]['name']. -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Linux PHP CLI and Environment variables
On Wed, 2005-01-26 at 22:38 -0700, Michael Gale wrote: > I have searched every where ...is this possible ? Well, take a look here http://www.php.net/manual/en/function.shell-exec.php . So you can exec an echo command and get the result. -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I convert UTF-8 strings into UTF-16
On Wed, 2005-01-26 at 16:54 -0500, v0id null wrote: > So how cna I convert UTF-8 to UTF-16? > -- > llundi0v > Have you tried with iconv ? www.php.net/iconv for further details ;-) -- Josip Dzolonga, dzolonga at mt dot net dot mk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php