Re: [PHP] What is wrong with next code
Have anyone answers on the strange behaviour discussed in the thread ? I has noted specially: It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented in all described versions of PHP. So next example works perfect: - error_reporting(E_ALL); $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); $result = mysql_query('SELECT 1+1', $db1); if ($result) { $row = mysql_fetch_row($result); echo Result: {$row[0]}\n; } - [EMAIL PROTECTED]:~/src/PHP# php -q mysql_connect3.php Result: 2 On Thu, 28 Oct 2004 23:08:39 -0400 John Holmes [EMAIL PROTECTED] wrote: Vladimir Shiray wrote: - Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... $result = mysql_query('SELECT 1+1', $db1); - [snip] $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); If you connect with the same parameters, PHP will just reuse the previous connection. So you only have one connection and closing either one will result in the connection being lost, hence the invalid link resource message. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals _ www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What is wrong with next code
I has noted specially: It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented in all described versions of PHP. So next example works perfect: - error_reporting(E_ALL); $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); $result = mysql_query('SELECT 1+1', $db1); if ($result) { $row = mysql_fetch_row($result); echo Result: {$row[0]}\n; } - [EMAIL PROTECTED]:~/src/PHP# php -q mysql_connect3.php Result: 2 On Thu, 28 Oct 2004 23:08:39 -0400 John Holmes [EMAIL PROTECTED] wrote: Vladimir Shiray wrote: - Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... $result = mysql_query('SELECT 1+1', $db1); - [snip] $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); If you connect with the same parameters, PHP will just reuse the previous connection. So you only have one connection and closing either one will result in the connection being lost, hence the invalid link resource message. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals _ www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What is wrong with next code
Can one explain me why I has got a result: - Warning: mysql_query(): 4 is not a valid MySQL-Link resource in ... $result = mysql_query('SELECT 1+1', $db1); - from next example. The example does not work correctly (as I expect) in PHP 4.3.8, 4.3.9, 5.0.2 It works OK in PHP 4.3.6 or when line $db2 = 0; had been commented in all described versions of PHP. If it's a correct behaviour in new versions of PHP so how can I free/unset $db2 variable without triggering such effect? - error_reporting(E_ALL); $db1 = mysql_connect ('localhost', 'test', '1'); $db2 = mysql_connect ('localhost', 'test', '1'); mysql_close($db2); $db2 = 0; $result = mysql_query('SELECT 1+1', $db1); if ($result) { $row = mysql_fetch_row($result); echo Result: {$row[0]}\n; } - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parse_ini_file problem
Hello folks! I have an ini file that looks like this: index.rent=Rent index.faq=FAQ index.contact=Contact index.links=Links then I want to read this file: $english_messages = parse_ini_file('conf/english.ini'); print_r($english_messages); What I see is: Array ( [index.rent] = Rent ) And that's all. Shouldn't parse_ini_file return all the messages I have in ini file but not only the first one? I'm using 4.3.8 on windows XP. TIA. Vladimir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] parsing question ('010.000.080.001' == `10.0.80.1`) how to be 'true'?
Two tables have diferent standarts to hold IP adresses: first: 045.012.001.002 003.000.123.231 123.230.101.080 second: 45.12.1.2 3.0.123.231 123.230.101.80 I have to compare the data and stack there .. my fantasy can't help me write regular expresion to parse first format into second or second into first. Please help me!... or there can be enother way to compare the data .. don't know... some function wich can translate both formats into binary format .. so any ideas very nessary :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mcrypt as shared module
How can I attach mcrypt to PHP (FreeBSD) without recompile whole PHP ? How can I compile mcrypt as PHP shared module ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: internal site search
Windows? Linux? Rehab Mostafa [EMAIL PROTECTED] ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hi guys, i wanna make an internal site search, i wanna search my internal html pages and php pages..and i have no clue how to do thatany help!!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: when is OOP a good choice?
if you work in comand its good thing. Anders Thoresson [EMAIL PROTECTED] ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I've just started to read about - and will soon try to write - object oriented code. I think I've got the basics both from the PHP-books I have, and from various sources on the web. But nowhere have I read a good explanation to two of my questions: 1. What are the main benefits from OOP? 2. When is OOP a good choice for a PHP script, and when is ordinary functions a better call? -- anders thoresson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advice on uploaded files
Me too. I add tracks to DB only and store images as independent files. My experiments with storing images in DB shows large memory use wich slow down other processes (especialy if I need to choose several images from DB). But if pictures unnumerous and small (smaler 30-40kb) my advice - insert them in DB. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] test
worked will be a flame I feel ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: server side games question
Good day! Some time ago I tried to create game server for games on line(people with people)... poker, preferance, chess and so on well as I was wery new in this action I tried diferent languages and even operation systems. At last (for some hawy rezons :-) ) I stoped on Client-Server model (Delphi+any database supported ODBCBDE) on Win NT (I feel that beter way is the same model on Unix C++ but I am not expiriensed in Unix process memory organization so have to use more light way). So the best way for online games is write your own client and server on C++ but use Appach-Some_Browser(by the way what it will be? IE1,2,3,4,5,6? NC? Mozilla? object model support?). There much gains you reciving using the model (first you know how it works + low trafick). Well but if you simply whant create games like Tetris or Digger online (man.server) than ofcouse better use IE5-6 as client (with it exelent object model) and server on PHPMySQL. Vladimir. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Help me to win the battle with browser's cache
Good time of a day! Hello Alex! META content=no-cache http-equiv=Pragma may be? but if you use $PHP_AUTH_USER, $PHP_AUTH_PW i don't see simple way if you check password every time page reqwesting... may be try to check password from temp file/table (just a miror of original). On login place reg data from original to temp and work with them... On logout delete or breake reg data in temp fille to resive the situation $PHP_AUTH_USER, $PHP_AUTH_PW entered before are denied now... Vladimir. Olexandr Vynnychenko [EMAIL PROTECTED] ???/ ? ?: [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello php-general, I have index.php, which has a href=index.php?logoutLog out/a. When I click it, I am logged out the site. But I type index.php in browser's address bar, press Enter and ... it shows non-logouted page. What should I write in php code to tell browser something like forget about old page, don't display it, get the newest version? Some time ago I tried to do that in several ways and nothing gived 100% result. And other thing I saw was that Netscape and Explorer behave in different ways in such cases. Could someone help me? Maybe this topic was discussed before, but still... I appreciate greatly any suggestion. -- Olexandr Vynnychenko mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Using PHP for directory indexing
Hi! Kevin! Try this... :-) have a nica day! ? // this is qw.php // is incoming parametr $catalog; // there can be better way to protect filesystem // directory where operations aloved define(START_PATH, named); $catalog = eregi_replace('([/]{2,})|([./]{2,})|([/.]{2,})', '/', $catalog); $handle=opendir(START_PATH.'/'.$catalog); rewinddir($handle); while ($file = readdir($handle)) { $filenames[]=$file; } closedir($handle); $str = 'Current directory: blaquo;'.START_PATH.$catalog.'raquo;/b'; print $str; echo 'brbrtable class=tabler'; echo 'tr class=menu_tr'; echo 'tdh4Record type tdh4Path/tr'; for ($i = 0; $i count($filenames); $i++) { if ($filenames[$i]!='.' $filenames[$i]!='..') { if (is_dir(START_PATH.$catalog.'/'.$filenames[$i])) { print 'tr class=ordinary_trtdDirectory/tdtd'; print 'a href=qw.php?catalog='.$catalog./.$filenames[$i].''.$filenames[$i].'/a/ td'; } else { print 'tr class=ordinary_trtdFile/tdtd'; print 'a href=qw.php?pather='.START_PATH.$catalog./.$filenames[$i].''.$filenames[$ i].'/a/td'; } print '/tr'; } } ? /table -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Using PHP for directory indexing
line print 'a href=qw.php?pather='.START_PATH.$catalog./.$filenames[$i].''.$filenames[$ i].'/a/td'; change on print 'a href='.START_PATH.$catalog./.$filenames[$i].''.$filenames[$i].'/a/td' ; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] how do the thing?
Good time of a day! well... as for me the construction... switch($action) { case ... .. } ...is not very elegant when number of cases over 40-60 or more and the only thing they must do is start one function (often with the same name). for example: case 'add_user_form': { show_add_user_form(); break; } more interesting is to create txt file with records like: add_user_formshow_add_user_form() add_user_recoderadd_user_recoder() ... So read show_add_user_form() is not a problem but how tell PHP that this is a name of function to start but a simple text string? ... P/S: I know about reading php manual ;-) may be in an hour or two I'll get answer on myself but may be somebody can answer qwicker? ;-) Thancks! Vladimr. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] get names of vars $HTTP_POST_VARS?
Good day! Is there any way to get names of vars and values from $HTTP_POST_VARS if I don't know their names and (ofcourse) values? (number can be taken from count($HTTP_POST_VARS) ) ... This is nesesery to write a function wich write log of user's work with remote filesystem. Vladimir Galkov [EMAIL PROTECTED] ICQ 84873967 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] how about walking another way?
Good time of a day! Very strange... the code you place here works good (if forget one '=' ). I thinck you have to chek what you have in $name, $MYPATH, $MYPATH/admin.php... by the way what error you have? not such file? ... or somth special?... If still not working. (vay;-))) ) than remember than any mission can be completed in different ways try somth like this ;-) if ($name == admin) { print 'META HTTP-EQUIV=Refresh Content=0; URL='.$MYPATH.'/admin.php.''; } .. Vladimir Galkov. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Passing many valaues to function
Good day! 1. Send array function_1($arr) where $arr: array. 2. This way is not very correct. just declare this varibles in function as global. 2.1. The enother way: get access to special array (in php3 only upper three are avible): $HTTP_GET_VARS $HTTP_POST_VARS $HTTP_COOKIE_VARS $HTTP_ENV_VARS $HTTP_SESSION_VARS $HTTP_SERVER_VARS This arrays store different types of varbles used during script's work. I never use this method to access to vars... so can't give 100% correct advice. just a way... read about using this arrays. Galkov Vladimir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: passing variables between pages without using url??
may be you find accepteble usint input name=id value=? print $id? type=HIDDEN ??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Running 1 more script inside
Good day! The problem I thinck ot in how but in what ... what do you wont to do?... Not realy understand the situation... May be the better way is to convert you child php file in some number of functions put them in some.php and at include('some.php'); ? ... som realy this all will work as one program but realy be different files? Galkov Vladimir [EMAIL PROTECTED] ICQ 84873967 Daniel Harik [EMAIL PROTECTED] ïèøåò â ñîîáùåíèè:[EMAIL PROTECTED] Hello Thank you for your prevoius replies I have 1 main php and 1 chil, i was wondreing how can i execute that child php file from parent, i just don't know how to do it with eval() function Thank You very much -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] regular expression
Need to remove all ../ /.. from user inputing string to prevent him walking and creating filesdirectories where I don't whant see them/him... The string: $path = eregi_replace('([..]{2,})|([./]{2})|([../]{3,})|([/.]{2})|([/..]{3})', '', $path); works good with any combinations ( ../../..qwert.txt = qwert.txt) untill somth like /../asd/../qwert.txt will be entered ... (/../asd/../qwert.txt = asdqwert.txt). So the qwestion is how upgrade regular expression to remove all this correctly (with all entered directory names but NOT assigned their names to file name... Must do the operation: /../asd//qwert.txt = qwert.txt but not = /asd/qwert.txt or asdqwert.txt.ru or /../asd/../qwert.txt.ru = qwert.txt.ru but not = /asd/qwert.txt.ru or asdqwert.txt.ru Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Yes you can........ but....
Yes you can... Ifif I rightly understand you only well... you whant submit information without clicking submit button? .. well then you have to imagine any suported event or use meta tag.. One problrm I don't use VB script Way one... ( this is example of 100% stupid code ... only to show the gate;-) ... will be usefull only if you find the way to abort/allow submit in you script ) form id= action=test.php onsubmit='chek()' // any supported event input type=text input type=submit /form script function chek() { document.forms('').submit(); } /script --- Way two... use meta tag (somth like game... or grenade ;-) I'm not worry you are not qwik enoth to fill all fields :-) ) ? $timer = 10; // seconds $url_str = http://arthurbard.com/testarea/AutoPost.php/?sender_name=Arthursender_emai l=me@workmessage=Hello.; // well.. what you wrote ? META HTTP-EQUIV=Refresh Content=? print $timer?; URL=? print $url_str ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: Dynamic update of content
Good day! Well... you can recive access to any tag on HTML page form java-script with code like this: h1 id='Razdel' here will be text from selected option /h1 br select id=selector onchange='some_event()' . /select function some_event() { objH1 = document.all[razdel]; objSelector = document.all[selector]; objH1.innerText = objSelector.value; } . innerText is a content betvin h1 /h1 Well... don't test that code... so cach only idea... but if you need more coments mail me I'll send working example. Have a nice day! --- Galkov Vladimir [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] does array sorted like you show in example?
Good day! ;-) does array sorted like you show in example? then the shortest way will be: $a = array_element_delete_function($a, 2); ... function array_element_delete_function($a, $ind) { $a[$ind] = $a[0]; unset($a[0]); return sort($a); } ofcourse if count($a) not criticaly large Galkov Vladimir [EMAIL PROTECTED] ICQ 84873967 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: does array sorted like you show in example?
Good day! my fingersrun faster my head ;-) ofcourse... MUST be (not in one string...) function array_element_delete_function($a, $ind) { $a[$ind] = $a[0]; unset($a[0]); sort($a); // return $a; // } - Galkov Vladimir [EMAIL PROTECTED] ICQ 8487396 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Question about PDF functions and PDFLib 3.03
I'm running PHP4.0.4pl1-Win32, Zend Engine v1.0.4, Zend Optimizer v1.0.0, I tryed to run sample script for creating PDF document. It's PHP manual script, but I get message like this: Fatal error: Call to undefined function: pdf_new() in c:/web/pdf/pdf.php on line 2 phpinfo.php said: PDF Support enabled PDFLib Version 3.03 CJK Font Support yes In-memory PDF Creation Supportyes Can you help me with this problem? Thanks in advance, Vladmir P.S. Here is a PDF that I wanted to create. ?php $pdf = PDF_new(); PDF_open_file($pdf, "test.pdf"); PDF_set_info($pdf, "Author", "Uwe Steinmann"); PDF_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0"); PDF_set_info($pdf, "Creator", "See Author"); PDF_set_info($pdf, "Subject", "Testing"); PDF_begin_page($pdf, 595, 842); PDF_add_outline($pdf, "Page 1"); PDF_set_font($pdf, "Times-Roman", 30, "host"); PDF_set_value($pdf, "textrendering", 1); PDF_show_xy($pdf, "Times Roman outlined", 50, 750); PDF_moveto($pdf, 50, 740); PDF_lineto($pdf, 330, 740); PDF_stroke($pdf); PDF_end_page($pdf); PDF_close($pdf); PDF_delete($pdf); echo "A HREF=getpdf.phpfinished/A"; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]