[PHP] PHP 4.3.0, __CLASS__ and __FUNCTION__
Hi there, can someone please explain what __CLASS__ and __FUNCTION__ are and what they do? They are listed in the PHP 4.3.0 changelog and can be found here: http://www.php.net/manual/en/reserved.php but i can't find any explanation. Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL question, getting error and not sure why
and don't do something like insert into (col1, col2) values ('1', '2'); to oracle. this is deadly if you do insert into (col1, col2) values ('3', 4'); afterwards, oracle will not know this query. it'll have to parse it again, because you used literals. you have to use bindvars, if it is possible with your oracle version. am only familiar with 8i, so i can't tell. this query has to look: insert into (col1, col2) values (:1, :2); and you have to use ocibindbyname to bind a phpvariable after ociparse. That way oracle will parse your query only for the first time and then take it out of the shared pool, if you come along with another value. This is massively important! Same for selcet or other queries. No matter what query, use bindvars. You can read much more in the docs and e.g here: http://asktom.oracle.com/pls/ask/f?p=4950:8:F4950_P8_DISPLAYID:528893984 337 Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This > > Read does not block read. > > read does not block write. > > write does not block read. > > write blocks write on the same column. > should read: > Oracle has a row locking mechanism, so > the following blocking mechanisms apply, when two > or more oracle sessions want to operate on the same row: > read does not block read. > read does not block write. > write does not block read. > write blocks write. > So if two ppl write on the same row on the same time, > oracle waits for the first transaction, to be committed, > or rollbacked, then for the second...and so forth. > > if you send your insert query with the select max(myrow)+1 form table; > and some other session inserts also with your statement at almost the > same time and commits in the meanwhile, that won't affect your max(myrow) > result in any way. oracle will bring you the result as it would have been > as you started your query.so it is for session b. the insert wont have to > wait, it > doesn't affect the same row as the other session. so you'll get the same > results. > > open two sql plus windows. > > in the first do: > > insert into acteursenc (nuacteur,nomacteur) > (select AA, BB from > (select max(nuacteur)+1 AA from acteursenc), > (select 'Michael Sweeney' BB from dual) > then in the second do: > > select max(nuacteur)+1 AA from acteursenc > then in the first > > commit > and in the second: > > select max(nuacteur)+1 AA from acteursenc > > yo'll see, that AA will be 1 higher the second time > > Michael > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > the problem is, that the second sql produces more > > than one row. To be exactly the amount of > > select count(*) from acteursenc rows, with > > 'Michael Sweeney' as value in BB. Perhaps you > > have a unique key on nomacteur?! > > > > I could help further, if i know what you want to do > > with your query. > > if nuacteur is a pk, use a sequence! > > if two users send this query almost at the same time, > > you'll get two times the same pk. > > That's because of oracles locking mechanism: > > Read does not block read. > > read does not block write. > > write does not block read. > > write blocks write on the same column. > > if someone inserts a row with your statement, and hasn't commited his > > transaction, > > and someone else inserts a row with your statment before he has commited, > > then the two will get the same results for max(id)+1. A sequence will > never > > give the > > same result and is easy to use. and for your query, wouldn' this be > easier: > > insert into acteursenc > >(nuacteur, nomacteur) > > values > >(S_ACTEURSENC.NEXTVAL, 'Michael Sweeney') > > > > please explain what you want to do. > > > > Michael > > > > "Michael Sweeney" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > My following query : > > > > > > insert into acteursenc (nuacteur,nomacteur) > > > (select AA, BB from > > > (select max(nuacteur)+1 AA from acteursenc), > > > (select 'Michael Sweeney' BB from acteursenc))" > > > > > > produces an ORA-1: unique constraint error. > > > > > > The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I > should > > > be getting a new key that is unique, however it does not seem that way. > > > > > > What am I doing wrong here? > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL question, getting error and not sure why
This > Read does not block read. > read does not block write. > write does not block read. > write blocks write on the same column. should read: Oracle has a row locking mechanism, so the following blocking mechanisms apply, when two or more oracle sessions want to operate on the same row: read does not block read. read does not block write. write does not block read. write blocks write. So if two ppl write on the same row on the same time, oracle waits for the first transaction, to be committed, or rollbacked, then for the second...and so forth. if you send your insert query with the select max(myrow)+1 form table; and some other session inserts also with your statement at almost the same time and commits in the meanwhile, that won't affect your max(myrow) result in any way. oracle will bring you the result as it would have been as you started your query.so it is for session b. the insert wont have to wait, it doesn't affect the same row as the other session. so you'll get the same results. open two sql plus windows. in the first do: > insert into acteursenc (nuacteur,nomacteur) (select AA, BB from (select max(nuacteur)+1 AA from acteursenc), (select 'Michael Sweeney' BB from dual) then in the second do: > select max(nuacteur)+1 AA from acteursenc then in the first > commit and in the second: > select max(nuacteur)+1 AA from acteursenc yo'll see, that AA will be 1 higher the second time Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > the problem is, that the second sql produces more > than one row. To be exactly the amount of > select count(*) from acteursenc rows, with > 'Michael Sweeney' as value in BB. Perhaps you > have a unique key on nomacteur?! > > I could help further, if i know what you want to do > with your query. > if nuacteur is a pk, use a sequence! > if two users send this query almost at the same time, > you'll get two times the same pk. > That's because of oracles locking mechanism: > Read does not block read. > read does not block write. > write does not block read. > write blocks write on the same column. > if someone inserts a row with your statement, and hasn't commited his > transaction, > and someone else inserts a row with your statment before he has commited, > then the two will get the same results for max(id)+1. A sequence will never > give the > same result and is easy to use. and for your query, wouldn' this be easier: > insert into acteursenc >(nuacteur, nomacteur) > values >(S_ACTEURSENC.NEXTVAL, 'Michael Sweeney') > > please explain what you want to do. > > Michael > > "Michael Sweeney" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > My following query : > > > > insert into acteursenc (nuacteur,nomacteur) > > (select AA, BB from > > (select max(nuacteur)+1 AA from acteursenc), > > (select 'Michael Sweeney' BB from acteursenc))" > > > > produces an ORA-1: unique constraint error. > > > > The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I should > > be getting a new key that is unique, however it does not seem that way. > > > > What am I doing wrong here? > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SQL question, getting error and not sure why
yes, in that way the query i suggested would look like: insert into acteursenc (nomacteur) values ('Michael Sweeney') and nuacteur would be provided by the before insert trigger automatically. that's like mysqls autoincrement. Michael "Rouvas Stathis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I would use a trigger with a sequence, as in: > > CREATE SEQUENCE _SEQ > INCREMENT BY 1 > START WITH -99 > MAXVALUE 99 > MINVALUE -9 > CYCLE CACHE 5 ORDER; > > create or replace trigger _autonum_ins > before insert on > for each row > begin >if :new. is null then > select _seq.nextval into :new. from dual; >end if; > end; > > -Stathis. > > Michael Sweeney wrote: > > > > lol sorry, buttons are too close together in OE. > > > > Anyon ehave a sugestion on a different way of doing what I want to do? > > Should be easy but i;m starting to get a headache from this (6-7 years not > > doing SQL doesn't help either) > > > > -- > Rouvas Stathis > [EMAIL PROTECTED] > http://www.di.uoa.gr/~rouvas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL question, getting error and not sure why
with second sql i meant: (select 'Michael Sweeney' BB from acteursenc) if you want one row and you need a dummy table, use "dual". Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > the problem is, that the second sql produces more > than one row. To be exactly the amount of > select count(*) from acteursenc rows, with > 'Michael Sweeney' as value in BB. Perhaps you > have a unique key on nomacteur?! > > I could help further, if i know what you want to do > with your query. > if nuacteur is a pk, use a sequence! > if two users send this query almost at the same time, > you'll get two times the same pk. > That's because of oracles locking mechanism: > Read does not block read. > read does not block write. > write does not block read. > write blocks write on the same column. > if someone inserts a row with your statement, and hasn't commited his > transaction, > and someone else inserts a row with your statment before he has commited, > then the two will get the same results for max(id)+1. A sequence will never > give the > same result and is easy to use. and for your query, wouldn' this be easier: > insert into acteursenc >(nuacteur, nomacteur) > values >(S_ACTEURSENC.NEXTVAL, 'Michael Sweeney') > > please explain what you want to do. > > Michael > > "Michael Sweeney" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > My following query : > > > > insert into acteursenc (nuacteur,nomacteur) > > (select AA, BB from > > (select max(nuacteur)+1 AA from acteursenc), > > (select 'Michael Sweeney' BB from acteursenc))" > > > > produces an ORA-1: unique constraint error. > > > > The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I should > > be getting a new key that is unique, however it does not seem that way. > > > > What am I doing wrong here? > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SQL question, getting error and not sure why
the problem is, that the second sql produces more than one row. To be exactly the amount of select count(*) from acteursenc rows, with 'Michael Sweeney' as value in BB. Perhaps you have a unique key on nomacteur?! I could help further, if i know what you want to do with your query. if nuacteur is a pk, use a sequence! if two users send this query almost at the same time, you'll get two times the same pk. That's because of oracles locking mechanism: Read does not block read. read does not block write. write does not block read. write blocks write on the same column. if someone inserts a row with your statement, and hasn't commited his transaction, and someone else inserts a row with your statment before he has commited, then the two will get the same results for max(id)+1. A sequence will never give the same result and is easy to use. and for your query, wouldn' this be easier: insert into acteursenc (nuacteur, nomacteur) values (S_ACTEURSENC.NEXTVAL, 'Michael Sweeney') please explain what you want to do. Michael "Michael Sweeney" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > My following query : > > insert into acteursenc (nuacteur,nomacteur) > (select AA, BB from > (select max(nuacteur)+1 AA from acteursenc), > (select 'Michael Sweeney' BB from acteursenc))" > > produces an ORA-1: unique constraint error. > > The primary key is nuacteur, but by setting AA to max(nuacteur)+1 I should > be getting a new key that is unique, however it does not seem that way. > > What am I doing wrong here? > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Ora_Fetch_Into function problem
if you are a newbie to oracle, don't forget to use bind variables in your queries, if this is possible in your Oracle Version. bindvars are placeholders for values in an oracle query, to which you bind your value on runtime. the advantage in using bind variables is, that oracle doesn't have to compile your query every time, but can reuse the compiled version of your query, simply bind the values and execute it. this is a main factor in writing highly scalable application with an oracle database backend, at least with Oracle8i. You can read more about that at http://asktom.oracle.com I'd provide a direct link, but i can't access the page at the moment... seems to be down. Michael "Michael P. Carel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 006a01c2055b$fbfcb280$[EMAIL PROTECTED]">news:006a01c2055b$fbfcb280$[EMAIL PROTECTED]... > > > > > > > > > ooopp...sorry just found out why. I just need to have Ora_Commit() > function after all the queries to totally set the data to the database. > Im querying a data which is not commited yet to the oracle database. > Sorry for that I'm just a newbie in oracle. > > Thanks to all.. > > mike > > > > > > I've recently found out that the Ora_Fetch_Into function cannot get a > small > > value of the tables data. We've tried to fetch other tables which have a > > large amount data ,and it succeeds. The queried values echoed > successfully. > > Is there any idea why? im using PHP4.2.1 oracle7.3.3 > > > > > > Regards, > > Mike > > > > > > > > > > > > > thanks miguel but i've already checked it, i've included return values > > > checking where it stop. Here's my full source test script. > > > There where no Ora_Error_Code returned. > > > > > > > > PutEnv("ORACLE_SID=PROD"); > > > PutEnv("ORACLE_HOME=/u01/app/oracle/product/7.3.3_prod"); > > > $connection = Ora_Logon("apps","apps"); > > > if($connection==false){ > > > echo Ora_ErrorCode($connection).":". > > Ora_Error($connection).""; > > > exit; > > > } > > > $cursor= Ora_Open($connection); > > > if($cursor==false){ > > > echo Ora_ErrorCode($connection).":". > > Ora_Error($connection).""; > > > exit; > > > } > > > $query = "select * from mikecarel"; > > > //$query = "select table_name from all_tables"; > > > $result = Ora_Parse($cursor,$query); > > > if($result==false){ > > > echo Ora_ErrorCode($connection).":". > > Ora_Error($connection).""; > > > exit; > > > } > > > $result=Ora_Exec($cursor); > > > if($result==false){ > > > echo Ora_ErrorCode($connection).":". > > Ora_Error($connection).""; > > > exit; > > > } > > > echo""; > > > echo"Full NameEmail Address"; > > > //$values=array(mike, tess); > > > while(Ora_Fetch_Into($cursor,$values)){ > > > $name = $values[0]; > > > $email = $values[1]; > > > echo "$name$email"; > > > echo "$email"; > > > print($name); > > > $result =1; > > > } > > > if(!$result==1) print("no result"); > > > echo""; > > > > > > ora_close($cursor); > > > ora_logoff($connection); > > > ?> > > > > > > > > > mike > > > > > > > > > > > > > Check the return values from your ora_logon, ora_open, ora_parse, and > > > > ora_exec calls to see whether they worked. That way you can know at > > > > which stage it stopped working. > > > > > > > > miguel > > > > > > > > On Mon, 27 May 2002, Michael P. Carel wrote: > > > > > Finally i've set-up my AIX server with PHP and oracle support. > Thanks > > > for > > > > > all who helps me for the configure setup. > > > > > Now I have a problem in oracle function regarding the retrieval of > > > entries > > > > > in the oracle table. The Ora_Fetch_Into function doesnt work > properly > > to > > > me > > > > > or i have an error in which i dont know. I've written below the > code > > > that i > > > > > used to test, it doesnt echo the value of $name and $email. My query > > > works > > > > > if i've enter it manually with my Oracle server. I really dont know > > why > > > im > > > > > just a newbie with this database(oracle) statement. > > > > > > > > > > Please help us here. Thanks in advance. > > > > > > > > > > > > > > PutEnv("ORACLE_HOME=/u01/app/oracle/product/7.3.3_prod"); > > > > > $connection = Ora_Logon("apps","apps"); > > > > > $cursor= Ora_Open($connection); > > > > > > > > > > $query = "select * from mikecarel"; > > > > > $result = Ora_Parse($cursor,$query); > > > > > $result=Ora_Exec($cursor); > > > > > echo""; > > > > > echo"Full NameEmail > Address"; > > > > > while(Ora_Fetch_Into($cursor,$values)){ > > > > > $name = $values[0]; > > > > > $email = $values[1]; > > > > > echo "$name$email"; > > > > > } > > > > > ora_close($cursor); > > > > > ora_logoff($connection); ?> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Regards, > > > > > mike > > > > > > > > > > > > > > > > > > > > > > > > -- > > > 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/
[PHP] Re: Ora_Fetch_Into function problem
have you tried compiling php with oci again, by installing the Oracle8i Client libraries? Should work as far as i have read. The oci interface is much better than the ora interface. And I am not familiar with the ora functions, only used to oci. Michael "Michael P. Carel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000f01c20542$77bf4780$[EMAIL PROTECTED]">news:000f01c20542$77bf4780$[EMAIL PROTECTED]... > Hi to all; > > Finally i've set-up my AIX server with PHP and oracle support. Thanks for > all who helps me for the configure setup. > Now I have a problem in oracle function regarding the retrieval of entries > in the oracle table. The Ora_Fetch_Into function doesnt work properly to me > or i have an error in which i dont know. I've written below the code that i > used to test, it doesnt echo the value of $name and $email. My query works > if i've enter it manually with my Oracle server. I really dont know why im > just a newbie with this database(oracle) statement. > > Please help us here. Thanks in advance. > > PutEnv("ORACLE_HOME=/u01/app/oracle/product/7.3.3_prod"); > $connection = Ora_Logon("apps","apps"); > $cursor= Ora_Open($connection); > > $query = "select * from mikecarel"; > $result = Ora_Parse($cursor,$query); > $result=Ora_Exec($cursor); > echo""; > echo"Full NameEmail Address"; > while(Ora_Fetch_Into($cursor,$values)){ > $name = $values[0]; > $email = $values[1]; > echo "$name$email"; > } > ora_close($cursor); > ora_logoff($connection); ?> > > > > > > > > Regards, > mike > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: how to display a file's last updated time using php?
look here: http://www.php.net/manual/en/ref.filesystem.php and especially here: http://www.php.net/manual/en/function.filemtime.php Michael "Rui Huang" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED]... > Hi, friends, > > I want to display the last updated time of a file using php, > but I don't know which function I should use. It seems that > the date() just show the current time. > > For html file, a simple javascript works well, but in php files > that script works weired. How to solve that problem? > > Thanks a lot. > > > > > > _ > Do You Yahoo!? > Get your free @yahoo.com address at http://mail.yahoo.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: arrays
> Can arrays be passed to functions just like a simple variable? yes, no difference. You can pass every variable to a function, you can pass constants or your values directly. You have to use a variable if a function requires passing by reference or if you want to pass by refernce, because only variables can take the value back. > Can arrays be passed as values in hidden form fields just like a > simple variable? yes, but differently. either you serialize the array, send it urlencoded to the page and unserialze it there: //page1.php: Page2 //or input field: //page2.php or you can appen urls like this, no serialization or sth needed then both pages: numerical indexed arrays: Page2 or Page 2 string indexed arrays: Page2 or with forms: numerical indexed arrays: or string indexed arrays: Michael "Michael Hall" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > A couple of simple ones here ... the usual references don't appear to give > a straightforward answer on these: > > Can arrays be passed to functions just like a simple variable? > > Can arrays be passed as values in hidden form fields just like a > simple variable? > > I've been playing around with these and getting inconsistent results. > I've been trying things like serialize and urlencode, but still haven't > worked out a straightforward 'rule' or policy. > > Can someone throw some light on this? > > TIA > Michael > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
but the scriptname itself will be included there. Try this, if you don't want the scriptname to be included.: $url = preg_replace('/^(http:\/\/)[^\/]+((\/[^\/])*\/)([^\/]+)$/', '\\1$SERVER_NAME\\2', $SCRIPT_URI); Haven't tested them, but should work. Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > typo: > > $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$/', '\\1$SERVER_NAME\\2', > $SCRIPT_URI); > > Michael > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > try: > > > > $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', > > $SCRIPT_URI); > > > > Michael > > > > "Jtjohnston" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > I want to detect the url my .php lies in. > > > > > > This is over kill and BS: > > > > > > $myurlvar = "http://".$SERVER_NAME.parse($SCRIPT_NAME); > > > > > > How do I get "http://foo.com/dir1/dir2/dir3/";. > > > > > > There seems to be nothing in phpinfo() that will give me a full url to > > > play with. > > > > > > Flame me if you will, but I browsed TFM and found nothing inspirational. > > > > > > Looked at phpinfo() too and got discouraged. > > > > > > I need a full url. > > > > > > John > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
typo: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$/', '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > try: > > $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', > $SCRIPT_URI); > > Michael > > "Jtjohnston" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I want to detect the url my .php lies in. > > > > This is over kill and BS: > > > > $myurlvar = "http://".$SERVER_NAME.parse($SCRIPT_NAME); > > > > How do I get "http://foo.com/dir1/dir2/dir3/";. > > > > There seems to be nothing in phpinfo() that will give me a full url to > > play with. > > > > Flame me if you will, but I browsed TFM and found nothing inspirational. > > > > Looked at phpinfo() too and got discouraged. > > > > I need a full url. > > > > John > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] inspirational
try: $url = preg_replace('/^(http:\/\/)[^\/]+(\/.*)$, '\\1$SERVER_NAME\\2', $SCRIPT_URI); Michael "Jtjohnston" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I want to detect the url my .php lies in. > > This is over kill and BS: > > $myurlvar = "http://".$SERVER_NAME.parse($SCRIPT_NAME); > > How do I get "http://foo.com/dir1/dir2/dir3/";. > > There seems to be nothing in phpinfo() that will give me a full url to > play with. > > Flame me if you will, but I browsed TFM and found nothing inspirational. > > Looked at phpinfo() too and got discouraged. > > I need a full url. > > John > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unexpected T_IF
you can look here: http://www.php.net/manual/en/tokens.php to see what T_IF means. 31: $FulflNme = $DOCUMENT_ROOT . $flNme you forgot the ; at the end of the line. Michael "Zac Hillier" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 002a01c203cf$4f1d7780$667ba8c0@ws">news:002a01c203cf$4f1d7780$667ba8c0@ws... Hmm, can anyone explain why I'm getting this error? Parse error: parse error, unexpected T_IF in /usr/local/htdocs/san.loc/upload-img.php on line 34 Code reads: 11:#--if form submitted then process file upload 12:if($HTTP_POST_VARS['ttl']) { 13: 14: #--check if there is already a picture called this 15: include $DOCUMENT_ROOT . 'incs/db.php'; 16: @mysql_select_db("infoNav") or die("unable to connect to table"); 17: $qry = "SELECT ttl FROM imgLst WHERE site = $HTTP_SESSION_VARS[site_no] AND ttl = '$HTTP_POST_VARS[ttl]';"; 18: $imgTst = MYSQL_QUERY($qry); 19: 20: if(mysql_numrows($imgTst) < 1) { 21: 22: #-- check file type 23: $ulf = $HTTP_POST_FILES['uplfile']['type']; 24: if($ulf == 'image/pjpeg' || $ulf == 'image/gif') { 25: 26: #-- get ext 27: ($ulf == 'image/pjpeg') ? $ext = '.jpg' : $ext = '.gif'; 28: 29: #-- create unique filename 30: $flNme = '\/imgs\/user-imgs\/' . time() . $REMOTE_HOST . $ext; 31: $FulflNme = $DOCUMENT_ROOT . $flNme 32: 33: #-- check file is realy uploaded for security then copy to store folder 34: if (is_uploaded_file($HTTP_POST_FILES['uplfile'])) { Thanks Zac -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Program execution stops at exec()
Must have overwritten this, but very good to know that. Thanx. Michael "Analysis & Solutions" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Fri, May 24, 2002 at 06:30:50PM +0200, Michael Virnstein wrote: > > > i think the exec in your php waits for the shell to return, but before the > > shell can answer, php terminates the script, because of the max_exection. > > http://www.php.net/manual/en/function.set-time-limit.php > > "... Any time spent on activity that happens outside the execution of > the script such as system calls using system(), the sleep() function, > database queries, etc. is not included when determining the maximum time > that the script has been running." > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Program execution stops at exec()
note: i think the exec in your php waits for the shell to return, but before the shell can answer, php terminates the script, because of the max_exection. Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > check your max_execution_time settings in php.ini > > Michael > > "Tom Mikulecky" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello > > > > In one script I use exec() to execute a shell script which takes 2-3 > > hours to run. I disabled user abort and set time limit to more than one > > day. The shell script finishes well but no instruction after exec() is > > run. The script finishes with no error nor warnings. > > Some of you know hwat happens? > > Thanx in advance. > > > > Tom > > > > Code snaps: > > > > > > ignore_user_abort(1); > > > > set_time_limit(10); > > > > (...) > > > > exec('/home/tom/build.sh >ouput 2>errlog');//takes 3 hours to > complete > > > > // *** Nothing from here gets executed, 'build.sh' script completed with > succes *** > > > > (...) > > > > I'm using php 4.0.4pl1(can't upgrade) with Apache 1.3.19 on Mandrake > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Program execution stops at exec()
check your max_execution_time settings in php.ini Michael "Tom Mikulecky" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello > > In one script I use exec() to execute a shell script which takes 2-3 > hours to run. I disabled user abort and set time limit to more than one > day. The shell script finishes well but no instruction after exec() is > run. The script finishes with no error nor warnings. > Some of you know hwat happens? > Thanx in advance. > > Tom > > Code snaps: > > > ignore_user_abort(1); > > set_time_limit(10); > > (...) > > exec('/home/tom/build.sh >ouput 2>errlog');//takes 3 hours to complete > > // *** Nothing from here gets executed, 'build.sh' script completed with succes *** > > (...) > > I'm using php 4.0.4pl1(can't upgrade) with Apache 1.3.19 on Mandrake > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] passing arrays
$myarray = unserialize(urldecode($_GET['myarray'])); or am i wrong? Regards Michael "Miguel Cruz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 23 May 2002, wm wrote: > > is there a way to pass arrays in forms or in the url? > > > > if i have $myarray=array("one","two","three"); > > > > can i pass the whole array at once as opposed to having to pass each > > individual element? > > > > Then in whatever.php: > > $myarray = unserialize($_GET['myarray']); > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Mail problem
refer to the manual of your email server and check for quota settings. You obviously reached the quota limit there and now you're not allowed to send any data, until the quota is reset. This may be on a daily or monthly basis or perhaps you have to do it manually. Regards Michael "Manisha" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I am doing email blast program. I wanted to blast 100 emails. For testing > purpose (I wanted to test how much time it takes), I blasted all 100 to my > account (That too twice) > > I received almost 100 over mails, but later on received - quota over - error. > > Now the problem is I can not get a single mail. I tried to test out with > sending out just one email, I also tried using other account, but now not > getting anything. > > What can be the problem and what shall I do now ? Is it that I have hang up > email server ? > > Thanks in advance, > Manisha > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] error in compling with oracle support
Found a better resource than me :) http://www.php.net/manual/en/ref.oci8.php Seems you have to install the Oracle8 Client Libraries to be able to call OCI8 interface Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > i think that Oracle 7.3.4.0.0 does not support the oci extension or vize > versa, > Oracle 8i does, that's what i know for sure. so try it without the > oci-extension. > If it works, use this funtions in your scripts: > http://www.php.net/manual/en/ref.oracle.php > > Regards Michael > > "Michael P. Carel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 002601c202d1$07c0ee20$[EMAIL PROTECTED]">news:002601c202d1$07c0ee20$[EMAIL PROTECTED]... > > can i now where and why? pls > > > > > > > ummm ur answer is in your question !! > > > > > > -Original Message- > > > From: Michael P. Carel [mailto:[EMAIL PROTECTED]] > > > Sent: Friday, 24 May 2002 12:56 PM > > > To: php > > > Subject: [PHP] error in compling with oracle support > > > > > > > > > Hi to All, > > > > > > Is there anyone know's why im receiving this error in compiling > PHP-4.2.1 > > > with oracle support in AIX. Im using oracle 7.3.4.0.0 . > > > Im having an configure error: Unsupported Oracle version! > > > > > > Here's my config script: > > > ./configure --with-apache=../apache_1.3.24 \ > > > --with-enable-track-vars --with-oci8=/u01/app/oracle/product/7.3.3_prod > \ > > > --with-oracle=/u01/app/oracle/product/7.3.3_prod > > > > > > Please help us and thank's in advance for those who reply. > > > > > > > > > > > > Regards, > > > Mike > > > > > > > > > -- > > > 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] error in compling with oracle support
i think that Oracle 7.3.4.0.0 does not support the oci extension or vize versa, Oracle 8i does, that's what i know for sure. so try it without the oci-extension. If it works, use this funtions in your scripts: http://www.php.net/manual/en/ref.oracle.php Regards Michael "Michael P. Carel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 002601c202d1$07c0ee20$[EMAIL PROTECTED]">news:002601c202d1$07c0ee20$[EMAIL PROTECTED]... > can i now where and why? pls > > > > ummm ur answer is in your question !! > > > > -Original Message- > > From: Michael P. Carel [mailto:[EMAIL PROTECTED]] > > Sent: Friday, 24 May 2002 12:56 PM > > To: php > > Subject: [PHP] error in compling with oracle support > > > > > > Hi to All, > > > > Is there anyone know's why im receiving this error in compiling PHP-4.2.1 > > with oracle support in AIX. Im using oracle 7.3.4.0.0 . > > Im having an configure error: Unsupported Oracle version! > > > > Here's my config script: > > ./configure --with-apache=../apache_1.3.24 \ > > --with-enable-track-vars --with-oci8=/u01/app/oracle/product/7.3.3_prod \ > > --with-oracle=/u01/app/oracle/product/7.3.3_prod > > > > Please help us and thank's in advance for those who reply. > > > > > > > > Regards, > > Mike > > > > > > -- > > 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
[PHP] Re: Passing Variables
and please, next time paste the error or tell us at least, if it is a php error or a mysql error and the line on which it occured and mark that line in your sample code, so someone can look at it , understand it and help you. Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $this usually is a self-reference inside a class. > Use it with care! > try to "echo $sql;", perhaps this tells you more. > > Regards Michael > > "James Opere" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > FC788AB9771FD6118E6F0002A5AD7B8F7268AB@ICRAFNTTRAIN">news:FC788AB9771FD6118E6F0002A5AD7B8F7268AB@ICRAFNTTRAIN... > > Hi All, > > I'm trying to pass variables from one form to the other.I have a problem > > when i want to do the the following: > > 1.COUNT($variable) > > 2.DISTINCT($variable) > > . > > I realise i can not use the brackets in my query and the variable be > > recognised.When i add COUNT without the brackets i still get an error. > > Example. > > test.html > > > > > > .. > > This is sent to : > > > > me.php > > > $db=mysql_connect('localhost','',''); > > mysql_select_db($database,$db); > > $sql="select COUNT($this) from $table group by $this"; > > > > ?> > > This gives an error. > > Please help. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing Variables
$this usually is a self-reference inside a class. Use it with care! try to "echo $sql;", perhaps this tells you more. Regards Michael "James Opere" <[EMAIL PROTECTED]> schrieb im Newsbeitrag FC788AB9771FD6118E6F0002A5AD7B8F7268AB@ICRAFNTTRAIN">news:FC788AB9771FD6118E6F0002A5AD7B8F7268AB@ICRAFNTTRAIN... > Hi All, > I'm trying to pass variables from one form to the other.I have a problem > when i want to do the the following: > 1.COUNT($variable) > 2.DISTINCT($variable) > . > I realise i can not use the brackets in my query and the variable be > recognised.When i add COUNT without the brackets i still get an error. > Example. > test.html > > > .. > This is sent to : > > me.php > $db=mysql_connect('localhost','',''); > mysql_select_db($database,$db); > $sql="select COUNT($this) from $table group by $this"; > > ?> > This gives an error. > Please help. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Learning PHP
you have to know what the function prototypes mean, and it is very easy to understand: int function(string varname, mixed varname2[[, array varname3], int varname4]); means the function returns a variable of type integer, which is the same as int. Just two names for the same thing. if int is specified, it also can be a resource like a database connection handle or a file handle. then comes the function name. in this case it's "function". then the parameter list. in this case, the first two arguments are required, the last two arguments are optional, which is shown by the [] brackets.a paramater definition first shows the type and then the name of the parameter. string varname, mixed varname2[[, array varname3], int varname4]] string varname = first argument is required and has to be a string mixed varname2 = second argument is required and could be any type or a list of types. e.g.: some functions could be called with an array or a string. array varname3 = third parameter is optional and has to be an array int varname4 = forth parameter has to be an integer and is optional why is it [[, array varname3], int varname4] and not [, array varname3][, int varname4]]: because you cannot call php functionparameters by name. you can only call them by order. e.g.: function("varname" => 'string', "varname2" => 1, "varname4" => 4); is not valid. php doesn't provide the feature of calling functions by name. you can work around that, but it is not implemented directly. so if you want to call the function but leaving the third parameter out, you have to set a default value for this parameter: function('string', 1, array(), 4); this works. so you have to pass the third parameter to be able to pass the forth. thats why it reads [[, array varname3], int varname4]]. the third is required for the forth. That's also why it is not possible to place optional parameters left and required parameters right: int function([[, array varname3], int varname4]],string varname, mixed varname2); varname and varname2 are always required and we have to pass them to the function. But to be able to do that, we also have to pass varname3 and varname4. function('string', 1); will fail. it'll pass 'string' to varname3 and 1 to varname4, leaving varname and varname2 unset. But that all can be found in the manual. This was just a little help to get started. :) What i find additionally useful are the user contributed notes, which are quite helpful sometimes. Especially for newbies. Regards Michael "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000801c20252$f859be40$0a6da8c0@lgwezec83s94bn">news:000801c20252$f859be40$0a6da8c0@lgwezec83s94bn... > Hey, > Welcome to PHP. > > I too am a newbie, I agree, php.net is too damn complex for a newbie, I > would suggest starting off on webmonkey as its really easy and has some > great examples for the beginner, then you can try to download the PHP manual > from php.net. > Nearly everyone I spoke to swears by the manual but I am using "PHP black > book" by peter moulding, coriolis and dreamtech publications, so far these 7 > chapters its really good, I do consult the manual a bit but am scared of it > :-) > > Hope that helped, > > -Ryan > > > > > > - Original Message - > From: "Darren Edwards" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Wednesday, May 22, 2002 4:17 PM > Subject: [PHP] Learning PHP > > > > hi ppl i am learning PHP and was wondering if there is a good book or web > > site that i could learn ALOT from. Not PHP.net coz the documentation is > > just too complex there for a beginner. > > > > > > > > -- > > 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: functions and scoping
Why not simply define a set of variables for root dir and the other directories, and use full paths in your includes? $root = "/wwwroot/mydomain/public/"; $homepageroot = "/"; $mydir = "subdir/"; now you can do: include $rootpath.$mydir."inc.php"; and ">Link or ">Link Regards Michael "David Huyck" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am trying to define a function that is *like* the standard PHP "include()" > function but is slightly different, but I am running into trouble with > varible scoping. The idea is this: > > I want to mimic "include()" in a way such that when I include a file, it can > then include files relative to itself, instead of relative to the root file > in the chain of includes. For example, if I do something like this: > > // we are here: /root/file.php > include("subDir/anotherFile.php"); > > // we are here: /root/subDir/anotherFile.php > include("diffSubDir/diffFile.php"); > > I get a warning saying that "diffSubDir" is not a valid directory, because > it is actually looking for "/root/diffSubDir/diffFile.php" when I mean to > include "/root/subDir/diffSubDir/diffFile.php". > > The first thing I did was this: > $myPath = getcwd()."/"; > chdir($myPath."subDir/"); > include("anotherFile.php"); > chdir($myPath); > > That's fine, but it's kind of kludgey, because I need to be really careful > not to do crush my $rootPath variable if I need to do it again inside my > include... So the next step was to protect the variable by making it local > to a function. Here is what I got: > > function myInclude($fileName) > { > //you are here > $rootPath = getcwd()."/"; > > //find where we need to go > $aryFilePath = split("/", $fileName); > $fileToInclude = array_pop($aryFilePath); > $includePath = join("/", $aryFilePath) . "/"; > > //do the include > chdir($rootPath.$includePath); > include($fileToInclude); > chdir($rootPath); > } > > So that's great! It does almost everything I want it to do, EXCEPT: the > variable scope within the includes is screwy. The file included in this > manner is local to the function, so it does not have inherent access to the > variables set before/after the call to myInclude(). That makes sense > conceptually, but it doesn't solve my problem. Declaring variables as > "global" doesn't really fix it because a) I want to keep this generic, so I > won't always know what variables to call as global, and b) if I call this > function from within an object, I want to keep my variables local to the > class, but not to the function call within the class. If I am in the class, > for example, and I declare a var as global, I just lost my encapsulation. > Yuck. > > What I really want is for this function to work just like the native PHP > "include()" function, where it does its thing without making its own scope. > Is there any way to do such a thing? I tried declaring and calling the > function as &myInclude(), but that didn't do it either. > > Am I out-of-luck, or is there some cool trick I haven't learned yet? > > Thanks, > David Huyck > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: substr....what does this mean? (newbie)
Hi, first take a look at this page: http://www.php.net/manual/en/function.substr.php > if (substr($text, -1) == ".") substr($text, -1) will return the last character in string $text. if it is a "." the if statement will evaluate to true and it'll do the following > {$test = substr($text, 0, -1);} $test = substr($text, 0, -1) will return all characters of $text but the last one and write them to $test. a negative third parameter means ommitting characters from the end of the string. The end of the string depends on the second parameter, which tells us where to start. if it is positive, start is the start and end is the end of the string, if it is negative start is the end and end is the start of the string Regards Michael P.S. the manual is your friend, learn how to read it!!! "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn">news:000701c2015c$fd2e1570$0a6da8c0@lgwezec83s94bn... > Hi ppl, > Can you tell me what does this mean? > > if (substr($text, -1) == ".") > {$test = substr($text, 0, -1);} > > I know the if part searches the $text from the starting for the "." > I am just confused about what the second and third arguement does in the > substr. (Second line) > > I know that this is an easy question for you PHP guys out there, > and I know i will get an answer, > so I thank you all in advance. > > Cheers > -Ryan A. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: JavaScript vs. Header redirect
note: you should use $array["test"] if test is a string and $array[test] if test is a constant. do not use $array[test] if you mean the string "test". $array[test] will also work, if "test" is a string. Php then tries to look for a constant with name "test", won't find one and evaluate "test" as string. But as soon as you define a constant with the name "test", it won't work as expected: $array = array(); $array["test"] = "hello"; define("test", "thetest"); $array[test] = "bye"; print_r($array); will output: Array ( [test] => hello [thetest] => bye ) This could also happen if the php dev team decides to set a constant with the name "test". Therefore always use "" for string-keys in arrays. Regards Michael "Hunter Vaughn" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there any reason I can't just use a JavaScript redirect from a PHP login > handling script since I can't seem to get the header("Location: URL"); > function to work? Any security concerns or anything else? As far as I can > tell, all calls to header fail as soon as I attain variables based on a POST > submission. See example below. > > $username = $_POST[username]; > $password = $_POST[password]; > > if(some username/password format verification) { > query the database > if($password matches pass in database) { > session_start(); > $email = $Row[0]; > $memberID = $Row[1]; > session_register('email'); > session_register('memberID'); > //header("Location: URL");This doesn't work. > print("window.location = > \"http://depts.washington.edu/bionano/HTML/letsboogie22.html\";;"); > exit; > } > else { > print("That didn't work..."); > } > } > else { > print("Please enter your username & password."); > } > ?> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executebale code from a databse
eval ('?>'.$var.' then comes the content of the php script which also can contain html and then we reopen and you say $var = ""; you'll result in ... eval("?> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi. > I'm changing my website to one based on My-SQL which will help with > organization and searching etc. Hopefully, the code for all the pages will > be stored in the database too. > However, I cannot get PHP to parse / execute the code stored in the > database. The script > > $query = mysql_query("SELECT * FROM pages", $link); > $result = mysql_fetch_array($query); > print $result['4']; > > gets the content of the page (column 4 of the database) but displays > > include("common/counter.php"); include("common/navbar.php"); > > to the screen instead of opening and including these two files in the > output. > > Is there something I need to do to the result to make it executable? Might I > need a \n between the two lines of code? > > I'm using Win 98, Apache 1.3.19, PHP 4.2.0 and MySQL but I'm not sure which > version! (fairly recent though) > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: variables
you can use $_POST['name1'] if you're using post vars $_GET['name1'] if you're using get vars Regards Michael "Roman Duriancik" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > When are set in php.ini (php version 4.2.1 on linux) register_globals = Off > how > I read variables from html files with forms in other php file ? > > Thanks > > roman > > for example : > > html file : > > > > > > > and in php file > echo $name1; > ?> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $answers[answer$n]
answers$n. php tries to concate the constant answers with the variable $n, but you forgot the concatenation operator ".". i assume that answers should be a string and is not a constant, therefore $answer["answers".$n] is right. if answers is a constant use $answer[answers.$n]; but a better way of what you try to accomplish would be a array using two dimensions: $answer["answers"][$n] $answer["question"][$n] ...etc or if you only have "answers" as key use: $answer[$n] if you want to send form data as array, using more than one dimension, do the following: or Which is pretty much the same. now on the processing page you can do: ForEach($answers as $val) { Foreach ($val as $answer) { // do something with one of the answers } } Regards Michael "Jule" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 02051716404700.28871@localhost">news:02051716404700.28871@localhost... Hey guys, i'm getting this error whe i try to access this variable. $answers[answer$n] Parse error: parse error, expecting `']'' in /home/blindtheory/web/quiz/add_quiz/add_quiz_process_2.php on line 36 the variable $answer[answers$n] comes from a form on the preceding page in which a number of answers has been entered. the number of answers is up to the user and can vary from 2 to 15. not the $n comes from a for loop whcih enteres the answers into a database since i do not know how many answers each user has used. why am i getting this error? and is there a way around it? following is the for() loop in which this story takes place. thanks Jule --SCRIPT-- for ($n = 1; $n <= $quiz[number_answers]; $n++) { $table = "$quiz[code]_answers"; $value = "$answers[answer$n]"; $query_alter_table = "ALTER table $table ADD answer$n TEXT NUT NULL"; $query_add_answers = "INSERT INTO $table (answer$n) VALUES($value)"; if (mysql_db_query($database_glob, $query_alter_table, $link_glob) AND (mysql_db_query($database_glob, $query_add_answer, $link_glob)); echo "Answer $n has successfully been added to the Quiz\n"; } else { echo mysql_error(); } echo "Click here to continue"; } --SCRIPT-- -- |\/\__/\/| | Jule Slootbeek | | [EMAIL PROTECTED] | | http://blindtheory.cjb.net | | __ | |/\/ \/\| -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] document root variable or function
$_SERVER["DOCUMENT_ROOT"] "Jason Wong" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Friday 17 May 2002 20:56, [EMAIL PROTECTED] wrote: > > Is there a variable in PHP which will show the directory of the document > > root? I have done a few searches and before I go looking harder I thought > > I'd ask. My problem is that I am using both windows, IIS and linux, Apache. > > I tried a few things like $document_root which didn't seem to work but I > > didn't try very hard :) > > phpinfo() > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.com.hk > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > > /* > the router thinks its a printer. > */ > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
-q? this is for disabling the html headers, right? "James E. Hicks III" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > #!/path.to/php -q > > I'd like to suggest the -q option for PHP shell scripts, which I rely on every > day. > > James > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file error
That's what i found about file(): Tip: You can use a URL as filename with this function if the "fopen wrappers" have been enabled. See fopen() for more details. So check your php.ini settings. If you're hosted by a hosting company and they failed to enable the fopen wrappers, you can overwrite their php.ini with your own. Simply place a file called php.ini in the document_root of your domain and this php.ini will get loaded instead of the php.ini of your hosting company. Nice and undocumented feature, which i found here in this list a few weeks ago. Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > i do not know if file() can be used with files on remote servers. > fopen() can, if this feature is enabled in php.ini. > > Regards Michael > > "Roman Duriancik" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I have this code : > > $text = file("http://www.hokej.sk/spravy/?id=16159";); > > echo count($text); > > for ($i=0;$i >echo $text[$i]; > > endfor; > > > > when in file commnad i insert page from local net or our web server this > > script run correctly but if i insert page from internet i have this error > > event > > > > Warning: php_hostconnect: connect failed in > > d:\programovanie\php\ftp\skuska.php on line 2 > > > > Warning: file("http://www.hokej.sk/spravy/?id=16159";) - Bad file > descriptor > > in d:\skuska.php on line 2 > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file error
i do not know if file() can be used with files on remote servers. fopen() can, if this feature is enabled in php.ini. Regards Michael "Roman Duriancik" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have this code : > $text = file("http://www.hokej.sk/spravy/?id=16159";); > echo count($text); > for ($i=0;$iecho $text[$i]; > endfor; > > when in file commnad i insert page from local net or our web server this > script run correctly but if i insert page from internet i have this error > event > > Warning: php_hostconnect: connect failed in > d:\programovanie\php\ftp\skuska.php on line 2 > > Warning: file("http://www.hokej.sk/spravy/?id=16159";) - Bad file descriptor > in d:\skuska.php on line 2 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
> the only thing that can smash th whole thing imo, is if you try to use the > cgi version via web if you have php also installed as apache module. if anyone has infos here, it'll be really nice. Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > afaik yes. > The module version should be called if apache has been requested with one of > the > reqistered php file types. the cgi version can be used as shell interpreter. > the only thing that can smash th whole thing imo, is if you try to use the > cgi version > via web if you have php also installed as apache module. but all of what i > wrote is a guess, > never tried by myself. > > Regards Michael > > > "Jay Blanchard" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt">news:000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt... > > [snip] > > > but this is only needed only if you compile php into apache or am i > wrong? > > > if i have the cgi version installed, i can call the php script > > > directly from the shell. The only thing for me to do then, is to set > > > #!/path.to/php in the first line of the script, right? > > [/snip] > > > > Can you have the compiled with apache version and the CGI version > installed > > on the same server? > > > > Thanks! > > > > Jay > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
afaik yes. The module version should be called if apache has been requested with one of the reqistered php file types. the cgi version can be used as shell interpreter. the only thing that can smash th whole thing imo, is if you try to use the cgi version via web if you have php also installed as apache module. but all of what i wrote is a guess, never tried by myself. Regards Michael "Jay Blanchard" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt">news:000601c1fd9b$70cb89b0$8102a8c0@niigziuo4ohhdt... > [snip] > > but this is only needed only if you compile php into apache or am i wrong? > > if i have the cgi version installed, i can call the php script > > directly from the shell. The only thing for me to do then, is to set > > #!/path.to/php in the first line of the script, right? > [/snip] > > Can you have the compiled with apache version and the CGI version installed > on the same server? > > Thanks! > > Jay > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using php as a scripting language within cron jobs?
> Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need > lynx installed for this to work :-) but this is only needed only if you compile php into apache or am i wrong? if i have the cgi version installed, i can call the php script directly from the shell. The only thing for me to do then, is to set #!/path.to/php in the first line of the script, right? Regards Michael "Jon Haworth" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS">news:67DF9B67CEFAD4119E4200D0B720FA3F010C40D4@BOOTROS... > Hi Henry, > > > Is this possible? > > yup. > > Set your cron job up as "lynx -dump http://www.myserver.com/myscript.php > > /dev/null" (or pipe it to a logfile if you fancy) - obviously, you'll need > lynx installed for this to work :-) > > Cheers > Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: search engine indexing and redirects
> i would have thought that server-side redirects are no problem for crawlers. That's what i would have thought too. mod_rewrite is an alternativ for virtual domains. if you request www.mydomain.com it doesn't matter to the server if you have virtual domains or mod_rewrite. both got redirected to the local directory. If you're using virtal domains, you say www.mydomain.com's document_root is /wwwroot/mydomain_com/. If you're using mod_rewrite you say the same, but you have a rule which translates the url to it's document_root path, so you don't have to set virtual domains for every domain on the server. imo there's no other difference, so it also shouldn't make any difference to any user, no matter if it's a crawler or regular user. Regards Michael "Adrian Murphy" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 001301c1fd8e$9f14ac00$02646464@ade">news:001301c1fd8e$9f14ac00$02646464@ade... Hi all, firstly: i know nowt about search engines/crawlers spiders really. i'm giving users fake sub-domains i.e www.username.mysite.com gets redirected to www.mysite.com/users/sites/username via mod_rewrite/wildcard dns so i'm wondering if search engines will have any trouble indexing those sites. i was talking to an 'internet consultant' who has a flash red sports car and earns about 5 times more than me and he said i should look into this. i would have thought that server-side redirects are no problem for crawlers. i set up a google adwords thingy for one of the sites and it worked for a while but now they've come back to me saying the url doesn't work when it clearly does.i've asked the google folks about this and am waiting for them to get back. was just wondering if anyone had experience of this sort of thing. thanks adrian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Need help with Arrays
1. your while loop should have {} brackets i can't see where it starts and where it ends. so does PHP. leaving brackets away tells PHP that only the next line is part of the while loop. i don't know if your file has only the three lines ($cust_name, $cust_area, $cust_code) or if more than one customer is in your file and every customer has these three lines. if you only have one customer with these three lines, you don't need the while loop, just leave while(!feof($fp2)) away. if there are multiple customers in the file and every customer has these three lines, you should close the while brackets after the switch but before the return. 2. if($cust_code==$code[$index]) is wrong here. you haven't initilized $index as far as i can see, so you get: if($cust_code==$code[null]) what you want to do is checking the array $code for the content $cust_code and getting the index of that element. so it'd be better to do: $row=array_search($cust_code, $code); so try this:(assuming that you have more than one customer in the file and every customer has the three lines. function inquiry($fp2,$date,$name,$code) { while(!feof($fp2)) { $cust_name=trim(fgets($fp2,12)); $cust_area=trim(fgets($fp2,9)); $cust_code=trim(fgets($fp2,6)); if(in_array($cust_code, $code)) { $row=array_search($cust_code, $code); } switch($cust_area) { case "National": print "national"; printf("%1s %1f", $name[$row], $cust_cost[$row][1]); break; case "East": print"East"; printf("%1s %1f", $name[$row], $cust_cost[$row][2]); break; case "Midwest": print"midwest"; printf("%1s %1f", $name[$row], $cust_cost[$row][3]); break; case "Pacific": print"pacific"; printf("%1s %1f", $name[$row], $cust_cost[$row][4]); break; } } return; } "Tony" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello, I'm new to this group and already have a problem (actually the > problem is the reason I found the group). I'm taking a Fundamentals of > Programming class, and they are using PHP to get the message across. I'm > having a lot of trouble passing the values in the first array to the second > array. I included the code (below). If anyone would be so kind as to give me > some advice (I'm NOT looking for someone to write it for me, just some > helpful advice). The data is being read in correctly (for the first array > anyway). The first function works wonderfully, the second function is > supposed to handle customer inqueries, working from the $code/$cust_code > variables. I need to match the numbers in these two arrays, and use switch > on $cust_area to let it know what to print. > > > Thanks > > Tony > + > > > > > > > $fp1=fopen("proj10b.dat","r"); > $fp2=fopen("proj10b2.dat","r"); > $date=date("m-d-Y"); > > headers($date); > main($fp1,&$name,&$code); > inquiry($fp2,$date,$name,&$code); > fclose($fp1); > fclose($fp2); > > function headers($date) > { > print"DENTAL FEES BY REGION as of Date: $date"; > print" Printed by: Tony Hall"; > print" "; > print" National > New"; > print"Code -Procedure Median > EnglandMidwest Pacific"; > print" "; > return; > } > > function main($fp1,$name,&$code) > { > for($index=0;$index<43;$index++) > { > $name[$index]=(string)fgets($fp1,42); > $code[$index]=(string)fgets($fp1,6); > $nat_cost[$index][1]=(integer)fgets($fp1,4); > $east_cost[$index][2]=(integer)fgets($fp1,4); > $mid_cost[$index][3]=(integer)fgets($fp1,4); > $pac_cost[$index][4]=(integer)fgets($fp1,4); > printf("%1s - %10s %10s %10s %10s %10s", $code[$index], > $name[$index], $nat_cost[$index][1], $east_cost[$index][2], > $mid_cost[$index][3], $pac_cost[$index][4]); > print" "; > } > return; > } > > function inquiry($fp2,$date,$name,$code) > { > while(!feof($fp2)) > > $cust_name=trim(fgets($fp2,12)); > $cust_area=trim(fgets($fp2,9)); > $cust_code=trim(fgets($fp2,6)); > > if($cust_code==$code[$index]) > { > $row=$index; > } > > switch($cust_area) > { > case "National": > print "national"; > > printf("%1s %1f", $name[$row], $cust_cost[$row][1]); > break; > > case "East": > print"East"; > > printf("%1s %1f", $name[$row], $cust_cost[$row][2]); > break; > > case "Midwest": > print"midwest"; > > printf("%1s %1f", $name[$row], $cust_cost[$r
[PHP] Re: question about objects and references
here's an example of what i said: a += 1; } function byRef(&$obj) { echo $obj->a += 1; } /// $a = &new obj(); $a->byVal(); echo ""; echo $a->a; echo ""; $a->byRef(); echo ""; echo $a->a; ?> Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > "Sascha Mantscheff" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 02051311162204.02523@pico">news:02051311162204.02523@pico... > > > > When I pass an object as a parameter to a function as "$this", this is an > > object reference (according to the docs). > > it depends on the function. if you call it by value, not by reference, > then the function will contain a copy of the original not a pointer. > Doesn't matter if you call the function with $this or some other reference. > $this is a self-reference to the object. you can only use it inside the > object itself. > but as soon as you send it to a function as "by value"-parameter, a copy of > the > object will be used inside the function. if you call the function "by > reference" > you'll hold a pointer inside the function > > > I store this reference in a local variable called $someObject. $someObject > > now contains an object pointer. > > Ok, let's say the parameter is send to the functions "by reference". Then > you are > right, it'll point to the original object, but: > > function (&$objRef) { > $blah = $objRef; > } > -> $blah will hold a copy! > > function (&$objRef) { > $blah = &$objRef; > } > -> $blah will hold a reference! > > > I pass $someObject to another function. Is this a reference to the > original > > $this, or is it a copy of the object? > > Read what i wrote above and answer it yourself. > > Regards Michael. > > > All function calls are by value, not by reference (without the "&" name > > modifier). > > > > > > s.m. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: question about objects and references
"Sascha Mantscheff" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 02051311162204.02523@pico">news:02051311162204.02523@pico... > When I pass an object as a parameter to a function as "$this", this is an > object reference (according to the docs). it depends on the function. if you call it by value, not by reference, then the function will contain a copy of the original not a pointer. Doesn't matter if you call the function with $this or some other reference. $this is a self-reference to the object. you can only use it inside the object itself. but as soon as you send it to a function as "by value"-parameter, a copy of the object will be used inside the function. if you call the function "by reference" you'll hold a pointer inside the function > I store this reference in a local variable called $someObject. $someObject > now contains an object pointer. Ok, let's say the parameter is send to the functions "by reference". Then you are right, it'll point to the original object, but: function (&$objRef) { $blah = $objRef; } -> $blah will hold a copy! function (&$objRef) { $blah = &$objRef; } -> $blah will hold a reference! > I pass $someObject to another function. Is this a reference to the original > $this, or is it a copy of the object? Read what i wrote above and answer it yourself. Regards Michael. > All function calls are by value, not by reference (without the "&" name > modifier). > > > s.m. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: XML-parser
http://sourceforge.net/projects/phpxpath/ <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > I´m working on a little web shop solution for a school project, therefore > I´m looking for > a PHP XML-Parser or some source code I can get from somewhere. > > Has anybody a good link to a tut or something else.. > > -- > Thanks in advance for your help, > kind regards Marcos > > GMX - Die Kommunikationsplattform im Internet. > http://www.gmx.net > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with sessions.
php4 sessions or self made? own session_set_save_handler? Let us see the login code! Ok...that's how i would do it: After successful login i'd register a variable or set the registered variable to a specific value. Now i check on every page: If (!IsSet($_SESSION["myLoginVar"] ) || $_SESSION["myLoginVar"] != "myval") { //login page } Else { // logged in } Regards Michael "Ben Edwards" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am using sessions for holding who is logged in and it is kind of > working. I have got a few emails from customers saying they cant log in > (and seeing as we have had less than 30 orders this is a real problem). I > can log in OK and cant recreate this problem. Any ideas regarding what > this could be would be much appreciated. > > I guess if you have cookies turned of it wont work but what else may cause > a problem. > > Regards, > Ben > > > * Ben Edwards +44 (0)117 9400 636 * > * Critical Site Builderhttp://www.criticaldistribution.com * > * online collaborative web authoring content management system * > * Get alt news/viws films onlinehttp://www.cultureshop.org * > * i-Contact Progressive Video http://www.videonetwork.org * > * Smashing the Corporate image http://www.subvertise.org * > * Bristol Indymedia http://bristol.indymedia.org * > * Bristol's radical news http://www.bristle.org.uk * > * PGP : F0CA 42B8 D56F 28AD 169B 49F3 3056 C6DB 8538 EEF8 * > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Hey PHP PPL - Great Question !!!
if you need access to your session among different servers, it's the best way to store session data inside a database, so every server can access it easily. The file container is accessible only for local users on the server, at least when you set up normal server configuration and not some nasty stuff with servers shareing hdds or partitions or something. There's no other difference between the file container and the database container. Perhaps the database driven container is running a bit slower, for you have to connect to the database, and that costs some time, at least if you don't use persistent connections. Persistent connections are only possible if you're running PHP as Apache Module, not in CGI version. So it's up to you to decide what you need. Regards Michael "Vins" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > For example: > > one form... > - First name > - last name > - address > - country > - phone > - email > - mobile number > > After you click submit on the first page, it sends you to a preview data > page where you can check all the data. > instead of inserting tons of hidden input form fields and waist download > time, use a session. > > after the button on the preview page is clicked, submit to a save page, > where data will be entered into a db > but all values my be called from the session. > > now would it be wise, faster and more safer to use a database or a file to > save the sessions ? > > > > > "Vins" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Session Data. > > > > What is the best. > > to save in database, or to save as file ??? > > > > let me know. > > > > Cheerz > > Vins > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Date and Time
seems like you echo an 1 before print $time is called. Look through your code, there must be something printed or echod. Perhaps it's simple some html (?>1 schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi all, > > Anyone know any reason that the date function would return 2am in the > morning as 102 if i use it in the following manner? > > $time=date("H:i:s"); > print $time; > > > this outputs 102:14:51 instead of 02:14:51, anyone know where the 1 comes > from? and why its there? > > > Cheers From > > baldey_uk > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Callin PHP gurus...figure this out
nice one! didn't notice this function yet! Regards Michael "John Holmes" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000101c1ed33$e2f13c60$b402a8c0@mango">news:000101c1ed33$e2f13c60$b402a8c0@mango... > Use wordwrap() to wrap the text to 75 characters and str_replace() to > replace " with ' > > www.php.net/wordwrap > www.php.net/str_replace > > ---John Holmes... > > > -Original Message- > > From: r [mailto:[EMAIL PROTECTED]] > > Sent: Friday, April 26, 2002 3:08 PM > > To: [EMAIL PROTECTED] > > Subject: [PHP] Callin PHP gurus...figure this out > > > > Greetings All, > > (Special greetings go out to Steve for excellient previous help - > Thanks > > again dude) > > Calling all PHP gurus, have broked my head over this but cant seem to > > figure > > this out in c,perl or java servlets. > > Am new to PHP so dont even know the common functions leave alone the > > answer > > to this problem. > > Heres the setup: > > I have a form with just one TEXTAREA > > Data from this form is entered directly into the database > > > > BUT... > > > > everytime a user presses the ENTER or RETURN key on the keyboard, when > the > > PHP script validates the form > > I want it to add it should also add a if the line is > > say75 > > charactors long & if there is no or enter key pressed.. > > If it finds any " it should convert it to ' > > > > Any ideas? > > > > Any help appreciated. > > Have a great day. > > -Ryan A. > > > > > > -- > > 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: Callin PHP gurus...figure this out
this is wrong: > foreach ($lines as $line) { > if (strlen($line) > $maxchars) { > $newtext .= substr($line, 0, $maxchars)."\n"; > $newtext .= substr($line, $maxchars)."\n"; > } > } try this: foreach ($lines as $line) { if (strlen($line) > $maxchars) { $newtext .= substr($line, 0, $maxchars)."\n"; $newtext .= substr($line, $maxchars)."\n"; } else { $newtext .= $line."\n"; } } Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > if you want to write into the database, i wouldn't convert newline to . > do this > when you read from the database using nl2br($var) ot convert every newline > in $var to . > default after 75 characters if no was found before. > if you don't care about word-splitting, you could do the following: > > //INSERT TO DATABASE > //max number of chars per line > $maxchars = 75; > //lets say $var is the content of your textarea > $lines = explode("\n", $var); > > // text we want to write to the db > $newtext = ""; > > foreach ($lines as $line) { > if (strlen($line) > $maxchars) { > $newtext .= substr($line, 0, $maxchars)."\n"; > $newtext .= substr($line, $maxchars)."\n"; > } > } > > > // SELECT FROM DATABASE > > //lets say $var is the selected content > echo nl2br($var); > > This is very simple solution. It won't look for words and splits after the > word > and if your line is 76 chars long, it'll convert it into two lines, onw with > 75 chars > and one with 1 char. but it's a start i think. > > Regards Michael > > > > > "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn... > > Greetings All, > > (Special greetings go out to Steve for excellient previous help - Thanks > > again dude) > > Calling all PHP gurus, have broked my head over this but cant seem to > figure > > this out in c,perl or java servlets. > > Am new to PHP so dont even know the common functions leave alone the > answer > > to this problem. > > Heres the setup: > > I have a form with just one TEXTAREA > > Data from this form is entered directly into the database > > > > BUT... > > > > everytime a user presses the ENTER or RETURN key on the keyboard, when the > > PHP script validates the form > > I want it to add it should also add a if the line is > say75 > > charactors long & if there is no or enter key pressed.. > > If it finds any " it should convert it to ' > > > > Any ideas? > > > > Any help appreciated. > > Have a great day. > > -Ryan A. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Callin PHP gurus...figure this out
forgot the " to ' conversion: // this should do the job quite fine. $var = str_replace ("\"", "'", $var); Regards Michael "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > if you want to write into the database, i wouldn't convert newline to . > do this > when you read from the database using nl2br($var) ot convert every newline > in $var to . > default after 75 characters if no was found before. > if you don't care about word-splitting, you could do the following: > > //INSERT TO DATABASE > //max number of chars per line > $maxchars = 75; > //lets say $var is the content of your textarea > $lines = explode("\n", $var); > > // text we want to write to the db > $newtext = ""; > > foreach ($lines as $line) { > if (strlen($line) > $maxchars) { > $newtext .= substr($line, 0, $maxchars)."\n"; > $newtext .= substr($line, $maxchars)."\n"; > } > } > > > // SELECT FROM DATABASE > > //lets say $var is the selected content > echo nl2br($var); > > This is very simple solution. It won't look for words and splits after the > word > and if your line is 76 chars long, it'll convert it into two lines, onw with > 75 chars > and one with 1 char. but it's a start i think. > > Regards Michael > > > > > "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > 000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn... > > Greetings All, > > (Special greetings go out to Steve for excellient previous help - Thanks > > again dude) > > Calling all PHP gurus, have broked my head over this but cant seem to > figure > > this out in c,perl or java servlets. > > Am new to PHP so dont even know the common functions leave alone the > answer > > to this problem. > > Heres the setup: > > I have a form with just one TEXTAREA > > Data from this form is entered directly into the database > > > > BUT... > > > > everytime a user presses the ENTER or RETURN key on the keyboard, when the > > PHP script validates the form > > I want it to add it should also add a if the line is > say75 > > charactors long & if there is no or enter key pressed.. > > If it finds any " it should convert it to ' > > > > Any ideas? > > > > Any help appreciated. > > Have a great day. > > -Ryan A. > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Callin PHP gurus...figure this out
if you want to write into the database, i wouldn't convert newline to . do this when you read from the database using nl2br($var) ot convert every newline in $var to . default after 75 characters if no was found before. if you don't care about word-splitting, you could do the following: //INSERT TO DATABASE //max number of chars per line $maxchars = 75; //lets say $var is the content of your textarea $lines = explode("\n", $var); // text we want to write to the db $newtext = ""; foreach ($lines as $line) { if (strlen($line) > $maxchars) { $newtext .= substr($line, 0, $maxchars)."\n"; $newtext .= substr($line, $maxchars)."\n"; } } // SELECT FROM DATABASE //lets say $var is the selected content echo nl2br($var); This is very simple solution. It won't look for words and splits after the word and if your line is 76 chars long, it'll convert it into two lines, onw with 75 chars and one with 1 char. but it's a start i think. Regards Michael "R" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn">news:000b01c1ed6e$d21595e0$0a6da8c0@lgwezec83s94bn... > Greetings All, > (Special greetings go out to Steve for excellient previous help - Thanks > again dude) > Calling all PHP gurus, have broked my head over this but cant seem to figure > this out in c,perl or java servlets. > Am new to PHP so dont even know the common functions leave alone the answer > to this problem. > Heres the setup: > I have a form with just one TEXTAREA > Data from this form is entered directly into the database > > BUT... > > everytime a user presses the ENTER or RETURN key on the keyboard, when the > PHP script validates the form > I want it to add it should also add a if the line is say75 > charactors long & if there is no or enter key pressed.. > If it finds any " it should convert it to ' > > Any ideas? > > Any help appreciated. > Have a great day. > -Ryan A. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: include() and require() problem
be sure that the path to the include file is relative to the script that was requested by the user. that's important if you include include-files into included files. you then have to make sure that the path to your include-file in the include-file is relative to the file that included the file, in which the include-file is included. *lol* what a sentence. anyway, hope you get my meaning! another problem is using include "/myincfiles/myfile.inc"; this way it could be searched in the root of the server, where for sure your file can't be found. use relative path instead: include "./myincfiles/myfile.inc"; "./" means the same directory. or use an absolute path, which has to contain the whole path from the server's root, e.g.: include "/wwwroot/somedir/yourdocroot/myincfiles/myfile.inc"; Regards Michael "Rodrigo Peres" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > List, > > I'm trying to include some .inc files in my project, but I got errors > all time saying that this includes couldn't be found. I'm a newbie, so I > can't understand what's happend, since it worked pretty good in my local > machine and not in the ISP. I tried to speak to ISP many times but they > couldn't solve to. > My directorie structure is : HRM(directorie)->includes(directorie)->my > inc files(to be included in files that is in the directorie HRM). > > Thank's > > Rodrigo > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Executing a time intensive script
you 'd need process forking, which is has to be compiled into php and which should/could not be used within a webserver environement. i don't know your scripts will work, if you call process_function after including auth_user.php. if it works, i'd do it this way: Regards Michael "Zach Curtis" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I have three scripts login.php, auth_user.php, and function.php. The > login.php script does user authentication and routes the user to > auth_user.php. The function.php script, which contains process_function(), > does some very intensive data processing and may take from 30 seconds to 3 > minutes to run. > > Here's what I have tried to do: > > // login.php script > > require("function.php"); > ... > ... do some authentication stuff > ... > > process_function(); // makes user wait too long to get to the authenticated > area > > include("auth_user.php"); // takes user to authenticated area > > > If I try to run the process_function() from the login.php script, the script > takes too long to run. How can I get this function to run so it does not > interfere with user logging in? Is there a way to get the function to > execute and let it run on its own within login.php and let the user continue > on to the authenticated area without that delay? > > Another thought I had was to get the function.php script that contains the > function to execute on its own based on time (e.g., run every hour on the > hour). Is there a way to do that? > > Thank you. > > _ > Zach Curtis > Programmer Analyst > POPULUS > www.populus.com > _ > > Confidentiality Statement: > > This e-mail message and any attachment(s) are confidential and may contain > proprietary information that may not be disclosed without express > permission. If you have received this message in error or are not the > intended recipient, please immediately notify the sender by replying to this > message and then please delete this message and any attachment(s). Any use, > dissemination, distribution, or reproduction by unintended recipients is not > authorized. > Thank you. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
you have to call session_start() before you send any output to the browser, because it sends some headers. "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am now getting the following errors on every page: > > Warning: Cannot send session cache limiter - headers already sent (output > started at c:\program files\apache > group\apache\htdocs\webmissions\picupload\miss_pic_upload.php:25) in > c:\program files\apache > group\apache\htdocs\webmissions\picupload\miss_pic_upload.php on line 81 > > > This is when I use the following block of code to first SET the session for > the very first time: > > if (mysql_num_rows($results) == 0) { > // Could not find info in db redirect to login library with error msg > $errorHTML .= "We could not find your information "; > $errorHTML .= " in our database. Please try again."; > $hasLoggedIn = 0; > } else if (strcmp(session_name(), "hasLoggedIn") != 0) { > // Set up session variable with username and redirect to pic upload lib > session_name("hasLoggedIn"); > $name = session_name(); > session_start(); > $HTTP_SESSION_VARS["username"] = $username; > $HTTP_SESSION_VARS["ip"] = $REMOTE_ADDR; // To prevent session stealing > } > > I am completely confused! > > Phil > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > you have to put this on top of every of your pages: > > - > > session_name("hasLoggedIn"); > > $stuff = session_name(); > > session_start(); > > - > > session_name first sets the name. then you call session_start which will > > look for the > > sessionid in ${session_name()}. that is why you have to call > session_name() > > BEFORE calling > > session_start(); > > > > Regards Michael > > > > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Thanx, however, I cannot retain the session_name when I go to the next > > URL. > > > How do I retain the session_name especially when I have to use a form > > > method=POST? > > > > > > I have a URL that will be the login > > > > > > Once you login you will have a session (that works now) > > > > > > That page with the session will have a form with five type > > form > > > elements > > > > > > Once submitted you will be at a "thank-you" page and files uploaded, but > > > then the session is gone (session_name is back to PHPSESSID again) > > > > > > What do I do to keep it? I cannot use cookies and putting it in the URL? > > > > > > Phil > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > session_name will retur the previos name of the session, so in your > case > > > > $stuff will contain "PHPSESSID" > > > > and i think you have to call session_start(); before you do > > > > $HTTP_SESSION_VARS["username"] = $username; > > > > > > > > so perhaps this will work: > > > > > > > > session_name("hasLoggedIn"); > > > > $stuff = session_name(); > > > > session_start(); > > > > $HTTP_SESSION_VARS["username"] = $username; > > > > > > > > Regards, Michael > > > > > > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > Will the following lines set up a session by the name of > "hasLoggedIn" > > > > with > > > > > HTTP_SESSION_VARS["username"]? > > > > > > > > > > $stuff = session_name("hasLoggedIn"); > > > > > $HTTP_SESSION_VARS["username"] = $username; > > > > > session_start(); > > > > > > > > > > I am trying to create a page that sets a session variable upon > > > successful > > > > > login, problem is, the session_name() never changes it always > remains > > > the > > > > > default PHPSESSID what am I doing wrong now? > > > > > > > > > > I fixed the problem with multiple files, that was bizarre! > > > > > > > > > > Thanx > > > > > Phil > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Open Download-Box
this is a problem of IE, not of PHP. it seems that IE is ignoring headers in some cases. Regards Michael "Martin Thoma" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello! I have a PDF-File, which the user should download (it should not > open in the browser, even if the Adobe-Reader-Pluging is installed). I > use: > > $filename = $DOCUMENT_ROOT."/".$QUERY_STRING; > $fd = fopen ($filename, "rb"); > $contents = fread ($fd, filesize ($filename)); > fclose ($fd); > > header("Content-type: application/octet-stream"); > header("Content-Disposition:attachment;filename=$savename"); > > echo $contents; > > This doesn't work in IE (Version 6, 5 is not tested yet): When I get the > download-box and I choose "open" instead of "save", the download-box > opens again! Then pressing "open", everything is okay, but why is the > box opened twice? > > Martin > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Error Handling Class - Any Recommendations?
Use PEAR_Error. It's really powerful and has yll you need. there's no logging method in PEAR_Error afaik, but you can easily do this with PEAR's Log class, same for mailing. use PEAR's mail class to send mails. I like PEAR very much. It has lots of good things to offer and is easily extendable for your needs. Regards Michael "Julio Nobrega Trabalhando" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Anyone recommend a good one? I am in need of the following features: > > 1) Catch any type of errors, > 2) Actions like: Show on the screen, log on a file or database, or email, > 3) Different actions for each error level/warning type, etc.. > > I have searched Hotscripts, but only found classes to control server > errors, like 404 or 503. On Sourceforge, no projects with files, and Google > returns me thousands of unrelated pages and I couldn't filter the results > until they were satisfactory ;-) > > I understand PEAR has somekind of error control, and it's my current DB > Abstraction Layer's choice. If there's a way to keep using PEAR to handle > other errors, I would be very glad if someone could point me to any tutorial > or documentation about how to do so, > > Thanks, > > -- > > Julio Nobrega. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
you have to put this on top of every of your pages: - session_name("hasLoggedIn"); $stuff = session_name(); session_start(); - session_name first sets the name. then you call session_start which will look for the sessionid in ${session_name()}. that is why you have to call session_name() BEFORE calling session_start(); Regards Michael "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Thanx, however, I cannot retain the session_name when I go to the next URL. > How do I retain the session_name especially when I have to use a form > method=POST? > > I have a URL that will be the login > > Once you login you will have a session (that works now) > > That page with the session will have a form with five type form > elements > > Once submitted you will be at a "thank-you" page and files uploaded, but > then the session is gone (session_name is back to PHPSESSID again) > > What do I do to keep it? I cannot use cookies and putting it in the URL? > > Phil > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > session_name will retur the previos name of the session, so in your case > > $stuff will contain "PHPSESSID" > > and i think you have to call session_start(); before you do > > $HTTP_SESSION_VARS["username"] = $username; > > > > so perhaps this will work: > > > > session_name("hasLoggedIn"); > > $stuff = session_name(); > > session_start(); > > $HTTP_SESSION_VARS["username"] = $username; > > > > Regards, Michael > > > > "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > Will the following lines set up a session by the name of "hasLoggedIn" > > with > > > HTTP_SESSION_VARS["username"]? > > > > > > $stuff = session_name("hasLoggedIn"); > > > $HTTP_SESSION_VARS["username"] = $username; > > > session_start(); > > > > > > I am trying to create a page that sets a session variable upon > successful > > > login, problem is, the session_name() never changes it always remains > the > > > default PHPSESSID what am I doing wrong now? > > > > > > I fixed the problem with multiple files, that was bizarre! > > > > > > Thanx > > > Phil > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How to create, name and start PHP sessions
session_name will retur the previos name of the session, so in your case $stuff will contain "PHPSESSID" and i think you have to call session_start(); before you do $HTTP_SESSION_VARS["username"] = $username; so perhaps this will work: session_name("hasLoggedIn"); $stuff = session_name(); session_start(); $HTTP_SESSION_VARS["username"] = $username; Regards, Michael "Phil Powell" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Will the following lines set up a session by the name of "hasLoggedIn" with > HTTP_SESSION_VARS["username"]? > > $stuff = session_name("hasLoggedIn"); > $HTTP_SESSION_VARS["username"] = $username; > session_start(); > > I am trying to create a page that sets a session variable upon successful > login, problem is, the session_name() never changes it always remains the > default PHPSESSID what am I doing wrong now? > > I fixed the problem with multiple files, that was bizarre! > > Thanx > Phil > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] email attachments
use PEAR::Mail(); it has all you need. "James E. Hicks III" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You need a Content-Disposition in yer $mime variable. I'll leave it up to you to > figure out where, because I've forgotten where it goes exactly. > > James > > > -Original Message- > From: ROBERT MCPEAK [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 16, 2002 8:46 AM > To: [EMAIL PROTECTED] > Subject: [PHP] email attachments > > > This nifty code (taken from PHP Cookbook) sends an email with a file > "attached" in-line. The text from the attached file appears within the > body of the email. I need to send attached files that are not in-line, > but, rather, come as attached files that the user views outside of their > email browser. Can somebody help me with this. Maybe tweak the code > I've got? > > Thanks! > > //attachment > $to = $the_email; > $subject = 'dump'; > $message = 'this is the dump'; > $email = '[EMAIL PROTECTED]'; > > $boundary ="b" . md5(uniqid(time())); > $mime = "Content-type: multipart/mixed; "; > $mime .= "boundary = $boundary\r\n\r\n"; > $mime .= "This is a MIME encoded > message.\r\n\r\n"; > //first reg message > $mime_message .="--$boundary\r\n"; > $mime .="Content-type: text/plain\r\n"; > $mime .="Content-Transfer-Encoding: base64"; > $mime .="\r\n\r\n" . > chunk_split(base64_encode($message)) . "\r\n"; > //now attach > $filename = "mysqldump/surveydump.txt"; > $attach = chunk_split(base64_encode(implode("", > file($filename; > $mime .="--$boundary\r\n"; > $mime .="Content-type: text/plain\r\n"; > $mime .="Content-Transfer-Encoding: base64"; > $mime .="\r\n\r\n$attach\r\n"; > > > > > > > mail($to, > $subject, > "", > $mime); > > > > //attachment > > > > -- > 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] eregi() problems...
the rest seems ok to me, if you search for files with e.g hello_.jpg as name "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > eregi('_[0-9]{4}.jpg$', $file_name) > > should be > > eregi('_[0-9]{4}\.jpg$', $file_name) > > . is a spcial character(means every character) and has to be backslashed if > you want it's normal meaning > > > "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I must be doing something wrong, for that solution did not work. > > > > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > jas wrote: > > > > > > > > // second selection for main image on main page > > > > $dir_name = "/path/to/images/directory/"; > > > > $dir = opendir($dir_name); > > > > $file_lost .= " > NAME=\"ad01\"> > > > > "; > > > > while ($file_names = readdir($dir)) { > > > > if ($file_names != "." && $file_names !=".." && > > eregi('_[0-9]{4}.jpg$', > > > > $file_name)) { > > > > $file_lost .= " > > > NAME=\"$file_names\">$file_names"; > > > > } > > > > } > > > > $file_lost .= " NAME=\"submit\" > > > > VALUE=\"select\">"; > > > > closedir($dir); > > > > > > > > My problem is with the eregi() function to filter out files without > the > > > > following criteria *_.jpg, it must have an underscore followed by > 4 > > > > numbers and then ending in .jpg file extension. I have tried a few > > > > different methods to try and get this to work however I think I am > > missing > > > > something. All of the documentation I have read on php.net states > that > > this > > > > string should work as is... I have checked the contents of the > directory > > and > > > > I only have files of these two types... > > > > filename_logo.jpg > > > > filename_0103.jpg > > > > Could anyone enlighten me on how this is not working? > > > > Thanks in advance, > > > > > > I hope I'm reading right... it seems you want to filter OUT files with > > > the extension '_.jpg' the above check appears to be filtering out > > > everything BUT these files. I think you want the following check: > > > > > > if( $file_names != "." > > > && > > > $file_names !=".." > > > && > > > !eregi( '_[0-9]{4}\.jpg$', $file_name) ) > > > > > > Cheers, > > > Rob. > > > -- > > > .-. > > > | Robert Cummings | > > > :-`. > > > | Webdeployer - Chief PHP and Java Programmer | > > > :--: > > > | Mail : mailto:[EMAIL PROTECTED] | > > > | Phone : (613) 731-4046 x.109 | > > > :--: > > > | Website : http://www.webmotion.com | > > > | Fax : (613) 260-9545 | > > > `--' > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] eregi() problems...
eregi('_[0-9]{4}.jpg$', $file_name) should be eregi('_[0-9]{4}\.jpg$', $file_name) . is a spcial character(means every character) and has to be backslashed if you want it's normal meaning "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I must be doing something wrong, for that solution did not work. > > "Robert Cummings" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > jas wrote: > > > > > > // second selection for main image on main page > > > $dir_name = "/path/to/images/directory/"; > > > $dir = opendir($dir_name); > > > $file_lost .= " NAME=\"ad01\"> > > > "; > > > while ($file_names = readdir($dir)) { > > > if ($file_names != "." && $file_names !=".." && > eregi('_[0-9]{4}.jpg$', > > > $file_name)) { > > > $file_lost .= " > > NAME=\"$file_names\">$file_names"; > > > } > > > } > > > $file_lost .= " > > VALUE=\"select\">"; > > > closedir($dir); > > > > > > My problem is with the eregi() function to filter out files without the > > > following criteria *_.jpg, it must have an underscore followed by 4 > > > numbers and then ending in .jpg file extension. I have tried a few > > > different methods to try and get this to work however I think I am > missing > > > something. All of the documentation I have read on php.net states that > this > > > string should work as is... I have checked the contents of the directory > and > > > I only have files of these two types... > > > filename_logo.jpg > > > filename_0103.jpg > > > Could anyone enlighten me on how this is not working? > > > Thanks in advance, > > > > I hope I'm reading right... it seems you want to filter OUT files with > > the extension '_.jpg' the above check appears to be filtering out > > everything BUT these files. I think you want the following check: > > > > if( $file_names != "." > > && > > $file_names !=".." > > && > > !eregi( '_[0-9]{4}\.jpg$', $file_name) ) > > > > Cheers, > > Rob. > > -- > > .-. > > | Robert Cummings | > > :-`. > > | Webdeployer - Chief PHP and Java Programmer | > > :--: > > | Mail : mailto:[EMAIL PROTECTED] | > > | Phone : (613) 731-4046 x.109 | > > :--: > > | Website : http://www.webmotion.com | > > | Fax : (613) 260-9545 | > > `--' > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Writing Cross DB application
PEAR::DB(); "Arcadius A." <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello ! > I'm planning to write a database application for MySQL, and then port it to > PostrgeSQL. > Is there any library or class that could help me to write/maintain just one > source code for both MySQL and PostgreSQL (on WIN and UNIX)? > > Thanks in advance. > > ARcadius > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problem
> Warning: Cannot send session cache limiter - headers already sent > (output started at /path/to/my/little/session.inc:9) in > /path/to/my/little/session.inc on line 10 this means that there is output before session_start() was called. look at your include files, and make sure that there is no whitespace before the first at the end. "Torkil Johnsen" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I get this errormessage when trying to make my logon work: > > Warning: Cannot send session cache limiter - headers already sent > (output started at /path/to/my/little/session.inc:9) in > /path/to/my/little/session.inc on line 10 > > line 10 contains: session_start(); > > > It does however seem like I am "logged in", becase at the bottom of my page, > my logout button is appearing. (which it is only supposed to do if > "session_is_registered(session_id)" > > When clickign the logout button I get this message: > Warning: Trying to destroy uninitialized session in > /path/to/my/little/session.inc on line 37 > > Where line 37 says:session_destroy(); > > Anyone...? > Anyone have any links to any really good php session examples? I have read > quite a few of them now... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: evaluate my mailing list attempt?
looks fine but i would change this: > $to=$list2[1];//set "to" to email address > $subject="Newsletter"; > $msg="Hello $list2[0], bla bla bla"; //include name in message > mail("$to,$subject,$msg"); //individual mail during to > $subject="Newsletter"; > $msg="Hello $list2[0], bla bla bla"; //include name in message > mail("$list2[1],$subject,$msg"); //individual mail during if you do not need $to later. "Police Trainee" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Well, constructed from the help i received from some > of you, this is the end result of my attempts to be > able to send email to everyone listed in a file and > including their names in the email. i would appreciate > any feedback or suggestions for simplification, etc. > > $contents = fread ($fp, filesize > ($doc));fclose($fp);//read file contents into variable > $list=explode("\n",$contents); //explode each dataset > into array > $size=count($list);//count number of array items > $size=$size-1;//subtract one for looping process > $counter=0;//set counter > while($counter<$size){ //do until no more array items > $list2=explode("#",$list[$counter]); //explode each > dataset into two separate arrays (name/email) > $to=$list2[1];//set "to" to email address > $subject="Newsletter"; > $msg="Hello $list2[0], bla bla bla"; //include name in > message > mail("$to,$subject,$msg"); //individual mail during > loop > $counter++; //increment > } > ?> > > i know several of you have expressed concerns about > overloading email servers, but since i have less than > 20 people on the list, i'm sure it can handle it. > > __ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: phpMyAdmin protection
you can use the built in auth system. see phpmyadmin manual "Mantas Kriauciunas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hey PHP General List, > > Can anybody point me to tutorial or real good explanation site how > to keep Http://localhost/phpmyadmin off for other users. I am using > it to help me with MySQL database but other peaople can access > it. I know there is something with .httacces but i dont know > anything about that .httacces. SO please if anybody can point me to > some explanation how to secure phpmyadmin or just explain bu them > selves. > > Thank You. > > :--: > Have A Nice Day! > Mantas Kriauciunas A.k.A mNTKz > > Contacts: > [EMAIL PROTECTED] > Http://mntkz-hata.visiems.lt > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: register_shutdown_function
afaik there is no way to call a class method with register_shutdown_function. simply use a function which calls your constructor function _shutdown() { xmysql::~xmysql(); } register_shutodown_function("_shutdown"); "Hayden Kirk" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000501c1e40b$694cab50$62e7adcb@relic">news:000501c1e40b$694cab50$62e7adcb@relic... > im trying to make a distructor for a mysql class to kill the connection when > the object is destroyed using register_shutdown_function("~xmysql"); if i > put that in my class will it do that or am i getting confused. ~xmysql is a > destructor function i made. Heres the code, will it work how i want it to? > > class xmysql { > > var $id; > > register_shutdown_function("~xmysql"); > > function xmysql() { > $id = mysql_connect(localhost,'mystic','cqr73chw'); >or die("Could not connect to MYSQL database"); > } > function ~xmysql() { > mysql_close($id); > } > function GetID() { > return $id; > } > } // end xmysql > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Understanding If conditional statements
if ($sql_result = 0) if you want to compare $sql_result with 0 you have to do it: if ($sql_result == 0) = is an assignment operator, == is a comparision operator "Lmlweb" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm trying to get my code to print out a "sorry - no results" message if > there is no match. I've read the If statement in the PHP manual > (http://www.php.net/manual/ro/control-structures.php#control-structures.if) > > and > > I think my code structure may be wrong.. am I wrong to nest it this way in > the following code? If so, where should I be putting the " if $sql returns 0 > records, then print.." code? > > while ($row = mysql_fetch_array($sql_result)) { > if ($sql_result = 0) { > $option_block .= "Sorry, your search has resulted in 0 records. Please try > again. \n"; > } > else { > $advocateID = $row["advocateID"]; > $esc_fname = $row["FNAME"]; > $esc_lname = $row["LNAME"]; > $esc_firm = $row["FIRM"]; > $esc_city = $row["CITY"]; > $esc_province = $row["PROVINCE"]; > $esc_area = $row["AREA"]; > > // strips out special characters before output. > $fname = stripslashes($esc_fname); > $lname = stripslashes($esc_lname); > $firm = stripslashes($esc_firm); > $city = stripslashes($esc_city); > $province = stripslashes($esc_province); > $area = stripslashes($esc_area); > > $option_block .= "Name: href=\"advocate_details.html?sel_advocateID=$advocateID\">$fname > $lnameFirm/Organization: $firmLocation: $city, > $provinceSpecialty: $area \n"; > } > } > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Empty delimiter error - ??
this means in your case, that $email is an empty string "Rich Pinder" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm totally unfamiliar with php, and making some slight modificiations > to Chris Heilmann's nice v 1.1 Newsleterscript. > > What exactly is meant by an empty delimiter? This code works just fine, > but I get the following error: > > Warning: Empty delimiter in /home/sites/site56/web/trailcrew.php on line > 63 > > > > # Put the entries into the array lines > $lines = explode("%",$content); > for ($key=1;$key # when the email is not in the list, add the old entries > if (!stristr($lines[$key], $email)) {< > offending line - line 63 > $out .= "%".$lines[$key]; > } > # when it's already in the list, set found > else { > $found=1; > } > } > > > Thanks > Rich Pinder > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: functions
like you call every function in php. "Alia Mikati" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hi > i would like now how can we call a function within another function in > php? > thx a lot > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: string...
beware if you're using preg_match instead. regex using preg_match have to be enclosed by / so the same with preg_match would look like: preg_match("/^.*_[0-9]{4}\.jpg$/i", $file_name) and using preg_match meens that / is a special character and has to be backslashed if wanted by it's meening. and there's nothing like preg_matchi to check case-insensitive. this has to be done using modifiers after the ending /. in the example above it's i for case-insensitive. "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > wrong again: > eregi("^/*_[0-9]{4}\.jpg$", $file_name) > > now yo say, / at the beginning between 0 and unlimited times, the rest is > ok. > > try this, i rechecked my second example and saw that i did a \. at the > beginning. this was wrong, > because it'll search for a dot at the beginning. simply forget about the > backslash before the first dot. > This should finally work: > eregi("^.*_[0-9]{4}\.jpg$", $file_name) > > . is a special character and meens every character. so if you want . by it's > meening you have to > backslash it: \. > so what my ereg meens now, is the following: > any character at the beginning between 0 and unlimited times, followed by an > _, followed > by 4 characters between 0 and 9 followed by a dot, followed by jpg which has > to be at the end of the string. > > Michael > > "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Ok, I have tried all 3 examples and even tried a few variations that you > > have given me and so far nothing is getting displayed, is there a way to > > check for errors? here is the code I am working with: > > > > // second selection for main image on main page > > $dir_name = "/path/to/images/directory/"; > > $dir = opendir($dir_name); > > $file_lost .= " > NAME=\"images\"> > > "; > > while ($file_names = readdir($dir)) { > > if ($file_names != "." && $file_names !=".." && > > eregi("^/*_[0-9]{4}\.jpg$", $file_name)) { > > $file_lost .= " > NAME=\"$file_names\">$file_names"; > > } > > } > > $file_lost .= " > VALUE=\"select\">"; > > closedir($dir); > > > > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > and i'd suggest using eregi instead, because then also .Jpg or .JPG will > > be > > > found. > > > > > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > see what's wrong here: > > > > ereg('(^[0-1231]$).jpg$',$file_name) > > > > > > > > [] meens a group of characters, so in your case > > > > 0,1,2 and 3 are valid characters. you haven't defined any > > > > modifer like ?,*,+ or{}, so one of this characters has to > > > > be found exactly one time. you're using ^ outside the [] so it meens > the > > > > beginning of the string. > > > > in your case none of these characters inside the [] can be found at > the > > > > beginning of the string. > > > > then you use $ after the []. $ meens the end of the string. none of > the > > > > characters in the [] matches at the end of the string. > > > > so this would be right: > > > > > > > > ereg('_[0-9]{4}\.jpg$', $file_name); > > > > > > > > so this meens: > > > > the beginning of the string doesn't matter, because we have not > > specified > > > ^ > > > > at the beginning. > > > > there has to be an underscore, followed by 4 characters between 0 and > 9, > > > > followed by an dot, > > > > followed by j, followd by p, followed by g. g has to be at the end of > > the > > > > string, because of the $. > > > > or you can use: > > > > ereg('^\.*_[0-9]{4}\.jpg$', $file_name); > > > > > > > > this will meen : > > > > any characters at the beginning between 0 and unlimited times, then > > > followed > > > > by an underscore, > > > > followed by 4 characters between 0 and 9, followed by a dot, followed > by > > > > jpg. same as above > > > > though.
[PHP] Re: string...
wrong again: eregi("^/*_[0-9]{4}\.jpg$", $file_name) now yo say, / at the beginning between 0 and unlimited times, the rest is ok. try this, i rechecked my second example and saw that i did a \. at the beginning. this was wrong, because it'll search for a dot at the beginning. simply forget about the backslash before the first dot. This should finally work: eregi("^.*_[0-9]{4}\.jpg$", $file_name) . is a special character and meens every character. so if you want . by it's meening you have to backslash it: \. so what my ereg meens now, is the following: any character at the beginning between 0 and unlimited times, followed by an _, followed by 4 characters between 0 and 9 followed by a dot, followed by jpg which has to be at the end of the string. Michael "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok, I have tried all 3 examples and even tried a few variations that you > have given me and so far nothing is getting displayed, is there a way to > check for errors? here is the code I am working with: > > // second selection for main image on main page > $dir_name = "/path/to/images/directory/"; > $dir = opendir($dir_name); > $file_lost .= " NAME=\"images\"> > "; > while ($file_names = readdir($dir)) { > if ($file_names != "." && $file_names !=".." && > eregi("^/*_[0-9]{4}\.jpg$", $file_name)) { > $file_lost .= " NAME=\"$file_names\">$file_names"; > } > } > $file_lost .= " VALUE=\"select\">"; > closedir($dir); > > > "Michael Virnstein" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > and i'd suggest using eregi instead, because then also .Jpg or .JPG will > be > > found. > > > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > see what's wrong here: > > > ereg('(^[0-1231]$).jpg$',$file_name) > > > > > > [] meens a group of characters, so in your case > > > 0,1,2 and 3 are valid characters. you haven't defined any > > > modifer like ?,*,+ or{}, so one of this characters has to > > > be found exactly one time. you're using ^ outside the [] so it meens the > > > beginning of the string. > > > in your case none of these characters inside the [] can be found at the > > > beginning of the string. > > > then you use $ after the []. $ meens the end of the string. none of the > > > characters in the [] matches at the end of the string. > > > so this would be right: > > > > > > ereg('_[0-9]{4}\.jpg$', $file_name); > > > > > > so this meens: > > > the beginning of the string doesn't matter, because we have not > specified > > ^ > > > at the beginning. > > > there has to be an underscore, followed by 4 characters between 0 and 9, > > > followed by an dot, > > > followed by j, followd by p, followed by g. g has to be at the end of > the > > > string, because of the $. > > > or you can use: > > > ereg('^\.*_[0-9]{4}\.jpg$', $file_name); > > > > > > this will meen : > > > any characters at the beginning between 0 and unlimited times, then > > followed > > > by an underscore, > > > followed by 4 characters between 0 and 9, followed by a dot, followed by > > > jpg. same as above > > > though. But the * is a real performance eater so it could be slightly > > faster > > > if you're using the first example. > > > > > > > > > > > > "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > I hate to say it but that didn't work, I have been trying different > > > > variations of the same ereg('_(^90-9{4}$).jpg$',$file_names) and > nothing > > > > seems to work for me, I have also been looking at the ereg and > preg_ereg > > > > functions but they don't seem to make sense to me, here is the code as > a > > > > whole if this helps: > > > > // query directory and place results in select box > > > > $dir_name = "/path/to/images/directory/on/server/"; // path to > directory > > > on > > > > server > > > > $dir = opendir($dir_name); // open the directory in question > > > > $file_lost .=
[PHP] Re: variable scoping...
why do you have more than one class with the same name? would be easier using different names for different classes. or define a base class template and extend it in the files as desired, but give them unique names. how do you know later, which class does what in which way, when they have the same name. not very good imo. "Aric Caley" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is it possible to keep the variable name-space separate between, say, two > files (one included into the other) to avoid name collisions? I'm trying to > get two scripts to work together on the same page. Each script defines some > classes that have the same names but work differently (ex., class Template). > All I need is to embed the output of one script into the other. > > Now, I could do this by just getting the output from a URL but that seems > really inefficient. Or I could run the script from the CGI version of PHP > using exec() but that also seems like it could be really slow and clunky. > > Is there some efficient way of doing this? > > It would be cool if you could just put the include() inside of a function > and have all the classes and variable names be local inside that function > but that didnt seem to work... plus the scripts explicitly access global > variable names. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Sending HTML from PHP with 'mail' as a cron job
i'd suggest using PEAR's mail class. It'll fit for all your needs and is easy to use. <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > $headers = "Content-type: text/html\n"; > $fromEmail = urlencode( $dbQuery->adminEmail ); > $subject = "Your new eStore is ready!"; > > $message = "::name::, > Your new eStore is ready at href=\"http://woodenpickle.com/shop\";>http://woodenpickle.com/shop.Y > ou can open the admin panel for it at the following link: href=\"http://woodenpickle.com/shop/admin.php\";> > http://woodenpickle.com/shop/admin.php You should receive > another email with the temp login and pass later today.\n"; > > $result = mysql_query( "SELECT * FROM customers" ); > while( $data = mysql_fetch_row( $result ) ) > { > print ". "; > $newMessage = str_replace( "::name::", $data->firstName, $newMessage ); > $if( mail( $data->emailAddress, $subject, $newMessage, "${headers}From: > $fromEmail" ) ) > { > $count++; > } > } > > echo( "Done." ); > > > > "Stefen Lars" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello all > > > > I have a script called 'report.php' that generates a report in HTML. This > > report must be created at regular intervals; hence I have set up a cron > job > > to call that script. The output of 'report.php' must be sent by e-mail. I > > use the following command: > > > > /usr/bin/lynx -source http://server.com/report.php | mail -s "Report" > > [EMAIL PROTECTED] > > > > This works fine. The result of report.php is sent to [EMAIL PROTECTED] > > > > However, the results do not appear as HTML in the e-mail client, but as > > text. This is due to the fact that the headers saying 'This is HTML' are > > missing from the e-mail message sent. > > > > Does anyone know how it is possible to get 'mail' to add suitable headers > to > > the above command, so that the receiving e-mail client knows that it is > > getting an HTML and not a text message? > > > > Any help would be gratefully received. TIA. > > > > S. > > > > > > _ > > Send and receive Hotmail on your mobile device: http://mobile.msn.com > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting values of duplicate keys in array
wrong again, forgot the grouping, this is the right sql: $sql = "SELECT p.id, p.$town, p.$zip, p.$phone, p.$description count(m.*) praxdocs FROM $praxTable p, $medTable m WHERE p.id = m.prax GROUP BY p.id, p.$town, p.$zip, p.$phone, p.$description"; "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > i rethought the sql and found, that the column parxdocs wont contain the > number of doctors per praxis. > this would only be done if there are more than one doctor with the same > name, surename and title in one praxis. > > but you can do this instead > // now you'll get the number of doctors per praxis > $sql = "SELECT p.id, >p.$town, >p.$zip, >p.$phone, >p.$description >count(m.*) praxdocs >FROM $praxTable p, >$medTable m > WHERE p.id = m.prax"; > > $result = mysql_query($sql, $conn); > while ($row = mysql_fetch_array($result)) { > for ($i = 0; $i < $row["praxdocs"]; $i++) { > $docsql = "SELECT $sureName, > $preName, > $title > FROM $medTable > WHERE prax = {$row["id"]}"; > $docresult = mysql_query($docsql, $conn); > while ($docrow = mysql_fetch_array($docresult)) { > // print names of docs here using $docrow array > } > //print address of praxis here using $row array > } > > } > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > typo in the querystring, this should work, i suppose > > > > $queryString = "SELECT count(m.*) parxdocs > > m.$sureName, > > m.$preName, > > m.$title, > > m.prax, > > p.$town, > > p.$zip, > > p.$phone, > > p.$description > > FROM $medTable m, > > $praxTable p > >WHERE m.$prax = p.$id > >GROUP BY m.prax, m.$preName, m.$sureName, > > m.$title, p.$town, p.$zip, p.$phone, p.$description > >ORDER BY m.$prax, m.$preName"; > > > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > ok, here we go. > > > > > > you normaly say this i suppose: > > > > > > while ($row = mysql_fetch_array($result) { > > > //your html inserts here > > > } > > > > > > if you'd use oracle, i'd suggest using a cursor, but you're using MySql, > > so > > > you probably have to do it a bit different: > > > (Not tested, could contain some errors!!!) > > > > > > // you'll now have the number of doctors in one praxis in praxdocs > > > $queryString = "SELECT count(m.*) parxdocs > > > m.$sureName, > > > m.$preName, > > > m.$title, > > > p.$town, > > > p.$zip, > > > p.$phone, > > > p.$description > > > FROM $medTable m, > > > $praxTable p > > > WHERE m.$prax = p.$id > > > GROUP BY m.prax, m.$preName, m.$sureName, > > > m.$title, p.$town, p.$zip, p.$phone, p.$description > > >
[PHP] Re: howto call php script from cgi script
doesn't it have to be: # md5.php #!/usr/bin/php (path to your php) and have you test your cgi using "su - webuser" before? perhaps some file permission problems, when called from the web. "Sanjay" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 017f01c1e15f$67d24220$0200a8c0@piii">news:017f01c1e15f$67d24220$0200a8c0@piii... > Hi, > > I am a cgi programmer and have written a small php script (md5.php) for md5 > password encryption which is being called from a cgi (temp.cgi) file. Now, when > I try to excute the temp.cgi script from command line it works well and returns > me the expected value. But, the same cgi script doesn't return anything when > trying to execute from the web. > > Any help would be highly appreciated. > > Regards, > Sanjay > > > ### temp.cgi > > #!/usr/bin/perl > print "Content-type: text/html\n\n"; > $passwd="testpass"; > $p=`/usr/bin/php /full/path/md5.php pass=$passwd|tail -1`; > print "pass is $p\n"; > > > md5.php > > $pass1=md5("$pass"); > #return "$pass1"; > print "$pass1"; > ?> > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String?
and i'd suggest using eregi instead, because then also .Jpg or .JPG will be found. "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > see what's wrong here: > ereg('(^[0-1231]$).jpg$',$file_name) > > [] meens a group of characters, so in your case > 0,1,2 and 3 are valid characters. you haven't defined any > modifer like ?,*,+ or{}, so one of this characters has to > be found exactly one time. you're using ^ outside the [] so it meens the > beginning of the string. > in your case none of these characters inside the [] can be found at the > beginning of the string. > then you use $ after the []. $ meens the end of the string. none of the > characters in the [] matches at the end of the string. > so this would be right: > > ereg('_[0-9]{4}\.jpg$', $file_name); > > so this meens: > the beginning of the string doesn't matter, because we have not specified ^ > at the beginning. > there has to be an underscore, followed by 4 characters between 0 and 9, > followed by an dot, > followed by j, followd by p, followed by g. g has to be at the end of the > string, because of the $. > or you can use: > ereg('^\.*_[0-9]{4}\.jpg$', $file_name); > > this will meen : > any characters at the beginning between 0 and unlimited times, then followed > by an underscore, > followed by 4 characters between 0 and 9, followed by a dot, followed by > jpg. same as above > though. But the * is a real performance eater so it could be slightly faster > if you're using the first example. > > > > "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I hate to say it but that didn't work, I have been trying different > > variations of the same ereg('_(^90-9{4}$).jpg$',$file_names) and nothing > > seems to work for me, I have also been looking at the ereg and preg_ereg > > functions but they don't seem to make sense to me, here is the code as a > > whole if this helps: > > // query directory and place results in select box > > $dir_name = "/path/to/images/directory/on/server/"; // path to directory > on > > server > > $dir = opendir($dir_name); // open the directory in question > > $file_lost .= " NAME=\"ad01\"> > > "; > > while ($file_names = readdir($dir)) { > > if ($file_names != "." && $file_names !=".." && > ereg('_(^[0-9]{4}.jpg$)', > > $file_names)) // filter my contents > > { > > $file_lost .= " > NAME=\"$file_names\">$file_names"; > > } > > } > > $file_lost .= " > VALUE=\"select\">"; > > closedir($dir); > > What I am trying to accomplish is to list the contents of a directory in > > select box but I want to filter out any files that dont meet this criteria > > *_.jpg and nothing is working for me, any help or good tutorials on > > strings would be great. > > Jas > > "Erik Price" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > > > On Thursday, April 11, 2002, at 05:59 AM, jas wrote: > > > > > > > Is this a correct string to show only files that look like so: > > > > *_.jpg > > > > if ($file_names != "." && $file_names !=".." && > > > > ereg('(^[0-1231]$).jpg$',$file_name)) > > > > Any help would be great. > > > > > > preg_match(/^_[0-9]{4,4}\.jpg$/, $file_name) should match any string > > > that starts with an underscore, is followed by exactly four digits, and > > > then a ".jpg". It will not match anything but this exact string. > > > > > > > > > Erik > > > > > > > > > > > > > > > > > > > > > Erik Price > > > Web Developer Temp > > > Media Lab, H.H. Brown > > > [EMAIL PROTECTED] > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting values of duplicate keys in array
hmm...he has a table for premises and one for doctors, hasn't he? > FROM $medTable m, > $praxTable p "Justin French" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Just a quick note, you wouldn't base it upon $description would you? > It really depends on your data, but consider these four records: > > Fred Flintstone > Bedrock > (shared house) > > Wilma Flintstone > Bedrock > (shared house) > > Homer Simpson > Springfield > (shared house) > > Marge Simpson > Springfield > (shared house) > > > By testing for (shared house), you'd end up grouping them together like > this: > > Fred Flintstone > Wilma Flintstone > Homer Simpson > Marge Simpson > Bedrock > (shared house) > > ... which isn't your intended result. > > > Really, what you'd like to do is group people together based on their > premises being the same. This of course is complicated by the fact that if > the premises is misspelled, or changed slighly (Unit 2, Suite 2, U2, etc > etc), the records won't match, and you won't be able to establish a > connection between the two Doctors. > > > If you have a lot of these types of records, yes, you may wish to do > something about it, but if it's only a few, I'd leave it be. > > > The real solution is a change in your data design. What you actually want > is to relate Doctors to their premises/practice. Hence, I would have a > table of Doctors, and a table of Premises, with an id being the key for > each. > > This way Doctor #2 and Doctor #15 can both be associated with Premises #5. > > Better still, a Doctor may be associated with one or more practices. > > > This seems like a smarter/quicker/faster/more future proof method than > hoping for matches in the address and performing complex array sorts. > > > Then again, I'm not an array expert :) > > > Two relational tables seem like the best result to me, although it might > create additional work at this early stage. > > > Justin French > > > Creative Director > http://Indent.com.au > > > > > on 11/04/02 9:20 PM, Christoph Starkmann ([EMAIL PROTECTED]) wrote: > > > Hi folks! > > > > The following problem: > > > > I got a db (mysql) with information about doctors. > > Name, adress, phone etc. > > > > Now I'm reading these information with a simple > > mysql-query: > > > > $queryString = "SELECT DISTINCT m.$sureName, m.$preName, m.$prax, m.$title, > > "; > > $queryString .= "p.$town, p.$zip, p.$phone, p.$description "; > > $queryString .= "FROM $medTable m, $praxTable p WHERE "; > > $queryString .= "m.$prax = p.$id"; > > > > Normally, I print out the information like this: > > > > Dr. med. John Doe// $title, $preName, $sureName > > (shared practice)// description > > Elmstreet 13// $street > > 666 Amityville 23// $zip, $town > > phone: 0049 - 815 - 4711// $phone > > > > Okay. Now some of these folks are sharing a practice > > ($description in the above code == "shared practice"). > > > > I would like to have these grouped together like this: > > > > Dr. med. John Doe// $title, $preName, $sureName > > Dr. med. Allan Smithee > > (shared practice)// description > > Elmstreet 13// $street > > 666 Amityville 23// $zip, $town > > phone: 0049 - 815 - 4711// $phone > > > > I am starting to get a little confused right here and right now. > > This is the reason for being THIS detailed, too ;) Don't want to > > mix anything up. > > > > How would you achieve this goal fastest and "best"? > > Creating a temp array and checking for double $description-s > > which I store in the temp array and delete from the original one? > > Or check this with the original array? How? > > I found functions to get the value for one key in a hash, but not > > for several values with the same key... > > > > Sorry for the confusion, starting to get fuzzy... > > > > Any ideas, hints? > > > > Thanx alot, > > > > Kiko > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting values of duplicate keys in array
i rethought the sql and found, that the column parxdocs wont contain the number of doctors per praxis. this would only be done if there are more than one doctor with the same name, surename and title in one praxis. but you can do this instead // now you'll get the number of doctors per praxis $sql = "SELECT p.id, p.$town, p.$zip, p.$phone, p.$description count(m.*) praxdocs FROM $praxTable p, $medTable m WHERE p.id = m.prax"; $result = mysql_query($sql, $conn); while ($row = mysql_fetch_array($result)) { for ($i = 0; $i < $row["praxdocs"]; $i++) { $docsql = "SELECT $sureName, $preName, $title FROM $medTable WHERE prax = {$row["id"]}"; $docresult = mysql_query($docsql, $conn); while ($docrow = mysql_fetch_array($docresult)) { // print names of docs here using $docrow array } //print address of praxis here using $row array } } "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > typo in the querystring, this should work, i suppose > > $queryString = "SELECT count(m.*) parxdocs > m.$sureName, > m.$preName, > m.$title, > m.prax, > p.$town, > p.$zip, > p.$phone, > p.$description > FROM $medTable m, > $praxTable p >WHERE m.$prax = p.$id >GROUP BY m.prax, m.$preName, m.$sureName, > m.$title, p.$town, p.$zip, p.$phone, p.$description >ORDER BY m.$prax, m.$preName"; > > "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > ok, here we go. > > > > you normaly say this i suppose: > > > > while ($row = mysql_fetch_array($result) { > > //your html inserts here > > } > > > > if you'd use oracle, i'd suggest using a cursor, but you're using MySql, > so > > you probably have to do it a bit different: > > (Not tested, could contain some errors!!!) > > > > // you'll now have the number of doctors in one praxis in praxdocs > > $queryString = "SELECT count(m.*) parxdocs > > m.$sureName, > > m.$preName, > > m.$title, > > p.$town, > > p.$zip, > > p.$phone, > > p.$description > > FROM $medTable m, > > $praxTable p > > WHERE m.$prax = p.$id > > GROUP BY m.prax, m.$preName, m.$sureName, > > m.$title, p.$town, p.$zip, p.$phone, p.$description > > ORDER BY m.$prax, m.$preName"; > > > > // then output the html > > while ($row = mysql_fetch_array($result)) { > > // we don't need the first one, because we already have it. > > echo "{$row["title"]} {$row["preName"]} {$row["sureName"]}"; > > for ($i = 1; $i < $row["praxdocs"]; $i++) { > > $doctor = mysql_fetch_array($result); > > echo "{$doctor["title"]} {$doctor["preName"]} > > {$doctor["sureName"]}"; > > } > > // rest of the output using $row here > > } > > > > hope that helps > > > > "Christoph Starkmann" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > > B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE">news:B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE... > > > Hi folks! > > > > > > The following problem: > > > > > > I got a db (mysql) with information about doctors. > >
[PHP] Re: Limits and PHP
ok, if you're using mysql you can use the LIMIT function in your statement: SELECT * FROM table LIMIT 0, 30 would show 30 rows starting from row 1. you can set a variable telling your php script how many entries per page you will show: $showlines = 10; and telling your script where to start the search $start = ($page * showlines) - $showlines; and you're sql should look like: SELECT * FROM table LIMIT $start, $showlines so if you're on page 3, it'll look like this: $start = (3 * 10) - 10 // 20 is our startpoint SELECT * FROM table LIMIT 20, 10 this would show 10 lines starting from line 21 "Chuck "Pup" Payne" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I would to know what is a good example of how to use limits within PHP. I > have an SQL statement that looks at a database and pulls from it and all > items in it, but like to be able to show let said ten items on one page then > you press like to get the next twenty and so and so until there is no more. > Is this hard to do? > > > Chuck > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting values of duplicate keys in array
typo in the querystring, this should work, i suppose $queryString = "SELECT count(m.*) parxdocs m.$sureName, m.$preName, m.$title, m.prax, p.$town, p.$zip, p.$phone, p.$description FROM $medTable m, $praxTable p WHERE m.$prax = p.$id GROUP BY m.prax, m.$preName, m.$sureName, m.$title, p.$town, p.$zip, p.$phone, p.$description ORDER BY m.$prax, m.$preName"; "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > ok, here we go. > > you normaly say this i suppose: > > while ($row = mysql_fetch_array($result) { > //your html inserts here > } > > if you'd use oracle, i'd suggest using a cursor, but you're using MySql, so > you probably have to do it a bit different: > (Not tested, could contain some errors!!!) > > // you'll now have the number of doctors in one praxis in praxdocs > $queryString = "SELECT count(m.*) parxdocs > m.$sureName, > m.$preName, > m.$title, > p.$town, > p.$zip, > p.$phone, > p.$description > FROM $medTable m, > $praxTable p > WHERE m.$prax = p.$id > GROUP BY m.prax, m.$preName, m.$sureName, > m.$title, p.$town, p.$zip, p.$phone, p.$description > ORDER BY m.$prax, m.$preName"; > > // then output the html > while ($row = mysql_fetch_array($result)) { > // we don't need the first one, because we already have it. > echo "{$row["title"]} {$row["preName"]} {$row["sureName"]}"; > for ($i = 1; $i < $row["praxdocs"]; $i++) { > $doctor = mysql_fetch_array($result); > echo "{$doctor["title"]} {$doctor["preName"]} > {$doctor["sureName"]}"; > } > // rest of the output using $row here > } > > hope that helps > > "Christoph Starkmann" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE">news:B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE... > > Hi folks! > > > > The following problem: > > > > I got a db (mysql) with information about doctors. > > Name, adress, phone etc. > > > > Now I'm reading these information with a simple > > mysql-query: > > > > $queryString = "SELECT DISTINCT m.$sureName, m.$preName, m.$prax, > m.$title, > > "; > > $queryString .= "p.$town, p.$zip, p.$phone, p.$description "; > > $queryString .= "FROM $medTable m, $praxTable p WHERE "; > > $queryString .= "m.$prax = p.$id"; > > > > Normally, I print out the information like this: > > > > Dr. med. John Doe // $title, $preName, $sureName > > (shared practice) // description > > Elmstreet 13 // $street > > 666 Amityville 23 // $zip, $town > > phone: 0049 - 815 - 4711 // $phone > > > > Okay. Now some of these folks are sharing a practice > > ($description in the above code == "shared practice"). > > > > I would like to have these grouped together like this: > > > > Dr. med. John Doe // $title, $preName, $sureName > > Dr. med. Allan Smithee > > (shared practice) // description > > Elmstreet 13 // $street > > 666 Amityville 23 // $zip, $town > > phone: 0049 - 815 - 4711 // $phone > > > > I am starting to get a little confused right here and right now. > > This is the reason for being THIS detailed, too ;) Don't want to > > mix anything up. > > > > How would you achieve this goal fastest and "best"? > > Creating a temp array and checking for double $description-s > > which I store in the temp array and delete from the original one? > > Or check this with the original array? How? > > I found functions to get the value for one key in a hash, but not > > for several values with the same key... > > > > Sorry for the confusion, starting to get fuzzy... > > > > Any ideas, hints? > > > > Thanx alot, > > > > Kiko > > > > -- > > It's not a bug, it's a feature. > > christoph starkmann > > mailto:[EMAIL PROTECTED] > > http://www.gruppe-69.com/ > > ICQ: 100601600 > > -- > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Getting values of duplicate keys in array
ok, here we go. you normaly say this i suppose: while ($row = mysql_fetch_array($result) { //your html inserts here } if you'd use oracle, i'd suggest using a cursor, but you're using MySql, so you probably have to do it a bit different: (Not tested, could contain some errors!!!) // you'll now have the number of doctors in one praxis in praxdocs $queryString = "SELECT count(m.*) parxdocs m.$sureName, m.$preName, m.$title, p.$town, p.$zip, p.$phone, p.$description FROM $medTable m, $praxTable p WHERE m.$prax = p.$id GROUP BY m.prax, m.$preName, m.$sureName, m.$title, p.$town, p.$zip, p.$phone, p.$description ORDER BY m.$prax, m.$preName"; // then output the html while ($row = mysql_fetch_array($result)) { // we don't need the first one, because we already have it. echo "{$row["title"]} {$row["preName"]} {$row["sureName"]}"; for ($i = 1; $i < $row["praxdocs"]; $i++) { $doctor = mysql_fetch_array($result); echo "{$doctor["title"]} {$doctor["preName"]} {$doctor["sureName"]}"; } // rest of the output using $row here } hope that helps "Christoph Starkmann" <[EMAIL PROTECTED]> schrieb im Newsbeitrag B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE">news:B120D7EC8868D411A63D0050040EDA77111BE9@XCHANGE... > Hi folks! > > The following problem: > > I got a db (mysql) with information about doctors. > Name, adress, phone etc. > > Now I'm reading these information with a simple > mysql-query: > > $queryString = "SELECT DISTINCT m.$sureName, m.$preName, m.$prax, m.$title, > "; > $queryString .= "p.$town, p.$zip, p.$phone, p.$description "; > $queryString .= "FROM $medTable m, $praxTable p WHERE "; > $queryString .= "m.$prax = p.$id"; > > Normally, I print out the information like this: > > Dr. med. John Doe // $title, $preName, $sureName > (shared practice) // description > Elmstreet 13 // $street > 666 Amityville 23 // $zip, $town > phone: 0049 - 815 - 4711 // $phone > > Okay. Now some of these folks are sharing a practice > ($description in the above code == "shared practice"). > > I would like to have these grouped together like this: > > Dr. med. John Doe // $title, $preName, $sureName > Dr. med. Allan Smithee > (shared practice) // description > Elmstreet 13 // $street > 666 Amityville 23 // $zip, $town > phone: 0049 - 815 - 4711 // $phone > > I am starting to get a little confused right here and right now. > This is the reason for being THIS detailed, too ;) Don't want to > mix anything up. > > How would you achieve this goal fastest and "best"? > Creating a temp array and checking for double $description-s > which I store in the temp array and delete from the original one? > Or check this with the original array? How? > I found functions to get the value for one key in a hash, but not > for several values with the same key... > > Sorry for the confusion, starting to get fuzzy... > > Any ideas, hints? > > Thanx alot, > > Kiko > > -- > It's not a bug, it's a feature. > christoph starkmann > mailto:[EMAIL PROTECTED] > http://www.gruppe-69.com/ > ICQ: 100601600 > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Temporary off...
jup, that's what i am using. much better! no email spam and i can keep track of threads more easily. and i can "David Robley" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > In article, > [EMAIL PROTECTED] says... > > Hi! > > > > Is there any way to turn the list mails off temporary ? > > I do not want to signoff, just now i wouldn't like to get 200 mails a day... > > But maybe tomarrow i wanna... > > > > Thx > > > > Vaso > > > Nope - unsubscribe and use the newsgroup at news.php.net might be an > option. > > -- > David Robley > Temporary Kiwi! > > Quod subigo farinam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String?
see what's wrong here: ereg('(^[0-1231]$).jpg$',$file_name) [] meens a group of characters, so in your case 0,1,2 and 3 are valid characters. you haven't defined any modifer like ?,*,+ or{}, so one of this characters has to be found exactly one time. you're using ^ outside the [] so it meens the beginning of the string. in your case none of these characters inside the [] can be found at the beginning of the string. then you use $ after the []. $ meens the end of the string. none of the characters in the [] matches at the end of the string. so this would be right: ereg('_[0-9]{4}\.jpg$', $file_name); so this meens: the beginning of the string doesn't matter, because we have not specified ^ at the beginning. there has to be an underscore, followed by 4 characters between 0 and 9, followed by an dot, followed by j, followd by p, followed by g. g has to be at the end of the string, because of the $. or you can use: ereg('^\.*_[0-9]{4}\.jpg$', $file_name); this will meen : any characters at the beginning between 0 and unlimited times, then followed by an underscore, followed by 4 characters between 0 and 9, followed by a dot, followed by jpg. same as above though. But the * is a real performance eater so it could be slightly faster if you're using the first example. "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I hate to say it but that didn't work, I have been trying different > variations of the same ereg('_(^90-9{4}$).jpg$',$file_names) and nothing > seems to work for me, I have also been looking at the ereg and preg_ereg > functions but they don't seem to make sense to me, here is the code as a > whole if this helps: > // query directory and place results in select box > $dir_name = "/path/to/images/directory/on/server/"; // path to directory on > server > $dir = opendir($dir_name); // open the directory in question > $file_lost .= " > "; > while ($file_names = readdir($dir)) { > if ($file_names != "." && $file_names !=".." && ereg('_(^[0-9]{4}.jpg$)', > $file_names)) // filter my contents > { > $file_lost .= " NAME=\"$file_names\">$file_names"; > } > } > $file_lost .= " VALUE=\"select\">"; > closedir($dir); > What I am trying to accomplish is to list the contents of a directory in > select box but I want to filter out any files that dont meet this criteria > *_.jpg and nothing is working for me, any help or good tutorials on > strings would be great. > Jas > "Erik Price" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > > > On Thursday, April 11, 2002, at 05:59 AM, jas wrote: > > > > > Is this a correct string to show only files that look like so: > > > *_.jpg > > > if ($file_names != "." && $file_names !=".." && > > > ereg('(^[0-1231]$).jpg$',$file_name)) > > > Any help would be great. > > > > preg_match(/^_[0-9]{4,4}\.jpg$/, $file_name) should match any string > > that starts with an underscore, is followed by exactly four digits, and > > then a ".jpg". It will not match anything but this exact string. > > > > > > Erik > > > > > > > > > > > > > > Erik Price > > Web Developer Temp > > Media Lab, H.H. Brown > > [EMAIL PROTECTED] > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: passing array to another php file
first serialize and then base64encode your array. send this encoded string to the next page and base64decode it there first and then unserialize it. ... and sample2.php: "Hirono Tanaka" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, does anyone know how to pass an array to different php file? > > Let's assume I have an array $array[] in sample1.php. I want to pass the > array to a different php files by doing something like: > > ... > > This didn't work actually. I can't think of any other wayto do this. > Please help. Thanks. > > > > _ > Chat with friends online, try MSN Messenger: http://messenger.msn.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: unsetting an instance from within its class
you can use unset($this), but it'll only work if there are no other variables referencing to this object. unset only unsets the reference to value, not the value itself. PHP will unset the value totally, if there are no references to it anymore. so using $this = null; , is perhaps the better solution. example for unset not unsetting the value but the reference: test1 = $str; } function kill() { unset($this); } } $new =& new test("hallo"); $test = &$new; $new->kill(); echo $test->test1; ?> this will output hallo, although you called unset($this). "Erik Price" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a way to unset or destroy an object instance from a method > within its class? I'm trying to write a method that destroys its > instance but I'm not sure how to refer to the object itself from within > the class. > > > Erik > > > > > > > > Erik Price > Web Developer Temp > Media Lab, H.H. Brown > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is While needed in MySQL Result with a Limit of 1
It seems that you don't understand why mysql_fetch_array is most often used inside a loop. The loop is not required! if you don't put mysql_fetch_array inside a loop, you can only get the first row and that's it, because calling mysql_fetch_array will return the next row in your result. if you expect more than one row, you have to call mysql_fetch_array for as many times as you expect rows. This could be done by calling mysql_fetch_array manually for as many times you need or via some sort of loop. The easiest way to get all rows, although you don't know how many rows you'll get, is using a while loop. "Brian Drexler" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Here is my code: > > mysql_connect("localhost","username","password"); > $result=mysql_db_query("Database","select * from table_name where > criteria=whatever limit 1"); > while($r=mysql_fetch_array($result) { > $Value1=$r["TableFieldName1"]; > $Value2=$r["TableFieldName2"]; > echo "$Value1, $Value2"; > } > > My question is thisis the while statement needed when I'm only returning > one record? > > Brian > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mailing list using mail()
> Should I just use one message and append the BCC: line of the one message? this could probably be the best way. "Petre Agenbag" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > the combination of PHP and mysql and the ease of use of the mail() > function obviously leads me to believe that it *should* be a singe to > use php to send customised messages to all my users , of whom I have > details in a mysql table by simply running a "select * from table" and > then using a while loop to run through every row and sending an e_mail > to $user_in_table. > > The obvious problem here is that ( in my case 17 000 users) this can > easily kill the mail server and could also cause the script to timeout > or ( if increasing the timeout) kill the server outright. > So, what are my options? > Should I be attempting this ( if not, how can I keep others that are > hosting on my machines from trying this with their own tables) > Should I just use one message and append the BCC: line of the one message? > > Thanks > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Scoping functions in PHP
No, there's nothing like private or public functions/methods. There's no way preventing someone using your private functions/methods. "Eric Starr" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 000e01c1e041$d931cc20$[EMAIL PROTECTED]">news:000e01c1e041$d931cc20$[EMAIL PROTECTED]... I am a Java programmer learning PHP. In Java you can have a class that contains public and private functions. Only the public functions are accessible outside of the class. Does PHP have a way to hide functions within a class (i.e. make the private)? My concern is that there are some functions that you don't want anyone being able to call...only local functions within the same class should be able to call it. I'll give an example below: f1(); // I want this to be a valid function call $p->f2(); // I want this to be an invalid function call ?> Any help would be greatly appreciated. Eric Starr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] XML HELP
Why don't you use this class...it's really good! http://sourceforge.net/projects/phpxpath/ "Analysis & Solutions" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hey Christopher: > > On Mon, Apr 08, 2002 at 09:14:08PM -0400, Christopher J. Crane wrote: > > ok I tried this at your suggestion > > Not exactly. As mentioned, you've got all sorts of unneded stuff going > on. To make sure you're on the right track, start with a new script > with just the basics: > > > > $Symbols[] = 'ek'; > $Symbols[] = 'et'; > > $URI = 'http://quotes.nasdaq.com/quote.dll?page=xml&mode=stock&symbol='; > > > function StartHandler($Parser, $ElementName, $Attr='') { > } > > function CharacterHandler($Parser, $Line) { > } > > function EndHandler($Parser, $ElementName, $Attr='') { > } > > > while ( list(,$Sym) = each($Symbols) ) { >$Contents = implode( '', file("$URI$Sym") ); > >$Parser = xml_parser_create('ISO-8859-1'); >xml_set_element_handler($Parser, 'StartHandler', 'EndHandler'); >xml_set_character_data_handler($Parser, 'CharacterHandler'); > >if ( xml_parse($Parser, $Contents) ) { > echo 'YES!'; >} else { > echo 'NO!'; >} > >xml_parser_free($Parser); > > } > > ?> > > > Now, if that works, start flushing out the element/character handlers. > Do it little by little to make sure each of your steps are correct. > > Enjoy, > > --Dan > > -- >PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Directory check
file_exists will perform a check if the file, no matter if it's a directory, a regular file or a symlink. if you want to know if it is a directory use is_dir($file) or refer to the php manual"Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Does anyone know how to check a directory exiasts? > > Thanks in advance, > Hiroshi Ayukawa > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php and html image tag...
Please post more code. Can't help any further in the moment. "Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Ok here is my problem, I have a piece of code that queries the database > pulls the results of a table into an array, on another file the results of > that array are used with a require function and then each variable is echoed > to the screen where I need it, I have a piece of javascript to open a pop up > window and the code is as such... > > As you can see I have placed the results of the array within my $ad01_t; ?>" width="200" height="100" vspace="0" hspace="0" border="0"> > Will not pull the results of the array into the page, I don't know if this > is a valid piece or not, any help would be great. Thanks in advance. > Jas > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Adding "a" in "try.jpg"! Problems!
typo..this one's right :) while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 2] .= "a"; echo ""; } "Michael Virnstein" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > but if > $myrow["ilmage"] = "hallo.hmm.gif"; your code won't work. > > so better: > > while ($myrow = mysql_fetch_array($result)) { > $img = explode('.',$myrow[ilmage]); > $img[count($img) - 1] .= "a"; > echo ""; > } > > > > "Richard Baskett" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Do the explode and implodes like that one fellow mentioned. > > > > So basically: > > > > while ($myrow = mysql_fetch_array($result)) { > > $img = explode('.',$myrow[ilmage]); > > echo "" > > } > > > > What this will do is take your image split the image at the '.' then echo > it > > with the 'a'.. Hope it helps! > > > > Rick > > > > Be kind. Everyone you meet is fighting a hard battle - John Watson > > > > > From: "Thomas Edison Jr." <[EMAIL PROTECTED]> > > > Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) > > > To: Miguel Cruz <[EMAIL PROTECTED]> > > > Cc: [EMAIL PROTECTED] > > > Subject: Re: [PHP] Adding "a" in "try.jpg"! Problems! > > > > > > Hi, > > > > > > Thanks for your relies. There are a couple of > > > problems. Firstly, i'm picking the filename from the > > > database, so my code is something like this : > > > > > > if ($myrow = mysql_fetch_array($result)) { > > > do { > > > echo(" > > > > > "); > > > } while ($myrow = mysql_fetch_array($result)); > > > } > > > > > > > > > Now the filename is actually stored in $myrow[ilmage] > > > How do i perform the spliting & adding functions on > > > $myrow[ilmage] ?? > > > Secondly, all images are not ".JPG", some are jpg & > > > others are gif !!! > > > > > > Thank you.. > > > T. Edison Jr. > > > --- Miguel Cruz <[EMAIL PROTECTED]> wrote: > > >> (untested) > > >> > > >> $newname = eregi_replace('\.jpg$', 'a.jpg', > > >> $oldname); > > >> > > >> No point messing up your database; just use > > >> something like the above when > > >> you're outputting the image tags for the thumbnails. > > >> > > >> miguel > > >> > > >> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > > >> > > >>> I have a new very intriguing problem at hand. > > >>> > > >>> I have the name of my Images stored in my mySQL > > >>> database in one column. Now when i pick the > > >> images, > > >>> they are displayed as it as. However, they are the > > >> big > > >>> images, and the thumbnails of those images are > > >> stored > > >>> with an "a" at the end of thier names. > > >>> That is, > > >>> If the image is "try.jpg" , the thumbnail of the > > >> image > > >>> is "trya.jpg" !! > > >>> Now i want to display the thumbnail and not the > > >> large > > >>> image. And unfortunately, my whole database > > >> contains > > >>> the name of Large images and NOt the Thumbnails. > > >>> > > >>> How can i : > > >>> 1. Insert "a" at the end of the name of the image, > > >>> before the ".extension" through PHP. > > >>> The problems are that the names are stored in the > > >>> database WITH the extesion. And the extensions > > >> also > > >>> vary, some are JPG and some are GIF. So in my > > >> datase i > > >>> have images as "try.jpg" or "something.gif"! How > > >> can i > > >>> insert an "a" at the end of the name before the > > >> "." ? > > >>> > > >>> 2. OR.. can i insert the "a" before the "." in the > > >>> image name in my mySQL database itself. > > >>> > > >>> Either of the two solutions can work for me. > > >>> > > >>> Thanks, > > >>> T. Edison Jr. > > >>> > > >>> __ > > >>> Do You Yahoo!? > > >>> Yahoo! Tax Center - online filing with TurboTax > > >>> http://taxes.yahoo.com/ > > >>> > > >>> > > >> > > > > > > > > > = > > > Rahul S. Johari (Director) > > > ** > > > Abraxas Technologies Inc. > > > Homepage : http://www.abraxastech.com > > > Email : [EMAIL PROTECTED] > > > Tel : 91-4546512/4522124 > > > *** > > > > > > __ > > > Do You Yahoo!? > > > Yahoo! Tax Center - online filing with TurboTax > > > http://taxes.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] Adding "a" in "try.jpg"! Problems!
but if $myrow["ilmage"] = "hallo.hmm.gif"; your code won't work. so better: while ($myrow = mysql_fetch_array($result)) { $img = explode('.',$myrow[ilmage]); $img[count($img) - 1] .= "a"; echo ""; } "Richard Baskett" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Do the explode and implodes like that one fellow mentioned. > > So basically: > > while ($myrow = mysql_fetch_array($result)) { > $img = explode('.',$myrow[ilmage]); > echo "" > } > > What this will do is take your image split the image at the '.' then echo it > with the 'a'.. Hope it helps! > > Rick > > Be kind. Everyone you meet is fighting a hard battle - John Watson > > > From: "Thomas Edison Jr." <[EMAIL PROTECTED]> > > Date: Mon, 8 Apr 2002 01:17:51 -0700 (PDT) > > To: Miguel Cruz <[EMAIL PROTECTED]> > > Cc: [EMAIL PROTECTED] > > Subject: Re: [PHP] Adding "a" in "try.jpg"! Problems! > > > > Hi, > > > > Thanks for your relies. There are a couple of > > problems. Firstly, i'm picking the filename from the > > database, so my code is something like this : > > > > if ($myrow = mysql_fetch_array($result)) { > > do { > > echo(" > > > "); > > } while ($myrow = mysql_fetch_array($result)); > > } > > > > > > Now the filename is actually stored in $myrow[ilmage] > > How do i perform the spliting & adding functions on > > $myrow[ilmage] ?? > > Secondly, all images are not ".JPG", some are jpg & > > others are gif !!! > > > > Thank you.. > > T. Edison Jr. > > --- Miguel Cruz <[EMAIL PROTECTED]> wrote: > >> (untested) > >> > >> $newname = eregi_replace('\.jpg$', 'a.jpg', > >> $oldname); > >> > >> No point messing up your database; just use > >> something like the above when > >> you're outputting the image tags for the thumbnails. > >> > >> miguel > >> > >> On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > >> > >>> I have a new very intriguing problem at hand. > >>> > >>> I have the name of my Images stored in my mySQL > >>> database in one column. Now when i pick the > >> images, > >>> they are displayed as it as. However, they are the > >> big > >>> images, and the thumbnails of those images are > >> stored > >>> with an "a" at the end of thier names. > >>> That is, > >>> If the image is "try.jpg" , the thumbnail of the > >> image > >>> is "trya.jpg" !! > >>> Now i want to display the thumbnail and not the > >> large > >>> image. And unfortunately, my whole database > >> contains > >>> the name of Large images and NOt the Thumbnails. > >>> > >>> How can i : > >>> 1. Insert "a" at the end of the name of the image, > >>> before the ".extension" through PHP. > >>> The problems are that the names are stored in the > >>> database WITH the extesion. And the extensions > >> also > >>> vary, some are JPG and some are GIF. So in my > >> datase i > >>> have images as "try.jpg" or "something.gif"! How > >> can i > >>> insert an "a" at the end of the name before the > >> "." ? > >>> > >>> 2. OR.. can i insert the "a" before the "." in the > >>> image name in my mySQL database itself. > >>> > >>> Either of the two solutions can work for me. > >>> > >>> Thanks, > >>> T. Edison Jr. > >>> > >>> __ > >>> Do You Yahoo!? > >>> Yahoo! Tax Center - online filing with TurboTax > >>> http://taxes.yahoo.com/ > >>> > >>> > >> > > > > > > = > > Rahul S. Johari (Director) > > ** > > Abraxas Technologies Inc. > > Homepage : http://www.abraxastech.com > > Email : [EMAIL PROTECTED] > > Tel : 91-4546512/4522124 > > *** > > > > __ > > Do You Yahoo!? > > Yahoo! Tax Center - online filing with TurboTax > > http://taxes.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] Adding "a" in "try.jpg"! Problems!
$myrow[ilmage] = eregi_replace("(\.[^\.]+)$", "a\\1", $myrow[ilmage]); and if ilmage isn't a constant use $myrow["ilmage"]. "Thomas Edison Jr." <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > Thanks for your relies. There are a couple of > problems. Firstly, i'm picking the filename from the > database, so my code is something like this : > > if ($myrow = mysql_fetch_array($result)) { > do { > echo(" > "); > } while ($myrow = mysql_fetch_array($result)); > } > > > Now the filename is actually stored in $myrow[ilmage] > How do i perform the spliting & adding functions on > $myrow[ilmage] ?? > Secondly, all images are not ".JPG", some are jpg & > others are gif !!! > > Thank you.. > T. Edison Jr. > --- Miguel Cruz <[EMAIL PROTECTED]> wrote: > > (untested) > > > > $newname = eregi_replace('\.jpg$', 'a.jpg', > > $oldname); > > > > No point messing up your database; just use > > something like the above when > > you're outputting the image tags for the thumbnails. > > > > miguel > > > > On Mon, 8 Apr 2002, Thomas Edison Jr. wrote: > > > > > I have a new very intriguing problem at hand. > > > > > > I have the name of my Images stored in my mySQL > > > database in one column. Now when i pick the > > images, > > > they are displayed as it as. However, they are the > > big > > > images, and the thumbnails of those images are > > stored > > > with an "a" at the end of thier names. > > > That is, > > > If the image is "try.jpg" , the thumbnail of the > > image > > > is "trya.jpg" !! > > > Now i want to display the thumbnail and not the > > large > > > image. And unfortunately, my whole database > > contains > > > the name of Large images and NOt the Thumbnails. > > > > > > How can i : > > > 1. Insert "a" at the end of the name of the image, > > > before the ".extension" through PHP. > > > The problems are that the names are stored in the > > > database WITH the extesion. And the extensions > > also > > > vary, some are JPG and some are GIF. So in my > > datase i > > > have images as "try.jpg" or "something.gif"! How > > can i > > > insert an "a" at the end of the name before the > > "." ? > > > > > > 2. OR.. can i insert the "a" before the "." in the > > > image name in my mySQL database itself. > > > > > > Either of the two solutions can work for me. > > > > > > Thanks, > > > T. Edison Jr. > > > > > > __ > > > Do You Yahoo!? > > > Yahoo! Tax Center - online filing with TurboTax > > > http://taxes.yahoo.com/ > > > > > > > > > > > = > Rahul S. Johari (Director) > ** > Abraxas Technologies Inc. > Homepage : http://www.abraxastech.com > Email : [EMAIL PROTECTED] > Tel : 91-4546512/4522124 > *** > > __ > Do You Yahoo!? > Yahoo! Tax Center - online filing with TurboTax > http://taxes.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: sessions and passing variables
sure. if all users should have access to this instance of your object, then you could store the serialized object in a file, everyone has access to and unserialize it if needed.But don't forget to include your object-surcecode before unserializing the object, or you'll lose your methods. If users should also have write access to the object, you also have to make sure, that only one user can access the file for writing at one time, or your data gets probably screwed. The easiest way would be storing the object not in a file but in a database, so you don't have to care about locking. But do you really need the same instance of the object? why not simply perform a $obj =& new Class(); -- Code for Storing: Code for accessing: schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Is there a way to pass variables (objects) across the different > sessions. I thought of sharing one object for all users that access my > web site (it's an object that does some operations with files common to > all users, like reading and writing). Any ideas? > > Tnx in advance. > Armin > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Newbie Question
try this: Solid "); print("".$data[0].""); print(""); print("."$data[2].""); print("".$data[3].""); print("".$data[4].""); print("".$data[5].""); print(""); } } ?> "Hubert Daul" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi , > > Here's my problem : > > I read a data file (no sql file) which contains 8 lines, and in each line, 8 > datas > > (ex: name1;picture1;title1;anything1;everything1;nothing1) > > and when i run it I see only one picture(the second data) and not all of > them > > If someone could help me > > TYA > > Here the code : > > > > Solid > > > > > > > $row = 1; > $fp = fopen ("album.dat","r"); > while ($data = fgetcsv ($fp, 1000, ";")) > { > $num = count ($data); > > $row++; > > if (isset($vignette)) > { > print(""); > print("$vignette"); >// I think it's wrong here but I dont know why > ==> print(" \"prod.php?file=lecteur.dat\">"); > print("$marque"); > print("$nom"); > print("$pdfproduit"); > print("$commprod"); > print(""); > } > > > for ($c=0; $c<$num; $c++) > switch ($c) { > case 0 : > { > $vignette = $data[$c]; > break; > } > > case 1 : > { > $photo= $data[$c]; > break; > } > > case 2 : > { > $marque= $data[$c]; > break; > } > > case 3 : > { > $nom = $data[$c]; > break; > } > > case 4 : > { > $pdfproduit= $data[$c]; > break; > } > > case 5 : > { > $commprod = $data[$c]; > break; > } > } > } > ?> > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Copying Directory
there was a typo...this one should work # # # boolean copy_dirs ( string src_dir, string target_dir ) # # # copy a directory with subdirectories to a target directory # # Function Parameters: # string src_dir: source directory # string target_dir: target directory # # Return Values: # 0 - error while copying # 1 - files copied successfully # function copy_dirs ( $src_dir, $target_dir ) { $src_dir = ereg_replace ( "/$", "", $src_dir ); $target_dir = ereg_replace ( "/$", "", $target_dir ); if ( filetype ( $src_dir ) != "dir" ): return (0); endif; if ( !file_exists ( $target_dir ) ): mkdir ( $target_dir, 0777 ); endif; $hdl = opendir ( $src_dir ); while ( ( $file = readdir ( $hdl ) ) !== false ): if ( $file != "." && $file != ".." && $file != "" ): if ( filetype ( $src_dir."/".$file) == "dir" ): if ( !copy_dirs ( $src_dir."/".$file, $target_dir."/".$file ) ): return (0); endif; else: if ( !copy ( $src_dir."/".$file, $target_dir."/".$file ) ): return (0); endif; endif; endwhile; return (1); } > "Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hello, > > > > I guess anyone have made the function to coppy directories, not files. > > I'd like to copy directory including sub directories to other place. > > Doesn't anyone has mades that kind of function?And please telll me. > > > > Thamks in advance. > > HiroshiAyukawa > > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Copying Directory
# # # boolean copy_dirs ( string src_dir, string target_dir ) # # # copy shopdirectories into a new shop # # Function Parameters: # string src_dir: source directory # string target_dir: target directory # # Return Values: # 0 - error while copying # 1 - files copied successfully # function copy_dirs ( $src_dir, $target_dir ) { $src_dir = ereg_replace ( "/$", "", $src_dir ); $target_dir = ereg_replace ( "/$", "", $target_dir ); if ( filetype ( $src_dir ) != "dir" ): return (0); endif; if ( !file_exists ( $target_dir ) ): mkdir ( $target_dir, 0777 ); endif; $hdl = opendir ( $src_dir ); while ( ( $file = readdir ( $hdl ) ) !== false ): if ( $file != "." && $file != ".." && $file != "" ): if ( filetype ( $src_dir."/".$file) == "dir" ): if ( filetype ( $src_dir."/".$file) == "dir" ): if ( !copy_dirs ( $src_dir."/".$file, $target_dir."/".$file ) ): return (0); endif; else: if ( !copy ( $src_dir."/".$file, $target_dir."/".$file ) ): return (0); endif; endif; endwhile; return (1); } "Hiroshi Ayukawa" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello, > > I guess anyone have made the function to coppy directories, not files. > I'd like to copy directory including sub directories to other place. > Doesn't anyone has mades that kind of function?And please telll me. > > Thamks in advance. > HiroshiAyukawa > http://hoover.ktplan.ne.jp/kaihatsu/php_en/index.php?type=top > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Headers not working
this might be because you use the cgi version of php. to be able to send e.g. 404 header, you have to run php as webserver module which currently only works with apache and linux afaik. otherwise these headers get send by the webserver and you cannot affect them. if you use php with apache as module, you should use this: header('WWW-Authenticate: Basic realm="Private"'); header('HTTP/1.0 401 Unauthorized'); or look at this tutorial: http://www.zend.com/zend/tut/authentication.php "Sheridan Saint-Michel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag 002501c1dccb$75fd7060$[EMAIL PROTECTED]">news:002501c1dccb$75fd7060$[EMAIL PROTECTED]... > I was trying to write a some code that would disallow specific users access > to certain pages. I had thought this would be as simple as looking at > $PHP_AUTH_USER and sending a 401 header if it was a user that shouldn't have > access to that page. > > The problem is the HTTP header was not going out. I tried 404 and 401, and > then I thought perhaps the HTTP authentication was preventing me from > sending the header, so I tried several different headers (all copied and > pasted from the PHP manual) in an unprotected directory. I also tried both > IE6 and Mozilla to make sure there wasn't a borwser issue. > > The header line seems to be completely overlooked as things echoed below the > header were appearing in the original script. > > The test scripts in the unprotected directory are all very simple, for > example: > >header("Status: 404 Not Found"); > ?> > > I have saved three test scripts as both .php and .phps so you can view them. > In addition, I put up an info.php so you can see my entire PHP config in > case that is the problem. (links below). Also header(Location:) seems to > work without any problems. > > So what am I overlooking? > > http://www.foxjet.com/info.php > http://www.foxjet.com/test1.php > http://www.foxjet.com/test1.phps > http://www.foxjet.com/test2.php > http://www.foxjet.com/test2.phps > http://www.foxjet.com/test3.php > http://www.foxjet.com/test3.phps > > Sheridan Saint-Michel > Website Administrator > FoxJet, an ITW Company > www.foxjet.com > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: What's wrong with the Array? I"m baffled!
> $number = $sumItUp[$name]; > $number++; > $sumItUp[$name] = $number; this could be done easier: $sumItUp[$name]++; :) "Scott Fletcher" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi! > > I'm a little baffled on why the array is not working the way I expect it > to. It showed there is something about the array I do not know about. > Well, it's never too late to learn something new. So, here's the code and > see if you can help me out. > > -- clip -- > > $name = "TU4R"; > > if ($sumItUp[$name] == "") { > $sumItUp[$name] = 0; > } else { > //debug > echo "**"; > $number = $sumItUp[$name]; > $number++; > $sumItUp[$name] = $number; > } > echo $sumItUp[$name].""; > > -- clip -- > > In this case, the if statement never went into else statement when > there's a number like 0, 1, 2, etc. So, what's the heck is happening here? > When the array, "sumItUp[]" was empty then the number "0" was assigned and > it work like a charm. So, when this code is repeated again, the if > statement check the array, "sumItUp[]" and found a number, "0" and it is not > equal to "" as shown in the if statement. So, therefore the else statement > should be executed. But in this case, it never did. I tested it myself to > make sure I wasn't missing something by putting in the php codes, "echo > '**';" and the data, "**" was never spitted out on the webpage. So, it tell > me that the else statment was never executed. So, the problem had to do > with the data in the array itself. So, can anyone help me out? Thanks a > million!! > > Scott > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Any ideas on combining arrays????
perhaps: $FFR = array("TU4R" => array("data" => array(array("count" => "TU4R is 0"), array("count" => "TU4R is 1"), array("count" => "TU4R is 2"))), "PH01" => array("data" => array(array("count" => "PH01 is 0"; print_r($FFR); "Rick Emery" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > ok...so what problem are you having? what's the error? > your code worked for me, i.e., it compiled and executed > > -Original Message- > From: Scott Fletcher [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, April 03, 2002 11:15 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Any ideas on combining arrays > > > Hi! > > Need some ideas on combining some arrays into one! I have array for > data and other array for counter. How do I make an array that would show > different data for each counter number? > > -- clip -- >$FFR = array ( > "TU4R" => array( "data" => "", "count" => "" ), > "PH01" => array( "data" => "", "count" => "" ), >); > -- clip -- > > The response should look something like this when I pick the correct > data and correct count; > >$FFR["TU4R"]["data"]["0"]["count"] = "TU4R is 0"; >$FFR["TU4R"]["data"]["1"]["count"] = "TU4R is 1"; >$FFR["TU4R"]["data"]["2"]["count"] = "TU4R is 2"; > > I tried to do something like this but it doesn't work. I have been > working for 2 days trying to figure it out. I appreciate any help you can > provide for me. > > Thanks, > Scott > > > > -- > 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: Javascript and PHP??
sure you can use javascript in your php. php is serverside and produces the page. the webserver sends then this produced page to the client. so javascript is the same as html for php. it's just some lines of text. "Joe Keilholz" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hello All! > > I think this is a pretty simple question. I have a file that I am writing > information to and when the process is complete, I am needing to send the > file to the user. In Javascript all I would need to do is window.open() and > the file would be sent to the user (it's a .csv file). How would I > accomplish this in PHP? Can I incorporate Javascript into my PHP code? If > so, how? > > Any help would be appreciated! > Thanks! > Joe Keilholz > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php