RE: [PHP] case insenstive
Just substitute strstr() with stristr() The extra I in stristr() stands for Insensitive. If I was insensitive, I would say RTFM :) If you look under http://www.php.net/manual/en/function.strstr.php It tells you about stristr [TK] -Original Message- From: jtjohnston [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 5 March 2002 5:08 PM To: [EMAIL PROTECTED] Subject: [PHP] case insenstive I need to make this case insensitive. This seems like over kill? if((substr($author, 0, 1) == a) or (substr($author, 0, 1) == 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] Compilation of PHP with socket module
Hi, Please, is there anybody who can help me to compile PHP with socket module? I work under W2000 with VC++ 6! Thanks in advance Fred
RE: [PHP] CheckBoxes....
Don't name the checkboxes all the same, instead: Option1 input type=checkbox name=ck0br Option2 input type=checkbox name=ck1br Option3 input type=checkbox name=ck2br Then handle it with function getCheckboxResults($prefix=FALSE) { global $_POST ; $results = NULL ; // needed for 'return' in case no items (v4.1.x) if(is_string($prefix)){ For($i=0;$i=count($_POST);$i++){ if(isset($_POST[$prefix.$i])) $results[] = $i ; } } else { return -1 ; } // throw exception in script return $results ; } $selectedCKItems = getCheckboxResults('ck'); if(!$selectedCKItems) makeError('Please select at least one item.'); If a checkbox is not selected, the CGI will drop it (as in, not pass on the name/value pair - meaning the name is not there - which is why you test for it's existance). I didn't test that example. But if it works, the function might be a nice addition to your (and mine) library :) you might use it like to: $prefix = 'ck'; Forech($arrLabels AS $i=$label) printf('%s input type=checkbox name=%s%dbr\n',$label,$prefix,$i); Then put this member functions in a class deinition and register instatiated objects with a session to use them across pages. $arrLabels would be a property of the class. 'ck' would be the value of another property. Maybe your foreach statement was in a member function. OK, I'll shut up now :) [TK] -Original Message- From: Erik Price [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 5 March 2002 2:24 AM To: bvr Cc: Ben Turner; [EMAIL PROTECTED] Subject: Re: [PHP] CheckBoxes On Sunday, March 3, 2002, at 11:15 AM, bvr wrote: If you append '[]' to the name, an array will be returned after submit with the values of the checked checkboxes. Is there any other way of doing this? Using the brackets at the end of the input's name is super-convenient, making it relatively easy to work with arrays and user input in PHP. I love that. But I also wish I could validate my pages as XHTML Strict. I know it's not really a big deal, it's just a pride-in-work thing. Alternatively, is there any plans to change the DTD for XHTML Strict to allow brackets? IMO it's not something that cause problems if it were to be supported. Kind of lame that it's not, actually. Until then, I'll keep using them (brackets) b/c there's some things that it seems I can't do without this technique, but it would be nice 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() getenv() problems (after 4.1.2 update)...
Hello, I wonder if anyone can help me with a problem I have. I have some sites hosted on a Cobalt Raq4 server (not sure if this is relevant). I recently upgraded PHP from a package at www.pkgmaster.com, and since making this upgrade I have problems with PHP that I cannot find the solution to. I have conacted their 'team' who have thus far offered no explanation, saying it must be something else causing these issues with PHP, but I haven't made any more changes, just installed the new PHP version. The problems are with the mail() function taking an AGE to excecute, and environmental HTTP header information not being sent/recieved by getenv(). Some examples follow.. For example, as an extremely basic example of the mail function going slow, this simple script: ? mail([EMAIL PROTECTED], Test subject, Test message); print finished!; ? Which can be found at http://www.clicktolearn.co.uk/test/mail.php in action, ran (as it should do) extremely fast the week before I made the upgrade from the packages. Now, as you will see, it runs dog slow. Secondly, the following script shows the lack of headers: http://www.clicktolearn.co.uk/test/ (click the link, so there's a referer to the script page)... ? function get_http_headers($url, $proto=HTTP/1.0, $timeout=10) { $return = false; if (substr($url,0,7)==http://;) { $url = substr($url,7); } $parts = parse_url(http://.$url); $ips = gethostbynamel($parts[host]); if ($ips[0]) { $ip = $ips[0]; $host = $parts[host]; $path = ($parts[path]) ? $parts[path] : /; $port = ($parts[port]) ? $parts[port] : 80; $start = time(); $timeout = $timeout + $start; if($sock = fsockopen($host, $port)) { set_socket_blocking($sock, 0); switch($proto) { case HTTP/1.1: set_socket_blocking($sock, 1); fputs($sock, sprintf(HEAD %s %s\n, $path, $proto)); fputs($sock, sprintf(Host: %s\n\n, $host)); break; default: fputs($sock, sprintf(HEAD %s %s\n\n, $path, $proto)); } while(!feof($sock) $t$timeout) { $line .= fgets($sock,1); $t = time(); } fclose($sock); $end = time(); if ($t=$timeout) { $http = parse_output($line); $http[result] = 502; $http[message] = Timed Out; $http[time_used] = $end - $start; $return = $http; } elseif($line) { $http = parse_output($line); $http[time_used] = $end - $start; $return = $http; } } } return $return; } function parse_output($line) { $lines = explode(\n, $line); if(substr($lines[0],0,4)==HTTP) { list($http[protocol], $http[result], $http[message]) = split([[:space:]]+,$lines[0],3); } else if(substr($lines[0],0,7)==Server:) { $http[server] = substr($lines[0],8); } for ($i=1; $icount($lines); $i++) { list($key, $val) = split(:[[:space:]]*, $lines[$i],2); $key = strtolower(trim($key)); if ($key) { $http[$key] = trim($val); } else { break; } } return($http); }; var_dump(getallheaders()); print brbr; var_dump(get_http_headers('http://www.clicktolearn.co.uk/test/testheaders.ph p')); print brbr; print $HTTP_REFERER; print brbr; print a href='Javascript: history.back();'Back/a; print brbr; var_dump(getenv($HTTP_REFERER)); ? Under the Back link is the output of: var_dump(getenv($HTTP_REFERER)); Now I know that this was working before the upgrade, as a log in script I use on the main site uses getenv($HTTP_REFERER) to send them back to where they came from. This again worked 100% fine before PHP upgrade. Sorry to take up your time, but there is a problem somewhere that has certainly only begun with PHP since I upgraded to 4.1.2, and I dont know what it could be!? Thanks in advance. Paul Mullett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Database Error
Ok guys, I need help with this one. I am getting the error: Error in query: SELECT label FROM menu WHERE id = '1'. Why am I getting this error? It seems right to me. I have the following code to call the class object, and I listed the class below it (I'm fairly new to classes): // Object being called from get.php ?php require(menu.class.php); $obj = new Menu(); echo $obj-get_label(1); ? // Class in the file menu.class.php class Menu { var $hostname; var $user; var $pass; var $db; var $table; function Menu() { $this-set_database_parameters(localhost, username, password, apps, menu); } function set_database_parameters($hostname, $user, $password, $db, $table) { $this-hostname = $hostname; $this-user = $user; $this-password = $password; $this-db = $db; $this-table = $table; } function query($query) { $connection = mysql_connect($this-hostname, $this-user, $this-pass) or die (Cannot connect to database); $ret = mysql_db_query($this-db, $query, $connection) or die (Error in query: $query); return $ret; } function get_label($id) { $query = SELECT label FROM $this-table WHERE id = '$id'; $result = $this-query($query); $row = mysql_fetch_row($result); return $row[0]; } } Thanks to anyone, in advance, that can help me with this one. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Database Error
On Wednesday 06 March 2002 17:56, Navid Yar wrote: Ok guys, I need help with this one. I am getting the error: Error in query: SELECT label FROM menu WHERE id = '1'. Why am I getting this error? It seems right to me. I have the following code to call the class object, and I listed the class below it (I'm fairly new to classes): Try plugging your query directly into mysql (at the command-line) to see whether it's a mysql problem or a php one. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If anything can go wrong, it will. -- Edsel Murphy */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Database Error
I'm thinking that it probably has to do with the quoting scheme or something else. I tried it on the command line, and it worked fine. I don't even think it matters what types of quotes I use around the id field. I tried both (single and double) on the command line, and it worked just fine. In other words, the SQL is fine, and there's nothing wrong with it. It must either be how I placed the sql statement into the query or how the class is executed. I'm not sure. It might entirely be something else. But, any help on this is really appreciated. -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 3:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Database Error On Wednesday 06 March 2002 17:56, Navid Yar wrote: Ok guys, I need help with this one. I am getting the error: Error in query: SELECT label FROM menu WHERE id = '1'. Why am I getting this error? It seems right to me. I have the following code to call the class object, and I listed the class below it (I'm fairly new to classes): Try plugging your query directly into mysql (at the command-line) to see whether it's a mysql problem or a php one. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If anything can go wrong, it will. -- Edsel Murphy */ -- 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 Digest 7 Mar 2002 10:17:11 -0000 Issue 1212
php-general Digest 7 Mar 2002 10:17:11 - Issue 1212 Topics (messages 87544 through 87595): Re: data from service into array 87544 by: Jim Winstead 87549 by: Craig Westerman 87550 by: Jim Winstead Re: Perl and PHP 87545 by: Steve Cayford Stopping PHP from sending any headers 87546 by: Nico Vrouwe Looking for a combo of include() and eval() 87547 by: Philip Hallstrom 87553 by: Philip Hallstrom 87554 by: Philip Hallstrom Session Array Problems - Please Help 87548 by: Jordan Re: php-general Digest 31 Jan 2001 00:15:17 - Issue 483 87551 by: wesley Re: preload dynamic image problems 87552 by: Tom Rogers wordwrapping by width 87555 by: Michael P. Carel Question on subscription 87556 by: Zenith Binary Tree Implimentation??? 87557 by: Bradley Goldsmith Re: PHPBuilder.com Has an Easy File Upload Article, does any1 know 87558 by: Tom Rogers Spruce Tree??? 87559 by: Bradley Goldsmith image creation to file 87560 by: Craig Westerman 87561 by: Tom Rogers 87563 by: Craig Westerman 87564 by: Jim Koutoumis 87581 by: Tom Rogers HELP UNIX vs Windows 87562 by: Christopher J. Crane 87573 by: michael kimsal Crontab 87565 by: Uma Shankari T. 87571 by: Philip Hallstrom File/Directory Permissions 87566 by: Alan McFarlane 87578 by: jtjohnston Use of flock() 87567 by: Alan McFarlane header() and frames 87568 by: Alan McFarlane 87570 by: Jim Winstead 87588 by: Paul A. Procacci A good PHP Shop 87569 by: Peter Haywood writing to a file 87572 by: Marc-Andre Vallee 87580 by: Marc-Andre Vallee Re: include() and paths 87574 by: Patrick Teague 87577 by: michael kimsal $db_list = mysql_list_dbs 87575 by: jtjohnston 87587 by: Kearns, Terry how to access an ini file using PHP 87576 by: jtjohnston Is flock necessary? 87579 by: jtjohnston Calling a Variable in a weird Way 87582 by: Phillip S. Baker 87583 by: Jason Murray Caching Problem 87584 by: Paul A. Procacci 87585 by: Paul A. Procacci Re: #!/usr/bin/php in output? 87586 by: Kearns, Terry Re: case insenstive 87589 by: Kearns, Terry Compilation of PHP with socket module 87590 by: Frédéric Vissault Re: CheckBoxes 87591 by: Kearns, Terry mail() getenv() problems (after 4.1.2 update)... 87592 by: Paul Database Error 87593 by: Navid Yar 87594 by: Jason Wong 87595 by: Navid Yar Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] -- ---BeginMessage--- Craig Westerman [EMAIL PROTECTED] wrote: I'm just now trying to learn PHP. I don't know ANYTHING about XML. I don't even have any XML reference books yet. I did create a PHP script that is usable (see below), but there has to be a more efficient way to do it with PHP. I'll hunt up your post on XML in the archives after I get a XML book. the example you provided isn't xml. (it has some resemblance, but it isn't xml.) here's a code snippet that will turn that format into an array: $fp = fopen($url,r); if (!$fp) die(could not open URL); $out = array(); while (!feof($fp)) { $line = fgets($fp,512); if (preg_match('!(\w+?)(.*?)/\1!', $line, $m)) { $out[$m[1]] = $m[2]; } } fclose($fp); print_r($out); jim ---End Message--- ---BeginMessage--- Thanks Jim. Works like a charm. Real sweet. Would you explain what this line does? $out[$m[1]] = $m[2]; Learning is a real blast. Wish I would have jumped in a couple of years ago. Thanks again. Craig [EMAIL PROTECTED] -Original Message- From: Jim Winstead [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 4:23 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] data from service into array Craig Westerman [EMAIL PROTECTED] wrote: I'm just now trying to learn PHP. I don't know ANYTHING about XML. I don't even have any XML reference books yet. I did create a PHP script that is usable (see below), but there has to be a more efficient way to do it with PHP. I'll hunt up your post on XML in the archives after I get a XML book. the example you provided isn't xml. (it has some resemblance, but it isn't xml.) here's a code snippet that will turn that format into an array: $fp = fopen($url,r); if (!$fp) die(could not open URL); $out = array(); while (!feof($fp)) { $line = fgets($fp,512); if (preg_match('!(\w+?)(.*?)/\1!', $line, $m)) { $out[$m[1]] = $m[2]; } } fclose($fp); print_r($out); jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Alphabet
Is there a simple function to generate the alphabet with php Thx Jeroen
Re: [PHP] Database Error
On Wednesday 06 March 2002 18:27, Navid Yar wrote: I'm thinking that it probably has to do with the quoting scheme or something else. I tried it on the command line, and it worked fine. I don't even think it matters what types of quotes I use around the id field. I tried both (single and double) on the command line, and it worked just fine. In other words, the SQL is fine, and there's nothing wrong with it. It must either be how I placed the sql statement into the query or how the class is executed. I'm not sure. It might entirely be something else. But, any help on this is really appreciated. If 'id' is a numeric field then you should not use quotes: SELECT label FROM menu WHERE id = 1 If it's a character field then it doesn't matter whether you use single or double quotes. One thing you could try doing is to rewrite your code so that it doesn't use mysql_db_query() as it has been deprecated as of php-4.0.6. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Patrick Henry thought that taxation without representation was bad, he should see how bad it is with representation. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabet
something like: for ($i=ord('A'); $iord('A')+26; $i++) { $str .= chr($i); } print $str; Greets, Edward - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: [General] [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 11:37 AM Subject: [PHP] Alphabet Is there a simple function to generate the alphabet with php Thx Jeroen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] overload() not working
is any compile time configuration needed to make 'overload()' function to work ?. when I use the below code it's saying 'undefined function overload'. Hope some light on this. Thanks in advance. ?php class OO { var $a = 111; var $elem = array('b' = 9, 'c' = 42); function __get($prop_name, $prop_value) { if (isset($this-elem[$prop_name])) { $prop_value = $this-elem[$prop_name]; return true; } else { return false; } } // Callback method for setting a property function __set($prop_name, $prop_value) { $this-elem[$prop_name] = $prop_value; return true; } } overload('OO'); $o = new OO; print \$o-a: $o-a\n; // print: $o-a: print \$o-b: $o-b\n; // print: $o-b: 9 print \$o-c: $o-c\n; // print: $o-c: 42 print \$o-d: $o-d\n; // print: $o-d: // add a new item to the $elem array in OO $o-x = 56; $val = new stdclass; $val-prop = 555; $o-a = array($val); var_dump($o-a[0]-prop); ? [EMAIL PROTECTED] --- We must use time wisely and forever realize that the time is always ripe to do right. -- Nelson Mandela --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabet
On Thursday 07 March 2002 18:42, Edward van Bilderbeek - Bean IT wrote: something like: for ($i=ord('A'); $iord('A')+26; $i++) { $str .= chr($i); } print $str; - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: [General] [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 11:37 AM Subject: [PHP] Alphabet Is there a simple function to generate the alphabet with php Don't know if it can get any simpler than: $alphabet = abc..; -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* The human race never solves any of its problems. It merely outlives them. -- David Gerrold */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PDF generation
Hello, I use PDF function to generate a PDF file. It works fine except I cannot generate a document with more than 10 pages ! For each page I use pdf_begin_page($pdf, 595, 842); I close each page with pdf_end_page Any ideas ?? jean-arthur EuroVox 4, place Félix Eboue 75583 Paris Cedex 12 Tel : 01 44 67 05 05 Fax : 01 44 67 05 19 Web : http://www.eurovox.fr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Rasmus, O'Reilly, Programming PHP
Rasmus/others, O'Reilly are advertising the imminent release (Mar 2002) of Programming PHP (http://www.oreilly.com/catalog/progphp/desc.html). Is that still going ahead? (I'll submit an advanced purchase order...) Regards, =dn -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] LDAP question
Hey I'm testing LDAP and I seem to have an error Call undefined function ldap_connect() the code is from php.net Can anybody tell me what I'm doing wrong :-)
[PHP] Re: header() and frames
Nope, that didn't work... Jim Winstead [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Alan McFarlane [EMAIL PROTECTED] wrote: header(location: index.php; target: _top); header(Location: index.php); header(Window-target: _top); jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] LDAP question
You don't seem to have LDAP support compiled into PHP. Try running ?php phpinfo(); ? and make sure that you have ldap support. /bsh/ Sven Jacobs wrote: Hey I'm testing LDAP and I seem to have an error Call undefined function ldap_connect() the code is from php.net Can anybody tell me what I'm doing wrong :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is flock necessary?
flock() may not be required - but I'm pretty sure it's damn sensible. As for using mySQL, well, these routines are part of a simple file-based cache system (specifically in my case used for caching mySQL data) Jtjohnston [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Group: Is flock even necessary? Allan: You look like you have Perled. It was necessary for Perl. Have you thought of MySQL instead? Alan McFarlane wrote: I've just written a couple of simple routines which read an write small text files to the server: function readData( $filename, $data ) { if (!$fd = @fopen($filename, r)) { return false; } flock($fd, LOCK_SH); $data = fread($fd, filesize($filename)); fclose($fd); return true; } function writeData( $filename, $data ) { if (!$fd = @fopen($filename, w)) { return false; } flock($fd, LOCK_EX); fwrite($fd, $data); fclose($fd); return true; } Now, the question is... How much time elapses between the fopen() statement and the flock() statements? Looking at the code, it would appear that two separate threads may call writeData() almost simultaneously giving the following execution: assume $filename = sample.txt; Thread #1 - $fd = fopen($filename, w); // succeeds Thread #2 - $fd = fopen($filename, w); // succeeds (I think) Thread #1 - flock($fd, LOCK_EX); // Does this succeed or fail? Thread #2 - flock($fd, LOCK_EX); // fails (I think) -- John Taylor-Johnston -- --- ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - Université de Sherbrooke: http://compcanlit.ca/ 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: header() and frames
On Thursday 07 March 2002 19:49, Alan McFarlane wrote: Nope, that didn't work... Jim Winstead [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Alan McFarlane [EMAIL PROTECTED] wrote: header(location: index.php; target: _top); header(Location: index.php); header(Window-target: _top); The location needs to be a full URL: http://www. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* Too often I find that the volume of paper expands to fill the available briefcases. -- Governor Jerry Brown */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] define new window
Hi This line opens in a new window. How can i define the size of the window, scroll options etc. echo a href= . $PHP_SELF . ?mode=results target=_blankResults/a; Thanks in advance Mohamed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] define new window
On Thu, 7 Mar 2002, Administration@myclassguide wrote: This line opens in a new window. How can i define the size of the window, scroll options etc. Javascript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and IBM DB2 / odbc_connect failed
Hello All, I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z in SQLConnect in /svr/jerry/web/myphppage.php But on the Linux server from the command line I don't have any problem to connect to the database... Do you have any idea what is the problem and how to solve it ? Thanks. Jerry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and IBM DB2 / odbc_connect failed
Jerry wrote: I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z in SQLConnect in /svr/jerry/web/myphppage.php We had a similar problem connecting to Adabas via ODBC. We installed a newer Apache version and then it worked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP MAIL function...why wont it work????
Brad, [I've put this back on the list, because someone who's into PHP's MAIL() from Linux might be able to help] OK, I 'KISS'ed' it. The line now reads: mail([EMAIL PROTECTED], Please call if this works, Hi there, From: [EMAIL PROTECTED]); and works fine. BUT, if i put my email address ([EMAIL PROTECTED]) in the 'to' field, no email is delivered. If i send it to any optushome address, no result. Seems it will work fine if sent outside my ISP. Any ideas?? Well the most ?sensible is that your fine Australian carrier, being ever mindful and caring of their customers, don't want you to talk to yourself - or to hear those voices in your head!? Now if you told me that you could 'talk' to in-house addresses but not 'outside', I'd not be surprised, but this way around? First off: you've achieved a successful transmission, so that you have proven the connection between PHP and the SMTP mail server! Secondly (I assume) you can use your email client to send msgs to yourself? (try not to listen to those voices - but don't ask me why - I'm only repeating what people say to me, regularly!) Ask CK to analyse the headers of the 'successful' msg. Take a look and see if you can follow the various servers that the msg routed through. Compare that with the headers on your me-to-me email and look for commonlity/differences. Other than that, another course would be to ask your ISP to explain the situation/email set up/if there is some 'bar' to prevent you from sending to yourself (a bit dopey, but possible) - I copy every newsletter sent to clients with one sent to 'me' - one of several checks for success/failure). Meantime, set yourself up with a free email service, eg Yahoo, and organise that as a 'reflector', ie to forward any msgs received automatically and immediately to your Optus account. Then use that for testing your transmissions (and not having to bother CK=Superman - wish my alter ego had such dramatic presence, but I think mine is a hat...). That way you could get on with things meantime. Regards, =dn Yep it is a linux box. Ok, seeing that's 'sweet', go for KISS! See earlier comments about simplifying and once 'plain vanilla' is working, add back the optional headers/multiple lines, etc. Will be easier to work out what's breaking things, and then address that issue. Regards, =dn Hi all... I have a line in a page that should send me an email when the page is loaded. mail([EMAIL PROTECTED], worked, Line 1\nLine 2\nLine 3); when i load the page...i get NO error msgs, but the function does not send the mail. There is no record of any activity in the mail log...any ideas... If your server is not a *nix box you need to separate headers with CRLF (Win) or CR (Mac). What does php.ini say in the mail section? Simplify the msg right down to the barest minimum, get it to work, then start adding... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Calling a Variable in a weird Way
-Original Message- From: Phillip S. Baker [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 05:52 for ($i=1; $i 12; $i++) { echo state_$i; // This would print out either Yes No or Maybe. } Close -- it's actually: echo ${state_$i}; (For the record, these are called variable variables, and are documented at http://www.php.net/manual/en/language.variables.variable.php). Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and IBM DB2 / odbc_connect failed
Which version of Apache did you installed to solve the problem ? Alexander Weber [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jerry wrote: I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z@ in SQLConnect in /svr/jerry/web/myphppage.php We had a similar problem connecting to Adabas via ODBC. We installed a newer Apache version and then it worked. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions PROBLEMS
Hey I have a problem with sessions, with the code below If I post i always seems to get the same session_id That is not the idea. I want to generate everytime a unique one what is wrong with my code if ($action ==logout){ session_destroy(); print destroy; } if ( $action == post ){ session_start(); session_register($username); print session_id(); print BRinput type='text' name='azerty' size='100'; print a href='http://192.168.101.75/netsaint/ldap3.php?action=logout'Logout/a; } if ( $action == ){ print form name='test' action ='http://192.168.101.75/netsaint/ldap3.php?action=post' method ='post' Login : input type='text' name='username' Password : input type='password' name='password' input type='submit' name='blabla' value='blabla' /form ; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Can anybody help me?
Hi friend, from morning onwards I am facing the problem with following php script. This script functionality as follows: Getting the date from user and validating it. I couldn't trace where the error is. Can anybody help me? Any help greatly appreciable. Devicetag.php - ?php //checking whether user had logged in or not. require(./secure_connection.php); $flag=session_authentication(); if(!$flag) { header(Location:wrongusage.html); exit; } // Connect to MySQL $connection = mysql_connect( 'localhost', 'balaji', 'pingpong' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'amerm' ) or die ( 'Unable to select database.' ); $emp_id=$HTTP_SESSION_VARS[user]; $query1=select emp_name from employee where emp_id='$emp_id'; $result=mysql_query($query1) or die(unable to execute query); // Get the employee name who logged in $line=mysql_fetch_array($result); $emp_name=$line[emp_name]; // Get current time and date $today = date(Y:m:d H:i:s); ? !DOCTYPE html public -//w3c//dtd html 4.0 transitional//en HTML head script type=JavaScript function changepage() { if(document.makereq.dev_name.selectedIndex!=0) { document.makereq.method=POST; document.makereq.action=./makerequest.php; document.makereq.submit(); return true; } return false; } function save() { if (document.makereq.dev_name.options[0].selected) { alert('Please choose the device name'); document.makereq.dev_name.focus(); return false; } else if(document.makereq.dev_type.options[0].selected) { alert(Please choose the device type); document.makereq.dev_type.focus(); return false; } else if(document.makereq.dev_tag.options[0].selected) { alert(Please choose the device tag); document.makereq.dev_tag.focus(); return false; } else { var flag; alert(Debug point #1); flag=checkDate(); if(flag==0) { return false; } else { flag=window.confirm('Are you sure details are correct?'); if(flag) { document.makereq.method = POST; document.makereq.action=save_request.php; document.makereq.submit(); return true; } else return false; } } } function checkDate() { var myDayStr1 = document.makereq.date1.value; var myMonthStr1 = document.makereq.month1.value; var myYearStr1= document.makereq.year1.value; var myDateStr1 = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; /* Using form values, create a new date object which looks like Wed Jan 1 00:00:00 EST 1975. */ var myDate1 = new Date( myDateStr1 ); // Convert the date to a string so we can parse it. var myDate_string1 = myDate1.toGMTString(); /* Split the string at every space and put the values into an array so, using the previous example, the first element in the array is Wed, the second element is Jan, the third element is 1, etc. */ var myDate_array1 = myDate_string1.split( ' ' ); /* If we entered Feb 31, 1975 in the form, the new Date() function converts the value to Mar 3, 1975. Therefore, we compare the month in the array with the month we entered into the form. If they match, then the date is valid, otherwise, the date is NOT valid. */ if ( myDate_array1[2] != myMonthStr1 ) { alert( 'I\'m sorry, but ' + myDateStr1 + ' is NOT a valid date.' ); return 0; } myDayStr2 = document.makereq.date2.value; myMonthStr2 = document.makereq.month2.value; myYearStr2 = document.makereq.year2.value; myDateStr2 = myDayStr2 + ' ' + myMonthStr2 + ' ' + myYearStr2; var myDate2 = new Date( myDateStr2 ); var myDate_string2 = myDate2.toGMTString(); var myDate_array2= myDate_string2.split( ' ' ); if ( myDate_array2[2] != myMonthStr2 ) { alert( 'I\'m sorry, but ' + myDateStr2 + ' is NOT a valid date.' ); return 0; } return 1; } function check() { document.makereq.method = POST;
RE: [PHP] HELP UNIX vs Windows
-Original Message- From: Christopher J. Crane [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 02:26 The problem is that on the windows platform all information is returned. On the linux platform the $Details variable is not populated. The nothing changes...so what could it be. The only thing I can think of is that maybe the version of php is different on the linux server. Sounds like a good bet, since the online manual entry for strtok says the following: The behavior when an empty part was found changed with PHP 4.1.0. The old behavior returned an empty string, while the new, correct, behavior simply skips the part of the string... So, if you have a line like this: cat|sku|name||9.99|image1|image2|yes|8.99|Massive reduction on widgets!| version prior to 4.1.0 would return 10 values (including a null 4th value for SubCategory), whereas from 4.1.0 onward you would get only the 9 non-null values. Thus, if you can legitimately have null values for any of your fields, using the split/explode route as previously suggested is definitely the way to go: explode('|', $cartFile[$i]) will return an array of the field values, including nulls, regardless of PHP version; you can then work with the array elements, or assign them to scalar variables using the list() construct. NOTE: explode('|', '|a|b|') will actually return an array with 4 elements, as explode sees empty fields before the first delimiter and after the last -- you can, of course, simply ignore these, but you need to be aware that they're there if this is how your lines are formatted. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Anybody have the script for getting date from the user and validating it?
Hi, If any body have the script for getting the date including the time from the user and validating it. If anybody have can u please forward it to me. Thanks in advance Balaji **Disclaimer Information contained in this E-MAIL being proprietary to Wipro Limited is 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying or dissemination of the information contained in the E-MAIL in any manner whatsoever is strictly prohibited. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Calling a Variable in a weird Way
You can do: for ($i=1; $i 12; $i++) { $n = state_$i; echo $$n; } That should do what you want (if I understood what you want correctly ;) /nico Phillip S. Baker [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am not sure I can articulate this well. But I will try. I want to combine either two variables or a variable and string to bring up the name of a previous variable name to display the data from the first. So in the first part I will have a listing that will look like type=radio name=state_1 value=No type=radio name=state_1 value=Yes type=radio name=state_1 value=Maybe type=radio name=state_2 value=No type=radio name=state_2 value=Yes type=radio name=state_2 value=Maybe // Submit etc Then later I will call a for loop to try and do something like for ($i=1; $i 12; $i++) { echo state_$i; // This would print out either Yes No or Maybe. } Is there a way I can do this. I thought I heard something about how I can but I do not remember. Phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Alphabet
$iord('Z') seems easier to me than $iord('A')+26 :) /Nico Edward Van Bilderbeek - Bean It [EMAIL PROTECTED] wrote in message 002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01">news:002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01... something like: for ($i=ord('A'); $iord('A')+26; $i++) { $str .= chr($i); } print $str; Greets, Edward - Original Message - From: Jeroen Timmers [EMAIL PROTECTED] To: [General] [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 11:37 AM Subject: [PHP] Alphabet Is there a simple function to generate the alphabet with php Thx Jeroen -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can anybody help me?
Did you recieve an error? If so, what was it? Tyler - Original Message - From: Balaji Ankem [EMAIL PROTECTED] To: Php-General [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 7:23 AM Subject: [PHP] Can anybody help me? Hi friend, from morning onwards I am facing the problem with following php script. This script functionality as follows: Getting the date from user and validating it. I couldn't trace where the error is. Can anybody help me? Any help greatly appreciable. Devicetag.php - ?php //checking whether user had logged in or not. require(./secure_connection.php); $flag=session_authentication(); if(!$flag) { header(Location:wrongusage.html); exit; } // Connect to MySQL $connection = mysql_connect( 'localhost', 'balaji', 'pingpong' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'amerm' ) or die ( 'Unable to select database.' ); $emp_id=$HTTP_SESSION_VARS[user]; $query1=select emp_name from employee where emp_id='$emp_id'; $result=mysql_query($query1) or die(unable to execute query); // Get the employee name who logged in $line=mysql_fetch_array($result); $emp_name=$line[emp_name]; // Get current time and date $today = date(Y:m:d H:i:s); ? !DOCTYPE html public -//w3c//dtd html 4.0 transitional//en HTML head script type=JavaScript function changepage() { if(document.makereq.dev_name.selectedIndex!=0) { document.makereq.method=POST; document.makereq.action=./makerequest.php; document.makereq.submit(); return true; } return false; } function save() { if (document.makereq.dev_name.options[0].selected) { alert('Please choose the device name'); document.makereq.dev_name.focus(); return false; } else if(document.makereq.dev_type.options[0].selected) { alert(Please choose the device type); document.makereq.dev_type.focus(); return false; } else if(document.makereq.dev_tag.options[0].selected) { alert(Please choose the device tag); document.makereq.dev_tag.focus(); return false; } else { var flag; alert(Debug point #1); flag=checkDate(); if(flag==0) { return false; } else { flag=window.confirm('Are you sure details are correct?'); if(flag) { document.makereq.method = POST; document.makereq.action=save_request.php; document.makereq.submit(); return true; } else return false; } } } function checkDate() { var myDayStr1 = document.makereq.date1.value; var myMonthStr1 = document.makereq.month1.value; var myYearStr1= document.makereq.year1.value; var myDateStr1 = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; /* Using form values, create a new date object which looks like Wed Jan 1 00:00:00 EST 1975. */ var myDate1 = new Date( myDateStr1 ); // Convert the date to a string so we can parse it. var myDate_string1 = myDate1.toGMTString(); /* Split the string at every space and put the values into an array so, using the previous example, the first element in the array is Wed, the second element is Jan, the third element is 1, etc. */ var myDate_array1 = myDate_string1.split( ' ' ); /* If we entered Feb 31, 1975 in the form, the new Date() function converts the value to Mar 3, 1975. Therefore, we compare the month in the array with the month we entered into the form. If they match, then the date is valid, otherwise, the date is NOT valid. */ if ( myDate_array1[2] != myMonthStr1 ) { alert( 'I\'m sorry, but ' + myDateStr1 + ' is NOT a valid date.' ); return 0; } myDayStr2 = document.makereq.date2.value; myMonthStr2 = document.makereq.month2.value; myYearStr2 = document.makereq.year2.value; myDateStr2 = myDayStr2 + ' ' + myMonthStr2 + ' ' + myYearStr2; var myDate2 = new Date( myDateStr2 ); var myDate_string2 = myDate2.toGMTString(); var myDate_array2= myDate_string2.split( ' ' ); if ( myDate_array2[2] != myMonthStr2 ) { alert( 'I\'m sorry, but ' + myDateStr2 + ' is NOT a valid date.' ); return 0; } return 1; } function check() { document.makereq.method = POST; document.makereq.action=createrequest_f.php; document.makereq.submit(); return true; } /script /head BODY background=imacbg1.gif ONLOAD=document.makereq.dev_tag.focus() form name=makereq div align=center center h2CREATE REQUEST/h2 table border=0 width=100% tr td width=50% align=right p align=rightbfont size=2 face=ArialDevice Name/font/b /td td width=5%/td td width=50% align=left select name=dev_name STYLE=width : 127px onChange=changepage(); option value=0SELECT/option option value=?php echo $dev_name; ? SELECTED?php echo $dev_name; ?/option /select /td /tr tr td width=50% align=right p align=rightbfont size=2 face=ArialDevice Typenbsp;nbsp;/font/b /td td width=5%/td td width=50% select name=dev_type STYLE=width : 127px option value=0SELECT/option option value=?php echo $dev_type; ? SELECTED?php echo $dev_type
Re: [PHP] Alphabet
Very true. oops :) /Nico - Original Message - From: David Apthorpe [EMAIL PROTECTED] To: 'Nico Vrouwe' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 2:34 PM Subject: RE: [PHP] Alphabet : Shouldn't it be $i=ord('Z') ? : : David Apthorpe : : -Original Message- : From: Nico Vrouwe [mailto:[EMAIL PROTECTED]] : Sent: 07 March 2002 13:30 : To: [EMAIL PROTECTED] : Subject: Re: [PHP] Alphabet : : $iord('Z') seems easier to me than $iord('A')+26 :) : : /Nico : : : Edward Van Bilderbeek - Bean It [EMAIL PROTECTED] wrote in message : 002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01">news:002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01... : something like: : : for ($i=ord('A'); $iord('A')+26; $i++) { : $str .= chr($i); : } : : print $str; : : Greets, : : Edward : : : - Original Message - : From: Jeroen Timmers [EMAIL PROTECTED] : To: [General] [EMAIL PROTECTED] : Sent: Thursday, March 07, 2002 11:37 AM : Subject: [PHP] Alphabet : : : Is there a simple function to generate : the alphabet with php : : Thx : : Jeroen : : : : : : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : : --- : Incoming mail is certified Virus Free. : Checked by AVG anti-virus system (http://www.grisoft.com). : Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/2002 : : : --- : Outgoing mail is certified Virus Free. : Checked by AVG anti-virus system (http://www.grisoft.com). : Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/2002 : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Alphabet
Or how about: foreach(range('A', 'Z') AS $val){ echo $val; } range('A', 'Z') will produce an array of character A thru Z. http://www.php.net/manual/en/function.range.php Robert Zwink http://www.zwink.net/daid.php -Original Message- From: Nico Vrouwe [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 8:42 AM To: David Apthorpe; [EMAIL PROTECTED] Subject: Re: [PHP] Alphabet Very true. oops :) /Nico - Original Message - From: David Apthorpe [EMAIL PROTECTED] To: 'Nico Vrouwe' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 2:34 PM Subject: RE: [PHP] Alphabet : Shouldn't it be $i=ord('Z') ? : : David Apthorpe : : -Original Message- : From: Nico Vrouwe [mailto:[EMAIL PROTECTED]] : Sent: 07 March 2002 13:30 : To: [EMAIL PROTECTED] : Subject: Re: [PHP] Alphabet : : $iord('Z') seems easier to me than $iord('A')+26 :) : : /Nico : : : Edward Van Bilderbeek - Bean It [EMAIL PROTECTED] wrote in message : 002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01">news:002601c1c5c4$d008e3f0$2d48c23e@VANBILDE01... : something like: : : for ($i=ord('A'); $iord('A')+26; $i++) { : $str .= chr($i); : } : : print $str; : : Greets, : : Edward : : : - Original Message - : From: Jeroen Timmers [EMAIL PROTECTED] : To: [General] [EMAIL PROTECTED] : Sent: Thursday, March 07, 2002 11:37 AM : Subject: [PHP] Alphabet : : : Is there a simple function to generate : the alphabet with php : : Thx : : Jeroen : : : : : : : -- : PHP General Mailing List (http://www.php.net/) : To unsubscribe, visit: http://www.php.net/unsub.php : : --- : Incoming mail is certified Virus Free. : Checked by AVG anti-virus system (http://www.grisoft.com). : Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/2002 : : : --- : Outgoing mail is certified Virus Free. : Checked by AVG anti-virus system (http://www.grisoft.com). : Version: 6.0.330 / Virus Database: 184 - Release Date: 28/02/2002 : -- 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] File/Directory Permissions
-Original Message- From: Alan McFarlane [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 03:20 I've seen and successfully used the built-in function 'mkdir()' on several occasions, but I am having trouble understanding the mode parameter. I've seen 0771, 0775 and 0777 used on several occasions but I am never quite sure what to use. These are actually the *nix access rights of the directory or file. What you see is actually an octal bitmask: the first octal digit (or odgit!) applies to the file or directory's owner, the second to all users in the same group as the owner, and the third to all other users. In each case, the odgit is made up by adding together the following bitmask values: 4: read permitted 2: write permitted 1: file can be executed; directory can be searched so a mode of 0750, for example, says that the owner has all rights, other users belonging to the same group have read and execute/search, and everyone else has none. 0777 is the most insecure setting as it gives everyone all rights! As a slight side note - can these permissions be applied to files - if so, when (and how) would it be done? Permissions are generally inherited from the parent directory if not explicitly set -- so you might set permissions on a file, for example, if you want it to be read-only in a directory that is itself set to allow read/write permissions. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session_start()
Do I have to place a session_start() function at the top of a page (.php) before the headers? If I am creating a login form with PHP_SELF, can I place the session_start() at any point in the html where the user has been validated and logged in? Thanks, Tami Team GotFusion
RE: [PHP] Re: PHP-Based Authentication Security?
.htaccess and pw files are pointless, who wants to maintain potentially 10 or 20 of these things? Furthermore, it's gotta do more than just serve a single file at a time -- that's simple... I needed directly-level security. The solution I came up with was to use a module called mod_auth_any, which (with a little minor adjustment) can execute a PHP script from the console and rely on it's response to grant authentication or not. That gives me Apache-level security without Apache-authentication. John -Original Message- From: J Smith [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 3:58 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: PHP-Based Authentication Security? An easier way to do it might be to use HTTP authentication with apache using .htaccess and .htpasswd files, which can be placed in the secure directories. (Or use one global .htpasswd file and have all .htaccess files point to it.) Another possibility would be to set up two PHP scripts, one being some kind of form to enter a username, password, etc., and another to check the input and act as a pass-thru for the file to be downloaded. The second script could look something like this (obviously simplified): if ($authenticated) { header(Content-type: whatever/text); readfile($filename); } else { print You can't download this. } Which you would call as something like: http://www.example.com/path/download.php?filename=somefile.txt Obviously, you need to take care of a few security problems, like making sure they don't do something like http://www.example.com/path/download.php?filename=/etc/passwd And you'd have to make sure the file exists and such before sending it out. And determine the MIME type of the file. (I usually do this by extension.) But overall, it would work. I have a similar script, minus the authentication feature. J John Coggeshall wrote: Hey all.. I've got a question -- I'd like to restrict access to entire directories based on if the user has been authenticated or not. Basically, I'd like to set up a auto-include *FROM APACHE* to run a PHP script prior to sending any documents what-so-ever and only send the requested document if the PHP script allows it. So.. Request Made - PHP Script Runs - PHP Checks Authentication - PHP says OK - Apache sends file normally Or.. Request Made - PHP Script Runs - PHP Checks Authentication - PHP says NO - Apache stops dead in it's tracks or displays a HTTP error Is this possible? It has to work for any document or MIME type and be restrictable by directory... (i.e. I just want this happening in a /secure/ directory) John -- 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] Makeing $string into CAPS
$str = strtoupper($str); John -Original Message- From: Philip J. Newman [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 06, 2002 4:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Makeing $string into CAPS How can I make a $string = hello into $string = HELLO? Philip J. Newman PhilipNZ :: Design Solutions http://www.philipnz.com/ [EMAIL PROTECTED] ICQ# 20482482 +64 25 6144012 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Can anybody help me?
Dear Tyler Thankyou for reply. I got java script error message! Line: 478 Char :1 Error:Object expected Code :0 Otherwise if u have the script (html and java) for getting the date and time and validating it... could u plz. Forward it to me. Thanks in advance Balaji -Original Message- From: Tyler Longren [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 7:08 PM To: Balaji Ankem; Php-General Subject: Re: [PHP] Can anybody help me? Did you recieve an error? If so, what was it? Tyler - Original Message - From: Balaji Ankem [EMAIL PROTECTED] To: Php-General [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 7:23 AM Subject: [PHP] Can anybody help me? Hi friend, from morning onwards I am facing the problem with following php script. This script functionality as follows: Getting the date from user and validating it. I couldn't trace where the error is. Can anybody help me? Any help greatly appreciable. Devicetag.php - ?php //checking whether user had logged in or not. require(./secure_connection.php); $flag=session_authentication(); if(!$flag) { header(Location:wrongusage.html); exit; } // Connect to MySQL $connection = mysql_connect( 'localhost', 'balaji', 'pingpong' ) or die ( 'Unable to connect to server.' ); // Select database on MySQL server mysql_select_db( 'amerm' ) or die ( 'Unable to select database.' ); $emp_id=$HTTP_SESSION_VARS[user]; $query1=select emp_name from employee where emp_id='$emp_id'; $result=mysql_query($query1) or die(unable to execute query); // Get the employee name who logged in $line=mysql_fetch_array($result); $emp_name=$line[emp_name]; // Get current time and date $today = date(Y:m:d H:i:s); ? !DOCTYPE html public -//w3c//dtd html 4.0 transitional//en HTML head script type=JavaScript function changepage() { if(document.makereq.dev_name.selectedIndex!=0) { document.makereq.method=POST; document.makereq.action=./makerequest.php; document.makereq.submit(); return true; } return false; } function save() { if (document.makereq.dev_name.options[0].selected) { alert('Please choose the device name'); document.makereq.dev_name.focus(); return false; } else if(document.makereq.dev_type.options[0].selected) { alert(Please choose the device type); document.makereq.dev_type.focus(); return false; } else if(document.makereq.dev_tag.options[0].selected) { alert(Please choose the device tag); document.makereq.dev_tag.focus(); return false; } else { var flag; alert(Debug point #1); flag=checkDate(); if(flag==0) { return false; } else { flag=window.confirm('Are you sure details are correct?'); if(flag) { document.makereq.method = POST; document.makereq.action=save_request.php; document.makereq.submit(); return true; } else return false; } } } function checkDate() { var myDayStr1 = document.makereq.date1.value; var myMonthStr1 = document.makereq.month1.value; var myYearStr1= document.makereq.year1.value; var myDateStr1 = myDayStr + ' ' + myMonthStr + ' ' + myYearStr; /* Using form values, create a new date object which looks like Wed Jan 1 00:00:00 EST 1975. */ var myDate1 = new Date( myDateStr1 ); // Convert the date to a string so we can parse it. var myDate_string1 = myDate1.toGMTString(); /* Split the string at every space and put the values into an array so, using the previous example, the first element in the array is Wed, the second element is Jan, the third element is 1, etc. */ var myDate_array1 = myDate_string1.split( ' ' ); /* If we entered Feb 31, 1975 in the form, the new Date() function converts the value to Mar 3, 1975. Therefore, we compare the month in the array with the month we entered into the form. If they match, then the date is valid, otherwise, the date is NOT valid. */ if ( myDate_array1[2] != myMonthStr1 ) { alert( 'I\'m sorry, but ' + myDateStr1 + ' is NOT a valid date.' ); return 0; } myDayStr2 = document.makereq.date2.value; myMonthStr2 = document.makereq.month2.value; myYearStr2 = document.makereq.year2.value; myDateStr2 = myDayStr2 + ' ' + myMonthStr2 + ' ' + myYearStr2; var myDate2 = new Date( myDateStr2 ); var myDate_string2 = myDate2.toGMTString(); var myDate_array2= myDate_string2.split( ' ' ); if ( myDate_array2[2] != myMonthStr2 ) { alert( 'I\'m sorry, but ' + myDateStr2 + ' is NOT a valid date.' ); return 0; } return 1; } function check() { document.makereq.method = POST; document.makereq.action=createrequest_f.php; document.makereq.submit(); return true; } /script /head BODY background=imacbg1.gif ONLOAD=document.makereq.dev_tag.focus() form name=makereq div align=center center h2CREATE REQUEST/h2 table border=0 width=100% tr td width=50% align=right p align=rightbfont size=2 face=ArialDevice Name/font/b /td td width=5%/td td
[PHP] using a variable to a function call
Hi all I get a variable that is set be a select box on a page. I want to use this variable to call a function within a class that is based on it's name. so if $var = me I want to call $class-me_function(); or if $var = you call $class-you_function(); How can I use the variable as part of the function name to call. TIA matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Script Debug.
Hi, someone was helping me with this last night at home, but now I am in work I am still struggling. I have a user_auth script what works fine, it registers the username and password as session variables then matches them to the rows entered in the database - if they don't match it unregisters the session vars, if it does i would like to ti register a new sesson var called user_auth_level (ie how much authorisation this user has) this is the part of the script that does that. When I print the $user_auth_level I get null ? can any one help. thanks, Matt. else { session_register(user_auth_level); $auth_select = select account_admin_level from account_details where username='$login_username'; $run_auth_select = mysql_query($auth_select); $run_auth_select_results = mysql_fetch_row($run_auth_select); $user_auth_level = $run_auth_select_results[0]; ? HTML HEAD/HEAD BODY BGCOLOR=black FONT FACE=arial COLOR=white SIZE=3 H1 Access Granted /H1 Welcome you are fully logged into testsite.com your access level is ? print $user_auth_level ? /BODY /HTML ?php exit; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and IBM DB2 / odbc_connect failed
I had the exact same problem too, reference here and you will find the answer, I assure you: http://www.phpbuilder.com/forum/read.php3?num=3id=105752thread=104455 -Original Message- From: Jerry [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 6:10 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP and IBM DB2 / odbc_connect failed Which version of Apache did you installed to solve the problem ? Alexander Weber [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jerry wrote: I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z@ in SQLConnect in /svr/jerry/web/myphppage.php We had a similar problem connecting to Adabas via ODBC. We installed a newer Apache version and then it worked. -- 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] Script Debug.
Could be several things ... else { session_register(user_auth_level); $auth_select = select account_admin_level from account_details where username='$login_username'; Perhaps echo the sql statement here so you can see what you're trying to do. $run_auth_select = mysql_query($auth_select); Check if the query was successful here. Success meaning the statement was valid; not that you got a result. If it's not successful, then there's something wrong with the sql statement. $run_auth_select_results = mysql_fetch_row($run_auth_select); Check here if you have a row before accessing the dataset below. If you don't then take some error handling action such as redisplaying login with a message that the user wasn't found. $user_auth_level = $run_auth_select_results[0]; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and IBM DB2 / odbc_connect failed
A quick and easy check is this: Once logged in as root do an 'su - db2inst1' The '-' is ins mandatory to get the dbinst profile Once there, do a 'su' with no '-' to keep the db2inst profile. Then stop and start apache. Dan -Original Message- From: Jerry [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 6:10 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP and IBM DB2 / odbc_connect failed Which version of Apache did you installed to solve the problem ? Alexander Weber [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Jerry wrote: I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z@ in SQLConnect in /svr/jerry/web/myphppage.php We had a similar problem connecting to Adabas via ODBC. We installed a newer Apache version and then it worked. -- 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: using a variable to a function call
You could try something like this: eval( \$class- . $var . _function(); ); /nico Matt Williams [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all I get a variable that is set be a select box on a page. I want to use this variable to call a function within a class that is based on it's name. so if $var = me I want to call $class-me_function(); or if $var = you call $class-you_function(); How can I use the variable as part of the function name to call. TIA matt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a variable to a function call
isn't it the easiest way to do something like this: class test { function do ($var) { if ($var=='you') { $this-you_function(); } else { $this-me_function(); } } function you_function() { ... } function me_function() { ... } } $class = new test(); $class-do($var); Greets, Edward - Original Message - From: Matt Williams [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 3:25 PM Subject: [PHP] using a variable to a function call Hi all I get a variable that is set be a select box on a page. I want to use this variable to call a function within a class that is based on it's name. so if $var = me I want to call $class-me_function(); or if $var = you call $class-you_function(); How can I use the variable as part of the function name to call. TIA matt -- 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] Script Debug.
Also you can set up php to show you all warnings and display them for you. In the php.ini file you can change some values so that you can do some debugging. Here are the values you can change: display_errors = On display_startup_errors = On or error_log = syslog or error_log = filename Having display_errors on will display errors to you when you run them. Display_startup_errors will show startup errors that php has if any. Or you can have all errors go to syslog or have error_log = filename go to a specific file for you. This has helped me debug many scripts that did not display errors for me. Thank you, Ray Hunter Firmware Engineer ENTERASYS NETWORKS -Original Message- From: DARCY,MATTHEW (Non-HP-UnitedKingdom,ex2) [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 7:52 AM To: [EMAIL PROTECTED] Subject: [PHP] Script Debug. Hi, someone was helping me with this last night at home, but now I am in work I am still struggling. I have a user_auth script what works fine, it registers the username and password as session variables then matches them to the rows entered in the database - if they don't match it unregisters the session vars, if it does i would like to ti register a new sesson var called user_auth_level (ie how much authorisation this user has) this is the part of the script that does that. When I print the $user_auth_level I get null ? can any one help. thanks, Matt. else { session_register(user_auth_level); $auth_select = select account_admin_level from account_details where username='$login_username'; $run_auth_select = mysql_query($auth_select); $run_auth_select_results = mysql_fetch_row($run_auth_select); $user_auth_level = $run_auth_select_results[0]; ? HTML HEAD/HEAD BODY BGCOLOR=black FONT FACE=arial COLOR=white SIZE=3 H1 Access Granted /H1 Welcome you are fully logged into testsite.com your access level is ? print $user_auth_level ? /BODY /HTML ?php exit; } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PLease Help : Php4.1.2 and MySQL Problem
Hi all, I'm currently experiencing a very strange probleme. It appears randomly and i'm not able to debug/diagnostic myself. I've a php script that connects to my mySQL database. This works good in most of time, but sometime i've got the following messages: Warning: Lost connection to MySQL server during query in /home/users/web/www/www/news/links.php on line 6 and just after: Warning: MySQL Connection Failed: Lost connection to MySQL server during query in /home/users/web/www/www/news/links.php on line 6 Could not connect The first message is very strange. All connections are done through TCP/IP. I'm running under glibc 2.2.5 PLease help me ! Thanks a lot -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Congrats to Rasmus?
It doesn't seem to have been mentioned here unless my newsfeed is very slow, but phpdeveloper.org has a quick mention of the new addition to Rasmus' family. http://www.phpdeveloper.org/ Well, everyone's favorite PHP developer multiplied last night - Rasmus Lerdorf now has a son (9.0lbs, 19.25in. - a big boy) was born at 13:26 PDT on Wednesday March 6, 2002. If you'd like to see some pics from the family, check out this page - or to send congrats, email [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] New to PHP, need help.
I currently working with some free source from CyberGl and am having a problem with the membership module. I've inserted the php into the beginning of the page but when I go to test the page, nothing appears. I don't get a 404 error or any error, the page just doesn't display. Any ideas? Thanks, Michele -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Userfriendly
Hello, Does anybody know of a php script that will email the daily userfriendly.org comic? Thanks, Josiah Wallingford Email = [EMAIL PROTECTED] Mailing lists: PHP General - [EMAIL PROTECTED] BBEdit Talk - [EMAIL PROTECTED] BBEdit Web Authoring - [EMAIL PROTECTED] ICRadius - [EMAIL PROTECTED] Linux Newbie - [EMAIL PROTECTED] MySql - [EMAIL PROTECTED] Messenger Services: (MSN Instant Messenger = josiahlizzard) (ICQ # 150522268) (Yahoo Instant Messenger = josiahwallingford) (AIM American Online Instant Messenger = JosiahWalling) Web Pages: www.josiahw.com www.pooponwindows.com www.mymysql.com www.bigbirdlinux.com www.sofast.net www.darwinduck.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP and IBM DB2 / odbc_connect failed
Good news problem solved ! It was an incorrect modules somewhere and an error of settings (a missing backslash) by our Linux Expert. Jerry Jerry [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello All, I have IBM DB2 v7.2 FP5 on a Windows 2000 Server A Linux Web server running with Apache/PHP4 And IBM DB2 V7.2 Client Install on it. When I try to use odbc_connect($dbname, $user,$password); I received the message: Warning: SQL error: , SQL state ¿Ë ?=z@éÿ¿ÛË ?=z@?=z@ in SQLConnect in /svr/jerry/web/myphppage.php But on the Linux server from the command line I don't have any problem to connect to the database... Do you have any idea what is the problem and how to solve it ? Thanks. Jerry . -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and IBM DB2 / odbc_connect failed
Good news problem solved ! It was an incorrect modules somewhere and an error of settings (a missing backslash) by our Linux Expert. Jerry Dan Vande More [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I had the exact same problem too, reference here and you will find the answer, I assure you: http://www.phpbuilder.com/forum/read.php3?num=3id=105752thread=104455 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] trapping the user name from .htaccess / .htpasswd
Hello all, I have an .htaccess and .htpasswd file in a directory. This is working fine, when anyone attempts to enter this directory, they are prompted for a user name and password, and if correctly entered, the page will load fine. What I would like is the ability to capture, or trap the user name. Immagine, in the simplist example, when the form loads, I could have ? print Hello.$username; ? Assuming $username was the varable for the user who logged in. How can I do this... any ideas? Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] impossible to delete file after 'parse_ini_file'
php script : ?php $ini_array = parse_ini_file(conf/conf.php); echo($ini_array[var1]); ? content of conf/conf.php : [data] var1 = xxx After execution of the php script, it is impossible to delete the conf.php file. Any idea ? greg -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trapping the user name from .htaccess / .htpasswd
On Friday 08 March 2002 00:36, Dave wrote: Hello all, I have an .htaccess and .htpasswd file in a directory. This is working fine, when anyone attempts to enter this directory, they are prompted for a user name and password, and if correctly entered, the page will load fine. What I would like is the ability to capture, or trap the user name. Immagine, in the simplist example, when the form loads, I could have ? print Hello.$username; ? Assuming $username was the varable for the user who logged in. Use $PHP_AUTH_USER $PHP_AUTH_PW. Read the manual chapter HTTP authentication with PHP. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* My idea of roughing it is turning the air conditioner too low. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.1.2 binary for windows
Does anyone know when this will be available? Or if it already is, where it can be downloaded? Thanks Charles -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] emulation of foreach with reference
The code below is too weird. I spent 15 min writing it but now works: for(reset($ar),list($k,)=each($ar),$v=$ar[$k];$k;list($k,)=each($ar),$v=$ar[$k]){ var_dump($k,$v); $v='ather'.($j+++0); var_dump($k,$v); } The $ar array is generated in this way : for ($i=0;$i10;$i++){ $ar['foo'.$i] = 'bar'.$i; } Best regards, Andrey Hristov P.S. There is in PHP's ToDo list such feature. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Congrats to Rasmus?
http://www.phpdeveloper.org/ Well, everyone's favorite PHP developer multiplied last night - Rasmus Lerdorf now has a son (9.0lbs, 19.25in. - a big boy) was born at 13:26 PDT on Wednesday March 6, 2002. If you'd like to see some pics from the family, check out this page - or to send congrats, email [EMAIL PROTECTED] 9 pounds!! Wow. Forget Dad, hats off to the Mom. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Why session is not deleted ???
Firstly i create a session, After that when i close the browser the sesion can still be seen in tmp directory in apache webserver. I just wanted to know that If i close the browser, Does the session terminates ? Beta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Why session is not deleted ???
I've the same problem here If i do logout it doesn't doe a session_destroy :( -Original Message- From: Beta [mailto:[EMAIL PROTECTED]] Sent: jeudi 7 mars 2002 18:54 To: [EMAIL PROTECTED] Subject: [PHP] Why session is not deleted ??? Firstly i create a session, After that when i close the browser the sesion can still be seen in tmp directory in apache webserver. I just wanted to know that If i close the browser, Does the session terminates ? Beta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why session is not deleted ???
Yes. If you know what is garbage collector then you will understand why it is there. The GC is started from time to time and cleans expired session data. Best regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com On Thursday 07 March 2002 07:54 pm, you wrote: Firstly i create a session, After that when i close the browser the sesion can still be seen in tmp directory in apache webserver. I just wanted to know that If i close the browser, Does the session terminates ? Beta -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] require v. includes
I was just wondering if anyone could tell me when would be the time to choose require(), require_once(), or include(). I know a little bit about using each one, but I am just not sure if there is one that is better than the other in certain situations. -- Joshua E Minnie CIO [EMAIL PROTECTED] Don't work for recognition, but always do work worthy of recognition. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: REQUEST QUESTION
Dear Mark, Thanx for your reply. The solution you mentioned I knew it allready but i cannot change the name of order to order[] or something else but i still want to know is there any other way i can solve this issue. I got so many anwer saying that it is not possible I wonder why because PHP is supporting so many feature why not this. In Java and Cgi-Perl it is very simple why not in PHP that's my question. In java i use : (works for both GET and POST) public Enumeration ServletRequest.getParameterNames() - for getting all the names public String[] ServletRequest.getParameterValues(String) - for getting all values for the given name ( this is the one which accomplishes my job, gets both order's values) I am very sure that there must be some solution to this but I don't know how to do this in PHP. I have one solution using GET method but not with POST. Looking forward for solution to this issue. Regards, karthikeyan. - Original Message - From: Mark and Suzette [EMAIL PROTECTED] To: Karthikeyan [EMAIL PROTECTED] Sent: Thursday, March 07, 2002 6:16 AM Subject: Re: REQUEST QUESTION What you want to do is change the hidden fields names to order[] = 10 and order[]=20. This way you are generating an HTML array. PHP can then handle both values being assigned ($order[0], $order[1]). If you don't create an array, value 20 will cancel out value 10 (well should anyway). - Original Message - From: Karthikeyan [EMAIL PROTECTED] Newsgroups: php.general To: [EMAIL PROTECTED] Sent: Tuesday, March 05, 2002 10:21 AM Subject: REQUEST QUESTION Hi Guys, I allready posted this question in detail but I believe I didn't explain it properly. There are 2 hidden variable in my FORM. 1. order = 10 and 2. order=20 I want to retrieve both the orders in the next page say somename.php. How do i do that. Regards, karthikeyan. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP-Based Authentication Security?
I wouldn't say .htaccess and .htpasswd files are pointless. They might not be applicable to your situation, fine, but they're not totally useless. And .htaccess/passwd files do provide directory-level security -- the directory they're in, plus any subdirectories if need be. But there are a million solutions to your problem. .htaccess was just one of them. It would also have been possible to forget about individual .htaccess files and just define everything in access.conf. Anyways, just glad you found a solution. J John Coggeshall wrote: .htaccess and pw files are pointless, who wants to maintain potentially 10 or 20 of these things? Furthermore, it's gotta do more than just serve a single file at a time -- that's simple... I needed directly-level security. The solution I came up with was to use a module called mod_auth_any, which (with a little minor adjustment) can execute a PHP script from the console and rely on it's response to grant authentication or not. That gives me Apache-level security without Apache-authentication. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] require v. includes
require includes code only once(on the parse), include includes code everytime it is called. if you have some libs and in two or more you do require or include of some core lib you have to use require_once or to define some constant and use it to check. I am sure when but require changed its behaviour. Before it leaded to fatal error if some the file that has to be required is not found. Now it works just like include (just notice or warning - not sure). For more info read the docs ar : http://www.php.net/ Best regards, Andrey Hristov On Thursday 07 March 2002 07:25 pm, you wrote: I was just wondering if anyone could tell me when would be the time to choose require(), require_once(), or include(). I know a little bit about using each one, but I am just not sure if there is one that is better than the other in certain situations. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: require v. includes
Joshua E Minnie wrote: I was just wondering if anyone could tell me when would be the time to choose require(), require_once(), or include(). I know a little bit about using each one, but I am just not sure if there is one that is better than the other in certain situations. For all intents and purposes there's no real difference between the two. From the manual: require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. require_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. include_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. Michael Kimsal http://www.phphelpdesk.com Taking the ? out of ?php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: REQUEST QUESTION
-Original Message- From: karthikeyan [mailto:[EMAIL PROTECTED]] Sent: 07 March 2002 17:52 [] I am very sure that there must be some solution to this but I don't know how to do this in PHP. I have one solution using GET method but not with POST. Then you're very surely wrong, because it's not currently possible with PHP. This is a known limitation. The solution is to lobby the PHP team to include it in a future version. There are at least two bug reports (#10502 and #13718) requesting this feature change that you could add a comment to or vote in favour of. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php, text file, and mysql
If you are not going to save, I wouldn't call it a file :-) Just store the contents in a string and insert in a TEXT (etc) field. -- Julio Nobrega. Um dia eu chego lá: http://sourceforge.net/projects/toca Ajudei? Salvei? Que tal um presentinho? http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884 Gregory Hernandez [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... hello everyone. i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. many thanks in advance, gregory hernandez [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, text file, and mysql
You can use a string to keep the file content. And then put it the mysql(probably a BLOB field) Best regards, Andrey Hristov IcyGEN Corporation On Thursday 07 March 2002 11:30 pm, you wrote: hello everyone. i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. many thanks in advance, gregory hernandez [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4.1.2 compile error with-gd
Hi, I'm about to compile the 4.1.2 version found on php.net. I have the following configure command: ./configure --with-apache=../apache_1.3.23 --with-mysql --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib --with-zlib-dir --with-freetype-dir --with-gd --enable-gd-native-ttf --with-tiff-dir --with-dom --with-mnogosearch --with-pdflib --with-ftp --enable-gd-imgstrttf --with-gettext The configurepart runs fine. But when I get to the makepart i get the following when its doing something with gd: Making all in gd make[2]: Entering directory `/opt/install/php-4.1.2/ext/gd' make[3]: Entering directory `/opt/install/php-4.1.2/ext/gd' gcc -I. -I/opt/install/php-4.1.2/ext/gd -I/opt/install/php-4.1.2/main -I/opt/install/php-4.1.2 -I/opt/install/apache_1.3.23/src/include -I/opt/install/apache_1.3.23/src/os/unix -I/opt/install/php-4.1.2/Zend -I/usr/local/include/freetype2/freetype -I/usr/local/mnogosearch/include -I/opt/install/php-4.1.2/ext/mysql/libmysql -I/opt/install/php-4.1.2/ext/xml/expat -I/opt/install/php-4.1.2/TSRM -g -O2 -c gd.c touch gd.lo gd.c: In function `zm_startup_gd': gd.c:271: `gdArc' undeclared (first use in this function) gd.c:271: (Each undeclared identifier is reported only once gd.c:271: for each function it appears in.) gd.c:272: `gdPie' undeclared (first use in this function) gd.c:273: `gdChord' undeclared (first use in this function) gd.c:274: `gdNoFill' undeclared (first use in this function) gd.c:275: `gdEdged' undeclared (first use in this function) gd.c: In function `zif_imagecreatetruecolor': gd.c:556: warning: assignment makes pointer from integer without a cast gd.c: In function `zif_imagecolorat': gd.c:1594: structure has no member named `tpixels' make[3]: *** [gd.lo] Error 1 make[3]: Leaving directory `/opt/install/php-4.1.2/ext/gd' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/opt/install/php-4.1.2/ext/gd' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/opt/install/php-4.1.2/ext' make: *** [all-recursive] Error 1 [root@localhost php-4.1.2]# The gdlib thats compiled is gd2.01 and is linked with freetype 2.0.5. It might be worth to mention, if I try the same configure command on php version 4.0.6 it makes fine. I compared /ext/gd from the 4.1.2 and 4.0.6 and seems to be some difference. Does anyone know a soloution to this? Feel free to contact me if you need more information to solve this. Best regards, Eric -- [ eric persson | [EMAIL PROTECTED] | www.persson.tm ] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Database Error
I changed mysql_db_query() to mysql_query(). I took the quotes away from the id. It still gives me an error: Error in query: SELECT label FROM menu WHERE id = 3 Where else could I be going wrong? -Original Message- From: Jason Wong [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 07, 2002 4:36 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Database Error On Wednesday 06 March 2002 18:27, Navid Yar wrote: I'm thinking that it probably has to do with the quoting scheme or something else. I tried it on the command line, and it worked fine. I don't even think it matters what types of quotes I use around the id field. I tried both (single and double) on the command line, and it worked just fine. In other words, the SQL is fine, and there's nothing wrong with it. It must either be how I placed the sql statement into the query or how the class is executed. I'm not sure. It might entirely be something else. But, any help on this is really appreciated. If 'id' is a numeric field then you should not use quotes: SELECT label FROM menu WHERE id = 1 If it's a character field then it doesn't matter whether you use single or double quotes. One thing you could try doing is to rewrite your code so that it doesn't use mysql_db_query() as it has been deprecated as of php-4.0.6. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* If Patrick Henry thought that taxation without representation was bad, he should see how bad it is with representation. */ -- 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] Userfriendly
On Thursday 07 Mar 2002 16:22, Josiah Wallingford wrote: Hello, Does anybody know of a php script that will email the daily userfriendly.org comic? Not sure about this -- Userfriendly.org is maintained by advertising, so unless you want to pay them a royalty for every page you view they might not appreciate it. Josiah Wallingford Email = [EMAIL PROTECTED] Mailing lists: PHP General - [EMAIL PROTECTED] BBEdit Talk - [EMAIL PROTECTED] BBEdit Web Authoring - [EMAIL PROTECTED] ICRadius - [EMAIL PROTECTED] Linux Newbie - [EMAIL PROTECTED] MySql - [EMAIL PROTECTED] Messenger Services: (MSN Instant Messenger = josiahlizzard) (ICQ # 150522268) (Yahoo Instant Messenger = josiahwallingford) (AIM American Online Instant Messenger = JosiahWalling) Web Pages: www.josiahw.com www.pooponwindows.com www.mymysql.com www.bigbirdlinux.com www.sofast.net www.darwinduck.com Nice sig. --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] trapping the user name from .htaccess / .htpasswd
EXCELLANT! I have found that $username = $_SERVER['REMOTE_USER']; does exactly what I need it to do. Now, final question is how do I program a LOGOUT button, so when clicked the person will lose their identity and I can bounce them to a non-secure page. Any ideas? Dave Jason Wong [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]... On Friday 08 March 2002 00:36, Dave wrote: Hello all, I have an .htaccess and .htpasswd file in a directory. This is working fine, when anyone attempts to enter this directory, they are prompted for a user name and password, and if correctly entered, the page will load fine. What I would like is the ability to capture, or trap the user name. Immagine, in the simplist example, when the form loads, I could have ? print Hello.$username; ? Assuming $username was the varable for the user who logged in. Use $PHP_AUTH_USER $PHP_AUTH_PW. Read the manual chapter HTTP authentication with PHP. -- Jason Wong - Gremlins Associates - www.gremlins.com.hk /* My idea of roughing it is turning the air conditioner too low. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Parsing Content
On Tuesday 05 Mar 2002 15:07, Erik Price wrote: On Monday, March 4, 2002, at 06:10 PM, Jonathan Duncan wrote: I want to make a web site that displays news headlines from my favorite news sites. PEAR has an RSS headline class that's dead easy to use and works for RDF files. Incidentally, does anyone know any good sites with RDF headlines? I've already got slashdot, newsforge and theregister. I'm looking for a few more good sites. Cheers, --jaa -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulation of foreach with reference
try this: ?php echo foo.$i++; echo \n; echo bar.($+++0); ? Thanks for showing that I add new element to the array. This is because on last iteration $k is null and I access $ar[$k] which automatically adds the new element. Why? I don't know? Maybe because I refer it by reference! The fixed code is pre ?php for ($i=0;$i10;$i++) $ar['foo'.$i] = 'bar'.$i; var_dump($ar); for(reset($ar),list($k,)=each($ar),$v=$ar[$k];$k;list($k,)=each($ar),($k)?$v=$ar[$k]:''){ var_dump($k,$v); $v='ather'.($j+++0); var_dump($k,$v); } var_dump($ar); ? This will not add new element to the array. You ask why I did that. First to say that I wanted to make something really weird to happy my day :)) Second I wanted to implement a feature from PHP's(Zend's) ToDo list. Third think about if the array is so big (some megabytes) since I hold really big strings in every $v. Then if I use the standart foreach() statement PHP will have to copy $ar[$k] to $v :))) Best regards and fun with PHP, Andrey Hristov On Thursday 07 March 2002 08:48 pm, you wrote: On Thu, 2002-03-07 at 09:53, Andrey Hristov wrote: The code below is too weird. I spent 15 min writing it but now works: for(reset($ar),list($k,)=each($ar),$v=$ar[$k];$k;list($k,)=each($ar),$v= $ar[$k]){ var_dump($k,$v); $v='ather'.($j+++0); var_dump($k,$v); } The $ar array is generated in this way : for ($i=0;$i10;$i++){ $ar['foo'.$i] = 'bar'.$i; } Hi there, I'm not sure exactly what the above code is for--but it seems to be going to an awful lot of trouble to do it. :) If I start with the array: Array ( [foo0] = bar0 [foo1] = bar1 [foo2] = bar2 [foo3] = bar3 [foo4] = bar4 [foo5] = bar5 [foo6] = bar6 [foo7] = bar7 [foo8] = bar8 [foo9] = bar9 ) ...and run the first for() loop above over it, I get this: Array ( [foo0] = ather0 [foo1] = ather1 [foo2] = ather2 [foo3] = ather3 [foo4] = ather4 [foo5] = ather5 [foo6] = ather6 [foo7] = ather7 [foo8] = ather8 [foo9] = ather9 [] = ) Note the extra null element at the end. Why not just do this? $j = 0; foreach ($ar as $key = $val) { $ar[$key] = 'ather' . $j++; } ...which results in: Array ( [foo0] = ather0 [foo1] = ather1 [foo2] = ather2 [foo3] = ather3 [foo4] = ather4 [foo5] = ather5 [foo6] = ather6 [foo7] = ather7 [foo8] = ather8 [foo9] = ather9 ) Also, I'm unsure what you're going for with the ($j+++0). It just increments $j and adds 0, which doesn't seem to do anything. Please forgive me if I have misunderstood. Cheers, Torben Best regards, Andrey Hristov P.S. There is in PHP's ToDo list such feature. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] emulation of foreach with reference
ooops ?php echo foo.$i++; echo \n; echo bar.($j+++0); ? On Thursday 07 March 2002 09:09 pm, Andrey Hristov wrote: try this: ?php echo foo.$i++; echo \n; echo bar.($+++0); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] uploading images
When uploading image files to my powerpc linux box (derived from redhat 7.1) running apache + php4.0.4pl1 something wierd happen. Images get corrupted by (IMHO) php itself. It adds the following 2 lines at the top of the file: Content-Type: image/jpeg^M ^M ...(rergular image file data) (as displayed by my text editor, vim). It seems a bug, as uploading images to another machine (a i386 debian 2.2 box) works as expected. Is this a known issue/bug? thanks, fbv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] upload corrupts images
When i upload an image file (i.e. a jpeg) to the server using php, it gets corrupted. Indeed the GIMP is no longer able to open it. Opening the uploaded file with a text editor i found that the following 2 lines were added at the top (as displayed by vim, my text editor): Content-Type: image/jpeg^M ^M This happens on my yellowdog (a redhat 7.1 derived powerpc based distro) linux box, with version 4.0.4pl1 of php. On the other hand, on a i386 debian machine vith php 4.0.3pl1 everything works fine. Is this a known bug/issue? Thasks, fbv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using a variable to a function call
On Thu, 2002-03-07 at 06:25, Matt Williams wrote: Hi all I get a variable that is set be a select box on a page. I want to use this variable to call a function within a class that is based on it's name. so if $var = me I want to call $class-me_function(); or if $var = you call $class-you_function(); How can I use the variable as part of the function name to call. TIA matt You can do this quite simply with variable function names. Essentially, create a variable with the name of the method you want to call, and use that where you would otherwise use the method name in the call: i.e. if you have the name of a function in $funcname, you would do $obj-$funcname(). Here's a full example: ?php error_reporting(E_ALL); class foo { function me_foo() { echo Me Foo!\n; } function you_foo() { echo You Foo!\n; } } $foo = new foo; $test = 'me'; // The direct way: $foo-{$test . '_foo'}(); // Slightly less direct but perhaps more readable: $method = $test . '_foo'; $foo-$method(); $test = 'you'; // The direct way: $foo-{$test . '_foo'}(); // Slightly less direct but perhaps more readable: $method = $test . '_foo'; $foo-$method(); ? Hope this helps, Torben -- Torben Wilson [EMAIL PROTECTED] http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: require v. includes
Thanks for the information, was definitely very helpful in clearing up that question. Joshua E Minnie [EMAIL PROTECTED] Don't work for recognition, but always do work worthy of recognition. ~ Unknown Michael Kimsal [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Joshua E Minnie wrote: I was just wondering if anyone could tell me when would be the time to choose require(), require_once(), or include(). I know a little bit about using each one, but I am just not sure if there is one that is better than the other in certain situations. For all intents and purposes there's no real difference between the two. From the manual: require() and include() are identical in every way except how they handle failure. include() produces a Warning while require() results in a Fatal Error. In other words, don't hesitate to use require() if you want a missing file to halt processing of the page. include() does not behave this way, the script will continue regardless. Be sure to have an appropriate include_path setting as well. require_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. include_once() should be used in cases where the same file might be included and evaluated more than once during a particular execution of a script, and you want to be sure that it is included exactly once to avoid problems with function redefinitions, variable value reassignments, etc. Michael Kimsal http://www.phphelpdesk.com Taking the ? out of ?php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Arrays/OOP again
I am having problem with an array filled with an object. I am trying to access it using current($object_array)-object_var. Here is the line of code that is giving me the problem, any help that can be provided will be greatly appreciated. if((current($retrieved)-beginTime $morning) (current($retrieved)-beginTime $night)) -- Joshua E Minnie CIO [EMAIL PROTECTED] Don't work for recognition, but always do work worthy of recognition. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail() getenv() problems (after 4.1.2 update)...
Can nobody help? This is so frustrating. I cannot see what's wrong, open to ANY suggestions! Thanks. Paul Paul [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hello, I wonder if anyone can help me with a problem I have. I have some sites hosted on a Cobalt Raq4 server (not sure if this is relevant). I recently upgraded PHP from a package at www.pkgmaster.com, and since making this upgrade I have problems with PHP that I cannot find the solution to. I have conacted their 'team' who have thus far offered no explanation, saying it must be something else causing these issues with PHP, but I haven't made any more changes, just installed the new PHP version. The problems are with the mail() function taking an AGE to excecute, and environmental HTTP header information not being sent/recieved by getenv(). Some examples follow.. For example, as an extremely basic example of the mail function going slow, this simple script: ? mail([EMAIL PROTECTED], Test subject, Test message); print finished!; ? Which can be found at http://www.clicktolearn.co.uk/test/mail.php in action, ran (as it should do) extremely fast the week before I made the upgrade from the packages. Now, as you will see, it runs dog slow. Secondly, the following script shows the lack of headers: http://www.clicktolearn.co.uk/test/ (click the link, so there's a referer to the script page)... ? function get_http_headers($url, $proto=HTTP/1.0, $timeout=10) { $return = false; if (substr($url,0,7)==http://;) { $url = substr($url,7); } $parts = parse_url(http://.$url); $ips = gethostbynamel($parts[host]); if ($ips[0]) { $ip = $ips[0]; $host = $parts[host]; $path = ($parts[path]) ? $parts[path] : /; $port = ($parts[port]) ? $parts[port] : 80; $start = time(); $timeout = $timeout + $start; if($sock = fsockopen($host, $port)) { set_socket_blocking($sock, 0); switch($proto) { case HTTP/1.1: set_socket_blocking($sock, 1); fputs($sock, sprintf(HEAD %s %s\n, $path, $proto)); fputs($sock, sprintf(Host: %s\n\n, $host)); break; default: fputs($sock, sprintf(HEAD %s %s\n\n, $path, $proto)); } while(!feof($sock) $t$timeout) { $line .= fgets($sock,1); $t = time(); } fclose($sock); $end = time(); if ($t=$timeout) { $http = parse_output($line); $http[result] = 502; $http[message] = Timed Out; $http[time_used] = $end - $start; $return = $http; } elseif($line) { $http = parse_output($line); $http[time_used] = $end - $start; $return = $http; } } } return $return; } function parse_output($line) { $lines = explode(\n, $line); if(substr($lines[0],0,4)==HTTP) { list($http[protocol], $http[result], $http[message]) = split([[:space:]]+,$lines[0],3); } else if(substr($lines[0],0,7)==Server:) { $http[server] = substr($lines[0],8); } for ($i=1; $icount($lines); $i++) { list($key, $val) = split(:[[:space:]]*, $lines[$i],2); $key = strtolower(trim($key)); if ($key) { $http[$key] = trim($val); } else { break; } } return($http); }; var_dump(getallheaders()); print brbr; var_dump(get_http_headers('http://www.clicktolearn.co.uk/test/testheaders.ph p')); print brbr; print $HTTP_REFERER; print brbr; print a href='Javascript: history.back();'Back/a; print brbr; var_dump(getenv($HTTP_REFERER)); ? Under the Back link is the output of: var_dump(getenv($HTTP_REFERER)); Now I know that this was working before the upgrade, as a log in script I use on the main site uses getenv($HTTP_REFERER) to send them back to where they came from. This again worked 100% fine before PHP upgrade. Sorry to take up your time, but there is a problem somewhere that has certainly only begun with PHP since I upgraded to 4.1.2, and I
[PHP] mcrypt? - Can't find any good info
I'm getting this error: Warning: mcrypt module initialization failed in /home/www/common.php on line 314 When running this code: ?php function encryptPassword($password) { $key = randomString(); $code = mcrypt_ecb(MCRYPT_BLOWFISH_128, $key, $password, MCRYPT_ENCRYPT); print($code = enc w/ $key); } encryptPassword(testing); ? And i can't find any documentation on what might be causing this... anyone out there know? //Nick Richardson [EMAIL PROTECTED] [EMAIL PROTECTED] -- -- We must come to see that the end we seek, is a society -- -- at peace with itself. A society that can live with its -- -- concience. That will be a day not of the white man, not -- -- of the black man... That will be the day of man, as man! -- -- -Dr. Martin Luther King Jr. -- -- -March 25th, 1965-- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Use an ini file
Anyone know of an easy to use library/or code that will read and write an ini file? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New to PHP, need help.
Michele, Possible a dumb question, but does the machine you are running it on have PHP installed and configured to work with the server software? If so, did you name the file correctly? It may need to be called page.php rather than page.html... M On Thu, 7 Mar 2002, Michele wrote: I currently working with some free source from CyberGl and am having a problem with the membership module. I've inserted the php into the beginning of the page but when I go to test the page, nothing appears. I don't get a 404 error or any error, the page just doesn't display. Any ideas? Thanks, Michele -- 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] User accounts
I'm new to this php thing and I would like to set up a web page were the users can login and edit their preferences and all that stuff. I have the basic login stuff worked out and I was passing the username and password as a hidden input in the form, but then the password can be seen with view source. I know that there's a better way to do this, so could someone point me to a good tutorial or example on how I could make it so that the user could login and logout and then I wouldn't need to be passing the password all around like this. Thanks, Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: User accounts
David Johansen wrote: I'm new to this php thing and I would like to set up a web page were the users can login and edit their preferences and all that stuff. I have the basic login stuff worked out and I was passing the username and password as a hidden input in the form, but then the password can be seen with view source. I know that there's a better way to do this, so could someone point me to a good tutorial or example on how I could make it so that the user could login and logout and then I wouldn't need to be passing the password all around like this. Thanks, Dave Dave: Have a read up about sessions in the PHP manual to start. The basic idea is that you'd store the fact that someone is succesfully logged in or not (and who they are) in session information at the server. The client forms never have to have the username or password in them at that point (only when they submit their login data). Michael Kimsal http://www.phphelpdesk.com Taking the ? out of ?php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP vs object.record set
Hi list, I'm new to PHP, but I found it greate. But I have a question. Recently I've saw a friend using asp and the object record set seems perfect, I mean the function to count records, navigate in throw record (back and forth) everything automatic is amazing. There's a way, to implement such things in PHP?? Thank's in advance Rodrigo -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php, text file, and mysql
On Thursday, March 7, 2002, at 04:30 PM, gregory hernandez wrote: i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. Sorry, but I don't really understand the question. If you are creating or generating a text file, the word file indicates that this is represented by an entity in a filesystem -- thus, it would be saved to a server. Are you asking if you can create/generate text without saving it as a file on the server, but rather just storing the text in memory temporarily? If so, then yes -- -- and the second question I haven't really figured out either. You want to store a text file into a MySQL database but not the contents of that file? It seems like in the first question you want to have contents without a file, and in the second you want a file without contents! :) Unless someone else figures out what you want and helps you, ask again but describe what you want a little bit more. PHP can do a lot of things. 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: mcrypt? - Can't find any good info
Nick Richardson wrote: I'm getting this error: Warning: mcrypt module initialization failed in /home/www/common.php on line 314 When running this code: ?php function encryptPassword($password) { $key = randomString(); $code = mcrypt_ecb(MCRYPT_BLOWFISH_128, $key, $password, MCRYPT_ENCRYPT); print($code = enc w/ $key); } encryptPassword(testing); ? And i can't find any documentation on what might be causing this... anyone out there know? Is mcrypt installed in your PHP system? echo phpinfo(); and look for mcrypt Michael Kimsal http://www.phphelpdesk.com Taking the ? out of ?php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Rasmus, O'Reilly, Programming PHP
On Thursday, March 7, 2002, at 06:05 AM, DL Neil wrote: Rasmus/others, O'Reilly are advertising the imminent release (Mar 2002) of Programming PHP (http://www.oreilly.com/catalog/progphp/desc.html). Is that still going ahead? (I'll submit an advanced purchase order...) Hmmm... on the one hand, it's an O'Reilly book, and their books tend to shine pretty brightly (though I'm extremely fond of two of my New Riders books, MySQL by Paul DuBois and Python Web Programming by Steve Holden, very well-written and well-made books). But on the other hand, the writeup at O'Reilly that you link to doesn't really entice me -- it seems to offer the same topics as most other non-introductory PHP titles out there. I'd probably pick it up regardless, if only to demonstrate to O'Reilly that there's a demand for more books on PHP. To date, their PHP selection is pathetic. David, did you hear anything more about this? 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: PHP vs object.record set
Rodrigo Peres wrote: Hi list, I'm new to PHP, but I found it greate. But I have a question. Recently I've saw a friend using asp and the object record set seems perfect, I mean the function to count records, navigate in throw record (back and forth) everything automatic is amazing. There's a way, to implement such things in PHP?? Thank's in advance Rodrigo Go look at adodb from http://php.weblogs.com. They have a PHP library that gives you much of the same functionality as the ADO system. Keep in mind that going 'back and forth' in a recordset comes at the expense of a great amount of speed. MS and others will tell you that for good performance you should use 'forward only' recordsets, so it's of limited value to many people anyway. -- Michael Kimsal http://www.phphelpdesk.com Taking the ? out of ?php 734-480-9961 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mktime() into TIMESTAMP ?
On Wednesday, March 6, 2002, at 05:11 AM, DL Neil wrote: My 'rules' are simple: If the date/time is for processing, keep it as a timestamp (consider which type). If the timestamp is being used to keep track of RDBMS activity, then use a TIMESTAMP column. By RDBMS activity, do you mean last time user performed x query ? In fact, one of my columns is in fact designed to record things like last time user logged in or whatever, but I am not using the auto-bumping ability of the TIMESTAMP column, but rather creating a new INSERT statement and mysql_query() function to do this job. If RDBMS auto-update would foul things up, use an integer data type. If the date/time is for people/presentation, use a textural format. I'm thinking of not storing any plaintext dates, simply because it's easier to format the mktime() result or TIMESTAMP column to suit my needs. In fact, combining mktime() and date() really seem to be the way to go, which is why I'm using mktime()-generated Unix-style timestamps -- I'll probably never do any database output directly from mysql[client], but rather everything from PHP or perhaps Python if I ever get the time to work on that side project.* If there will be minor processing on the column, eg GROUP BY, ORDER BY, or even , =, etc, then use ISO format ISO = MySQL-style TIMESTAMP? If so, then can't you do ORDER BYs and , = queries with the Unix-style mktime()-generated integers as well? I'm not very experienced with the more advanced MySQL features, though I know they're there and have a decent reference should my script require them. If there will be no processing between what comes out of PHP and what PHP wants back, use a string format column. That's what I was thinking. Apart from some simple queries for results whose dates are between x and y (which should work with mktime()-generated timestamps, right?), it seems that this is the best policy. I should change those columns from TIMESTAMP to INT now before I go any further, just so that I don't accidentally ever bump up the value of the column via an insert or update... Yes you should remember that MySQL will happily cast between string and integer alternative presentations! I'm not sure I understand what this means. I'm guessing that you're suggesting that an INT or a VARCHAR column can both have mathematical operations performed on their values, but perhaps I'm completely off-base. My SQL skills are miserable... I need to brush up. (Too much time spent learning PHP lately!) Your take/critique welcomed! More like questions than critique! 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] php, text file, and mysql
Erik: thank for answering my first question: the word file indicates that this is represented by an entity in a filesystem -- thus, it would be saved to a server. now let me rephrase the second part. what i meant to say was the following: can i insert the actual file (i.e. document.txt, of course with it contents) into a mysql? in other words, i don't want to read the contents of the file and insert the contents into a field in mysql. i want to insert the actual file into the database. is this possible? thanks again in advance. gregory on 3/7/02 12:44 PM, Erik Price at [EMAIL PROTECTED] wrote: On Thursday, March 7, 2002, at 04:30 PM, gregory hernandez wrote: i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. Sorry, but I don't really understand the question. If you are creating or generating a text file, the word file indicates that this is represented by an entity in a filesystem -- thus, it would be saved to a server. Are you asking if you can create/generate text without saving it as a file on the server, but rather just storing the text in memory temporarily? If so, then yes -- -- and the second question I haven't really figured out either. You want to store a text file into a MySQL database but not the contents of that file? It seems like in the first question you want to have contents without a file, and in the second you want a file without contents! :) Unless someone else figures out what you want and helps you, ask again but describe what you want a little bit more. PHP can do a lot of things. 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] php, text file, and mysql
Are you planning on using MySQL as a filesystem? There seems to be great confusion here. Good luck! --- gregory hernandez [EMAIL PROTECTED] wrote: hello everyone. i'm wondering if i can do the following: FIRST, using php, can i create/generate a text file on-the-fly (not saved to a server) THEN, insert the actual text file (and not its contents) into a mysql database. many thanks in advance, gregory hernandez [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = Anas Mughal [EMAIL PROTECTED] [EMAIL PROTECTED] Tel: 973-249-6665 __ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Database Error
Yes, Jason. I posted it earlier, but here it is again. // Error I'm getting Error in query: SELECT label FROM menu WHERE id = 3 Warning: Supplied argument is not a valid MySQL result resource in e:\localhost\menu\menu.class.php on line 47 // Object being called from get.php ?php require(menu.class.php); $obj = new Menu(); echo $obj-get_label(1); ? // Class in the file menu.class.php class Menu { var $hostname; var $user; var $pass; var $db; var $table; function Menu() { $this-set_database_parameters(localhost, username, password, apps, menu); } function set_database_parameters($hostname, $user, $password, $db, $table) { $this-hostname = $hostname; $this-user = $user; $this-password = $password; $this-db = $db; $this-table = $table; } function query($query) { $connection = mysql_connect($this-hostname, $this-user, $this-pass) or die (Cannot connect to database); $ret = mysql _query($this-db, $query, $connection) or die (Error in query: $query); return $ret; } function get_label($id) { $query = SELECT label FROM $this-table WHERE id = $id; $result = $this-query($query); $row = mysql_fetch_row($result); return $row[0]; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Userfriendly
Does anybody know of a php script that will email the daily userfriendly.org comic? Why not write one yourself? Most of the file names can be guessed, today is http://www.userfriendly.org/cartoons/archives/02mar/uf004027.gif for example. By the way... Josiah Wallingford Email = [EMAIL PROTECTED] Mailing lists: PHP General - [EMAIL PROTECTED] BBEdit Talk - [EMAIL PROTECTED] BBEdit Web Authoring - [EMAIL PROTECTED] ICRadius - [EMAIL PROTECTED] Linux Newbie - [EMAIL PROTECTED] MySql - [EMAIL PROTECTED] Messenger Services: (MSN Instant Messenger = josiahlizzard) (ICQ # 150522268) (Yahoo Instant Messenger = josiahwallingford) (AIM American Online Instant Messenger = JosiahWalling) Web Pages: www.josiahw.com www.pooponwindows.com www.mymysql.com www.bigbirdlinux.com www.sofast.net www.darwinduck.com ... could you please use a *slightly* less obnixously long signature when you post to the list? Signatures aren't supposed to be over 4 lines (and if we want to know your AIM/ICQ/MSN/Y! ID's, we'll ask you). Jason -- Jason Murray [EMAIL PROTECTED] Web Developer, Melbourne IT Work now, freak later! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php