Jump to content

Koobi

Staff Alumni
  • Posts

    419
  • Joined

  • Last visited

    Never

Everything posted by Koobi

  1. ober: i've been using PEAR's QuickForms and I used ITX briefly, I love it's Console class and phpDocumentor is great too for documentation purposes. jeremywesselman, is CakePHP fast?
  2. How many of you actually use PEAR classes in your projects? Sometimes I find them a bit bloated...but sometimes time is an issue and at the cost of optimization and they're easy to use so I put on my Vader shorts and use PEAR hehehe and if you do use PEAR, what do you think you would say is your favourite package apart from PEAR or PEAR-Info? what about the rest of you? For those of you who think I'm talking about a fruit: [a href=\"http://pear.php.net/\" target=\"_blank\"]PEAR[/a]
  3. sounds like that tutorials don't really interest you. what you should do is look up functions that are floating around in your head from the PHP manual and learn what they do and what their extra parameters will allow them to do (tutorials rarely, if ever, tell you these things) so that you build up an intimate knowledge of what is possible with each functions. Then, think of somehing you'd liek to build as a hobby so that you can learn PHP better. this way you can combine learning and fun together and you'll enjoy it. I'd suggest going through most of the [a href=\"http://www.php.net/manual/en/ref.strings.php\" target=\"_blank\"]string functions[/a] first. also, have a look into the security issues with regard to PHP. i don't mean you, but in general, lots of people can code PHP but in almost all the cases i've seen, they are unaware of a lot of security issues, myself included :) learning is never complete :) :edit: i decided to move this post to the Miscellaneous section because it's really more suited there. Staff: Feel free to move this back to the PHP Help section if you feel this is better suited there.
  4. hmmm is your intention to check if $_POST['uname'] is empty OR $_POST['fname'] is longer than 2 characters in th first if condition? if that's the case, consider using || instead of | || is a logical OR, | is a bit operation. same applies for the second if condition. just to let you know, you can even construct your conditions like this if i'm not mistaken: [code] $print_again = (!$_POST['uname'] || strlen($_POST['fname']) < 2); [/code] although i would feel more comfortable with a more specific empty() function [code] $print_again = (!empty($_POST['uname']) || strlen($_POST['fname']) < 2); [/code] those two lines do the same as your if condition. also, consider the [a href=\"http://www.php.net/operators.comparison#language.operators.comparison.ternary\" target=\"_blank\"]ternary operator[/a].
  5. it would be helpful if you mentioned what exactly you tried and what error messages you recieved. as Orio pointed out, you would need PHP5 for that particular function. if you're on PHP4.x, the idea is: 1. open a directory 2. read all the files via a while loop (caveat: remember to exclude '.' and '..') 3. store each file in an array from within the while loop 4. use count() on the array to determine how many elements exist in that array you don't really have to store the items in an array, you can even have a counter in the while loop. when you say "files" i'm assuming you mean directories as well because on Unix/Linux, directories are also files but if that's not your intent, look into the is_dir() function. i'm assuming you have a general knowledge of file handling in PHP so i've left out some obvious things in my post. if you need further clarification on this matter, let us know...but really, if you had followed Orion's advice in his first post, you would have sorted this problem out...which makes me wonder why i have to type all this :)
  6. you can also use [a href=\"http://www.php.net/set_error_handler\" target=\"_blank\"]set_error_handler()[/a]. actually this is how it should be done. we shouldnt allow PHP to display its errors, we should be able to read PHP's message and display our own message to the viewer....what if your viewer doesn't speak english? If your system is not language dependant, you can use set_error_handler() and customize your message in their language. oh and i'm quoting this from the above link (it's in the "Description"): [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] It is important to remember that the standard PHP error handler is completely bypassed. error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately. [b]Of particular note is that this value will be 0 if the statement that caused the error was prepended by the @ error-control operator.[/b] [/quote] Another useful link in the PHP manual for the @ error operator: [a href=\"http://www.php.net/manual/en/language.operators.errorcontrol.php\" target=\"_blank\"]Error Control Operators[/a] i hope this dissuades you from using the @ operator where not necessary in the future :)
  7. I agree in saying that you should avoid supressing errors like this. when developing, i would enable all error messages, even warnings and notices. when publishing, it might be best to hide errors via error_reporting() and using an error handler to quitely inform you of the errors and displaying a custom predefined error message to the users of the web app/site. and like kenrbnsn said, i would only use @ if absolutely necessary. here's an example for using @ when including files: [code] <?php     if(@!include 'config.php')     {         echo 'A required configuration file could not be included. Script terminating.';         exit(0);     } ?> [/code] IMO, when publishing the system, if you're handling the problem yourself, it's ok to hide them from everyone else...so long as person in charge (YOU) knows what's going on.
  8. i know this is an old topic but i just came accross it and wanted to post yeah vim is a bit awkward to get used to but once you do it's amazing. you don't have to take your hands off the alphabet keys to do ANYTHING in the editor. every function has a keybinding within that bunch of keys. and there's a kvim hehe i guess someone read theverychap's post kvim at freshmeat kvim at slashdot there's also cream for those who don't like to get down and dirty with vim. personally i think it might be better to whoever wants to learn vim to get used to vim straight away before they build up habits that might impede using vim. i hated vim in the beginning, but it does miracles now! Vim at the wikipedia
  9. well my PC is ancient so i'm pretty stingy with my resources. i work on linux, editor is usually Vim, i might use gedit once in a blue moon. usually when i'm working, i switch to terminal...so i'd have Vim open for editing and another terminal for Lynx to check the HTML output and yet another terminal for browsing my directories. after im done with the functionality, i'd use Firefox and the other browsers to check the cosmetics.
  10. ah ok, since you had mentioned .htaccess, i assumed you meant mod rewrite. anyway, here is a PHP alternative. it's been done before many times, this is just my version of it. [a href=\"http://koobi-studio.com/downloads/php/functions/seoUrl/index.php?source=1\" target=\"_blank\"]Koobi-Studio: Search Engine Friendly URL's[/a] let me know if there's anything else :)
  11. you can achieve this affect with PHP...but it's best you do it via your server which is standard practice. in Apache, this is called "Mod Rewrite" the first 5-6 links here will be useful to you: [a href=\"http://www.google.com/search?q=mod%20rewrite&hl=en\" target=\"_blank\"]Google: mod rewrite[/a] you might need help with writing the rewrite rule itself which might be hard to find via google and if that's the case, please do post here and one of us will help you. i'll move this to the Apache forum since this is Apache specific
  12. Hi, to tell you honestly, i'm a bit rusty on my PHP. this is the first time i'm using it after a period of almost 3-4 months with no PHP whatsoever. but from what i can recall, what you posted should work. try using the integer 1 instead of the string "On": [code] php_flag display_errors 1 php_value error_reporting 2047 [/code] also, is your apache configured to allow .htaccess per directory? because that feature can be turned off. you might want to check that up. and try this using ini_set() as well to check if the errors show up at all before you proceed.
  13. i'm a student/freelance web developer and most of my work involves creating CMS systems from scratch. VERY little of my work involves adding to an existing system. right now, i'm working on 2 CMS's and a website. the website and one of the CMS's have to be created from scratch but the other CMS just needs some features added to it. one thing i hate creating is websites because it's so monotonous :/ i don't mind creating CMS's if it's an unusual one...i enjoy data mining which is something i look for when it comes to clients. so yeah, as a PHP developer, there is almost always a lot of work...the problem is finding the time to do all that work and maintain a social life. one has to go :)
  14. i suppose this would work: [code] php_flag error_reporting 2047 [/code] name that file .htaccess and place it in your directory. error_reporting > [a href=\"http://www.php.net/manual/en/ref.errorfunc.php#errorfunc.constants\" target=\"_blank\"]predefined constants[/a]
  15. i'm not sure i understand...do you want any file, except for another PHP file to be rewritten to index.php?
  16. [!--quoteo(post=343589:date=Feb 7 2006, 05:18 PM:name=Charles Andrews)--][div class=\'quotetop\']QUOTE(Charles Andrews @ Feb 7 2006, 05:18 PM) [snapback]343589[/snapback][/div][div class=\'quotemain\'][!--quotec--] I have a unix server running Apache with 30+ domains on it. How can I tell what script is being attacked to send spam [/quote] can't you just grep your access logs to check which files are being access the most and narrow it down?
  17. [a href=\"http://www.getvanilla.com/\" target=\"_blank\"]Lussumo Vanilla[/a] == <3
  18. i usually turn JS off the reason is that my PC is pretty slow and some sites use JS in such a way that it takes up a lot of processing power and that slows the PC down a lot. if the site doesn't work in JS, i usually dont browse it. actually i don't browse the internet so much to begin with...just a few PHP tutorial sites, google and some forums (haven't been doing much of that lately either but that will change next week )
  19. hey, i'm writing a script that filters some text for some data and then writes out an SQL file which contains an INSERT command to enter that filtered data into a MySQL database. i want to know, how many INSERTS is it allright to make in one go via phpMyAdmin? there may be upto 10,000 entries i want to insert, but phpMyAdmin would probably timeout before all of them are made so i want to break it up into multiple SQL scripts. the user who will be handling this is running FreeBSD on a relatively fast machine using the latest version of phpMyAdmin. if there's an alternative, such as MySQL CLI that won't time out with around 10,000 records, then feel free to make such a suggestion but give me an idea as to how i can do it because when it comes to MySQL, my knowledge is severely limited :/ thanks guys
  20. yeah you're right. i will probably save more time if i did it all manually all over again. thanks for the reply anyway
  21. ooops, i used -n instead of -c for PHP cli heh heh, anyway i just tried this: php -c /etc/php4/apache2/php.ini -i | grep -i apache and all i get is this: so i guess i don't have that flag in my PHP install...but i don't recall touching my PHP installation in the last two days... in any case, as long as i have the proper AddType directive in apache2.conf, Apache shouldn't ask me if i want to download the PHP file, right?
  22. it probably does. i haven't touched my PHP installation. i just reinstalled Apache, i did it again a few minutes ago but using Ubuntu's apt-get system, i didnt compile it manually. i tried this: php -in /etc/php4/apache2/ so that i could see the options but it still loads the php.ini from /etc/php4/cli/ got any ideas, effigy? thanks so far.
  23. hey, thanks for the reply. all the paths i mention here are relative to /etc/apache2/ mods-available/ has php4.conf and php4.load mods-available/php4.conf has this: <IfModule mod_php4.c> AddType application/x-httpd-php .php .phtml .php3 AddType application/x-httpd-php-source .phps </IfModule> and mods-available/php4.load ahs this: LoadModule php4_module /usr/lib/apache2/modules/libphp4.so and mods-enabled/ has php4.conf and php4.load which are both symlinks to their counterparts in mods-available/ so everything seems in order to me. am i missing something? and all files in mods-enabled/ and mods-available/ are included via apache2.conf...but just to double-check things, i added the LoadModule directive for the PHP module in apache2.conf as well and when i tried graceful via apache2ctl, it throws an error saying that the module was already loaded. thanks for your time.
  24. i'm running Apache v2.x on linux the server itself is running, but apache doesn't recognize PHP files, it asks me if i want to download them. i had to reinstall Apache the other day because i made a mess of it while messing about with it. i've edited /etc/apache2/apache2.conf to add the following: AddType application/x-httpd-php .php and done a graceful restart with apache2ctl but it doesnt seem to work. i also don't have an .ht* file in any of my dir's that might tell .php files are anything but applicatoin/x-httpd-php files. i've tried everything i know but nothing works. either i've forgotten something, or apache is reading another .conf file from somewhere else...but other changes to apache2.conf seem to work. for example, i enabled the server-status and server-info options in that same conf file, and while server status doesnt seem to work, server-info gives a 403 header (forbidden) even when i run it as root via lynx. does anyone know if there's an apache tool that i can use which will tell me the order of the conf files being read? i'm open to any suggestions. i just can't figure out what i've missed out. i've done this a million times before :/ thanks.
  25. Housni Yakoob, 23 years old (i'm 6 years old mentally ) male. i used to work on C++ quite a bit while in school but took a break from coding for a few years, then got into PHP on Jan 2004 a friend of mine is a Java freak and she's female. it's really very hard to find female programmers...but this girl makes up for all the rest...genius!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.