Re: [PHP] REQUIRE_ONCE AND CLASSES
Hiya Try it like this: require_once "HTML/IT.php"; class Home { var $tpl_home = NULL; function Home () { $this->tpl_home = new IntegratedTemplate("../templates"); } function Home(){ $this->tpl_home->loadTemplatefile("index.tpl.html", true, true); $this->tpl_home->setCurrentBlock("GEREN"); $this->tpl_home->setVariable("GEREN","b"); $this->tpl_home->parseCurrentBlock("GEREN"); $this->tpl_home->setCurrentBlock("PRINCIPAL"); $this->tpl_home->setVariable("DADOS","a"); $this->tpl_home->parseCurrentBlock("PRINCIPAL"); } function show(){ $this->tpl_home->show(); } } $alo=new Home(); $alo->show(); ?> P.S. you can assign 'dynamic' content to a class var in a (class) function, not with var $var = aFunction() or something At 16:24 16-12-02 +, Mauro Romano Trajber wrote: Hi all. I got a problem. When i include a external file using require_once('my_file.php'); in a class file i cant use my_file´s vars and functions. Example: require_once "HTML/IT.php"; class Home{ var $tpl_home= new IntegratedTemplate("../templates"); function Home(){ $this->tpl_home->loadTemplatefile("index.tpl.html", true, true); $this->tpl_home->setCurrentBlock("GEREN"); $this->tpl_home->setVariable("GEREN","b"); $this->tpl_home->parseCurrentBlock("GEREN"); $this->tpl_home->setCurrentBlock("PRINCIPAL"); $this->tpl_home->setVariable("DADOS","a"); $this->tpl_home->parseCurrentBlock("PRINCIPAL"); } function show(){ $this->tpl_home->show(); } } $alo=new Home(); $alo->show(); ?> DONT WORK!!! why? im new in php. i will thank any help. sorry my english!!! :) Mauro! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REQUIRE_ONCE AND CLASSES
Ofcourse there can only be one home function: require_once "HTML/IT.php"; class Home { var $tpl_home = NULL; function Home(){ $this->tpl_home = new IntegratedTemplate("../templates"); $this->tpl_home->loadTemplatefile("index.tpl.html", true, true); $this->tpl_home->setCurrentBlock("GEREN"); $this->tpl_home->setVariable("GEREN","b"); $this->tpl_home->parseCurrentBlock("GEREN"); $this->tpl_home->setCurrentBlock("PRINCIPAL"); $this->tpl_home->setVariable("DADOS","a"); $this->tpl_home->parseCurrentBlock("PRINCIPAL"); } function show(){ $this->tpl_home->show(); } } $alo=new Home(); $alo->show(); ?> At 17:36 16-12-02 +0100, Wico de Leeuw wrote: Hiya Try it like this: require_once "HTML/IT.php"; class Home { var $tpl_home = NULL; function Home () { $this->tpl_home = new IntegratedTemplate("../templates"); } function Home(){ $this->tpl_home->loadTemplatefile("index.tpl.html", true, true); $this->tpl_home->setCurrentBlock("GEREN"); $this->tpl_home->setVariable("GEREN","b"); $this->tpl_home->parseCurrentBlock("GEREN"); $this->tpl_home->setCurrentBlock("PRINCIPAL"); $this->tpl_home->setVariable("DADOS","a"); $this->tpl_home->parseCurrentBlock("PRINCIPAL"); } function show(){ $this->tpl_home->show(); } } $alo=new Home(); $alo->show(); ?> P.S. you can assign 'dynamic' content to a class var in a (class) function, not with var $var = aFunction() or something At 16:24 16-12-02 +, Mauro Romano Trajber wrote: Hi all. I got a problem. When i include a external file using require_once('my_file.php'); in a class file i cant use my_file´s vars and functions. Example: require_once "HTML/IT.php"; class Home{ var $tpl_home= new IntegratedTemplate("../templates"); function Home(){ $this->tpl_home->loadTemplatefile("index.tpl.html", true, true); $this->tpl_home->setCurrentBlock("GEREN"); $this->tpl_home->setVariable("GEREN","b"); $this->tpl_home->parseCurrentBlock("GEREN"); $this->tpl_home->setCurrentBlock("PRINCIPAL"); $this->tpl_home->setVariable("DADOS","a"); $this->tpl_home->parseCurrentBlock("PRINCIPAL"); } function show(){ $this->tpl_home->show(); } } $alo=new Home(); $alo->show(); ?> DONT WORK!!! why? im new in php. i will thank any help. sorry my english!!! :) Mauro! -- 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] Re: php --with-gd support
http://www.php.net/manual/ At 13:13 17-12-02 +0100, [EMAIL PROTECTED] wrote: Hi Bogdan, sorry I am new to PHP where can I find a manual of PHP? Oliver Sorry, I only saw the first line in your message ("I want to know all about...") - somehow assumed the 2nd to be part of the sig on first reading - and hurried to be cynical. Can't help you with a good site/book. Why don't you RTFM instead? :) Bogdan [EMAIL PROTECTED] wrote: > Hello List, > > I want to know all about copiling, installing and configuring php with gd-support. > > Anybody knows a good site or book to read about? > Oliver Etzel > -- 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] *arrays/evaluating - ! urgent !
Hiya, I couldn't read you code really (i think you gotta look into it, eval is evil and really not nessacery here) I suggest you look at this (piece) of code: value="">value_ Gr, Wico At 17:52 17-12-02 +0100, Alexey Lysenkov wrote: Hello, another newbie here. Here is a loop: for($f=0;$f\n"); echo("$frage5[$f]\n"); for($h=0;$h\n"); $tempQar = "array_values(\$arq_5_".$hh.")"; eval("\$tempQar=\"$tempQar\";"); for($v=0;$v<7;$v++){ if((int)$tempQar[$f] == $v){ $sel = "selected"; }else{ $sel = ""; } echo("$v\n"); } echo("\n\n"); } } Arrays hersteller as well as frage5 are set manually, so they are okay.They are printing out okay as well. The logic is as follows - not to make (frage5*hersteller) variables, I manually set 5 empty arrays with the names arq5_1, arq5_2 and arq5_[hersteller], etc. Now, when the form is submitted and something is being wrong with the input, it returns the form (practically, goes through the whole html again) and sets the selected fields to the options, radios and values already submitted. Supposed to be nice, so you correct only what you did wrong. What I am failing to achieve with this code, is keeping the options of the selects in the manner they were selected when submitting. In the include, which validates the input it works alright. Here is the code: for($i=1;$i 3){ $varsOkay = false; $frage5warn = true; } If I put print_r($tempQar) after the second "for..." statement, it prints out the array, which is alright - with every value submitted in its place. But somehow, almost the same thing doesn't work in the main, so to say, file. Could anyone help? Please? It's urgent. Regards, Alex -- 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] flush output error
At 20:41 18-12-02 +1100, you wrote: hi guys i have a little problem with flushing the buffer output, in this loop it should be downloading a file and changing the progress of a progress bar, although it waits until the shell_exec of all the files are done and then flushes the buffer which will start @ 95% , so it wont start until shell_exec is finished , is this a bug ? php can't multitask, so it's not a bug what you can try: page1: (start process) put an ignore_user_abort on it put a header location on it to page2 start the command and let it write to a file where it is page 2 : read the file and display a processbar (with javascript or meta refresh) when done goto page3 page3: continue foreach ($filename as $file){ shell_exec("curl -O ".$url.$file); //shell_exec("wget ".$url.$file); //echo $file; $bar->progressbar_percentage($i,$filename,'NewWin','Percentage','Downloading '.$file); $i++; } -- 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] Compiling php-4.0.6 with MySQL support
At 14:44 18-12-02 +0500, Igor Shulgin wrote: Hi! I cannot compile php-4.0.6 with MySQL support as static module for apache_1.3.20 on FreeBSD 4.4. Early I successfully build and install /usr/ports/databases/mysql323-server and /usr/ports/databases/mysql323-client with standard configuration. I have done following without problems: cd /usr/ports/www/apache13/work/apache_1.3.20 ./configure cd /usr/ports/www/mod_php4/work/php-4.0.6 rm config.cache ./configure --with-mysql= --with-apache=/usr/ports/www/apache13/work/apache_1.3.20 --enable-track-vars shouldn;t it be ./configure --with-mysql --with-apache=/usr/ports/www/apache13/work/apache_1.3.20 --enable-track-vars (so without the =) Gr, Wico make make install cd /usr/ports/www/apache13/work/apache_1.3.20 ./configure --prefix=/usr/local/www --activate-module=src/modules/php4/libphp4.a But make stops with following: gcc -funsigned-char -I/usr/ports/www/mod_php4/work/php-4.0.6 -I/usr/ports/www/mod_php4/work/php-4.0.6/main -I/usr/ports/www/mod_php4/work/php-4.0.6/main -I/usr/ports/www/mod_php4/work/php-4.0.6/Zend -I/usr/ports/www/mod_php4/work/php-4.0.6/Zend -I/usr/ports/www/mod_php4/work/php-4.0.6/TSRM -I/usr/ports/www/mod_php4/work/php-4.0.6/TSRM -I/usr/ports/www/mod_php4/work/php-4.0.6 -DUSE_EXPAT -I./lib/expat-lite -DNO_DL_NEEDED `./apaci` -o httpd buildmark.o modules.o modules/standard/libstandard.a modules/php4/libphp4.a main/libmain.a ./os/unix/libos.a ap/libap.a lib/expat-lite/libexpat.a -rdynamic -Lmodules/php4 -L../modules/php4 -L../../modules/php4 -lmodphp4 -lpam -lcrypt -lm-lcrypt modules/php4/libphp4.a(php_mysql.lo): In function `_free_mysql_result': php_mysql.lo(.text+0x1c): undefined reference to `mysql_free_result' modules/php4/libphp4.a(php_mysql.lo): In function `_close_mysql_link': php_mysql.lo(.text+0x9d): undefined reference to `mysql_close' modules/php4/libphp4.a(php_mysql.lo): In function `_close_mysql_plink': php_mysql.lo(.text+0xf9): undefined reference to `mysql_close' modules/php4/libphp4.a(php_mysql.lo): In function `php_info_mysql': php_mysql.lo(.text+0x42f): undefined reference to `mysql_get_client_info' modules/php4/libphp4.a(php_mysql.lo): In function `php_mysql_do_connect': php_mysql.lo(.text+0xd0e): undefined reference to `mysql_init' php_mysql.lo(.text+0xd2f): undefined reference to `mysql_real_connect' php_mysql.lo(.text+0xd5c): undefined reference to `mysql_error' php_mysql.lo(.text+0xd89): undefined reference to `mysql_errno' php_mysql.lo(.text+0xe4f): undefined reference to `mysql_stat' php_mysql.lo(.text+0xe8c): undefined reference to `mysql_real_connect' php_mysql.lo(.text+0x105a): undefined reference to `mysql_init' php_mysql.lo(.text+0x107b): undefined reference to `mysql_real_connect' php_mysql.lo(.text+0x10ac): undefined reference to `mysql_error' php_mysql.lo(.text+0x10d9): undefined reference to `mysql_errno' php_mysql.lo(.text+0x10eb): undefined reference to `mysql_error' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_select_db': php_mysql.lo(.text+0x1550): undefined reference to `mysql_select_db' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_get_client_info': php_mysql.lo(.text+0x159d): undefined reference to `mysql_get_client_info' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_get_host_info': php_mysql.lo(.text+0x168d): undefined reference to `mysql_get_host_info' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_get_proto_info': php_mysql.lo(.text+0x1781): undefined reference to `mysql_get_proto_info' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_get_server_info': php_mysql.lo(.text+0x184d): undefined reference to `mysql_get_server_info' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_create_db': php_mysql.lo(.text+0x1a14): undefined reference to `mysql_create_db' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_drop_db': php_mysql.lo(.text+0x1bcc): undefined reference to `mysql_drop_db' modules/php4/libphp4.a(php_mysql.lo): In function `php_mysql_do_query_general': php_mysql.lo(.text+0x1ce5): undefined reference to `mysql_select_db' php_mysql.lo(.text+0x1d42): undefined reference to `mysql_eof' php_mysql.lo(.text+0x1d6d): undefined reference to `mysql_fetch_row' php_mysql.lo(.text+0x1e47): undefined reference to `mysql_real_query' php_mysql.lo(.text+0x1e72): undefined reference to `mysql_use_result' php_mysql.lo(.text+0x1e80): undefined reference to `mysql_store_result' php_mysql.lo(.text+0x1e93): undefined reference to `mysql_field_count' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_list_dbs': php_mysql.lo(.text+0x21a3): undefined reference to `mysql_list_dbs' modules/php4/libphp4.a(php_mysql.lo): In function `php_if_mysql_list_tables': php_mysql.lo(.text+0x2370): undefined reference to `mysql_select_db' php_mysql.lo(.text+0x2385): undefined reference to `mysql_list_tables' modules/php4/libphp4.a(php_mysql.lo): In function `p
Re: [PHP] Undefined variable error message
http://www.php.net/manual/en/function.error-reporting.php At 10:31 18-12-02 +, Michael Egan wrote: All of the PHP scripts hosted on a Linux server I'm working with have suddenly begun producing an error message: undefined variable 'variablename' This occurs wherever a variable name is referred to. I'm concerned about this for two reasons: 1 Will I have to go through each script making substantial alterations? 2 Has the configuration of PHP been altered in some way without my knowledge? The latter would suggest fairly significant security issues. Does anybody have any ideas as to how this might have occurred and the quickest way of resolving it? Or of links to possible solutions? This is particularly irritating as last night was the office Christmas party and I'm in a rather fragile state this morning :-( Michael Egan -- 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] How to upload a file
Look for the limit in php.ini http://www.php.net/manual/en/configuration.directives.php#ini.upload-max-filesize Gr, Wico At 16:47 18-12-02 +0530, Somesh wrote: Hi, I am using the following code to upload file; X--- Send the file: X--- This works fine for small files of like some Kbs but fails to upload larger files near to 1MB. Can any one help me out from this problem my file processing code is:: X--- if(is_uploaded_file($userfile)) { copy($userfile,"./upload/$userfile_name"); echo "Successfully completed the uploading of the file $userfile_name of size $userfile_size"; }else{ echo "some error has occured while uploading the file $userfile_name"; echo "$userfile"; } -X--- -- 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] Random Number Genertation
http://www.php.net/manual/en/function.array-rand.php At 11:35 18-12-02 +, shaun wrote: Hi, Say i have a set of non sequential numbers for example: 1 3 8 12 13 16 19 21. How can i get php to take a random number from this set? Thanks for your help -- 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] $_SERVER["PATH_TRANSLATED"] returns empty string
Maybe basename($_SERVER['SCRIPT_NAME']); At 14:10 18-12-02 +0100, Robert Nedbal wrote: Hi, I'm having problems with my PHP installation. When I try to get real path to my script by using $_SERVER["PATH_TRANSLATED"], I receive empty string. $_SERVER["PATH_TRANSLATED"] empty string (why?) $_SERVER["PHP_SELF"] works as expected (ok) $_SERVER["DOCUMENT_ROOT"]works as expected (ok) OS: RedHat Linux 8.0 Apache: httpd-2.0.40-11 PHP: php-4.2.2-8.0.5 (recompiled from source) Any ideas how to fix this? Best regards, Robert PS: When replaying please CC me as I'm not subscribed to this list, thanks. -- Robert Nedbal - Czech Technical University in Prague, Czech Republic email: [EMAIL PROTECTED] http://www.sh.cvut.cz/~robik/ /* Debuggers are evil. Never ever trust them. */ -- 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] Re: AW: [PHP-DEV] PHP Setup / Query
Hiya It's not allowed to put spaces into an url it has to be replaced by a + or %20 however apache will fix this IIS will however not You could make a header script that looks at $_SERVER['REQUEST_URI'] and fix the vars Gr, Wico At 14:19 18-12-02 +0100, you wrote: Thanks for the information. I know the urlencode function. But my PHP application is done already (developed on the linux based PHP) and it would be very hard to edit the source code again. So the urlencode function is only a workaround. -Ursprungliche Nachricht----- Von: Wico de Leeuw [mailto:[EMAIL PROTECTED]] Gesendet: Mittwoch, 18. Dezember 2002 13:51 An: Michael A. Norweh; [EMAIL PROTECTED] Betreff: Re: [PHP-DEV] PHP Setup / Query At 13:19 18-12-02 +0100, Michael A. Norweh wrote: >I've installed the newest version of PHP on an ISS 5.0 based System. >The problem I have at the moment: >If post a variable (URL Query) e.g.: "xxx.php?errormsg=error message" to a >site, php is unable to get these variable. On my linux server the space is >interpreted as "%20" in the correct way. >On IIS the variable data is cutted after "error". >I think i ve set any wrong parameter in the php.ini file or in the IIS >webserver settings. > in your script do: >-- >PHP Development 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] test
test -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Mailling list error
Hiya everytime i send something to the php list i get an error from someone @fc.emc.com.ph stating: php-list,emc (The name was not found at the remote site. Check that the name has been entered correctly.) I can't send the whole email, i tried but then i was unsubscribed from the list :) Can someone fix/test this? Gr, Wico -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Put text matching regex into array?
At 13:39 18-12-02 +, achillex wrote: [EMAIL PROTECTED] (Leif K-Brooks) wrote in news:3DFE7849.5050102 @buyer-brokerage.com: > Is there a way to put each part of a string matching a regex into an > array? Example: > $string = "-_-_--- --_-_-- random text here-_"; > $array = regextoarray($string,"[-_]{1,}"); > //Produces array of "-_-_---","--_-_--","-_" > if (Preg_Match_All('~([-_]+)~S', $string, $matches)) { var_dump($matches); } or try ereg () with third argument. -- 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] preventing sql injections
addslashes should be enough and put qoutes arround your strings in the sql At 14:58 18-12-02 +0100, Anders Thoresson wrote: Would this function do the trick? // validate.php - functions that validates form input function validate_string($unsafe_string) { // create array containing bad words $badwords = array(";","--","select","drop","insert","xp_","delete"); $goodwords = array(":","---","choose","leave","add"," ","remove"); // check for occurences of $badwords for($i=0; $i<7; $i++) { $unsafe_string = str_replace("$badwords[$i]", "$goodwords[$i]","$unsafe_string"); } $unsafe_string = AddSlashes($unsafe_string); $unsafe_string = trim($unsafe_string); $safe_string = $unsafe_string; Return $safe_string; } ?> Br, Anders -- 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] URL parsing
http://www.php.net/manual/en/function.parse-url.php At 06:39 18-12-02 -0800, Mako Shark wrote: I've got a URL like this: http://www.naturalist.com/~fungae/index.php which is stored in $http_referer (as parse_url from $HTTP_REFERER). I'm trying to extract the username (~fungae). I've read the docs on parse_url(), and have tried to get $http_referer[user], but it comes up with zilch. I've also tried to print_r $http_referer, but I only get scheme, host, path, and query. Any ideas? __ Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now. http://mailplus.yahoo.com -- 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] Empty textfield
At 15:33 18-12-02 +, shaun wrote: Hi, what is the best way to check if a textfield is empty, and is it the same for file fields? if (empty(trim(@$textfield))) { } thanks for your help -- 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] ereg.
^ is not in this case Try if(!ereg("^([a-zA-ZåÅäÄöÖ]{4,20})\$", $_REQUEST['f_name'])) { Added the $ at the end else the could be more then 20 chars Greetz At 17:20 18-12-02 +0100, Anders Thoresson wrote: What's wrong with the following regular expression? As far as I can se, only alphabetic characters including the special swedish ones, should be let through, but whatever character passed on in $_REQUEST['f_name'] passes the test? if(!ereg("(^[a-zA-ZåÅäÄöÖ]{4,20})", $_REQUEST['f_name'])) { error("Your first name should be between 4 and 20 alphabetic characters"); } The next one, used to check valid birthday dates, work. And I can't see where they differ! if(!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $_REQUEST['birthday'])) Br, Anders -- 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] ereg.
At 17:26 18-12-02 +0100, Wico de Leeuw wrote: ^ is not in this case Cancel that, i don't think thats true anyway if(!ereg("^[a-zA-ZåÅäÄöÖ]{4,20}\$", $_REQUEST['f_name'])) { Should work i think Gr, Try if(!ereg("^([a-zA-ZåÅäÄöÖ]{4,20})\$", $_REQUEST['f_name'])) { Added the $ at the end else the could be more then 20 chars Greetz At 17:20 18-12-02 +0100, Anders Thoresson wrote: What's wrong with the following regular expression? As far as I can se, only alphabetic characters including the special swedish ones, should be let through, but whatever character passed on in $_REQUEST['f_name'] passes the test? if(!ereg("(^[a-zA-ZåÅäÄöÖ]{4,20})", $_REQUEST['f_name'])) { error("Your first name should be between 4 and 20 alphabetic characters"); } The next one, used to check valid birthday dates, work. And I can't see where they differ! if(!ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})", $_REQUEST['birthday'])) Br, Anders -- 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] Looping needs to re-open parm file
Did you look at: http://www.php.net/manual/en/function.file.php Puts all lines in an array Gr, At 12:00 19-12-02 +0100, Jacob van Zanen wrote: Hi All, I'm reading a paramter file and a text file. Per line of the text file I want to check if there is a word in there from the parameter file. However I need to open and read the parameter file for each line in the text file. How can I change this? Followin is the code I have. \n"); } } } ?> -- 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] Looping needs to re-open parm file
Hiya something like this if ($FileContent = file("d:\MyPhp\\test.ora") AND $IniContent = file("d:\MyPhp\initORA.ini")) { foreach($FileContent AS $line) { if (in_array($line, $iniContent)) { echo "$Line\n"; } } } ?> At 12:00 19-12-02 +0100, Jacob van Zanen wrote: Hi All, I'm reading a paramter file and a text file. Per line of the text file I want to check if there is a word in there from the parameter file. However I need to open and read the parameter file for each line in the text file. How can I change this? Followin is the code I have. \n"); } } } ?> -- 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] RegExpres Prob
At 11:18 19-12-02 +, John Wards wrote: I have a regexp problem I want to go through some HTML and where I want to change it to this http://www.domain.com/path/to/image.jpg";> BUT if the image tag is like this http://www.domain.com/path/to/image.jpg";> already I don't want anything to happen I thought this would do it: ereg_replace("src=\"(^http)","src=\"http://www.domain.com/";, $string); Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string); but it didn't... Argh... Cheers John Wards -- 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] RegExpres Prob
At 11:27 19-12-02 +, John Wards wrote: On Thursday 19 Dec 2002 11:25 am, Wico de Leeuw wrote: Preg_Replace('~src="(?!http://)~iS', 'src="http://www.domain.com/', $string); 1. find src=" 2. look forward if next chars are http:// i=not case sensitive S=optimize pattern because we going to use is many times You should add also a check if it starts with like this: Preg_Replace('~(http://www.domain.com/', $string); Gr, Ha! Ta I am all for quick fixes but I am new to RegExpresions...so could someone explain what its all doing for me. Cheers John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fputs including php syntax?
fput($fp, ''); should work else try fput($fp, '<' . '?' . "\n"); fput($fp, 'phpinfo() . "\n"); fput($fp, '?' . '>' . "\n"); Greetz At 09:27 25-2-03 -0500, MIKE YRABEDRA wrote: Is it possible to use 'fputs' to write to a text file and include php code within it? That way the generated page will have working php syntax within. How do I make it so the php code is treated like text and not code? -- Mike Yrabedra President 323, Inc. Home of The MacDock and The MacSurfshop [http://macdock.com] : [http://macsurfshop.com] VOICE: 770.382.1195 iChat/AIM: ichatmacdock ___ "Whatever you do, work at it with all your heart, as working for the Lord, not for men." ~Colossians 3:23 <{{{>< -- -- 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] Send mail with hidden copy.
add an etra header (see mail function) and use the bcc: header Gr At 11:39 25-2-03 -0300, Skyhawk wrote: How do I make to I send mail with hidden copy? What the correct sintax?? 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
Re: [PHP] querying for values inside range
At 06:04 18-3-03 -0500, Jason Paschal wrote: this is an sql syntax question and i know it's not appropriate for this mailing list, but i didn't want to subscribe to another mailing list for something i think one of you might be able help me with. thank you for your patience. i'm building a site utilizing PHP/MySQL. i'm querying a table to find records where a field lies within a certain range. $age1 = "20"; $age2 = "30"; $sql = "select * from table where age>=$age1 and age<=$age2"; "select * from table where age between $age1 and $age2"; is there another way to write this query? i'm going to be building the sql string programmatically and i was curious about different syntax being able to produce the same result in the hopes that it'll help streamline my PHP code. for example, what if i don't know which is value is greater, age1 or age2? is there some sql syntax that will deal with this situation without me having to determine which is which via PHP? _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- 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] querying for values inside range
At 06:04 18-3-03 -0500, Jason Paschal wrote: this is an sql syntax question and i know it's not appropriate for this mailing list, but i didn't want to subscribe to another mailing list for something i think one of you might be able help me with. thank you for your patience. i'm building a site utilizing PHP/MySQL. i'm querying a table to find records where a field lies within a certain range. $age1 = "20"; $age2 = "30"; $sql = "select * from table where age>=$age1 and age<=$age2"; if ($age1 <= $age2) { $sql = select * from table where age between $age1 and $age2"; } else { $sql = select * from table where age between $age2 and $age1"; } is there another way to write this query? i'm going to be building the sql string programmatically and i was curious about different syntax being able to produce the same result in the hopes that it'll help streamline my PHP code. for example, what if i don't know which is value is greater, age1 or age2? is there some sql syntax that will deal with this situation without me having to determine which is which via PHP? _ Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail -- 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] Shorter way for "each"
hiya echo implode (' ', $array); greetz, Wico At 08:24 10-1-01 -0800, Chris Lee wrote: >everyone allready posted about foreach(), but they didnt post the >alternative syntax > >foreach ($array as $position => $value) >{ > echo $postition : $value\n"; >} > >http://www.php.net/manual/control-structures.foreach.php > >Chris Lee >Mediawaveonline.com > > > > >""Moritz Petersen"" <[EMAIL PROTECTED]> wrote in message >[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi, > > > > is there a shorter way to do: > > > > while (list($key, $value) = each($my_array)) > > { > > echo $value... > > } > > > > I just need the value! > > > > Thanks, > > Mo. > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP 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] Generating percentages of numbers
At 11:47 22-2-01 +0100, Christian Reiniger wrote: >On Thursday 22 February 2001 00:04, Simon Garner wrote: > > > > I have a database of numbers: > > > > > > TOTAL HITS: 1000 > > > PAGE 1: 500 > > > PAGE 2: 250 > > > PAGE 3: 250 > > > > > > How can I query these numbers and display back a percentage number? > > > For instance with the numbers above: > > > > > > PAGE 1: 50% > > > PAGE 2: 25% > > > PAGE 3: 25% > > > > > > Or is their a process by which to store numbers for easily getting > > > this to work? > > > > SELECT (hitcount / 1000) * 100 AS percentage FROM sometable > >Better (if it works): >SELECT (hitcount / MAX(hitcount)) * 100 AS percentage FROM sometable Should be sum then i think :) >-- >Christian Reiniger >LGDC Webmaster (http://sunsite.dk/lgdc/) > >I saw God - and she was black. > >-- >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] Is it possible to parse a variable by character?
At 00:28 18-4-2001 -0700, Sean Coyle wrote: >Thanks for that help! Now I am getting an interesting error that I am not >sure what to make of. > >Warning: REG_ERANGE in /home/httpd/www/worldvibe.org/digitall/edit_f.php on >line 91 > >Here are lines surrounding 91: > >89-> strtolower($f_loc_name); >90-> $f_loc_new = ""; >91-> $f_loc_new = ereg_replace("[^[_a-z0-9-\.]]", "", $f_loc_name); >92-> $f_loc_name = ""; >93-> $f_loc_name = $f_loc_new; $f_loc_new = ereg_replace("[^_a-z0-9-\.]", "", $f_loc_name); >I have tried tow other variations of line 91, and both of them do not seem >to work the way I am hoping for. > >I have (since the last message, decided to remove the offending characters, >rather than replace them with an underscore (hence the ""). Below is an >example of what I am trying to accomplish: > >Test_File#()*#$.txt should be converted to test_file.txt > >TEST.file.#.txt should be converted to sean.coyle..txt > >I am not all that great with regular expressions, so any help I can get on >this is greatly appreciated! > >Kind Regards, > >Sean > > >On 4/17/01 11:01 PM, in article >DC017B079D81D411998C009027B7112A015ED111@EXC-TYO-01, "Maxim Maletsky" ><[EMAIL PROTECTED]> wrote: > > > > > $str = eregi_replace("[^[_a-z0-9-]]", '_', $str) > > > > would this 2-seconds written-in, non-tested scratch of code do the job? > > > > If not then something like this... > > > > eregi_replace() is what you are looking for. > > > > > > > > Sincerely, > > > > Maxim Maletsky > > Founder, Chief Developer > > PHPBeginner.com (Where PHP Begins) > > [EMAIL PROTECTED] > > www.phpbeginner.com > > > > > > > > > > -Original Message- > > From: Sean Coyle [mailto:[EMAIL PROTECTED]] > > Sent: Wednesday, April 18, 2001 2:23 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Is it possible to parse a variable by character? > > > > > > Hey there guys, > > > > This may seem like a dumb question, but I have to ask it anyway. > > > > I have a form in one of my php based scripts that allows for file uploads. > > I recently noticed a potential issue if people upload files containing > > anything else but the standard characters ([_a-z0-9-]+(\.[_a-z0-9-]). > > > > I am not sure if this can be done, but what I need to do is parse this > > variable (lets call it $file_name) by character looking for anything save > > letters a-z (A-Z) and numbers 0-9. Any arrangements of numbers, > letters and > > full stops (.) are to be permitted, and if any character does not meet > those > > specifications, that single character should be converted to an underscore. > > > > Any ideas on how I can go about doing something like this? > > > > BTW: (Some background info) I examined the average validate e-mail idea, > > however, rather than reject the string, I would like to be able to > 'replace' > > the offending character. > > > > Thanks in advance, > > > > Sean > > > > >-- >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] Regular Expression
At 13:39 18-4-2001 +0200, Jeroen Geusebroek wrote: >Hi, > >I have question about regular expressions; I don't know anything >about it and was wondering if someone could help me out. > >I have this text: > >"[ this is atest ] and this is the rest of the text" $data = "[ this is a test ] and this is the rest of the text" if (preg_match('"\[([^\]]+)\]"', $data, $match)) { var_dump($match[1]) } >I want to get the text inbetween the [ and ]. > >If someone could help me out, i would appreciate it. >A link to a tuturial would also be nice. > >Regards, > >Jeroen Geusebroek > > >-- >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] % always return int?
At 21:33 3-5-2001 -0300, Christian Dechery wrote: >How can I get the modulus of an float by an integer? > >$time=3.345345; >$time2=2.34234; >$time3=$time%$time2; try $time3=(long)$time%$time2; something like that should work >echo $time3; > >this outputs 1. > >$time=3.345345; >$time2=2 >$time3=$time%$time2; >echo $time3; > >this also outputs 1. > >Of course... when dividing two floats, there is no remainder... but, there >is an integer invovled... is automatically converted to float before >dividing, so that's why no remainder? > >. Christian Dechery (lemming) >. http://www.tanamesa.com.br >. Gaita-L Owner / Web Developer > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Webdeveloper aangeboden in Nederland
Hiya Fist of all sorry for the off-topic and dutch topic / email, I'm trying to find a nice job in Holland and where can you better ask then at the big official php source :) Als iemand een bedrijf heeft/weet die opzoek is naar een goeie php programmeur hou ik me aanbevolen :) Op verzoek kan in een uitgebreide cv toesturen. Alvast bedankt, Wico de Leeuw -- 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] removing backslashes using regular expressions
At 11:27 8-5-2001 +0200, Trond Straume wrote: >Hi! > >I'm having problems using preg_replace to search and remove backslash >character. > >print preg_replace("/\\/","","testing \\ testing"); try print preg_replace('"\"',"","testing \\ testing"); double-quote single-quote back-slash single-qoute double-qoute, Greetz, Wico >This regexp produces this warning: >No ending delimiter '/' found in c:\internweb\html\preg.php on line 27 > >It seems like I'm escaping the ending delimineter '/', but if i try to >remove one'\' I'm still escaping. What do I have to do, to make this right? > >-- >Regards >Trond Straume > > > >-- >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] removing backslashes using regular expressions
At 11:45 8-5-2001 +0200, Wico de Leeuw wrote: >At 11:27 8-5-2001 +0200, Trond Straume wrote: >>Hi! >> >>I'm having problems using preg_replace to search and remove backslash >>character. >> >>print preg_replace("/\\/","","testing \\ testing"); > >try > >print preg_replace('"\"',"","testing \\ testing"); > >double-quote single-quote back-slash single-qoute double-qoute, Hmmm not very awake yet i think :) should be of course: single-quote double-quote back-slash double-qoute single-qoute i typed it but didn't wrote it :) >Greetz, > >Wico > > >>This regexp produces this warning: >>No ending delimiter '/' found in c:\internweb\html\preg.php on line 27 >> >>It seems like I'm escaping the ending delimineter '/', but if i try to >>remove one'\' I'm still escaping. What do I have to do, to make this right? >> >>-- >>Regards >>Trond Straume >> >> >> >>-- >>PHP General Mailing List (http://www.php.net/) >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >>To contact the list administrators, e-mail: [EMAIL PROTECTED] > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP 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] remotly include file
At 15:40 8-5-2001 +0200, Dominic Brander wrote: >Hi >I'm trying to include some php3 files via http. >one part of the php files is on a regular server and the other part is >on an secure server. >Instead of duplicating all the files for both servers I would like to >include them via http. >How does it work? Like : include("http://www.somehost.ext/path/to/include/include.php";); :) Greetz, Wico >thanx > >domnic > >-- >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] Re: Lists are back up
At 22:43 18-6-2001 -0500, David VanHorn wrote: >At 12:01 AM 6/19/01 +0200, Alexander Skwar wrote: >>So sprach Clayton Dukes am Mon, Jun 18, 2001 at 05:38:26PM -0400: >> > Why not just set your filter to look for [EMAIL PROTECTED] in >> the to >> > or cc line? >> >>Because not all filters support that, and it makes reading mails eg. via >>webmail interfaces easier? > >Eudora can't filter on CC lines. >I've dropped one subscription to another group because the members >insisted on sending emails to each other individually, and CCing the group. > I don't know which ancient version you are using but version 5+ can filter on cc: Greetz, Wico >-- >Dave's Engineering Page: http://www.dvanhorn.org > >I would have a link to http://www.findu.com/cgi-bin/find.cgi?KC6ETE-9 here >in my signature line, but due to the inability of sysadmins at TELOCITY to >differentiate a signature line from the text of an email, I am forbidden >to have it. > >
Re: [PHP] Function by reference?
At 11:35 31-1-01 +0300, Max A. Derkachev wrote: >Hello Niklas, > >Wednesday, January 31, 2001, 7:02:49 PM, you wrote: >NS> >$tmpParsing=eregi_replace("href=(\")([^*]*)(\")","href=\"\\1\"",$this->dataToBeParsed); Take a look @ Preg_Replace with the e modifier, i think you are looking for that (php4 only) Greetz, Wico >NS> where I want \\1 to be fed into urlencode() I was thinking somewhere >along the lines > >NS> $func=&urlencode; > >It won't work. You can not reference a function. But you can call a >variable with the function name value. >$func = 'urlencode' >$func($str) here will do the same as urlencode($str). > >-- >Best regards, >Max A. Derkachev mailto:[EMAIL PROTECTED] >Symbol-Plus Publishing Ltd. >phone: +7 (812) 324-53-53 >http://www.Books.Ru -- All Books of Russia > > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] >To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Easy flowchart programm
Hiya Anyone knows a flowchart program that's very easy in use and good for programming (in php) I saw programms like viso and stuff i think there a better en easier in use programms to make a good programm flow. Greetz, Tnx in advance WIco -- 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]