Jump to content

Koobi

Staff Alumni
  • Posts

    419
  • Joined

  • Last visited

    Never

Everything posted by Koobi

  1. have you satisfied these dependencies? [a href=\"http://php.net/mbstring\" target=\"_blank\"]http://php.net/mbstring[/a] have you disabled posix threads? [a href=\"http://php.net/mcrypt\" target=\"_blank\"]http://php.net/mcrypt[/a]
  2. well if i'm not mistaken, /usr along should suffice. suppose you have mysql installed in /usr/sfw/mysql, if you use the /usr/sfw prefix, it would look for /usr/sfw/sfw/mysql but if you used /usr only, it would search for mysql in /user/sfw/mysql i believe that's the case. the configure just needs to know the base installation path (/usr). the environment variables should know where mysql is relative to the base installation path.
  3. i haven't really helped you yet :) why do you give the entire path here though? [code] --with-mysql=/usr/sfw [/code]
  4. System: Linux ubuntu 2.6.12-10-386 #1 Fri Apr 28 13:13:44 UTC 2006 i686 GNU/Linux PHP: 4.4.0 (apache module) [code] #1 Option 1 : 0.00262498855591 Option 2 : 0.0545389652252 #2 Option 1 : 0.0826070308685 Option 2 : 0.0269320011139 #3 Option 1 : 0.131360054016 Option 2 : 0.0354020595551 [/code] System: Linux lemonhead 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+++opt+c6+gr2b-v6.192 #1 SMP Wed Dec 14 17:06:16 PST 2005 i686 GNU/Linux PHP: 4.4.2 (cgi) [code] #1 Option 1 : 1.8764750957489 Option 2 : 0.004478931427002 #2 Option 1 : 0.02643609046936 Option 2 : 1.8777549266815 #3 Option 1 : 0.0059609413146973 Option 2 : 0.004857063293457 [/code]
  5. :edit: sorry, i just noticed effigy has already mentioned two of my points above. :/edit: i think it was UNIX and Slackware that go with the philosophy: KISS = Keep It Simple Stupid :) out of your example, i don't like: 1. PHP short tag for compatibility reasons. 2. i avoid having the value in an if condition on the right hand side in the event that i use a = instead of a == which i always do by mistake and wonder why my condition is always true :/ to illustrate: [code] //i prefer this if(3 == $value) //i don't like this if($value == 3) [/code] 3. i hate breaking out of the PHP tags. i avoid it where possible. sometimes, i even use the heredoc syntax 4. i avoid double quotes and use single quotes as much as possible. i only use doublt quotes if i'm outputting a string literal along with a variable. i'm neutral about the ternary operator. i think it has its uses in some places but overusing it would just make illegible code.
  6. Koobi

    PCRE

    just to let you know, the other famous regular expression "type" is called POSIX (google tells me that this stands for: Portable Operating System Interface for X). POSIX is less powerful than PCRE but POSIX modern is an extended version of the traditional POSIX but it's still considered less feature rich than POSIX. if you've used 'grep' in a Linux/UNIX terminal, you've probably used a POSIX style regexp.
  7. :EDIT: take thorpe's advice. also, this is a debugging function that would come in handy: [code] <?php     function debugMe($var)     {         return '<pre>' . print_r($var, true) . '</pre>';     } ?> [/code] so now, you can just do echo debugMe($_POST) to observe what's in your _POST variables. also, i'm just being picky here...but whenever you exit, try exiting with a valie like so: [code] exit(0); [/code] so that something is returned. in the unlikely case that you are running this via cli as a cron job or something on a linux machine, the proceses wouldn't know the script has exited properly unless you return a value. so it's just a tiny good habit in coding that you might want to follow :) sorry i couldn't solve the real problem at hand here though but you should pick on thorpe's advice. it will lead you to solving the problem.
  8. i would only use regexp if i'm trying to match a pattern and not something definite. for example, if you know that the user can only input the following words (perhaps he's limited to these choices because it's input via a select menu, ignoring the fact that forms can be spoofed): * VISA * Mastercard * American Express now since you know for sure that he will only enter those 3 words, it's ok to do an explicit check with an if condition. however, if your user is allowed to enter an email address, you would simply have to make sure the email conforms to the standard format of an email which is where regexp comes in because it does matching by a sequence of patterns. Apart from this being the most sensible way to do it, regexp is also fractionally slower than most other string functions because of it's nature. back to the previous case, if you know exactly what to expect, do an explicit string match. use [a href=\"http://www.php.net/ctype\" target=\"_blank\"]ctype functions[/a]. your version of PHP probably has this feature by default unless you were once neighbours with Fred and Wilma :)
  9. just about to leave for work. i can come home and have a look but i quickly glanced through this and it seems like it could either be: 1. some of the files might not be meant for your architecture (php? libs?) 2. you haven't given paths to the libs in some cases (prefix/base install folder) 3. your library files might be too old i'll have a look at it tonight. good luck till then
  10. it would be helpful if you posted the configure command along with your exact output. in any case, i always do this efore i actualy make: [code] make test [/code] that will only work if your Makefile has a test rule. but what it does is, simulates the make and does tests to see if your make has all the things it needs. let me know how it goes.
  11. Sounds to me like you need LDAP, GD and Sablotron (XSL, XSLT). XML comes built-in with PHP5, i believe. you should be able to do this to get help: [code] ./configure --help [/code] but, you can configure it like this: [code] ./configure \ --prefix=/usr \ --with-gd=/usr \ --with-xslt-sablot=/usr \ --with-ldap=/usr [/code] of course you might require more features, but this should do it for what you've asked for. just append the rest to this. You'll need to store your LDAP, GD and Sablot libs in the appropriate place. on linux, it's in /usr/* (thats the default base install dir for most libraries) which is why in my configure code, i use /usr as my prefix. i'm not sure what sun server structure is like. /usr can even be /home/username/usr on a linux system. it totally depends on your environment variables. actually, you might not have to specify the path to the gd libraries for GD because it seems as though PHP ships with GD by default so if you're compiling from source, you should have GD there so you can just use --with-gd you can view details of your required libs in the links below. also, in the links below, there are links to sites where you can download the required libs. please read through it well :) and if you still genuinely have a problem with it, let us know. Sablotron: [a href=\"http://www.php.net/xslt\" target=\"_blank\"]http://www.php.net/xslt[/a] LDAP: [a href=\"http://www.php.net/ldap\" target=\"_blank\"]http://www.php.net/ldap[/a] GD: [a href=\"http://www.php.net/gd\" target=\"_blank\"]http://www.php.net/gd[/a] Installation and configuration: [a href=\"http://www.php.net/manual/en/install.php\" target=\"_blank\"]http://www.php.net/manual/en/install.php[/a]
  12. i don't have IE but i get a lot of annoying javascript messages on Firefox so i mostly use Elinks to browse PHPfreaks. i think it has to do with Ajax in Firefox for linux because I have the same problem when I send attachments via Gmail in Firefox on linux. Elinks works fine though once you get used to the UI
  13. Koobi

    Regex Question

    i think it's because PHP is just the glue language. it needs to pass on this regex to the regex engine which is independant of PHP's engine. And PHP won't add the delimiters on it's own because what if your pattern consisted of an instance of that delimiter? You would have to escape it so that it is taken literally...and that can be annoying if you have many instances of that delimiter, therefore, PHP gives us the option to specify the delimiters as well. case in point: this is fine [code] <?php     //example: match either 4 or more lower case alphabets     preg_match('/[a-z]{4,}/', ...); ?> [/code] this looks messy [code] <?php     //example: match a simple url     preg_match('/^http:\/\/[a-z]+\.com\//', ...); ?> [/code] i used my own delimiters instead of the common one (/) [code] <?php     //example: match a simple url     preg_match('%^http://[a-z]+\.com/%', ...); ?> [/code]
  14. uh...."Did you create PHP all by yourself"? i guess a "yes" would be the right answer there?...
  15. i believe it's best to use a pre-existing class, for example, if it already does what you want to for the sake of meeting deadlines. but if your intent is to build a super optimized system, you should see if those classes are optimized for YOUR needs, if not, i don't see anything wrong with reinventing the wheel in such a case. [!--quoteo(post=382244:date=Jun 10 2006, 09:43 PM:name=poirot)--][div class=\'quotetop\']QUOTE(poirot @ Jun 10 2006, 09:43 PM) [snapback]382244[/snapback][/div][div class=\'quotemain\'][!--quotec--] Also true, but if I don't publish my scripts, it's harder to find vulnerabilities. That's my opinion. [/quote] i have to say i strongly disagree with that. i believe it's better to initially publish the script in question in beta status as widely as possible so that people might notify you of vulnerabilities because different people would have different circumstances or different server setups and they might be able to pick out something you didn't even think of. besides, i'm not such a big fan of hiding code. i believe that if you can do something unusual with code and people would find it useful and if sharing that code wont prevent you from putting food on the table, then you should share the information as much as possible because that way someone else might learn something new and who knows, that person might be the next Linux Trovaldis. but that's just my opinion :)
  16. i have a friend who runs an IRC channel where he offers packets to be downloaded. to tell you the truth, i'm not really sure how it all works although i use IRC. what i want to do is, grab the packets that the bots online offer and stick them in a database so that it can be searched through. i don't have the ability to install anything on the machines the bots reside on but the host that will have the searchable db, i will have control over. i realize that PHP has its IRC specific functions, do you suggest i use this? if so, do you have any tips? i've never really looked into the IRC packages but i can learn them fast, just wondered if any of you have any tips on it for me. PHP and IRC Gateway: [a href=\"http://www.php.net/manual/en/ref.ircg.php\" target=\"_blank\"]http://www.php.net/manual/en/ref.ircg.php[/a]
  17. well let me know how it goes. i have a rough idea of the PEAR directory structure, so worse comes to worse, i can give you a hand with that. but if you would find it helpful, here is what my PEAR directory looks like: [code] koobi@ubuntu:~/Desktop$ ls -lh /usr/share/php total 232K drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Archive drwxr-xr-x   4 root root 4.0K 2006-05-30 01:59 Auth -rw-r--r--   1 root root  30K 2006-05-30 01:59 Auth.php drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Console drwxr-xr-x   3 root root 4.0K 2006-05-15 02:55 data drwxr-xr-x   2 root root 4.0K 2006-05-18 08:18 DB -rw-r--r--   1 root root  39K 2006-05-18 08:18 DB.php drwxr-xr-x  10 root root 4.0K 2006-05-30 01:59 docs drwxr-xr-x   4 root root 4.0K 2006-05-18 08:19 HTML -rw-r--r--   1 root root  13K 2005-09-02 20:12 HTTP.php drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 Mail -rw-r--r--   1 root root 7.9K 2005-09-02 20:12 Mail.php drwxr-xr-x   3 root root 4.0K 2006-05-15 02:55 Net drwxr-xr-x   2 root root 4.0K 2006-05-15 02:55 OS drwxr-xr-x   4 root root 4.0K 2006-05-15 02:55 PEAR -rw-r--r--   1 root root  10K 2006-03-08 14:18 pearcmd.php -rw-r--r--   1 root root  33K 2006-03-08 14:18 PEAR.php drwxr-xr-x   5 root root 4.0K 2006-05-19 22:14 PhpDocumentor drwxr-xr-x   3 root root 4.0K 2006-04-12 23:48 PHPUnit -rw-r--r--   1 root root 2.5K 2004-11-06 14:37 PHPUnit.php drwxr-xr-x   3 root root 4.0K 2006-05-25 11:49 smarty -rw-r--r--   1 root root  18K 2006-03-08 14:18 System.php drwxr-xr-x   8 root root 4.0K 2006-05-30 01:59 tests drwxr-xr-x   4 root root 4.0K 2006-05-15 02:55 XML [/code] so i have the PEAR directory which holds all the PEAR base files. it is a dependency for every other PEAR package so you need it. and i have a bunch of directories like DB, Archive, Auth which are all packages simply unzipped to that directory. PEAR installer does this internally. i'm not sure how PEAR registers these paths so that it can keep track. i suppose it has these paths hardcoded into it. but how do i know what my PEAR directory is to even post my structure to you in the first place? i do the following in terminal: [code] koobi@ubuntu:~/Desktop$ pear config-get php_dir [/code] and in my case, the result was /usr/share/php but it can vary depending on your configs.
  18. [!--quoteo(post=381051:date=Jun 7 2006, 10:18 PM:name=Richard_Hewison)--][div class=\'quotetop\']QUOTE(Richard_Hewison @ Jun 7 2006, 10:18 PM) [snapback]381051[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, Changing the way I write the cases (i.e. to case 1:) has fixed the tab issue! Now, the only thing that makes me curious is why! i.e. is it the different version of PHP or is it down to the PHP configuration? Anyway, many thaks for that - I have also changed to $_GET as well. I have a few other issues, but at least I can cross this off my 'to fix' list now! Many Thanks! [/quote] glad you sorted it out :) you should really take wildteen88's advice seriously. he makes a valid point there regarding future compatibility issues.
  19. i think a lot of the time goes towards iterating through that foreach. if you used something like array_walk() for example, it mightbe faster but i don't know by how much.
  20. [!--quoteo(post=381114:date=Jun 8 2006, 01:27 AM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 8 2006, 01:27 AM) [snapback]381114[/snapback][/div][div class=\'quotemain\'][!--quotec--] Pardon me because I'm probably missing something very simple... but is it going to find the quickform package on the harddrive by default... or do I have to put it in a specific place? And do I leave it zipped up or do I extract it down to the folder + package.xml file? [/quote] i believe what you're trying to do is manually install it. it's better to use the built in PEAR installer. if you're on an up to date PHP installation, you probably have the PEAR base installer unless you compiled PHP with the --without-pear flag. if you're on *nix, you can install the PEAR base installer via your repository. I know debian/ubuntu/gentoo/freeBSD repositories have it. simply search for "PEAR" in your repositories and install PEAR and PEAR-info because those are dependencies for any PEAR class as all the other classes inherit things such as error handling from them. and once you have pear, you can use it via CLI as i've posted above. if you're on a Win machine and you dont have PEAR, i suppose you could follow these instructions here: [a href=\"http://pear.php.net/manual/en/installation.getting.php\" target=\"_blank\"]http://pear.php.net/manual/en/installation.getting.php[/a] either way, once you have PEAR installed, simply use the commands i've mentioned above to install and in general, manage any PEAR classes because it handles dependencies to an extent. what really happens is, it downloads and copies the packages you request to a folder that is determined in the PEAR configs which in turn was determined by PHP's settings. this path to the PEAR files is appended to php.ini if i'm not mistaken (either that or PEAR only copies these files to a path that exists in php.ini) and this path is defined in the include_path directive of php.ini so everytime you want to include a PEAR class, you don't give the absolute path to it, you simply include it relative to include_path and it will be included in your system. perhaps this link will help as well: [a href=\"http://pear.php.net/manual/en/installation.cli.php\" target=\"_blank\"]http://pear.php.net/manual/en/installation.cli.php[/a] if i have not answered your question then i don't think i understand the question. as i see it, you're trying to install the packages manually which can be messy unless you know a few configuration variables and the PEAR folder structure. just use the base installer and you should be good to go. let me know if i need to further clarify anything. you should really try some of the PEAR classes, SOME of them look pretty sweet.
  21. there's also a good one on zend.com. do a quick search there and you should find it.
  22. i forgot to mention that i use PEAR DB too. i actually quite like that class. very nice functions in it and overall, a very nicely constructed class without too many frills. [!--quoteo(post=380988:date=Jun 7 2006, 07:21 PM:name=ober)--][div class=\'quotetop\']QUOTE(ober @ Jun 7 2006, 07:21 PM) [snapback]380988[/snapback][/div][div class=\'quotemain\'][!--quotec--] Ok... stupid question, I went about enabling PEAR on my company server and I want to install the QuickForm package, but I have no idea what I'm supposed to do with the files. Where do I put them? [/quote] well PEAR provides an installer. if you can get to a terminal, type: [code] pear [/code] and it will show you all the options. this would show you the list of available PEAR packages: [code] pear list-all [/code] so typically, if i wanted to find the quickforms package, and install it, i would do it in this sequence: [code] pear search quickform # searches for the package 'quickforms' pear install HTML_QuickForm # installs HTML_QuickForms which was found from the previous command pear info HTML_QuickForm [/code] although those commands arent working for me at the moment...i think somethings temporarily wrong at PEAR's end. and if you want to use quickforms, this is a good start: [a href=\"http://pear.php.net/manual/en/package.html.html-quickform.tutorial.php\" target=\"_blank\"]http://pear.php.net/manual/en/package.html...rm.tutorial.php[/a] once you're done installing PEAR, depending on if you've edited any config variables, PEAR will be installed to that directory. by default this is generally /usr/share/php or /usr/share/pear (it's stored in php.ini under the include_path directive) nice system. only thing is i think some classes are a bit too heavy but i really like the DB class...especially since i'm not too fond of handling db related issues via PHP. you should also look at the Console package for PEAR...the member functions are really nicely constructed and thought through. let me know if i can be of more help on this subject.
  23. ITX is a templating class. seems to be good. I like how QuickForms seamlessly integrates with Smarty. frankly i don't like templating engines so much, especially smarty because it seems bulky but sometimes its not my choice :/ [a href=\"http://pear.php.net/manual/en/package.php.phpdocumentor.intro.php\" target=\"_blank\"]phpDocumentor[/a] is amazing. cuts out any documentation i have to work. the only hitch is that you have to use a certain documentation format for your functions so that when you run your source files through phpdocumentor, it can pick out what it needs to document. it's not much of a problem for me because i've created a keybinding in vim to auto generate the necessary documentation format depending on a functions parameters, return values, etc. if i'm not mistaken, phpdocumentor is what was used to document the PHP Manual...kinda similar to JavaDoc. it's hard to explain, the best thing to do is to have a look at the site: [a href=\"http://pear.php.net/manual/en/package.php.phpdocumentor.intro.php\" target=\"_blank\"]http://pear.php.net/manual/en/package.php....entor.intro.php[/a]
  24. first of all, avoid using $HTTP_GET_VARS, use $_GET instead for compatibility reasons. second of all, that seems to be incorrect use of switch/case. here's a valid example: [code] switch($var) {     case 1:             echo 'Var is 1';         break;     case 2:     case 4:             echo 'Var is an even number below 5';         break;     case 3:             echo 'Var is 3';         break;     case 5:             echo 'Var is 5';         break;     default:             echo "Var is $var";         break; } [/code] always have a "default" case in the even that an unexpected value is input. i haven't read through all your posts. post more code here if you want help because one thing can be done in many ways in PHP so it's better that we see some code before we can figure out how to help you :)
×
×
  • 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.