[PHP] How to achieve mixed authentication/anonymous access
Hi, i have a problem with Authentification. I currently doubt that it is possible at all. Perhaps someone can enlighten me how to achive the goal or confirm that it is not reachable. The scenario is to achieve a mixed authentication/anonymous access similar as described for Subversion (see http://svnbook.red-bean.com/nightly/de/svn-book.html#svn.serverconfig.httpd.authz.perdir.ex-3). Therefore the .htaccess looks something like that: Order allow,deny Allow from all AuthType Basic AuthName Realm AuthUserFile /some/path/.htusers require valid-user Satisfy any Additionally a PHP script is inside the same folder. When you now browse to the URL of the PHP script, you can access it without any credentials requested. At some point the PHP script decides that authentification is required (e.g. when passing a param like ?access-secret=1). Therefore it sends the following two headers: WWW-Authenticate: Basic realm=Realm HTTP/1.x 401 Unauthorized Then you are asked to insert your username/password for the basic auth. But now comes the problem: How can the PHP script determine if you have provided valid credentials? The server variables PHP_AUTH_USER and PHP_AUTH_PW are populated independent of the result of the authentification defined in Apache. I do explicitly not want to check the credentials in PHP - think of the many different auth-methods which could be configured with Apache. Nor can the anonymous and authenticated parts be split in separate folders. Is this goal even possible or is the only way to not allow anonymous access (but for replacement a dummy user like guest with no password) or implement the auth in PHP? Any feedback is highly appreciated. Thank you Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP timezone is unstable...
Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP timezone is unstable...
Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP timezone is unstable...
Nathan Rixham wrote: Dirk wrote: Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk you're not on multiple load balanced / dns round robin servers are you..? no.. it's just a home server... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP timezone is unstable...
Nathan Rixham wrote: Dirk wrote: Nathan Rixham wrote: Dirk wrote: Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk you're not on multiple load balanced / dns round robin servers are you..? no.. it's just a home server... random.. home server is windows xp or vista, when you installed the os it was set to locale America/Chicago (control panel, locales) you then changed it to Europe/Sweden - as a developer you frequently hit a key combination by mistake which switches locale, and php picks it up to fix remove the extra america/chicago locale in control panel and problem sorted if thats it i'll eat my hat lol no... it's ubuntu... mostly the timezone is correct (Europe/Berlin).. sometimes it goes 6 hours back... the system clock remains correct btw... really, only PHP is affected... i never seen anything like this... :C -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP timezone is unstable...
Nathan Rixham wrote: Dirk wrote: Nathan Rixham wrote: Dirk wrote: Hello, what could cause the timezone in PHP to, randomly, jump back and forth 6 hours now and then? from phpinfo(): date date/time support enabled Olson Timezone Database Version 0.system Timezone Database internal Default timezone America/Chicago DirectiveLocal ValueMaster Value date.default_latitude31.766731.7667 date.default_longitude35.233335.2333 date.sunrise_zenith90.5890.58 date.sunset_zenith90.5890.58 date.timezoneEurope/SwedenEurope/Sweden Default timezone jumps between America/Chicago and Europe/Berlin while date.timezone stays Europe/Sweden all the time... Dirk you're not on multiple load balanced / dns round robin servers are you..? no.. it's just a home server... random.. home server is windows xp or vista, when you installed the os it was set to locale America/Chicago (control panel, locales) you then changed it to Europe/Sweden - as a developer you frequently hit a key combination by mistake which switches locale, and php picks it up to fix remove the extra america/chicago locale in control panel and problem sorted if thats it i'll eat my hat lol also PHP shows the correct unix time... only the timezone is messed up by 6 hours now and then... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Regards from .de Thilo PS: If you speak german, answer in german. Appreciate it. well you export the db you designed into ansi sql and use the cmdline mysql client to create a db with it... this guide http://www.databasejournal.com/features/mysql/article.php/1469211/Using-a-MySQL-database-with-PHP.htm seems ok on the first look.. from php you access the db like this... ?php $username = pee_wee; $password = let_me_in; $hostname = localhost; $dbh = mysql_connect($hostname, $username, $password) or die(Unable to connect to mysql); print connected to mysqlbr; $selected = mysql_select_db(first_test,$dbh) or die(Could not select first_test); if (mysql_query(insert into people values('5','Hazel','Burger'))) { print successfully inserted record; } else { print Failed to insert record; } mysql_close($dbh); ? Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [PHP MySQL] Introduction to using relational databases
Thilo Klein wrote: Dear readers, I am new to relational DB but not to MySQL PHP in general. I created a RDB using Powerdesigner. Struggling with the program's complexity I managed to create a set of databases being interconnected via (foreign) keys. What I want to know is how to use this database via php. How does my ER-Diagram come into play? In other words I want to know more about a general approach to using relational databases via php. Regards from .de Thilo PS: If you speak german, answer in german. Appreciate it. The ER-Diagram can be printed and rolled up to a nice weapon for smacking your co-workers with so they learn the layout faster... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] question regarding type hinting parameters of php functions
Hi, i have tried a current snapshot of PHP 5.3 and have a question regarding type hinting. For example when using the function array_slice(array $array, int $offset, int $length) with a non-integer length parameter, what is the desired behavior? When calling array_slice($array, 0, (float)2); the resulting array is EMPTY. When using the right type array_slice($array, 0, (int)2); it works as expected. Shouldn't there be a notice/warning than just a wrong return value? In my case there is neither a warning nor does it work as expected. (perhaps it do something wrong?) Of course i can use int's, but in my opinion either a warning should be given or the function should gracefully handle the wrong typed parameter. Thank you for any feedback, Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Reading binary http post
Manuel Lemos schreef: Hello, on 02/21/2006 03:40 PM Dirk Vanden Boer said the following: I have a C++ application that posts binary data to a php script that I created using libcurl. Everything works fine except when my binary data happens to start with the '' symbol. In that case I can't read the http post data (isset returns false). The post argument then looks like data=ÑÚA Reading the post is done like this: if (isset($_POST['data']) Is there a way to fix this problem? The problem is that you are misleading PHP telling that you are posting form data. You need to correct the request Content-Type. It must not be application/x-www-form-urlencoded nor multipart/form-data . I think you can use anything except those types, like for instance application/octet-stream which is the default for binary files. I don't know how can you hack libcurl to make it use the right request content-type. It is probably easy. If you are not able to do it, you may want to try this PHP HTTP client class . It can send custom POST requests. http://www.phpclasses.org/httpclient You are correct, setting the headers is necessary but I was already doing that, curl supports it by calling struct curl_slist *headers=NULL; headers = curl_slist_append(headers, Content-Type: text/xml); curl_easy_setopt(easyhandle, CURLOPT_HTTPHEADER, headers); I have everything working at the moment by base64 encoding my data and then doing a urlencode. One pitfall I noticed: do not urlencode the post argument, only the data, eg: data=JtVLV43XWl... urlencoded data%3DJtVLV... This doesn't work, so I just urlencoded my base64 data, and prepended the data= string. Thanks for all your help guys from this thread ;) Cheers, Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Reading binary http post
Hi, I have a C++ application that posts binary data to a php script that I created using libcurl. Everything works fine except when my binary data happens to start with the '' symbol. In that case I can't read the http post data (isset returns false). The post argument then looks like data=ÑÚA Reading the post is done like this: if (isset($_POST['data']) Is there a way to fix this problem? Thanks in advance Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading binary http post
Thanks for the hint, I'm not doing any encoding at the moment, I'll try it out tomorrow. Dirk On 2/21/06, Paul Scott [EMAIL PROTECTED] wrote: On Tue, 2006-02-21 at 19:40 +0100, Dirk Vanden Boer wrote: The post argument then looks like data=A Reading the post is done like this: if (isset($_POST['data']) Is there a way to fix this problem? Have you tried base64_encoding the binary data, then decoding it again on the PHP side? --Paul -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Reading binary http post
Thanks for the info, it was really helpfull. One question though, is it necessary to first encode my data with the base64 algo, or can I skip that step and immediately urlencode my data? Dirk On 2/21/06, Richard Lynch [EMAIL PROTECTED] wrote: You probably should be URL-encoding your data in the first place... http://php.net/urlencode ?php $data = whatever funky characters you want: $data_url = urlencode($data); //WRONG: $URL = http://example.com/$data; //RIGHT: $URL = http://example.com/$data_url;; If it's not feasible for your C++ application to replicate urlencode() then you may be able to get what you want with that http_raw_post_data stuff. You'll have to search on php.net for something not unlike raw post data until you find it, as I don't have the ULR in my head. But you'd be 100% better off to follow the standards and url-encode the data in the first place -- Especially if you're ever going to re-use this code elsewhere, and MOST especially if you ever might want to hook up YOUR code to another person's server that actually follows the standards. On Tue, February 21, 2006 12:40 pm, Dirk Vanden Boer wrote: Hi, I have a C++ application that posts binary data to a php script that I created using libcurl. Everything works fine except when my binary data happens to start with the '' symbol. In that case I can't read the http post data (isset returns false). The post argument then looks like data=ÑÚA Reading the post is done like this: if (isset($_POST['data']) Is there a way to fix this problem? Thanks in advance Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Configure PHP
Hi, in case you installed php4 from the SuSE-CD or -DVD: just install via yast2 (or your favourite rpm install tool) the php4 extension module called php4-session (its a rpm-package). The package should come with your SusE-CD or -DVD. In case you didnt installed php4 from SuSE, you must reconfigure and install php, good luck, Dirk Am Dienstag, 15. Mrz 2005 14:00 schrieb Steven Sher: Can someone please help me configure php. I have installed php on SUSE 9.2 by default it loads php with session support disabled how do I enable it, I know I am supposed to use some configure command or something but not sure how, please help. Thanks Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Data Enryption
Am Mittwoch, 12. Januar 2005 11:13 schrieb Shaun: Hi, I have site that allows users to upload private information to our server. We would like to encrypt the data for security reasons and only allow certain users to be able to un-encrypt the data and view it. I have looked at the PHP encryption functions and they appear to be one way algorithms - I am guessing this is the whole point of encrption ;) Does anyone have any suggestions regarding this? Many thanks hey :) you should use the mcrypt_* functions. Look at the manual pages, you will find there many examples. Here are some functions i use for encryption of private data, may they help you: /** * mcrypt iv generieren */ if(!isset($_SESSION['MCRYPT_IV'])) { $_SESSION['MCRYPT_IV']= mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM); } /** * Encryption * * @param String input - unencrypted string * @return String encrypted string */ function encrypt($input) { $encrypted= mcrypt_encrypt(MCRYPT_BLOWFISH, SECRET, $input, MCRYPT_MODE_CBC, $_SESSION['MCRYPT_IV']); $encoded= base64_encode($encrypted); return $encoded; } /** * Decryption * * @param String input - encrypted string * @return String - decrypted string */ function decrypt($input) { $decoded= base64_decode($input); $decrypted= mcrypt_decrypt(MCRYPT_BLOWFISH, SECRET, $decoded, MCRYPT_MODE_CBC, $_SESSION['MCRYPT_IV']); return rtrim($decrypted); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Unit Tests - which framework to use?
Am Freitag, 7. Januar 2005 09:49 schrieb dAniel hAhler: I'm looking for a PHP Unit Test framework and found so far: SimpleTest: https://sourceforge.net/projects/simpletest/ PEAR PHPUnit: - http://pear.php.net/package/PHPUnit - http://pear.php.net/package/PHPUnit2 Sourceforge PHPUnit: http://phpunit.sourceforge.net/ While SF PHPUnit seems to have stalled (2002-10) there are still PEAR PHPUnit and Simpletest. ... I'm still on PHP4 mainly - but tests could be done/run with PHP5 of course (if PHPUnit2 supports that). Hey :) for my PHP4 Projects i happily use PHPUnit from Sebastian Bergmann, i like it very much and it seems to me, it is the best Unit-Test-Framework for PHP4. All PHP5 Projects take the advanced features from PHPUnit2 (which is indeed only for PHP5) in credit - again the Framework is from Sebastian and i must commit: He does his job on it very,very well :) So in one sentence: I use PHPUnit for PHP4 and PHPUnit2 for PHP5 and i am really happy with it. Have fun, Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Efficency in looping arrays?
hey :) i use for this reason: for($i= 0, $size= sizeof($arr); $i $size; $i++) { echo $arr[$i]; } Peter Lauri: Best groupmember, For the moment when I loop an array I use something like this: reset($arr); while($a=each($arr)) { echo $a['value']; } But the each() function genereates a array with four elements (0,1,value, key), I am only interested in the value. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Efficency in looping arrays?
Hey again :) Peter Lauri: But what if the array have a unordered keystructure? What your loop do is to call the value with key $i, or am I wrong? What if the keys are strings? $arr= array(1 = dirk, 'wife' = iris, 'dog' = feivel, 'peter' = lauri); $values= array_values($arr); for($i= 0, $size= sizeof($values); $i $size; $i++) { echo $values[$i]; } should work :) Dirk Kredler [EMAIL PROTECTED] skrev i meddelandet news:[EMAIL PROTECTED] hey :) i use for this reason: for($i= 0, $size= sizeof($arr); $i $size; $i++) { echo $arr[$i]; } Peter Lauri: Best groupmember, For the moment when I loop an array I use something like this: reset($arr); while($a=each($arr)) { echo $a['value']; } But the each() function genereates a array with four elements (0,1,value, key), I am only interested in the value. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php 4 and Php 5 on same box
The solution depends on the Webserver you are using, i think for Apache2.x there should be no big problem at all to use php4 and php5 concurrently - just search the web. For Apache1.3.x you can look here: http://www.schlitt.info/applications/blog/archives/83_How_to_run_PHP4_and_PHP_5_prallel.html I use for my Apache 1.3 Testserver a really simple solution: - PHP4 is installed as a module - PHP5 is compiled as CGI this is my php5 config: './configure' '--with-zlib' '--with-bzip' '--with-gd' '--enable-force-cgi-redirect' '--prefix=/usr/local/php5' '--enable-bcmath' '--enable-calendar' '--enable-ctype' '--enable-dbase' '--enable-discard-path' '--enable-exif' '--enable-filepro' '--enable-ftp' '--enable-gd-imgstrttf' '--enable-gd-native-ttf' '--enable-inline-optimization' '--enable-magic-quotes' '--enable-mbstr-enc-trans' '--enable-mbstring' '--enable-mbregex' '--enable-memory-limit' '--enable-safe-mode' '--enable-shmop' '--enable-sigchild' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-versioning' '--enable-wddx' '--with-bz2' '--with-dom=/usr/include/libxml2' '--with-ftp' '--with-gdbm' '--with-gettext' '--with-gmp' '--with-jpeg-dir=/usr' '--with-mcal=/usr' '--with-mcrypt' '--with-mhash' '--with-mysql=/usr' '--with-ndbm' '--with-png-dir=/usr' '--with-tiff-dir=/usr' '--with-ttf' '--with-freetype-dir=yes' '--with-xml' '--with-xpm-dir=/usr/X11R6' '--with-zlib=yes' '--with-qtdom=/usr/lib/qt3' '--with-gd' '--with-openssl' '--with-curl' '--enable-xslt' '--with-xslt-sablot' '--with-iconv' '--with-mm' '--enable-dba' Both PHP versions reside in different directories and use different php.ini's. To use PHP5 i simply put a .htaccess file like this in the root of the php5-project-directory: Action php5-script /cgi-php5/php AddHandler php5-script .php Options +ExecCGI Additionally i added this directive to my apache httpd.conf: ScriptAlias /cgi-bin/ /srv/www/cgi-bin/ ScriptAlias /cgi-php5/ /usr/local/php5/bin/ Directory /usr/local/php5/bin Options +ExecCGI Allow From All /Directory for my testenvironment, this works good enough. Dirk Am Donnerstag, 28. Oktober 2004 09:26 schrieb Dave Carrera: Hi List, I have php 4 running all ok on a freebsd box installed from ports. What I would like to do is install php5 with all modules so's not to over right the php4 install and tell my users that they can test their scripts against the new php5 by including the path to php5 in their scripts before I make it the main php running on my box. I would really appreciate a simple (no brainer) set of steps to achieve this I ask the clever guys here to offer their pearls of wisdom. I thank anyone who helps with this fully in advance. Dave C -- UK Web Hosting @ http://www.ephgroup.com --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.783 / Virus Database: 529 - Release Date: 25/10/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting Commercial PHP Scripts
I found this one very usefull: http://shiflett.org/php-security.pdf You should anyway start at: http://php.net/security/ good luck, Dirk Am Dienstag, 26. Oktober 2004 13:44 schrieb Nick Wilson: Hello all, I was wondering if anyone might have suggestions or useful links on protecting commercial php scripts. I am about to design a system that would be pretty valuable in a very niche market and would not wish the script to be passed on to others once downloaded. Suggestions, discussion and links would be much appreciated ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP5 Tutorials...?
Here: http://www.zend.com/php5/ Am Sonntag, 24. Oktober 2004 21:01 schrieb Michael Lauzon: Where can I find detailed PHP5 tutorials, but written for the beginner...they must be online tutorials as I cannot afford any computer books at the moment?! -- Michael Lauzon http://phantasyrpg.com/main.php?view=9898 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I produce a random database query for each day or week?
My idea on your problem would be to use a random sql-query selecting a cd from your database. SELECT * FROM my_table ORDER BY RAND() LIMIT 1; This could be placed in a script that is executed only by the first user in a week and the result is stored e.g. in a text file and included in any later call of your website. It's too early in the morning for details (I just stood up), but if you have questions about realization please ask. Dirk. On Fri, 01 Oct 2004 15:45:54 +0200, -{ Rene Brehmer }- [EMAIL PROTECTED] wrote: At 10:31 01-10-2004, Graham Cossey wrote: A couple of thoughts: As you want to cycle through the list rather than randomly (with repetition) picking from the list, have you considered storing the last CD shown details in the DB? If each CD has a sequential ID then each week (or day) you increment the number which will determine what CD is shown. If the incremented CD id exceeds the highest id in the DB, restart back at the first id. Just incrementing the ID is not a good idea. It does not allow for the flexibility required if you suddenly delete a CD in the middle. So it'd be better doing something like SELECT * FROM cds WHERE `CDid`'$LastCDid' . Then obviously you'd need to check if the last shown was the last in the base, you'd get 0 rows. But this can be circumvented by just checking the number of rows returned, and if the rowcount is 1, simply do a new SELECT with CDid 0. You could also include a column (or two) in the CD info table to record when it was last displayed and check that this is 29 days ago. I agree that this would be the easiest way. On every display you do an update to store the date, then on each page load just calculate how long ago the CD show must've been shown last. What about cookies? Each visitor could then have their own 'cycle' through the list. This is a per need basis. With the last shown date you don't need the cookies. -- Rene Brehmer aka Metalbunny If your life was a dream, would you wake up from a nightmare, dripping of sweat, hoping it was over? Or would you wake up happy and pleased, ready to take on the day with a smile? http://metalbunny.net/ References, tools, and other useful stuff... Check out the new Metalbunny forums at http://forums.metalbunny.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: set multiple variables
$REMOTE_ADDR == 212.3.54.65 || $REMOTE_ADDR == 212.3.54.66 is correct On Sun, 3 Oct 2004 12:39:11 +0100, Graham Cossey [EMAIL PROTECTED] wrote: ||= OR = AND -Original Message- From: argesson [mailto:[EMAIL PROTECTED] Sent: 03 October 2004 11:30 To: [EMAIL PROTECTED] Subject: [PHP] Re: set multiple variables Daniel Schierbeck wrote: Argesson wrote: try this: if ($REMOTE_ADDR == 212.3.54.65 $REMOTE_ADDR == 212.3.54.66) Joe Szilagyi wrote: Hi, I have this working: if ($REMOTE_ADDR == 212.3.54.65) { header(Location: http://www.google.com/search?q=huzzah;); Redirect browser exit; } But I want to specify multiple IPs. What's the best recommended way for doing that? thanks Joe Make that: if ($REMOTE_ADDR == 212.3.54.65 || $REMOTE_ADDR == 212.3.54.66) isn't the || same as ? Or I missed something? -- 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 -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Submitting info from a form to a db
Try it with escaped qutation marks (\) ? mysql_query(INSERT INTO `users`(fullname, email, username, password) VALUES (\.$_POST['fullname'].\, \.$_POST['email'].\, \.$_POST['username'].\, \.md5($_POST['password'].\)); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Outputting HTML with PHP - Buffer Problem?
Well, there is a difference between function html_head() { $html = html; return $html; } and function header() { ? html head title ? } The first function you need to call using ? echo header(); ? to see the output THe second function is not a real function because it has no return statement. In german you call this Prozedur. Don't know if it's the same as procedure in english. But you will call this piece ? header(); ? to see some output. Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Array inside Class
Hello everybody, can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ? Output: Parse error: parse error, unexpected '(', expecting ',' or ';' in /srv/www/htdocs/stundenplan/stpoo.php on line 4 Thanks, Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array inside Class
Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 I forgot to mention that I'm using php-5.0.1 before Dirk On Fri, 10 Sep 2004 14:26:22 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] can anyone explain to me, why I can't resize an array inside a class? Sample Code: ?php class Liste { var $input = array (1,2,3); var $input2 = array_pad ($input,10, 1); } ? Output: Parse error: parse error, unexpected '(', expecting ',' or ';' in /srv/www/htdocs/stundenplan/stpoo.php on line 4 You can't assign values like that. Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); ---John Holmes... -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array inside Class
Works fine within the constructor, thanks. Dirk On Fri, 10 Sep 2004 14:38:45 -0400, John Holmes [EMAIL PROTECTED] wrote: From: dirk [EMAIL PROTECTED] Try this: var $input = array(1,2,3); var $input2 = array(); $this-input2 = array_pad($this-input,10,1); Well, doesn't work either: Parse error: parse error, unexpected T_VARIABLE, expecting T_FUNCTION in /srv/www/htdocs/stundenplan/stpoo.php on line 5 The array_pad part needs to go inside of a function. The constructor would be a good place for it. ---John Holmes... -- Try http://einx.dyndns.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] unset Fuction
Hello John, From: JohnT [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 4:54 AM Hello, mind explain a little bit further cause i'm confused and not sure if the fuction really work or something [some Code] As far as I know (or understand), unset() will only destroy the reference to a variable. That's why you get sometimes a bit confusing results when unset variables insinde functions, because they are often just a reference or even a copy of another variable. (for example using global $a; is equal to $a = $GLOBALS['a']) See: Chapter References Explained - Unsetting References and Function Reference of unset() of the php Manual. Now I guess that a static variable is only available via reference in a function call. Otherwise it would be unseted if the function call is finished, what's not the use of a static var. How to fix this problem: The purpose of your code was to reset the value of the static variable. So just do this reseting by assigning the value you wanted, e.g. /// CODE / function foo() { static $a; $a++; echo $aBR; $a = 0; } foo(); foo(); foo(); /// Now it outputs: 1 1 1 Regards, Dirk Oschlies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Template Function
Hi Cameron, Seems like http://xaoza.net/software/phpmesh/ could be of some interest to you. I'm checking it out myself as we speak, so I cannot confirm whether it gives you template inheritance via subdirectories. It does provide a means to do away with standard includes anywhere on your site... HTH good luck with the project, dirk ps: I welcome any insights you might gather on implementing template inheritance without the need for includes (by any means), as I will be facing a similar conversion project in the opening weeks of 2004. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Webpage like MySql- need to be able to see all fields and edit
Hi, You might want to look at phpFriendlyAdmin at sourceforge http://sourceforge.net/projects/phpfriendly/ quote the web developer's answer to simplify content management for the masses! This package is a remote database management tool made specifically for web developers who want to ease an audience into the world of content management /quote I recently incorporated it in a homegrown Content Management System and am very happy with it... As always everything depends on the knowledgeability of your userbase... Hope this helps, Dirk Maetens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] variable sized arrays global vars - another newbie question
Am Dienstag, 15. Juli 2003 14:39 schrieb bob pilly: Can i declare an array that doesnt have a fixed size? Basically i want to assign the results of a query to the array but obviously the query results can change. Something along the lines of: $myarray= array(); while($temp=mssql_fetch_array($tmresult)){ brandnew array = $temp[fieldname]; $myarray[]= $temp[fieldname]; } this doesnt work for me, any ideas? Also is it possible to have global variables within php? I have noticed that if i create a function i cant write to what i thought were global variables(declared outside the function). Im not trying to pass variables between pages, just use a global counter within a single page? $globalvar= 'Hi there'; function afunction() { global $globalvar; echo($globalvar); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 4.3.0 and Sablotron 0.97
Hi, I' trying to install the version 4.3.0 of PHP with xslt via sablotron on a linux system. Already installed are expat 1.95.6, JS 1.5.x and Sablotron 0.97. When I run ./configure in the PHP source directory everything seems to be okay. But on calling make I've got the following error messages after which make stops: /usr/lib/libsablot.so: 'undefined reference to 'JS_*' where * stands for nearly 20 different JS objects(methods?). Can someone tell me where the problem lies and give me at least a hint to solve it? Many thx in advance Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Parsing a directory for specific files
Hi, does anybody know how to solve the following task? I'd like to generate a dynamic page, which contents come from txt-files. The files will be in a directory called content (from the page: ../content) and they are labeled with date and (within one day) increasing numbers, e.g. 20030108-1.txt, 20030108-2.txt, 20030108-3.txt, 20030109-1.txt, 20030110-1.txt, 20030110-2.txt The script should parse the file names and get the most recent five ones! The text inside should be included in the page - but this is not the problem, the task mentioned above is the problem! Thx in advance for these who can deliever solutions or ideas! Dirk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP 4.3 unable to load php_domxml.dll in WinXP Apache 2.0.43
Same applies here using XP pro SP1, apache 1.3.27 no dll will load even if the extensions path is set to the correct dir in this case J:\php-4.3.0\extensions - where they reside dirk On Sun, 29 Dec 2002 14:38:51 -, [EMAIL PROTECTED] (Rui Costa) wrote: hi, Windows XP, Apache 2.0.43(Win32) with PHP 4.3 can't load DLL 'php_domxml.dll'. it pops-up: Unknown(): unable to load dll'C:\php\extensions\php_domxml.dll' if I use the old 'php_domxml.dll' from PHP 4.2.4, it works fine. I'm using libxml2-2.4.30, expat 1.95.4. by the way, 'libxml2.dll' is not packed in the PHP 4.3 Windows distribution, although it mentions that it does in the PHP documentation. thanks in advance rui -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problem with memory_limit and php 4.2.3
Hi all, the httpd - Process on my linux-box exits (no segfault) when executing the following simple script with php 4.2.3. I don't get the expected error message ( something like 'Allowed memory size of 512000 bytes exhausted'). =[test Script]=== ? ini_set (memory_limit, 512000); // 500kB $aArray = array(); for ($i=0;$i(1024);$i++) { for ($j=0;$j1024;$j++) $aArray[$i] .= x; echo . sizeof($aArray); } ? [end of Script]== The same script works fine under php4.0.6. What ist going on here? Is it a problem with my linux box or with php4.2.3? My configuration: suse Linux 2.4.10-4GB i386 =[php.ini]== engine = On short_open_tag = On asp_tags = Off precision= 14 y2k_compliance = Off output_buffering = Off output_handler = zlib.output_compression = Off implicit_flush = Off allow_call_time_pass_reference = On safe_mode = Off safe_mode_exec_dir = safe_mode_allowed_env_vars = PHP_ safe_mode_protected_env_vars = LD_LIBRARY_PATH disable_functions = expose_php = On max_execution_time = 600 ; Maximum execution time of each script, in seconds memory_limit = 92M ; Maximum amount of memory a script may consume (8MB) error_reporting = E_ALL ~E_NOTICE display_errors = On display_startup_errors = Off log_errors = On track_errors = Off [...some more stuff] = =[php configure-line]=== ./configure --with-apxs --enable-sockets --enable-memory-limit --with-mysql --with-xslt-sablot --with-sablot=/usr/local/lib --with-expat=/usr/local/lib --with-ldap --with-ftp --enable-track-vars --enable-trans-sid --with-zlib-dir=/usr/lib --with-ming --with-oci8=/opt/oracle/OraHome1 --enable-xslt -with-config-file-path=/etc/httpd2 ==[ldd output]== ldd /usr/local/lib/php4/libphp4.so /opt/oracle/OraHome1/lib/libclntsh.so.8.0 = /opt/oracle/OraHome1/lib/libclntsh.so.8.0 (0x40175000) libdl.so.2 = /lib/libdl.so.2 (0x406f9000) libpam.so.0 = /lib/libpam.so.0 (0x406fd000) libsablot.so.0 = /usr/local/lib/libsablot.so.0 (0x40706000) libexpat.so.0 = /usr/local/lib/libexpat.so.0 (0x407e8000) libming.so = /usr/local/lib/libming.so (0x4080b000) libldap.so.1 = /usr/lib/libldap.so.1 (0x4084c000) liblber.so.1 = /usr/lib/liblber.so.1 (0x40861000) libz.so.1 = /lib/libz.so.1 (0x40866000) libcrypt.so.1 = /lib/libcrypt.so.1 (0x40875000) libresolv.so.2 = /lib/libresolv.so.2 (0x408a2000) libm.so.6 = /lib/libm.so.6 (0x408b4000) libnsl.so.1 = /lib/libnsl.so.1 (0x408d6000) libc.so.6 = /lib/libc.so.6 (0x408ed000) libwtc8.so = /opt/oracle/OraHome1/lib/libwtc8.so (0x40a13000) libpthread.so.0 = /lib/libpthread.so.0 (0x40a15000) libstdc++-libc6.2-2.so.3 = /usr/lib/libstdc++-libc6.2-2.so.3 (0x40a2b000) /lib/ld-linux.so.2 = /lib/ld-linux.so.2 (0x8000) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using checkboxes
Hey all, I have a form, generated in php, with a lot of checkboxes on it. They are initialized from the db. All checkboxes are in a 2d array and they come through to my processing script fine. The only problem is that the ones that are unchecked do not come through. I know that the post command only sends the checked boxes. What I would like to know is which ones were changed, ie checked or unchecked by the user. Right now I do it by putting a string with the old values in a hidden textbox and comparing those to what I get back in the array. I have been thinking about writing some client side script to produce the differences. Does anyone know if there is a better way to do this? Thanks, Dirk.
[PHP] Writing IPTC tags
Hi all, Just wanted to know if it's possible to write iptc tags with php, and, if so, how? I can read them trough getimagesize(). TIA, Dirk Bean IT T: +31 (0)23 - 5422299 F: +31 (0)23 - 5422728 W: http://www.bean-it.nl -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Store file remotely using socket/fopen
Hello list, Simple Enough Objective: store file remotely (wu-ftp); MinorSnag: PHP's ftp-functions unavailable at localhost; BelowWorkaround: works fine for deleting remote file; MajorSnag: how to STORE a file remotely using socket? ?php $ftp=fsockopen(ftp.server.com, 21, $errno, $errstr, 60); if (!$ftp) { echo Connection failed: $errstr ($errno); exit; } else { socket_set_blocking($ftp, true); echo fgets($ftp,255); fputs($ftp,USER ftp_username\r\n); echo fgets($ftp,255); fputs($ftp,PASS ftp_passw\r\n); echo fgets($ftp,255); fputs($ftp,DELE /home/httpd/html/test.htm\r\n); echo fgets($ftp,255); fputs($ftp,QUIT\r\n); echo fgets($ftp,255); fclose($ftp); } ? BTW: I also messed with fopen(ftp://user:pass@...;) but failed miserably (although it seemed possible before my mind wandered off). ANY HELP IS APPRECIATED (using socket, fopen, ...) -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] How upload file(s) using socket/fopen
Hello list, Simple Enough Objective: store file remotely (wu-ftp); MinorSnag: PHP's ftp-functions unavailable at localhost; BelowWorkaround: works fine for deleting remote file; MajorSnag: how to STORE a file remotely using socket? ?php $ftp=fsockopen(ftp.server.com, 21, $errno, $errstr, 60); if (!$ftp) { echo Connection failed: $errstr ($errno); exit; } else { socket_set_blocking($ftp, true); echo fgets($ftp,255); fputs($ftp,USER ftp_username\r\n); echo fgets($ftp,255); fputs($ftp,PASS ftp_passw\r\n); echo fgets($ftp,255); fputs($ftp,DELE /home/httpd/html/test.htm\r\n); === STORE EQUIVALENT ? echo fgets($ftp,255); fputs($ftp,QUIT\r\n); echo fgets($ftp,255); fclose($ftp); } ? BTW: I also messed with fopen(ftp://user:pass@...;) but failed miserably (although it seemed possible before my mind wandered off). ANY HELP IS APPRECIATED (using socket, fopen, ...) -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Upload file(s) using socket/fopen
Hello list, Simple Enough Objective: store file remotely (wu-ftp); MinorSnag: PHP's ftp-functions unavailable at localhost; BelowWorkaround: works fine for deleting remote file; MajorSnag: how to STORE a file remotely using socket? ?php $ftp=fsockopen(ftp.server.com, 21, $errno, $errstr, 60); if (!$ftp) { echo Connection failed: $errstr ($errno); exit; } else { socket_set_blocking($ftp, true); echo fgets($ftp,255); fputs($ftp,USER ftp_username\r\n); echo fgets($ftp,255); fputs($ftp,PASS ftp_passw\r\n); echo fgets($ftp,255); fputs($ftp,DELE /home/httpd/html/test.htm\r\n); echo fgets($ftp,255); fputs($ftp,QUIT\r\n); echo fgets($ftp,255); fclose($ftp); } ? BTW: I also messed with fopen(ftp://user:pass@...;) but failed miserably (although it seemed possible before my mind wandered off). ANY HELP IS APPRECIATED (using socket, fopen, ...) -- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Passing files from A to B
Hello PHP-list, I am not an expert, so explaining the problem might be somewhat tricky. Please bare with me... Server A: PHP 4.01pl2 Safe Mode On Not configured with ftp functions Server B: ftp access, no PHP (shame) On Server A I use output buffering to generate some simple HTML files. So far so good. My problem starts when I want to copy these files from Server A to Server B, where the public can get to them. How can I accomplish this? Any help (RTFM included) is as welcome as it will be appreciated! (BTW I am subscribed to the digest version of this php-general list, so a cc: [EMAIL PROTECTED] would be nice) Thanks. -- Dirk Maetens Belgium -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP an WinNT-Filesystem
Hi, i have to install a php-tool on an IIS4.0 NT-server owned by our customer. I would like to write into a directory with a script but i always receive an error: Warning: fopen("d:\InetPub\blabla\pages\news\admin\data\210301192417.dat","a") - Permission denied in d:\InetPub\blabla\pages\news\admin\publish.php on line 17 I gave writing permission to the directory \data\ but it doesn't work. Can you tell me please, what i have to do! Tanks a lot Dirk Ritters -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]