[PHP] Webmail and mime
Hi I'm creating a webmail interface for a pop3-server (I know weird to do webmail with pop3, but it's for a running server which I can't control. So pop3 it is and caching the mails in a mysql database). I've implemented the pop3-support myself since the one in www.php.net/imap lacks a lot of basic pop3 features like uidl support. Anyway I've hit a wall trying to add support for receiving attachments. I'm not sure how to handle it. The imap_fetchstructure call doesn't seem to be useful for me, since I can't send it text but only an imapstream. I tried the pear projects mimeDecode class and it worked fine. But the only thing it returns was the structure (like it will return an array with info like one mime part plain text, one part image, etc.) and not the content. I don't get the actual text and the actual image. Any ideas of how I can get the content split up in neat pieces? I've probably just missed something obvious in www.php.net/imap or the pear mail classes. Because I guess there are a function that does this. I need this running nw. So I'm sort of desperate. If you have any ideas at all please please speak. Thanks. Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bar codes
Hello! Sorry if this is off topic. I'm making a php site where one can order a kit and now I would like to mark the kits with bar codes generated by the php script. I would also need some kind of bar code hardware reader and some way for a computer to read the result from the bar code reader, guess php might not work here so I might create some java application or whatever. I've never done anything like this before, do you know of any good starting points? I don't know anything about bar codes. Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encoding PC-850
Hi! I need to be able to encode text to PC-850 but I have big trouble finding out info about this encoding. Does it even exist? I get a few google hits, but nothing useful. Any idea of how I can convert for example an UTF-8 string or an ISO-8859-1 to this PC-850 format? Thanks for any input. Regards Emil
[PHP] Cookies in non-frame sites
Hello, Most sites today seems to be based on this style: include(top); include(current_page); include(bottom); If one wants to set cookies from current_page, how should that be handled with as clean source as possible? Before I had the top and bottom output as functions that are called from each page, so I can call header stuff before it's executed. But it's not a very good looking approach. I did it like this in every page: include(top_bottom_lib); // cookie stuff echo getTopPage(); // page stuff echo getBottomPage(); I hope you understand my problem. Thanks Best regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Secure input
Hi, What shall one do to avoid people that trys to manipulate my server? I mysql_real_escape_string() all input from GET and POST. A long time ago I think I used addslashes or something like that too, so people couldn't insert php code in their input. Is that still something I should do, or does mysql_real_escape_string() take care of that too? And is it even possible for a user to execute there own php code if I not output the input via the eval() function? When users input is displayed for others then themself I try to filter out html tags too. Anything else I should think of? Sorry if this has been asked a million times before. Thanks for your time /Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encrypt database table
Hi, What methods do you guys use to keep a mysql table encryped, or well atleast a major part of it. Security is very important and I want to use a public and private key. Is GPG the only safe way? It's hell of an overhead using GPG on every col, even a very short string is easily 1000 characters when encrypted in gpg. Best Regards Emil
[PHP] Using GPG in Safe Mode
Hello, My ISP have php set for safe mode. And now I'm trying to run gpg from php. Basically I'm trying to run this from exec(): echo "testar testar" | /usr/local/bin/gpg --homedir /home/myuser/ .gnupg -a --always-trust --batch --no-secmem-warning -e -u "Test Test <[EMAIL PROTECTED] .com>" -r "Test Test " When I run it from cli myself it works fine, but it fails when I run it from php. Are there anyway I can get this to work? Sorry if this is OT or an obvious question. /Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using GPG in Safe Mode
Hi Edwin! Thanks for the tips but my ISP hasn't given me root. I'm very sad to hear gpg from cli won't work under safe mode. Are there any 100% php implementations of GPG I could use? (because I guess that is the only way that is left?) /Emil >If you are using gnupg comand line, there is not way on PHP-safe mode. >The only way that i know to wrap around this problem it's install pecl >extension package -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt
Hello, Since I'm running php under safe mode and the gpglib extension is not installed in php at my isp gpg seems to be unavalible for me. Are there anything else I can use with public/private keys that is as safe/solid/hard to crack as gpg? The mcrypt extension is installed if that helps, or are all those crypts using the same key for encryption and decryption? (I've read a couple pages about the crypt algorithms at wikipedia, but it didn't really help me) Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Functions
Hi not the () after the function name > > function ShowMessage() { > echo "Show message...\n"; > } > > How can I call the function now? > echo ShowMessage(); :: Emil --- Emil Rasmussen http://www.noget.net -- 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] Functions
That should bee notice and not "not"! Ups :-) > > Hi > > not the () after the function name > > > > > function ShowMessage() { > > echo "Show message...\n"; > > } > > > > How can I call the function now? > > > > > echo ShowMessage(); > > > :: Emil > > --- > Emil Rasmussen > http://www.noget.net > > -- > 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]
RE: [PHP] What does "url_rewriter.tags" do?
> Subject: [PHP] What does "url_rewriter.tags" do? > What does it do? url_rewriter.tags is a list of HTML elements that will get the PHPSESSID added to them. Its all about sessions: http://www.php.net/manual/en/ref.session.php. Emil -- Emil Rasmussen http://www.noget.net -- 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] A compress function?
Hey > With all the wonderful String functions in PHP, I haven't been able to find > a str_compress(). Is there such an animal? Let's say I have a string like > this: > > $myString = First_word <30 spaces> second_word <10 spaces> etc... This would proberly work: -- function str_compress($stString) { if (substr_count($stString,' ') == 0) { return $stString; } $stString = str_replace(' ',' ',$stString); return str_compress($stString); } echo str_compress('dsfsd fdf sdf sdfd sf sf sdf sf s fdsf sdfsdf sfsfsd sfs sf '); -- Regards Emil ps. I admit that I dont know if there is a built in function. -- Emil Rasmussen http://noget.net -- 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] $GLOBALS
> i´m new in PHP. What does the expression: >$ref=$GLOBALS["HTTP_GET_VARS"]["ref"]; >$id=$GLOBALS["HTTP_GET_VARS"]["id"]; > do? It gives you the content of the querystring variable ref and id. eg. page.php?id=20&ref=value > What is $GLOBALS? $GLOBALS is an array wich contains all the varibles in the "global variable scope". http://dk.php.net/manual/en/language.variables.scope.php You can get an overview of all the variables by using the print_r() function: print_r($GLOBALS); http://dk.php.net/manual/en/function.print-r.php > What are the parameters ["HTTP_GET_VARS"]["ref"]? ["HTTP_GET_VARS"] is also an array, and it contains alle the variables from the querystring. And ['ref'] is a querystring variable. /Emil -- Emil Rasmussen http://noget.net -- 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] informations
Sir/Madame Please allow me to introduce myself. My name is Mihailescu Emi. I am sales manager at Romcomp SRL and I am contacting you in behalf of the firm. We are a computer sellers company from Romania and we are interested to buy Intel Pentium III @ 933 MHz processors not boxed(tray) and 128 Mb PC 133 memories. If do not have any of this item please send us your price list (item/price). We are interested to get from your company your prices list, including any other products and your payments and shipping methods. Please advise, Mihailescu Emil, sales Manager, Romcomp SRL. P.S. If this e-mail is send to you by mistake please accept our deepest apology for any disturbement. If you have alredy recived this message please ignore it. E-Mail sent using the Free Trial Version of WorldMerge, the fastest and easiest way to send personalized e-mail messages. More information at http://www.coloradosoft.com/worldmrg 199642 -- 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] PEAR mail sorted as spam
Hi, When I send mail via PEARs Mail class they are sorted as spam by Thunderbird. Do you have any ideas why? I can't figure it out. function send_mail($to,$from,$subject,$body) { $recipients = $to; $headers = array(); $headers['From']= $from; $headers['To'] = $to; $headers['Subject'] = $subject; $params["host"] = "my.smtp.com"; $mail_object =& Mail::factory('smtp', $params); $mail_object->send($recipients, $headers, $body); } -- Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Hi, I can of course tell Thunderbird that something is not spam, but I don't want all of my users to have to do that for every mail I send via pear. Maybe I haven't included some header non-spam usually have or something? Did my script look all okey? Emil Roman Neuhauser wrote: Surely Thunderbird provides an interface to query and modify its spam filters? Or is it an automated email black hole without even a log file? -- Hälsningar Emil Edeholt Karlsson & Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Are you sure? The email is very short and is something like this (but in swedish): Hello, Your order is now available. Regards Emil Jochem Maas wrote: it's not the script. it's the content of the email (possibly in conjunction with 'bad' mail headers, etc) -- Hälsningar Emil Edeholt Karlsson & Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PEAR mail sorted as spam
Roman Neuhauser wrote: That's not what I asked. Does Thunderbird tell you why it marked something as spam? If it does, use that information. If it does not, you're crazy for using it. Either way, your question belongs into a Thunderbird mailing list, along with the exact full message. Full means including all headers, exact means you need to abandon formulations "it was something like". As far as I can see it does not give more information. Why would that make me crazy? I can see what's marked as spam, and it gets better at finding spam the more emails I mark as spam or not spam. I think that is an okey solution. I don't want to spend more time on spam in my email client, since almost all spams are stopped by the mail server anyway. But I'll look for a log file. Maybe there are something hidden below the gui. Maybe I haven't included some header non-spam usually have or something? How are we supposed to know? Should we read Thunderbird's source code for you? :) Of course not. I just wondered if there was something obvious in the mail headers or whatever from pear that would make my mail look like spam. And I want a more mainstream solution that works on all/most email clients, not just firefox. But I'll talk to the mozilla folks instead, if you think it's so off topic to discuss this. Thanks for your time... Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] CMS plugin support
Hi! I have a bit of a vague question. I have always used different selfmade basic "CMS" for web pages. That works fine, and I like having my own structure and light code weight. But the big pro with using a standard CMS like drupal is the plugin support. Are there any php plugin standards or is there a doable way of implementing support for drupal (joomla, whatever) plugs? Of course there are php libraries, but I would like something more lika a visual gadget and extremly fast implementation. I created a wordpress blog instead of using my own code a while ago, and implementing twitter support, antispam, etc was just two clicks and 2 min work, instead of reading a manual for a library and maybe half an hour an hour work implementing and debugging. And that was a nice change. When you make normal simple web pages do you guys use a ready-made CMS as a base or do you have a self-made php template, or self-made cms, or what solutions do you use? Kind Regards Emil Edeholt
[PHP] SDO DAS XML "drops" some elements
Hello, I try to generate a XML using an XSD with the library SDO DAS XML: http://www.php.net/manual/en/book.sdo-das-xml.php Most elements are working nicely, but others are just missing in XML. There where no warnings and no log entries. Where can I get some more debug information? Is there a more detailed tutorial somewhere? Are there any known bugs in that library? Thanks for any help Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Render fonts
Hi I would like to render some fonts into images, for captions on a site. What tools should I use to get the best looking render? Do you guys use the built-in tools PHP has, or are there third party libraries that does a better job? Thanks! Kind regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL and SVN
Hi all! Maybe slightly off topic, but I would like to know how you guys handle mysql structures between different computers (and for that matter from the developer desktop to the stable server). I work on my home and my office computer with the same php projects. I keep all my php files on svn, so I just update and commit the first and last thing I do when I switch computer. The problem is when I've made a change in the structure of my mysql tables. I usually try to save a dump and ssh it to my server and download and import it on the other computer. But that feels clumsy, and if I've made changes on both computers I have no simple way to merge the structures like I can in svn. How do you handle this in your projects? Best Regards Emil Edeholt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL and SVN
Hi, Thanks for your answer. Are you sugesting - what I think is called - a multi-master replication? Since I would like to keep two sources in sync and want to be able to make changes on both servers. I know very little about replication. Maybe I'm making a bigger problem of this than it would have to be. Best Regards Emil dordea cosmin wrote: consider replication Emil wrote: I would like to know how you guys handle mysql structures between different computers (and for that matter from the developer desktop to the stable server). I work on my home and my office computer with the same php projects. I keep all my php files on svn, so I just update and commit the first and last thing I do when I switch computer. The problem is when I've made a change in the structure of my mysql tables. I usually try to save a dump and ssh it to my server and download and import it on the other computer. But that feels clumsy, and if I've made changes on both computers I have no simple way to merge the structures like I can in svn. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Calendar
Hi, I'm about to add some simple calendar functions to my application, and I'm thinking of how I should implement recurring events. Are there one standard way most people use that works well? I guess you have some kind of emitter event that creates the recurring events and a group id that holds the events together. How long forward does one usually create the events. Two-three years...? Sorry if I'm a bit blury. But any ideas on recurring events are welcome. I guess I could just hack something together, but it would be fun to do it right. Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Verification number
Hi Sorry if this is considered off topic. Please ignore the post in that case. My site uses ten digit numbers as ID:s for our products. I would like the last digit to be a verification/check digit. I was just about to just make some simple function that would add the other values together into a one digit verification digit. But I thought maybe there are better or worse ways of doing this, since some algorithms probably produce a more even distribution of verification digits than others do. I.e. it would be a shame if I later on notice that half of my ID:s get 9 as verification. Any ideas? Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Verification number
Hi, Thanks for your sugestions. I ended up using the Luhn algorithm. Simple but I think it will work for me. http://en.wikipedia.org/wiki/Luhn_algorithm Emil George Pitcher wrote: Emil, have you looked at the 10-digit ISBN verification, which has just been replaced by the 13-digit EAN system? It may be of use, but it needs the field to be varchar as the checkdigit may be a 'X'. Hope this helps. George -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php-general Digest 25 Jan 2008 07:59:28 -0000 Issue 5255
Hi! I have a website where people can upload photos and it creates previews. My problem is with pictures with big dimensions like 12000px height for example where the script times out. I've seen other sites that seems do be able to do this faster. I use gd to scale the image. Is there a faster way of doing it? Is ImageMagick better for example? Kind Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security scanner
Thanks. Sure, I know how to escape and filter the input.. But since not all my sites use PDO yet, and I use some external code it would be a good idea to also use an sql injection scanner. Emil [EMAIL PROTECTED] wrote: Injections only work on sloppy code. If you are using globals you are asking for injections. Turn your globals off, use $_POST[var_name] and filter all user input. Just my opinion, I am sure some will disagree. Richard L. Buskirk ## Show me a man with no fear, I will point out the date on his tomb stone. ## -- Hälsningar Emil Edeholt Karlsson & Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security scanner
Hi! I've been trying Nessus to search for sql injections and other security issues. I'm quite sure Nessus is missing a lot of possible sql injections (and maybe other stuff too). Are there any other tools that I can install on my server that searches a bit more carefully? What do you use and why? Any other good security tools for LAMP that one should know of? Kind Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Search engines and cookies
Hi, Do you guys how search engines like cookies? One site I'm working on now requires the user to select which region he/she is from on the start page. That value is stored in a cookie. So without cookies you can't get past the start page. Does this leave the search engines at the start page? Right now google only index the start pages on my site and I'm trying to figure out why. If I can't use cookies, how would you force users to select a region but letting the search engine spiders in on the site somehow? Hope this wasn't too off topic. Kind Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Ajax?
Hi! What do you guys use to develop ajax applications and do you have any good articles on the subject? I've just about finished an ajaxish site but it wasn't fun. A lot of nesting javascript inside php calls, having to write the logic both in javascript and php and so on. The source looks ugly and was time consuming to debug. Thanks! Kind regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session destroy callback (onSessionDestroy event)
Hi, I need to do some clean-up when the session is destroyed or values are removed from it (expired). using session_set_save_handler does not work for me, as I don't want to rewrite session handling, I just need to be notified when a value is destroyed. Regards, Emil Ivanov P.S. I'm dealing with temporary pictures, saved on the disk and their path stored into the session and I need to delete them when they are no longer needed. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP debugger
Currently I'm Using PDT/XDebug on daily basis and works just fine. You can get Xdebug from www.xdebug.org, PDT from www.eclipse.org/pdt and the plugin for PDT to add support to the PDT is https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408 In the plugin precompiled package you'll find a pdf with instruction how to get things working. On the Xdebug site there's a lot of information how to setup PHP and XDebug. Note that the precompiled binary of the support for PDT will work for you, as it's written in Java and you don't need to compile it. Regards, Emil Ivanov ""Miles Thompson"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >I am trying to load a PHP debugger in our most recent build of PHP 5.2.1. > > The debugger which I am trying to set up is the free, pre-compiled > Linux version of dbg ( DBG 2.15.5 dbg modules), from > http://dd.cron.ru/dbg/, and all of the instructions have been followed > as posted on the NuSphere site. > > Yes, Apache has been stopped and restarted!! > > There is no difference in the output from phpinfo(). The line > "with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru"; > does not appear. > > PHP is compiled without debugging, but I did consider that was for the > purpose of debugging PHP itself, not scripts. > > Suggestions will be most welcome. Also, I'm not married to this, so if > anyone thinks there is a better debugger, please jump in. > > Regards - Miles Thompson > > PS Why are we doing this? Because we are getting tired of debugging > with Javascript alert() boxes. /mt > > PPS And we are using those because of Joomla! Some things are buried > so deeply we cannot use print() or echo(). /mt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problem with string & floats in PHP
Outputs:string(9) "5.812E-08" float(5.812E-8) float(2.0005812) All you need is to cast it (float) to float, (int) to int. Regards, Emil Ivanov ""Pablo Luque"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hello, Im designing a website in which I have to read some data (numbers) > from a txt file and then send this data to a function which prints a > graphic with them. When I read the data I save it in an array and the > numbers are in this format: 5.812E-08. I have read the php documentation > about it, and I have use the example given there to check which type is > the data saved in the array. The response I got is > $vectorIc[1]== 5.812E-08 type is string > > I dont understand why. In the documentation it is clear that this kind of > data should be considerer float, or thats what I understood. I cant > continue with my web designing if I dont get to turn the vector elements > into float numbers, because the function that prints the graphic gives > errors when recieving strings. I would be very thankful if you could help > me trying to solve this. In using PHP 4.4.7 and Apache 2.0.59. > > Thank you very much! > > _ > Descubre la descarga digital con MSN Music. Más de un millón de canciones. > http://music.msn.es/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 Static functions called through __call() that don't exist... yet
Hi, I also think this a good proposal, but you might consider writing to the internals group, as this group is only for discussions and most of the people that read it are PHP users and have no idea how the language is made (including me). Regards, Emil Ivanov ""Jared Farrish"" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi all, > > Here is more code, with a test case included. What I would prefer to do is > call TypeAssist::$string(), instead of TypeAssist::$a->string(). Or at > least > __construct() the $a object. > > > if (!class_exists('TypeAssert')) { >class TypeAssert { >public static $a; >public static $assert; >private static $types = array( >'array','bool','float','integer','null','numeric', >'object','resource','scalar','string' >); >function __construct() { >self::$assert =& self::$a; >} >public static function __call($method,$arguments) { >$obj = self::assertStandardTypes($arguments[0]); >return $obj->$method; >} >public static function assertStandardTypes($para) { >$r = TypeAssert::getTypesObject(); >foreach ($r as $type=>$v) { >$func = "is_".strtolower($type); >if (function_exists($func) === true) { >if ($func($para) === true) { >$r->$type = true; >} else { >$r->$type = false; >} >} >} >return $r; >} >public static function getTypesObject() { >$obj = (object) ''; >for ($i = 0; $i < count(self::$types); $i++) { >$obj->{self::$types[$i]} = (bool) false; >} >return $obj; >} >} > } > TypeAssert::$a = new TypeAssert(); > echo("\n"); > switch($_GET['type']) { >case 'int': >$test = 100; >$_test = 100; >break; >case 'float': >$test = 100.001; >$_test = 100.001; >break; >case 'null': >$test = null; >$_test = 'null'; >break; >case 'object': >$test = TypeAssert::$a; >$_test = '[object]'; >break; >default: >$test = 'string'; >$_test = 'string'; >break; > } > foreach (TypeAssert::getTypesObject() as $type => $v) { >echo("is_$type($_test) === ". > (TypeAssert::$assert->$type($test)? > 'true': > 'false'). > "\n" >); > } > echo("\n"); > ?> > > > Original Message Text > >> Hi all, >> >> I am building an assertType object using static functions. What I want to >> keep away from is the following: >> >> >> public static function assertString($para){ >> return $answer; >> }; >> public static function assertBool($para){ >> return $answer; >> }; >> ... >> public static function assertArray($para){ >> return $answer; >> }; >> >> >> What I would like to do is replace this with the following: >> >> >> if (!class_exists('TypeAssert')) { >> class TypeAssert { >> private static $types = array( >> 'array','bool','float','integer','null','numeric', >> 'object','resource','scalar','string' >> ); >> public static function __call($method,$arguments) { >> $obj = self::assertStandardTypes($arguments[0]); >> return $obj->$method; >> } >> public static function assertStandardTypes($para) { >> $r = TypeAssert::getTypesObject(); >> if (is_array($para))$r->array = true; >> if (is_bool($para)) $r->bool = true; >> if (is_float($para))$r->float = true; >> if (is_integer($para)) $r->integer = true; >> if (is_null($para)) $r->null = true; >> if (is_numeric($para)) $r->numeric = true; >> if (is_object($para)) $r->o
[PHP] Making your our MVC framework with PHP
Hi, I just posted something like a how-to about making your very own PHP-based lightweight MVC framework. Hope you like it: http://vladev.blogspot.com/2007/06/implementing-your-very-own-lightweight.html Regards, Emil Ivanov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Wiki lib?
Hi, Do any of you guys know of a good php library to use as a base if one wants to develop a simple wiki? I don't want a complete system like MediaWiki, I want a library that can compare different versions of text, and so on. I first thought of using subversion, but it seems a bit overkill. It would be really neat with a small php library under LGPL or BSD or similiar license. Any ideas? -- Regards Emil Edeholt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Disadvantages of output buffering
Hi! My php project would get a much cleaner code if I could set cookies anywhere in the code. So I thought of output buffering. But I can't find any articles on the cons of output buffering. I mean it most be a reason for it being off by default? Kind Regards Emil Edeholt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Disadvantages of output buffering
Thanks for your help Dave and Rob. I will start using output buffering a lot more now. Regards Emil Robert Cummings wrote: Cons of output buffering: - tncy weency time overhead - memory overhead since buffered content remains in memory until flushed. Cheers, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Unit testing
Hi What (preferably open source) tools are the best for unit testing php? JUnit is not available for PHP from what I can see? Thanks for your time! -- Best Regards Emil Edeholt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Includes eating up my time
Consider using the __autoload() function in php. (also the SPL autoloading features). It's a way to tell php to load a file when it cannot find a definition for a CLASS (only for classes). I don't know how you have set-uped your project, but in mine the only place in the project where I use include is thie __autoload() function. In other words - php supports load-on-demand for classes. Check out http://php.net/__autoload Regards, Emil Ivanov "Dave M G" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > PHP general list, > > This is probably obvious to people who are good at PHP, but I'm > > I have a PHP based CMS (content management system) built, which has grown > and become quite robust. It's now spread out over about 30 files, and each > file represents one class within the object oriented design. Each are a > couple hundred lines of code, and two or three of the most critical > classes are over a thousand lines of code. > > While first building it, I didn't really anticipate quite that many files. > What I did is have a file called "includes.php", which list all the files > to be included. Then I in turn included "includes.php" at the beginning of > my "index.php" file. Every page request passes through the "index.php" > file, so that basically means every single file is included at the start > of every new page request. > > I'm using Zend Studio, which has a "profile" option, which shows how long > it takes for my PHP scripts to complete a request. It has a breakdown > showing percentages of which scripts are using that processing time. > > Currently, my processes are taking under a second, but they can be around > half a second or more. Although it all happens too fast for me to really > notice as a person, it seems to me that a half second of processing time > might be kind of long and lead to scalability problems. > > My first question is: Is a half second too long? I'm pretty sure it is, > but maybe I'm just being paranoid. What do people consider to be > acceptable time frames for processing a web page similar to what Wikipedia > delivers? > > Most of the time is taken with the includes. Anywhere from 60% to 90% of > the time it takes to process my scripts is coming from the includes.php > file. > > I read somewhere that it's not a good idea to have more than 10 includes > in any one place. I'm fine with trying to break up my include requests, > but I'm unsure as to how. As each function in each class passes around > objects, it's not clear from looking at the code which ones are used at > any one time, so I'm unsure how to efficiently include only the necessary > classes. > > My second question is: Is there a systematic way of determining how to > incrementally include files that people use? Or is it just a constant > process of testing and checking? > > Thank you for any advice. > > -- > Dave M G > Ubuntu Feisty 7.04 > Kernel 2.6.20-16-386 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Texture and wrap
Hi I would like to output an image from php where an input image is textured and wrapped around a frame. Like when you assemble a canvas on a frame (on, not under). So I get a sort of canvas looking texture on the image and that the edges of the image are wrapped around the sides of the frame in a 3d-ish look. Do you understand what I mean? Is this somehow possible? I guess I would use gd and maybe a transparent png to get the texture, or am I way off? The wrapping thing I have no clue how to make. Thanks for your time! Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Texture and wrap
Hi Thanks, but what I meant with wrapping around a frame was this: http://www.proformat.se/gfx/pic_006_kilram.jpg Not just a normal frame around the image. Emil Emil: Yes, that can be done by simply merging images (i.e., watermark). For example: http://xn--ovg.com/watermark The texture image should be to some degree transparent and the frame simply larger OR be added via css. hth's tedd -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Texture and wrap
Hi again Sorry if I was unclear what I wanted was of course what Jon Anderson said. I wanted what was pictured in the image I posted (the look of wrapping a canvas over a frame) with some kind of fake or simple 3d rendering. The pear libs for doing it seems like what I was looking for, I hope it will look good and that it's fast/easy enough for me to implement. Thanks both of you. tedd wrote: Emil: To continue top posting. Dude, an image is an image. You're not wrapping anything -- you're just producing an image that looks a certain way. My first example did not just put a frame around an image, it merged two images. If I had wanted to put a frame around your image, I would have done this: http://xn--ovg.com/pframes Incidentally, styles #4 and #2 put a shadow around it, which could be expanded to mimic what I think you want. I suggest that you back up and re-read what I said. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] canon jpegs
Hi! I'm trying to make thumbnails of uploaded jpegs via GD. It works fine on most jpegs but doesn't seem to work on canon jpegs (tried both a consumer canon and one of the finer DSLRs). When I resaved the canon jpeg in my imaging application GD could handle it. Any ideas of how to solve this? I'm in a bit of a panic. Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() encoded subject line
Hi, I hope this is not too off topic but I have a problem when I use mail(). When I add the header Content-Type: text/plain; charset=UTF-8 the body of the mail is encoded fine but the subject is not encoded. I've tried to utf8_encode() and utf8_decode() the subject text but neither helps. Any idea of how to pass what encoding to use on an email subject? Thanks! Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] flash/php file uploader
Hi Sorry if this is considered off topic, but do you know of any code examples/libs with a flash/php file uploader with progress bar? I've googled for a while but the scripts I find won't work. I'm using Firefox 2 and Flash player 9 on an intel Mac if that tells you anything? Or should I ask somewhere else? Thanks for your time. Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] flash/php file uploader
Hi Thanks for your answer, but I use an ajax solution right now and that is what I want to replace. I would really like to avoid flash, but I can't get this solution to work properly. Atleast my solution has been a little buggy in Safari (works mostly, but sometimes it won't upload the file) and I think sometimes in Firefox too, haven't tested it enough in Explorer to be sure if the bug is there too. But formerly the upload speed has been extreeemly slow compared to a flash solution or a normal form file upload. I've based my work on http://tomas.epineer.se/archives/3 do you know if that is a good implementation? I could send you some of my source, if you want/have time to take a quick look? (would really like to know if my code is bad, or if it's the browsers support for ajax file upload that are buggy/slow). Mustafa Aras Koktas wrote: Hello Flash is not the best solution for this. Either patch PHP with an unofficial patch for accessing raw data content length which is available on the manual page of file uploads in php.net or use perl to access raw data. I use a combination of the following 1. post data to perl 2. perl file gets the data length and id of the file, saves it to a temporary file 3. on post submit an ajax application posts to a php file with the same id 4. php file checks the length of the temporary file with the corresponding id number 5. php file writes the size, and some fancy graphs to screen 6. ajax sets timeout every 3 seconds to update status 7. perl file forwards the saved data to a php file, so that it can make necessary operations on the raw data. It works fine this way. --Aras -- Hälsningar Emil Edeholt Karlsson & Novak Medical AB Telefon 090-154830 Mobil 070-3758222 E-post [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Bar codes
Hi, I've never used bar codes before. And now I need to print out bar codes, and I've been told it should be in the format K39 Normal (I could have misunderstood since I can't find that on google. Maybe Code 39 Normal?). Any idea how to find that bar code font or what it's called? And what shall I use to print it out? Is it just as a regulat font, or do I need some special bar code lib? Thanks for your time Best regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] xss filter
Hello, Do you know of any good ways to filter out javascript from html code? I've seen this code http://kallahar.com/smallprojects/php_xss_filter_function.php but I found some old discussions about it saying that it wasn't really secure. There most be some safe way to filter out xss without filtering out all html. Or...? Kind Regards Emil -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error when open files
If this isn't local webserver, you maybe have a problem with allow_url_fopen: http://www.php.net/manual/en/ref.filesystem.php#ini.allow-url-fopen Or if this is on your local server, you can try this: $fp = fopen("/A.zip", "r"); Your sincerely Emil NOVAK, Slovenia, EU
Re: [PHP] Array within array
Like this? Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Server Time Out
That should work! Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Query - Warning: Cannot modify header information
You can simply avoid that by buffering the output: or (older versions of PHP): Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Testing for an empty array (with null values)
Better use is empty(), which supports array as parameter: $test = array(); if(empty($test)) // true { // code... } else // false { } Emil Novak, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] creating a shopping cart.
Hi! The best way is already presented in PHP manual: http://www.php.net/oop . In this example you create an object, which you can - naturaly pass over Session, etc. If you'll use OOP (Object-Oriented Programming), it is preffered in PHP5 to use OOP5 (OOP for PHP5). You can find details on http://www.php.net/oop5 . Emil NOVAK, Slovenia, EU -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing passwords in $_SESSION
Yet another unsafe way... You can try to write a program that reads stored cookies in Temporary Internet Files - it's peace of cake for somebody that is advanced programmer. The best way is to "eliminate" lazy users - you simply do not implement "auto login". It's the fastest, safest and the easiest way to solve the problem. Emil NOVAK LAMP Developer On 10/10/05, Dan Brow <[EMAIL PROTECTED]> wrote: > Well, um. ya. Back to the drawing board. Save it in a cookie? > > On Mon, 2005-10-10 at 14:59 -0400, Kilbride, James wrote: > > If the session expired.. how will session hold their user id?? > > > > > -Original Message- > > > From: Dan Brow [mailto:[EMAIL PROTECTED] > > > Sent: Monday, October 10, 2005 3:05 PM > > > To: PHP-Users > > > Subject: Re: [PHP] storing passwords in $_SESSION > > > > > > Thanks, figured that would be the case. Can't for life of me > > > think why I wanted to do that, must have had a brain > > > infarction. I want to have an expired session prompt so > > > people can log back in with out having to start at the login > > > page. Would having the users login saved in $_SESSION be > > > alright? prompt them for their password and compare it with > > > the password in the DB be fine? I want to reduce the amount > > > of typing someone has to do when a session expires. > > > > > > 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 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] storing passwords in $_SESSION
Oh, just username... That's good idea. Emil NOVAK LAMP Developer On 10/10/05, Dan Brow <[EMAIL PROTECTED]> wrote: > I was meaning just the username, not the password, still the same issue? > > On Mon, 2005-10-10 at 21:35 +0200, Emil Novak wrote: > > Yet another unsafe way... You can try to write a program that reads > > stored cookies in Temporary Internet Files - it's peace of cake for > > somebody that is advanced programmer. The best way is to "eliminate" > > lazy users - you simply do not implement "auto login". It's the > > fastest, safest and the easiest way to solve the problem. > > > > Emil NOVAK > > LAMP Developer > > > > On 10/10/05, Dan Brow <[EMAIL PROTECTED]> wrote: > > > Well, um. ya. Back to the drawing board. Save it in a cookie? > > > > > > On Mon, 2005-10-10 at 14:59 -0400, Kilbride, James wrote: > > > > If the session expired.. how will session hold their user id?? > > > > > > > > > -Original Message- > > > > > From: Dan Brow [mailto:[EMAIL PROTECTED] > > > > > Sent: Monday, October 10, 2005 3:05 PM > > > > > To: PHP-Users > > > > > Subject: Re: [PHP] storing passwords in $_SESSION > > > > > > > > > > Thanks, figured that would be the case. Can't for life of me > > > > > think why I wanted to do that, must have had a brain > > > > > infarction. I want to have an expired session prompt so > > > > > people can log back in with out having to start at the login > > > > > page. Would having the users login saved in $_SESSION be > > > > > alright? prompt them for their password and compare it with > > > > > the password in the DB be fine? I want to reduce the amount > > > > > of typing someone has to do when a session expires. > > > > > > > > > > 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 > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Emil NOVAK, razvijalec distribucije Slonix -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php