[PHP] Class calling Class returning 'object'
I am in need of some assistance working with classes. I have a function (X) which calls a class (A), that class calls another class (B) and returns the results. At this point I think I am doing everything correctly within' class A because if I echo the results of Class A calling Class B the data is displayed. However, when I use 'return $data' from function X (ex. $data = $ClassA-function( $var1, $var2 ); ) the word 'object' is being displayed in the browser. Here is the code; any help, tips, pointers is appreciated. // function 'chooser' calls class 'myAuth' and returns $data function chooser( $level, $page, $user, $pass ) { if( $page == auth ) { require 'auth.inc.php'; $data = new myAuth; $data = $data-login( $_POST['user'], $_POST['pass'] ); } else { $data = error; } return $data; } // myAuth class class myAuth { var $data; function login( $user, $pass ) { if( ( empty( $user ) ) || ( empty( $pass ) ) ) { $data = new myAuthTmplte(); $data = $data-AuthTemplate( 1, NULL, NULL, NULL, $errors ); } else { $data = error; } return $data; // If I do echo $data I can see the results of calling the myAuthTmplte Class } // myAuthTmplte class class myAuthTmplte { var $data; function AuthTemplate( $cmd, $args, $num, $message, $errors ) { $data = I should be seeing this text right here; // This data should be displayed but I am only seeing the word 'object' in the browser return $data; } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $_POST to function?
I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: $_POST to function?
Tanoor Dieng wrote: Hi, are there some variables in your post array(aka are you sure that $_POST is not empty)? Normally this should works. Tanoor. 2006/2/24, Jason Gerfen [EMAIL PROTECTED]: I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yep, I just double checked the $_POST vars prior to calling the function, ex: echo pre; print_r( $_POST ); echo /pre; // This prints everything contained in $_POST without problem return global_template( 3, $_POST, count( $_POST ), $message, NULL ); function global_template( $cmd, $args, $num, $message, $errors ) { echo pre; print_r( $args ); echo /pre; // This will not display anything in the $args-$_POST array? WTH? } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST to function?
Vidyut Luther wrote: Since $_POST is a superglobal, it should not lose scope inside a function() call. I could be wrong though. Also, curious if $args is empty.. what is $num and $message. ? Also.. you're calling a function in your return statement ? On 2/24/06, Jason Gerfen [EMAIL PROTECTED] wrote: Tanoor Dieng wrote: Hi, are there some variables in your post array(aka are you sure that $_POST is not empty)? Normally this should works. Tanoor. 2006/2/24, Jason Gerfen [EMAIL PROTECTED]: I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Yep, I just double checked the $_POST vars prior to calling the function, ex: echo pre; print_r( $_POST ); echo /pre; // This prints everything contained in $_POST without problem return global_template( 3, $_POST, count( $_POST ), $message, NULL ); function global_template( $cmd, $args, $num, $message, $errors ) { echo pre; print_r( $args ); echo /pre; // This will not display anything in the $args-$_POST array? WTH? } -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Sure, by calling return function_name( args ) it just sends vars based on conditional statements to a template type setup. The $num and $message vars are used by the template function to determine what and how to display the page contents is all. That is what I thought, $_POST is a superglobal, but it is loosing scope. Could it be that I am trying to pass $_POST from one function to another function be causing the problem you think? I have never ran into this before. -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: $_POST to function?
Christopher Taylor wrote: I am not as familiar with php as I am c++ but I wonder if you need to pass by reference? Does this make sense in the context of php? One other thing I would try is setting $temp = $_Post and then passing $temp. Chris Yeah, I actually tried that as well. -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST to function?
Dan Parry wrote: Why are you passing the POST array? As it's superglobal why not just work directly on it within the function? Dan - Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -Original Message- From: Jason Gerfen [mailto:[EMAIL PROTECTED] Sent: 24 February 2006 15:27 To: PHP General (E-mail) Subject: [PHP] $_POST to function? I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } Perhaps I should post some more of the code I am working. I am attempting to create a simple method of outputing data to a template function which only holds html data to be displayed on the browser. Here is a quick overview, perhaps I cannot do this. index.php calls this: $data = chooser( $_SESSION['a'], $_GET['b'], $_SESSION['c'], $_SESSION['d'] ); Contents of chooser function: function chooser( $level, $page, $user, $pass ) { if( $page == global ) { require 'global.inc.php'; $data = global_dhcp( $_SESSION['lvl'], $_POST['dn'], $_POST['lt'], $_POST['mlt'], $_POST['msc01'], $_POST['msc02'], $_POST['msc03'], $_POST['msc04'], $_POST['msc05'], $_POST['pxe'], $_POST['pxe01'], $_POST['pxe02'], $_POST['pxe03'], $_POST['pxe04'], $_POST['pxe05'], $_POST['pxe05'] ); } contents of global_dhcp function: function global_dhcp( $level, $domain, $lease, $mxlease, $msc01, $msc02, $msc03, $msc04, $msc05, $pxe, $pxe01, $pxe02, $pxe03, $pxe04, $pxe05, $pxe06 ) { global $defined, $error_message; require 'template.php'; if( ( empty( $domain ) ) || ( empty( $lease ) ) || ( empty( $mxlease ) ) ) { $db = db( $defined['dbhost'], $defined['username'], $defined['password'], $defined['dbname'] ); $sql = @mysql_query( SELECT * FROM global, $db ) $args = @mysql_fetch_array( $sql_global ); @mysql_close( $db ); $message = message; return global_template( 1, $args, count( $args ), $message ); logs( $error_message['valid'] ); } else { return global_template( 4, NULL, NULL, NULL, NULL ); logs( $error_message['usr_chk'] ); } } and the contents of the global_template function: function global_template( $cmd, $args, $num, $message, $errors ) { if( $cmd == 4 ) { $data = img src=\images/error.jpg\nbsp;nbsp;blinkbError: /b/blinkYou do not have proper access to use this utility. Your computer information has been recorded and the Administrator has been notified.; } return $data; } So in essence: index.php-chooser-global_dhcp-global_template-output to browser I hope that clarifies my problem a bit. -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST to function?
Peter Lauri wrote: Is the function actually returning anything? Aren't you just echoing the content of the $_POST? -Original Message- From: Jason Gerfen [mailto:[EMAIL PROTECTED] Sent: Friday, February 24, 2006 10:27 PM To: PHP General (E-mail) Subject: [PHP] $_POST to function? I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } Well as I pass $_POST to the global_template function I am not seeing anything in the $args array in the global_template function. And to this point I still have not figured out why. -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST to function? [SOLVED]
Peter Lauri wrote: http://th.php.net/manual/en/function.return.php -Original Message- From: Jason Gerfen [mailto:[EMAIL PROTECTED] Sent: Saturday, February 25, 2006 12:29 AM To: Peter Lauri Cc: php-general@lists.php.net Subject: Re: [PHP] $_POST to function? Peter Lauri wrote: Is the function actually returning anything? Aren't you just echoing the content of the $_POST? -Original Message- From: Jason Gerfen [mailto:[EMAIL PROTECTED] Sent: Friday, February 24, 2006 10:27 PM To: PHP General (E-mail) Subject: [PHP] $_POST to function? I am not sure why this is not working. Aren't $_POST vars superglobals? I am trying to pass the $_POST array as an argument to a function and nothing is being returned. Any help is appreciated. return global_template( 3, $_POST, count( $_POST ), $message ); function global_template( $cmd, $args, $num, $message ) { echo pre; print_r( $args ); echo /pre; } Well as I pass $_POST to the global_template function I am not seeing anything in the $args array in the global_template function. And to this point I still have not figured out why. Figured it out, typo. I must have fat fingers today. Thanks everyone. -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] databases, loops and tables oh my...
Not sure about this one, I am trying to execute a SQL query to retrieve records then loop over the records and display X amount per line. Any help is appreciated. $sql = @mysql_query( SELECT * FROM subnets, $db ); $num = @mysql_num_rows( $sql ); $subnets .= table width=\100%\trtd bgcolor=\#C10202\ class=\fntTR\ colspan=\$num\Subnets and global parameters for each/td/trtr; $i = 1; while( $list = @mysql_fetch_array( $sql ) ) { list( $id, $subnet, $mask, $dns01, $dns02, $router, $vlan, $scope, $range1, $range2, $vlan ) = $list; if( $i % 2 == 0 ) { $tr = /trtr; } if( $scope == no ) { $range1 = NULL; $range2 = NULL; } $subnets .= td valign=\top\ valign=\center\ table cellspacing=\3\ border=\0\ trtd colspan=\2\ align=\center\bu$vlan/u/b/td/tr trtdbSubnet:/b/tdtd$subnet/td/tr trtdbMask:/b/tdtd$mask/td/tr trtdbDNS:/b/tdtd$dns01/td/tr trtdbDNS:/b/tdtd$dns02/td/tr trtdbGateway:/b/tdtd$router/td/tr trtdbVlan:/b/tdtd$vlan/td/tr trtdbScope:/b/tdtd$range1nbsp;-nbsp;$range2/td/tr /table/td . $tr; $i++; } $subnets .= /tr/table; -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [How-to]flatfile New system with comments
John Nichel wrote: Nicholas Couloute wrote: How would I make a flatfile new systen with the ability for users to comment on the news selection (no login required)? Write the code for it. lol, too funny. The filesystem reference: http://us2.php.net/manual/en/ref.filesystem.php (this will help you with some of the runtime vars) To write a file use this function: http://us2.php.net/manual/en/function.fwrite.php To read in a file use this function: http://us2.php.net/manual/en/function.fopen.php There are quite a few internal functions PHP can help you read, write files with. HTH -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: array variables with or without quotes
I believe it is because without the quotes, it is expecting a predefined constant. With the quotes, it is expecting an array key. This is why if you use a word that is not defined as a constant, php will first look for it as a constant, won't find it, then looks through the array treating it like a key. If it is found as a constant, then the constant's value is used as the key. Jason -Original Message- From: Chuck Anderson [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 22, 2006 3:30 PM To: php-general@lists.php.net Subject: [PHP] Re: array variables with or without quotes 2dogs wrote: I recently encountered a situation where I had to retrieve data from a MYSQL database table with a field named include. My code looked like this: $content_result = mysql_query('SELECT * FROM calander') or die(mysql_error()); $content_row = mysql_fetch_array($content_result); if ($content_row[include]) {go do something;} When I tried to run this, PHP treated the word -include- as a control structure rather than an index name. Understandable. So, I put it in single quotes ('include') to see what would happen and it works fine. But I don't understand why! What is the difference between $content_row [include] and $content_row['include']? I have been unable to resolve this question in the php manual, I need enlightenment. 2dogs http://www.php.net/manual/en/language.types.array.php#language.types.array.f oo-bar -- * Chuck Anderson . Boulder, CO http://www.CycleTourist.com Integrity is obvious. The lack of it is common. * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php smime.p7s Description: S/MIME cryptographic signature
Re: [PHP] Looping from A to Z
Richard K Miller wrote: Good afternoon. I'm having trouble getting PHP to loop from A through Z. Here is what I tried, coming from a C background: for ($l = A; $l = Z; $l++) echo $l; I use this: for($i='a'; $i != 'aa'; $i++){ print $i; | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php ajax
pete wrote: ello all, Im a beginner at php. but I was able to get this script to work. Now I am looking to have it automatically refresh itself using ajax every 10 seconds. Can somebody explain or show me how to do this. Thank you. PHP Code: | | | meta http-equiv=REFRESH content=10; URL=http://URL; This is what you are looking for. It is HTML, but it refreshes the page as needed. ?php $httpfile = file_get_contents('http://www.game-monitor.com/client/buddyList.php?uid=8654listid=0xml=1'); $doc = DOMDocument::loadXML($httpfile); $myBuddyNodes = $doc-getElementsByTagName('buddy'); /not neccessary, but im using it $nameStatusDoc = new DOMDocument('1.0', 'iso-8859-1'); $rootElement = $nameStatusDoc-createElement('PetesList'); $rootElement = $nameStatusDoc-appendChild($rootElement); / echo table border = '0' cellpadding= '2' bgcolor='#616042'\ntheadtrth/thth/thtr/thead\n; foreach ($myBuddyNodes as $node) { echo tr; echo tdfont size='-1'.$node-firstChild-nextSibling-nodeValue./font/td; if($node-firstChild-nextSibling-nextSibling-nextSibling-nodeValue == Online) | -- Jason Gerfen When asked what love is: Love is the Jager talking. ~Craig Baldo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Application Vuln. Testing
I have a question which as of yet I am unable to find any information about from googling. Lets say you have just written a fairly robust PHP/MySQL application and would like to put it on your production server. For reasons of clarification lets say this application handles sensitive customer data including credit infromation, so it is imperitive that the data remain secure and during the development process at every turn you went through great lengths to filter data on forms, URL's file uploads etc. Is there any product available, commercial or free which performs source code auditing which *specificly searches PHP code for SQL, XSS type of attacks or vulnerabilities? TIA. -- Jason Gerfen the life you live ignoring who, ignoring who you're giving money to. and you, you support the corrupt industries and companies who dont think to care. guilty...guilty...guilty by ignorance. no feeling... no substance... killing... you're killing through your ignorance. ~ Snapcase -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Application Vuln. Testing
Richard Davey wrote: On 7 Feb 2006, at 16:54, Jason Gerfen wrote: Is there any product available, commercial or free which performs source code auditing which *specificly searches PHP code for SQL, XSS type of attacks or vulnerabilities? TIA. No. But there are people who can perform the service for you (Brainbulb, Hardened PHP, etc) Cheers, Rich -- http://www.corephp.co.uk Zend Certified Engineer PHP Development Services Hmm, I found one but it seems it is still in beta. http://www.codescan.com/product.html I have done some of my own auditing but the application I have been working on is nothing but form after form. At each point the form is submitted I do sanity checks on the data to ensure that 1) it is being submitted from a page on the server. 2) that it doesn't contain script|object|embed type of code or SQL syntax. 3) that the specified length of the submitted data is of a certain length. Can anyone on this list perhaps engage this conversation? I am bringing up this topic, not just for the application I am working on but for the information to be spread to other developers. Any code examples, tips, resources etc., is appreciated. -- Jason Gerfen the life you live ignoring who, ignoring who you're giving money to. and you, you support the corrupt industries and companies who dont think to care. guilty...guilty...guilty by ignorance. no feeling... no substance... killing... you're killing through your ignorance. ~ Snapcase -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Window close.
On 2/7/06, Miles Thompson [EMAIL PROTECTED] wrote: Actually, expand it a little bit, and you avoid the JS Alert. function close_opener(){ parentwin = window.self; // Make handle for current window named parentwin parentwin.opener = window.self;// Tell current window that it opened itself parentwin.close(); // Close window's parent (e.g. the current window) } Interesting, but this code seems to be exploiting a flaw in certain browsers (Internet Explorer). I believe the window.opener property is read-only in Firefox and probably other browsers. At the very least, I wouldn't rely on this method. Jason
Re: [PHP] Re: [Off] Cheap SSL certificates?
Problem is when you have cheap ssl certs they might pop up in browser on visit, when they are not in the browser cert list though. I just know verisign, and truesign. but kinda expensive -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) I use GoDaddy personally and have never had any issues with them. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID vs NAME in different browsers
On 1/28/06, Niels [EMAIL PROTECTED] wrote: when making an input field for submission from a form, I need to put a name='something' in it. For CSS I often use an id='something'. Some browsers apparently submit the field properly if name is missing and id is present. Others might not. Can anyone tell me about what browsers do what? HTML Forms should always use the NAME attribute to pass values, never ID. You can use print_r($_REQUEST); at the top of your script to debug. Jason
Re: [PHP] absolute vs relative path?
On 1/25/06, William Stokes [EMAIL PROTECTED] wrote: I Have a web site on one server and a test site on another. How can I build the hyperlinks so that they work on both servers without modification. The cleanest solution is to use relative paths so that your site will work regardless of where it's placed on the web server. Sometimes it can be tricky to determine what the relative path should be, but PHP can help solve that. Simply write a function or method to calculate the path to the base directory of the site. Make this a global variable and echo it before any path to a resource on the site. global $PATH; echo a href=\{$PATH}images/blah.gif\ /\n; Jason
[PHP] testing
[PHP] this is a test
this is a test
[PHP] XMPP Gateways
Can PHP interact with GoogleTalk like this bot built in ASP I think: - add the following user to your GTalk: [EMAIL PROTECTED] - send it a msg
Re: [PHP] mcrypt
Duffy, Scott E wrote: Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to work but when I decrypt it with a different script I get most of it but some garbage. Using blowfish. So to test. Encrypt.php $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . \n; $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, $iv); echo $crypttext. \n; decrypt.php $server = $_SERVER['SERVER_NAME']; $url = 'http://'.$server.'/encrypt.php'; $fh = fopen($url,'r') or die (cant open: $php_errormsg); $new_string=; while (! feof($fh)) { $new_string = $new_string.rtrim(fgets($fh,4096)); } $enc=$newstring; $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $enc=$_POST['text']; $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); $key = This is a very secret key; $text = Meet me at 11 o'clock behind the monument.; //echo strlen($text) . br; $crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv); echo $crypttextbr; I get from decrypt Meet me at 11 o'clock behind the monumen3ýÚ·nÃtbr Is it doing some padding or something? When I encrypt/decrypt same script it works fine. Maybe something to do with these? $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB); $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND); Thanks, Scott Duffy Look at trim(). And your right it does have to do with using ECB. -- Jason Gerfen The charge that he had insulted Turkey's armed forces was dropped, but he still faces the charge that he insulted Turkishness, lawyers said. ~ BBC News Article -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help getting PHP and GPG to work
On 1/9/06, zedleon [EMAIL PROTECTED] wrote: Has anybody had success using PHP and GPG to send encripted email from a form? Yes. You're on the right track. The method I used was to create a temp file with my data, encrypt it with GPG, read it back into a string, then mail() it. (Of course it goes without saying that care should be taken to restrict possible access to the tempfiles, and delete them when they're no longer needed) Have you set up a public key for the web server (httpd)? Jason
Re: [PHP] Help getting PHP and GPG to work
On 1/9/06, Support [EMAIL PROTECTED] wrote: quote for the book- PHP scripts will invoke the encryption process, and the public key has to be on the key ring of the user invoking the encryption. On the Web server, PHP usually runs as user nobody or www or as the user for your Web server. It could even be your own login name. Whichever user is assigned to PHP/the Web server, nobody, www, etc. must have a GnuPG key ring, and that key ring needs to contain the public key for any person to whom you wish to send encrypted mail by using PHP to invoke the encryption process. so how does one find out what the name would be? This is getting more into server configuration than strictly PHP. I'll try to help, but I'm not a professional system administrator. These steps worked for me, but follow these instructions at your own risk. You will probably need root access on your server. $ su - Most distributions don't allow the web server account to log in by default. Edit /etc/passwd to (temporarily) allow access. # vi /etc/passwd Search for httpd or apache. When you find it, change the last part (/bin/false) to /bin/sh Note the home directory - you may need to create it. # mkdir /home/httpd And set permissions # chown apache:apache /home/httpd Now, switch to the web server account # su apache And generate a GPG key: $ gpg --gen-key Read the GPG documentation to learn how to import and export keys. When you're done, don't forget to edit /etc/password and set apache's shell back to /bin/false. Hope this helps! Jason
Re: [PHP] Newbie question: need to transfer directory contents from my local machine to my website
Hi, You should perhaps look at setting up a web server on your computer. PHP as stated works server-side and if those folders/files you wish to transfer reside in the web root, then PHP can process those files. Perhaps look at how a web based FTP client written in PHP works for how to copy/move/delete files in PHP. If you can't set up Apache with PHP on Windows, try something like phpdev5 for a click and use solution. As for your IP, it won't really matter unless you want the server to send data back to your computer. If a static IP or hostname is in order, then they are easy enough to set up even if you are on a dial up connection. Regards Jason Jon Westcot wrote: Hi all: I'm really new at PHP and will probably embarrass myself many times over asking questions that have been asked gazillions of times before, so let this serve as a blanket apology. Now, to my question. Here's what I'm trying to do. I have a simple database on my website that I wish to populate with information from various directories on my local computer. The website is running Linux; my computer is running Windows XP. Once the data are stored, I want to be able to update the information as things change on my local computer (not in real time, mind you, but at my request). I can set up the database access easily enough, and I know how to both populate and query it. What I don't know is how to obtain the information from my local computer via the website. Initially, I'd like to be able to specify the folder on my local computer to access and whether or not to process any subfolders that are found. After the data have been added, I'd like the web application to be able to access the individual folders without having to specify them again (although I'd still be able to identify new folders to include in subsequent updates). I'm not really asking for anyone to write the code for me, but I am looking for suggestions for PHP functions to use to accomplish the inspection of my local computer's folders. I'd also need to know what additional information I'd need to store in the database so that subsequent updates can be automated (i.e., do I need to somehow store my IP address?). Any help you can send my way will be greatly appreciated! Thanks in advance. Sincerely, Jon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Graphically displayed number to confirm user is a human
John Meyer wrote: Duncan Hill wrote: On Wednesday 04 January 2006 16:56, Dave M G wrote: First, is there a term for these kinds of images, or that kind of verification system? What would be the best search terms to look for source scripts? captcha I've been looking for this term for a while as well. Me too. Geez the things I Googled for without luck makes me cringe. Thanks a bunch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Repost: GD/Freetype text problems with bold or size 8
Is anyone able to assist with this? I need to have 6 point fonts looking like they should, instead of all scrunched up. Paid consultation okay, if that's what's stopping an answer. What needs to be changed in the bundled GD source to make these fonts look decent? Thank you. Jason Young wrote: Just to followup on this, I was able to install PHP 5.1.1 with its embedded GD library, and it turns out that GD is definitely the cause of the issues. So my question now is what changes to the source can be made to ensure the highest-quality fonts in smaller sizes? As I've said, I've been on hosts with very smooth rendering of smaller text (size 8, assuming 96 pixel resolution), but my current build looks horrible. http://card.mygamercard.net/mini/Morgon.jpg is what it looks like now - all text is 6 point aside from the bold text at the top, which is 8. This is the 5.0.4 install. http://data.mygamercard.net/test.png is an image I created using a built-but-not-installed version of PHP 5.1.1. I changed the GD_RESOLUTION to 72 point font, so to compensate, these are a font size of 9. What I would like is for the fonts to look similar to what would really be displayed, had this been standard system fonts in a browser or other application. If anyone has had experience with rendering text, I would really appreciate some hints on how to tweak GD to make things look proper. Thanks Jason Young wrote: Currently, I'm running PHP 5.0.4 (only because it's the only one I can get to work on my FC4 x64 install!), but for some reason, using pixel sizes under 8, or using bold fonts, makes the text look horrible. My old host (11 in case anyone else has them..) had this working well, but I have no idea what their settings were. I've heard that editing the gd.h file to change the resolution from 96 to 72 helps, but I'm assuming I'd have to recompile something for that to take effect, and I can't find a PHP-GD Source RPM for my arch. What must I do to get everything smooth again? Fedora Core 4, x64 PHP 5.0.4 PHP-GD module (separate RPM install) Freetype 2.1 gd-2.0.33 Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD/Freetype text problems with bold or size 8 - Followup
Just to followup on this, I was able to install PHP 5.1.1 with its embedded GD library, and it turns out that GD is definitely the cause of the issues. So my question now is what changes to the source can be made to ensure the highest-quality fonts in smaller sizes? As I've said, I've been on hosts with very smooth rendering of smaller text (size 8, assuming 96 pixel resolution), but my current build looks horrible. http://card.mygamercard.net/mini/Morgon.jpg is what it looks like now - all text is 6 point aside from the bold text at the top, which is 8. This is the 5.0.4 install. http://data.mygamercard.net/test.png is an image I created using a built-but-not-installed version of PHP 5.1.1. I changed the GD_RESOLUTION to 72 point font, so to compensate, these are a font size of 9. What I would like is for the fonts to look similar to what would really be displayed, had this been standard system fonts in a browser or other application. If anyone has had experience with rendering text, I would really appreciate some hints on how to tweak GD to make things look proper. Thanks Jason Young wrote: Currently, I'm running PHP 5.0.4 (only because it's the only one I can get to work on my FC4 x64 install!), but for some reason, using pixel sizes under 8, or using bold fonts, makes the text look horrible. My old host (11 in case anyone else has them..) had this working well, but I have no idea what their settings were. I've heard that editing the gd.h file to change the resolution from 96 to 72 helps, but I'm assuming I'd have to recompile something for that to take effect, and I can't find a PHP-GD Source RPM for my arch. What must I do to get everything smooth again? Fedora Core 4, x64 PHP 5.0.4 PHP-GD module (separate RPM install) Freetype 2.1 gd-2.0.33 Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] GD/Freetype text problems with bold or size 8
Currently, I'm running PHP 5.0.4 (only because it's the only one I can get to work on my FC4 x64 install!), but for some reason, using pixel sizes under 8, or using bold fonts, makes the text look horrible. My old host (11 in case anyone else has them..) had this working well, but I have no idea what their settings were. I've heard that editing the gd.h file to change the resolution from 96 to 72 helps, but I'm assuming I'd have to recompile something for that to take effect, and I can't find a PHP-GD Source RPM for my arch. What must I do to get everything smooth again? Fedora Core 4, x64 PHP 5.0.4 PHP-GD module (separate RPM install) Freetype 2.1 gd-2.0.33 Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Blocking Values From an External Source
Or try $defined['hostname'] = ALLOWED_DOMAIN_NAME; if ($_SERVER['SERVER_NAME'] != $defined['hostname']) { echo Not from my domain pal; } Michael Hulse wrote: On Dec 16, 2005, at 11:50 AM, Shaun wrote: I have a script on my site for processing values sent from a contact form and emailing them to the webmaster. The script has been abused by spammers and my hosting company has recommended that I change the script to only accept information posted from my own URL. Could someone tell me how this can be done please? Hello, Maybe try using: $_SERVER['DOCUMENT_ROOT'] Or, something similar. http://us2.php.net/reserved.variables Hth, Cheers, Micky -- Jason Gerfen Oh I have seen alot of what the world can do, and its breaking my heart in two... ~ Wild World, Cat Stevens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Anyone getting bounces from
Yeah, I am recieving the same. Jay Blanchard wrote: [EMAIL PROTECTED] ? I am getting failure notices out the wazoo for some very old messages to the general list. -- Jason Gerfen Oh I have seen alot of what the world can do, and its breaking my heart in two... ~ Wild World, Cat Stevens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Cross Site Scripting Vulnerbilities
comex wrote: Similarly is there a library function for escaping database content for inclusion in HTML pages? http://php.net/htmlspecialchars http://php.net/htmlentities Or roll your own and replace the eregi regex with data that is valid to your application: function chk_input( $string ) { if( eregi( ^[0-9a-z_ -]$, $string ) ) { return 0; } else { return 1; } } if( chk_input( $string ) == 0 ) { echo valid; } else { echo invalid; } -- Jason Gerfen Oh I have seen alot of what the world can do, and its breaking my heart in two... ~ Wild World, Cat Stevens -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What software do you use for writing PHP?
On 12/6/05, Jeff McKeon [EMAIL PROTECTED] wrote: Hey all, Forever now I've been using Frontpage for all my web work including php. I'm sure there's better software out there that is more suited to writing and editing PHP pages. What do you all use? Vim is my editor of preference. If I have to use Windows, I usually go with Homesite (because I already have a licensed copy) or Textpad (because it's better than Notepad). IDEs? Who needs 'em ;) Best, Jason
Re: [PHP] Browser Control Help
I wish I had a dollar every time I've seen a question like yours, it seems like a lot of new developers think they need to fundamentally alter the way the browser works to protect their content. The fact is, if you're putting content on the public web, it can--and will--be downloaded by all of your visitors. (they have to download it to display it after all) You're going the wrong way about protecting your images. No matter what Javascript tricks you try to use, all I have to do is disable Javascript. And you're going to seriously annoy your visitors who are not technically savvy, whether they have the intention to steal your content or not. Personally I would not come back to a site that assumes I'm a thief. You might want to look into other methods to protect your content, such as login authentication and watermarking. PHP can help with these. But if you come on this list and demand ridiculous things, don't expect to be taken seriously. A better way to ask your original question would have been: How can PHP help protect web content? Best, Jason On 12/5/05, Chirantan Ghosh [EMAIL PROTECTED] wrote: Hi Jason, You sound offended...Happy Christmas to you too! If you really wanted to know what I was addressing please read what Dan (Parry) wrote. Keep smiling after all its Dec, C - Original Message - *From:* Jason Petersen [EMAIL PROTECTED] *To:* Chirantan Ghosh [EMAIL PROTECTED] *Sent:* Monday, December 05, 2005 10:57 AM *Subject:* Re: [PHP] Browser Control Help 1. PHP is server side, not client side. 2. You don't have a working version, my browser is fully functional on your site. 2. No one is interested in ripping off your Dreamweaver-generated site anyway. Best, Jason On 12/5/05, Chirantan Ghosh [EMAIL PROTECTED] wrote: Hi All, I was wondering how do in trick in PHP page head part? I want to disable Ctrl, Atl, Print Screen and also remove the File, Edit, View menus from the browser. I already have a working version with disabled Ctrl, Atl, Print Screen ( http://www.art-nyc.us/ )but I need some help with coding with the later. If someone can please help me remove the File, Edit, View menus from the browser in PHP it would help a LOT. Thanks, C
[PHP] Problems with PHP and Apache 2.x 404 ErrorDocument handlers
I used to have a number of sites direct 404 errors towards PHP scripts for error handling and the such. Recently I upgraded my PHP installs to 4.4.1(from 4.3.11) with the configure parameters listed below. Now, none of my PHP handlers are functioning. They are all returning 0 size responses. After quite a bit of troubleshooting I have determined it is not Apache as it's ErrorHandler functions are working correctly and I can drop a Perl (or other language) script in place of the PHP script and they function as desired. Has anybody else run into this problem lately, and if so, does anybody know how to resolve it? The configure parameters used are as follows: --with-apxs2=/usr/local/apache2/bin/apxs --enable-force-cgi-redirect --enable-discard-path --enable-fastcgi --enable-magic-quotes --with-openssl --with-kerberos --with-zlib --enable-calendar --with-curl --enable-exif --with-dom --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --with-xlib-dir --with-imap-ssl --with-pspell --with-recode --with-readline --with-snmp --with-imap --enable-sockets --with-pdflib=/Archives/Linux/PDFLib/5.0.4/PDFlib-5.0.4-Linux/bind/c --with-pspell --with-swf=/Archives/Linux/LibSWF/dist --with-xmlrpc --with-pear --with-mysql --with-gmp --with-expat-dir=/usr Thank you for any assistance anyone is able to offer regarding this issue. Jason Ziemba
Re: [PHP] Re: Problems with PHP and Apache 2.x 404 ErrorDocument handlers
Unfortunately, and even more frustrating, I tried swapping out my script with the basic 'hello world'. It still doesn't run (when triggered via the 404 ErrorDocument parameter), but direct access run's just fine. I attempted to debug (per the PHP faq ( http://us2.php.net/manual/en/faq.installation.php#faq.installation.nodata)) and received the following output: Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 16384 (LWP 2336)] 0x405cd794 in php_handler (r=0x86624b8) at /tmp/PHP/php-4.4.1/sapi/apache2handler/sapi_apache2.c:535 535 if (!parent_req) { then (per the FAQ) I issued the bt command received: #0 0x405cd794 in php_handler (r=0x86624b8) at /tmp/PHP/php-4.4.1/sapi/apache2handler/sapi_apache2.c:535 #1 0x080a9b25 in ap_run_handler (r=0x86624b8) at config.c:152 #2 0x080aa130 in ap_invoke_handler (r=0x86624b8) at config.c:364 #3 0x0808e428 in ap_internal_redirect (new_uri=0x8620948 \020\tb\bh¨a\bÀ\t7\b¸$f\b, r=0x8620948) at http_request.c:465 #4 0x0808de0c in ap_process_request (r=0x8620948) at http_request.c:262 #5 0x080892bd in ap_process_http_connection (c=0x861a868) at http_core.c:251 #6 0x080b4f55 in ap_run_process_connection (c=0x861a868) at connection.c:43 #7 0x080a8124 in child_main (child_num_arg=140642632) at prefork.c:610 #8 0x080a833b in make_child (s=0x407c597c, slot=0) at prefork.c:650 #9 0x080a8398 in startup_children (number_to_start=10) at prefork.c:722 #10 0x080a8c0a in ap_mpm_run (_pconf=0x80f7598, plog=0x8133688, s=0x80fdbe8) at prefork.c:941 #11 0x080af18d in main (argc=4, argv=0xbd44) at main.c:618 Don't know if that helps any, but that's all I've been able to come up with (so far). On 12/1/05, James Benson [EMAIL PROTECTED] wrote: Well if all other PHP scripts work then it must be a problem with your script or something changed in the latest PHP version that your script used, if you post the code someone may be able to say if something is wrong with it. James Jason Z wrote: I used to have a number of sites direct 404 errors towards PHP scripts for error handling and the such. Recently I upgraded my PHP installs to 4.4.1(from 4.3.11) with the configure parameters listed below. Now, none of my PHP handlers are functioning. They are all returning 0 size responses. After quite a bit of troubleshooting I have determined it is not Apache as it's ErrorHandler functions are working correctly and I can drop a Perl (or other language) script in place of the PHP script and they function as desired. Has anybody else run into this problem lately, and if so, does anybody know how to resolve it? The configure parameters used are as follows: --with-apxs2=/usr/local/apache2/bin/apxs --enable-force-cgi-redirect --enable-discard-path --enable-fastcgi --enable-magic-quotes --with-openssl --with-kerberos --with-zlib --enable-calendar --with-curl --enable-exif --with-dom --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --with-xlib-dir --with-imap-ssl --with-pspell --with-recode --with-readline --with-snmp --with-imap --enable-sockets --with-pdflib=/Archives/Linux/PDFLib/5.0.4/PDFlib-5.0.4-Linux/bind/c --with-pspell --with-swf=/Archives/Linux/LibSWF/dist --with-xmlrpc --with-pear --with-mysql --with-gmp --with-expat-dir=/usr Thank you for any assistance anyone is able to offer regarding this issue. Jason Ziemba -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on Mobile Devices(Pocket PC specifically)
On Wednesday 30 November 2005 22:48, Kilbride, James wrote: Does anybody know of a way to run PHP files on a windows mobile device(Pocket PC 2003)? Optimally I'd like to run it under a web server running on the mobile device itself but barring that I'll take some form of command line I guess. Realize that the mobile device will NOT be running any active network connectivity. For all intents and purposes the individual is sitting in a wireless empty room with no land connectivity talking to the mobile device. I haven't been able to find any web servers that run on the Pocket PC that can be viewed by the mobile IE(or mobile Opera either I guess) when it doesn't have active connectivity, at which point I might as well just be using a server for all of the mobile devices rather than hiding it on the mobile device. If you're willing to ditch the windows mobile requirement (Wince/WM is crap anyway) then you could have a look at the Sharp Zaurus series. Run www.pocketworkstation.org on one of the Zaurus and you'll have access to most of Debian in the palm of your hand. I've successfully run FUDforum using Apache2/PHP4/MySQL on my Zaurus. Ruby on Rails works as well albeit a tad slow -- I need to figure out how to get fastcgi working. And unlike WM devices, you can run *real* browsers, Firefox and Mozilla are available. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: [PHP-DB] Drag and Drop with PHP and MySQL
I've used this (radlinks upload) on one of my sites and it works great. Drag and drop, even multiple files. Jason Karns ~~~ Web Designer Applications Programmer 3AM Productions www.3amproductions.net - Things look different @3AM -Original Message- From: Joe Harman [mailto:[EMAIL PROTECTED] Sent: Friday, November 18, 2005 11:31 PM To: php-general@lists.php.net Subject: Re: [PHP] Re: [PHP-DB] Drag and Drop with PHP and MySQL Here is what you are asking for I think.. it uses Java. I did have a complication letting the applet install.. also, it's not free, but there is a Lite version. Hope this helps http://www.radinks.com/upload/dnd.php Joe On 11/18/05, Nate Nielsen [EMAIL PROTECTED] wrote: You wont be able to do the drag and drop, but you can gracefully do multiple file uploads with flash (via flash 8). It also lets you know the progress of the file upload itself. I've done a snazzy picture upload tool for a Flex (generates flash applications on the fly with ActionScript and XML files only - no actual flash IDE) - it allows you to select a file, hit upload, shows a progress bar of the transfer (you can cancel at any time) - and when done, the image is made into a thumbnail and shown on the screen. -obviously, no page reloads and totally cross compatible. I wouldnt know where to start with regular flash as I'm a programmer, so only Flex appeals to me - but I know it can be done, and isnt extremely complicated. My guess is that you could have a flash guru whip something out pretty fast. =) -Nate Nielsen [EMAIL PROTECTED] - Original Message - From: Jasper Bryant-Greene [EMAIL PROTECTED] To: Joe Harman [EMAIL PROTECTED] Cc: php-general@lists.php.net Sent: Friday, November 18, 2005 8:52 PM Subject: Re: [PHP] Re: [PHP-DB] Drag and Drop with PHP and MySQL Joe Harman wrote: Hi Chris, I would think that there has to be something out there like a Javascript that would accomplish that... that would be my first guess anyhow... there possibly could be something done in flash that would act as a drop area for the file... let us know what you find Joe There's no way the browser is going to let JS have access to the user's filesystem. I would expect ditto for Flash, although I don't use it. Jasper On 11/18/05, Micah Stevens [EMAIL PROTECTED] wrote: No. That would be nice though eh? What I have done in the past is when a user needs to upload a file, I give them a linked button that links to a ftp:// style address. This ftp account points to a directory that PHP can have access to. The user then drags and drops (IE only) the files on this new window, which uploads the files to this directory. Once they're done, they close the window, and hit a second button 'Click here when finished uploading' which tells php to grab all the files in the upload directory and put them where they need to go. This is far from ideal, causes miserable problems when more than one person is using the technique at once, and offers a host of security and usability issues. Oh, and it's IE only, Firefox can't do this, and I don't think opera/safari can either. However, it's much better than uploading a ton of files individually using a form. I only use this for applications where I can be sure that only one user will use it at once, and they're trusted. In a pinch it works though. I don't care so much about drag and drop, I was just trying to solve the multi-file upload issue. I wish there was a better way. If I'm stupid and there is, I'd love to hear about it. -Micah On Friday 18 November 2005 5:42 pm, Chris Payne wrote: HI there everyone, I have a file upload system where you select via requester the file to upload, it then uploads it with PHP and stores the info in a MySQL database. Is there an interface / programming method I can use which I can DRAG a file from the desktop into an area in a form just as if I had used a file requester to select a file? Learning a new programming technique is no problem as long as it can be used with PHP and MYSQL. Any helps / pointers would be REALLY welcome. Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] compiling php to use imagettftext
been fighting this for a while but can find no definitave docs that say how exactly and with what options are needed to enable this.. Here is what Im using for my config ./configure -v --with-oci8=/apps/oracle --with-apxs=/local/apache-1333/bin/apxs --with-gd=/local/stuff --with-mysql=/local/stuff --with-curl --with-imap=/local/jason/imap-2002d --with-config-file-path=/local/apache/libexec --enable-bcmath --enable-calendar --with-zlib --with-dom --with-db4=/local/stuff --with-dba --with-gettext --with-iconv --with-mcrypt=/local/stuff --with-openssl=/local/stuff --with-mcal=/local/jason/libmcal --with-curl=/local/stuff --with-jpeg-dir=/local/stuff --with-png-dir=/local/stuff --with-ldap=/local/stuff --enable-gd-native-ttf --with-ttf=/local/stuff --with-xpm-dir=/local/stuff/X11 and im using freetype-2.1.10 gd-2.0.33 but cannot get it working.. Heres what the libphp.so looks like [EMAIL PROTECTED] ldd libphp4.so libcrypt_i.so.1 = /usr/lib/libcrypt_i.so.1 libmcal.so =/local/jason/libmcal/libmcal.so libmysqlclient.so.10 = /local/stuff/lib/mysql/libmysqlclient.so.10 libmcrypt.so.4 =/local/stuff/lib/libmcrypt.so.4 libltdl.so.3 = /local/stuff/lib/libltdl.so.3 libldap-2.3.so.0 = /local/stuff/lib/libldap-2.3.so.0 liblber-2.3.so.0 = /local/stuff/lib/liblber-2.3.so.0 libpam.so.1 = /usr/lib/libpam.so.1 libintl.so.1 = /usr/lib/libintl.so.1 libgd.so.2 =/local/stuff/lib/libgd.so.2 libX11.so.4 = /usr/lib/libX11.so.4 libXpm.so.4.11 =/local/stuff/X11/lib/libXpm.so.4.11 libpng.so.3 = /local/stuff/lib/libpng.so.3 libz.so = /local/stuff/lib/libz.so libjpeg.so.62 = /local/stuff/lib/libjpeg.so.62 libdb-4.3.so = /local/stuff/lib/libdb-4.3.so libssl.so.0.9.7 = /local/stuff/lib/libssl.so.0.9.7 libcrypto.so.0.9.7 =/local/stuff/lib/libcrypto.so.0.9.7 libresolv.so.2 =/usr/lib/libresolv.so.2 libm.so.1 = /usr/lib/libm.so.1 libdl.so.1 =/usr/lib/libdl.so.1 libnsl.so.1 = /usr/lib/libnsl.so.1 libsocket.so.1 =/usr/lib/libsocket.so.1 libcurl.so.3 = /local/stuff/lib/libcurl.so.3 libxml2.so.2 = /usr/lib/libxml2.so.2 libgen.so.1 = /usr/lib/libgen.so.1 libsched.so.1 = /usr/lib/libsched.so.1 libclntsh.so.8.0 = /apps/oracle/lib/libclntsh.so.8.0 libc.so.1 = /usr/lib/libc.so.1 libz.so.1 = /usr/lib/libz.so.1 /opt/local/gcc/3.4.2/lib/libgcc_s.so.1 libcmd.so.1 = /usr/lib/libcmd.so.1 libfreetype.so.6 = /local/stuff/lib/libfreetype.so.6 libpng12.so.0 = /local/stuff/lib/libpng12.so.0 libXext.so.0 = /usr/openwin/lib/libXext.so.0 librt.so.1 =/usr/lib/librt.so.1 libmp.so.2 =/usr/lib/libmp.so.2 libpthread.so.1 = /usr/lib/libpthread.so.1 libwtc8.so =/apps/oracle-8.1.7/lib/libwtc8.so libaio.so.1 = /usr/lib/libaio.so.1 /usr/platform/SUNW,UltraAX-e2/lib/libc_psr.so.1 libthread.so.1 =/usr/lib/libthread.so.1 but looking at the PHPinfo page, under GD section, it says GD Support enabled GD Version 2.0 or higher GIF Read Supportenabled GIF Create Support enabled JPG Support enabled PNG Support enabled WBMP Supportenabled shouldnt it say something about freetype being enabled if done right? Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] compiling php to use imagettftext
seems like as soon as I post to the list, I end up figgereing it out.. anyway, heres what ended up working. ./configure -v --with-oci8=/apps/oracle --with-apxs=/local/apache-1333/bin/apxs --with-gd=/local/stuff --with-mysql=/local/stuff --with-curl --with-imap=/local/jason/imap-2002d --with-config-file-path=/local/apache/libexec --enable-bcmath --enable-calendar --with-zlib --with-dom --with-db4=/local/stuff --with-dba --with-gettext --with-iconv --with-mcrypt=/local/stuff --with-openssl=/local/stuff --with-mcal=/local/jason/libmcal --with-curl=/local/stuff --with-jpeg-dir=/local/stuff --with-png-dir=/local/stuff --with-ldap=/local/stuff --enable-gd-native-ttf --with-ttf --with-xpm-dir=/local/stuff/X11 --with-freetype-dir=/local/stuff Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if statement help
I am trying to determine if it is worth my time to attempt a if statement similar to the following. I am asking because I have not found any references to something like this: if( ( !empty( $var1 ) ) || ( if( !empty( $var2 ) ) ( !empty( $var3 ) ) ) || ( $var1 == something ) ) { // do something fancy } -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Using PHP for accsess control, preventing access to static files
I'm designing a controlled access system in PHP, and it's coming along quite well. It's very simple, and just sets a session varibale, such as $_SESSION['authenticated'] = 1, not a whole lot. Now I run a small sniplet of code on the top of each HTML and PHP file, which checks for this variable, and either allows or denys access to the page. However, how do people protect against the downloading of real files, ones which are not parsed by PHP? .WMV, .MOV, .ZIP, .EXE and so on? I want to protect access to these as well, and if a visitor just types in a URL and is able to access the file because my access control mechanism simply doesn't work on those types of files, what should be the solution here? It's been suggested to use readfile() to accomplish this, by forwarding content from outside of the document root - but this just sounds odd. On top of being (what I think would be) incredibly slow, it just doesn't sound right. I had a similar issue. I ended up using a .htaccess so that you could not open the file directly. If checked for the referrer. This is not the most secure way to do it. I know it can be spoofed. IndexIgnore * SetEnvIfNoCase Referer ^http://example.com/viewer.php; local_ref=1 Order Allow,Deny Allow from env=local_ref Jason Motes php at imotes.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] regex and global vars problem
I am having a problem with a couple of function I have written to check for a type of string, attempt to fix it and pass it back to the main function. Any help is appreciated. ?php /* * ex. 00:AA:11:BB:22:CC */ function chk_mac( $mac ) { if( ( eregi( ^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$, $mac ) ) || ( !eregi( ^[0-9a-fA-F]$, $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC do replacements if necessary */ function fix_mac( $mac ) { global $mac; if( eregi( ^[0-9A-Fa-f-\:]$, $mac ) ) { $mac1 = $mac; echo MAC: $mac1br; } /* strip the dash replace with a colon */ if( eregi( ^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$, $mac ) ) { $mac1 = preg_replace( /\-/, :, $mac ); echo MAC: $mac1br; } /* add a colon for every two characters */ if( eregi( ^[0-9A-Fa-f]{12}$, $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac_1, $mac_2, $mac_3, $mac_4, $mac_5, $mac_6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac1 = $mac_1 . : . $mac_2 . : . $mac_3 . : . $mac_4 . : . $mac_5 . : . $mac_6; echo MAC: $mac1br; } return $mac1; } // do our checks to make sure we are using these damn things right $mac1 = 00aa11bb22cc; $mac2 = 00-aa-11-bb-22-cc; $mac3 = 00:aa:11:bb:22:cc; $mac4 = zz:00:11:22:ff:xx; if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . converted to . $mac . br; } else { echo $mac1 is valid.br; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . converted to . $mac . br; } else { echo $mac2 is valid.br; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . converted to . $mac . br; } else { echo $mac3 is valid.br; } if( chk_mac( $mac4 ) != 0 ) { $mac = fix_mac( $mac4 ); echo $mac4 . converted to . $mac . br; } else { echo $mac4 is valid.br; } ? -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a : separating every two characters it then passes the var to the fix_mac() function which attempts to fix the string or h/w address by either replacing any - with a : or to break the h/w address up and insert a : every two characters. I also believe this is the one you should be playing with as the last post I added a new regex which wasn't working. Any help is appreciated. ?php /* * function to check validity of MAC address for the ISC DHCPD daemon * ex. 00:AA:11:BB:22:CC */ function chk_mac( $mac ) { if( ( eregi( ^[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}\:[0-9A-Fa-f]{2}$, $mac ) ) { return 0; } else { return 1; } } /* * check validity of MAC do replacements if necessary */ function fix_mac( $mac ) { global $mac; if( eregi( ^[0-9A-Fa-f-\:]$, $mac ) ) { $mac1 = $mac; echo MAC: $mac1br; } /* strip the dash replace with a colon */ if( eregi( ^[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}\-[0-9A-Fa-f]{2}$, $mac ) ) { $mac1 = preg_replace( /\-/, :, $mac ); echo MAC: $mac1br; } /* add a colon for every two characters */ if( eregi( ^[0-9A-Fa-f]{12}$, $mac ) ) { /* split up the MAC and assign new var names */ @list( $mac_1, $mac_2, $mac_3, $mac_4, $mac_5, $mac_6 ) = @str_split( $mac, 2 ); /* put it back together with the required colons */ $mac1 = $mac_1 . : . $mac_2 . : . $mac_3 . : . $mac_4 . : . $mac_5 . : . $mac_6; echo MAC: $mac1br; } return $mac1; } // do our checks to make sure we are using these damn things right $mac1 = 00aa11bb22cc; $mac2 = 00-aa-11-bb-22-cc; $mac3 = 00:aa:11:bb:22:cc; $mac4 = zz:00:11:22:ff:xx; if( chk_mac( $mac1 ) != 0 ) { $mac = fix_mac( $mac1 ); echo $mac1 . converted to . $mac . br; } else { echo $mac1 is valid.br; } if( chk_mac( $mac2 ) != 0 ) { $mac = fix_mac( $mac2 ); echo $mac2 . converted to . $mac . br; } else { echo $mac2 is valid.br; } if( chk_mac( $mac3 ) != 0 ) { $mac = fix_mac( $mac3 ); echo $mac3 . converted to . $mac . br; } else { echo $mac3 is valid.br; } if( chk_mac( $mac4 ) != 0 ) { $mac = fix_mac( $mac4 ); echo $mac4 . converted to . $mac . br; } else { echo $mac4 is valid.br; } ? Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 11:15 -0600, Jason Gerfen wrote: I am having a problem with a couple of function I have written to check for a type of string, attempt to fix it and pass it back to the main function. Any help is appreciated. [snip] Would you mind telling us what the problem was? -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] regex and global vars problem
The code I just showed you is supposed to do the following, the chk_mac() returns a true or false on the vars $mac1, $mac2 and $mac3. $mac3 is the only var that should not be thrown into the fix_mac() function which is working correctly. The problem is when $mac1 and $mac2 get put into the fix_mac() function nothing is being returned. I am not recieving any error codes, just an empty var. Sample output: 00aa11bb22cc converted to 00-aa-11-bb-22-cc converted to 00:aa:11:bb:22:cc is valid. As you can see $mac3 is a valid example of a h/w address where $mac1 $mac2 were returned from the fix_mac() function as an empty string. Jasper Bryant-Greene wrote: On Wed, 2005-10-26 at 12:07 -0600, Jason Gerfen wrote: Um I did actually, but I will re-interate the problem with more detail. the vars $mac1, $mac2, $mac3 are to get passed to the chk_mac() function which determines if it is a valid hex representation of a h/w address, if it does not meet the criteria of having a : separating every two characters it then passes the var to the fix_mac() function which attempts to fix the string or h/w address by either replacing any - with a : or to break the h/w address up and insert a : every two characters. I also believe this is the one you should be playing with as the last post I added a new regex which wasn't working. OK, you've told us what your code does. Now can you explain what the problem is? A new regex which wasn't working is a bit vague. * Does it throw an error? - If so, can we have the error message? * Does it mark invalid strings as valid? - Or vice versa? Just posting a pile of code with an explanation of what it does and leaving the rest of us to figure out what the problem is, is not helping us to help you. -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] str_split() and errors?
I am recieving this error in the logs when attempting to split strings with str_split(). I am not sure but isn't this a default function for PHP, as in there aren't any dependant packages involved during the ./confgure time? Errors: PHP Fatal error: Call to undefined function: str_split() in file.php on line 21 -- Jason Gerfen My girlfriend threated to leave me if I went boarding... I will miss her. ~ DIATRIBE aka FBITKK -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Using .htaccess files with PHP CGI
I am using PHP5 as a CGI and I can't seem to figure out how to set INI values through httpd.conf or .htaccess files. Since PHP isn't built as a module, the php_admin_value and php_value directives don't exist. If I had a module version of PHP along side the CGI, this would not help because as far as I know Apache won't parse those php directives and pass them to the CGI instance. I know I can call the CGI binary using a Handler and pass var=value arguments using the '-d' flag, but I want to be able to set them differently per Virtual Host. Specifically, I want to set 'session.save_path' for each virtual host to a directory other than the one set in php.ini that only apache can read/write to since my suexec'd php cgi binary can only write session data to a directory owned by the virtual host user. How can this be done? Any help would be appreciated, thanks. -Jason Kovacs
[PHP] PHP5+FastCGI Segmentation Fault
Hello, I have Apache 2, PHP5 (cgi-fcgi), FastCGI, and Suexec on FC4 64-bit, and it works for the most part, but some 3rd-party PHP software written for PHP4 will break and in my error_log I've seen the message: FastCGI: (dynamic) server /.../php-fcgi terminated due to uncaught signal '11' (Segmentation fault), causing it to flood the error_log with messages that it could not remain running for 30 sec and its restart was backed off to 600 seconds, then reports an Internal Server Error. Is this normal or expected from some PHP scripts, or is there a misconfiguration in my setup? How do I troubleshoot this? Any help would be appreciated, thanks. -Jason Kovacs
RE: [PHP] fckeditor and PDF and pesky users
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Monday, October 17, 2005 5:11 PM To: Torgny Bjers Cc: php-general@lists.php.net Subject: Re: [PHP] fckeditor and PDF and pesky users On Mon, October 17, 2005 3:56 pm, Torgny Bjers wrote: Also, when using iframe/ you are weeding out those old browsers that If somebody else wants to weed out old browsers, that's all fine and good, but that's not me... Besides, if this is for an editor interface, for a specific client, one could reasonably demand that they use at least one of the newer browsers such as IE5+ or Mozilla. If not for a specific client, or subset of clients, but for a general update of an entire application that is open sourced, I agree with Jasper, don't touch it. :) I personally don't think I should demand editors use a specific browser. I believe in customer choice. For that matter, *I* probably don't use a browser that does this right, being as I'm usually on Linux, almost always on Netscape, and very very very rarely do PDF and/or Flash work really right for me. And you know what? I very very very seldom care badly enough about any of the content I'm missing and when I do care enough to go get it, I'm disappointed by the content more often than I'm pleased that I took that effort. Again, this is obviously MY weird world-view at work here. :-) -- 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 Not that you'd want to use a deprecated tag, but using an embed tag with a src value pointing to a PDF file (with appropriate height/width) will render the entire Adobe plugin with toolbars and all directly in the page, as demonstrated here: http://www.cstv.com/auto_pdf/p_hotos/s_chools/osu/sports/m-footbl/auto_pdf/w eekly-release Jason Karns -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fckeditor and PDF and pesky users
Richard Lynch said the following on Monday, October 17, 2005 3:30 PM: On Fri, October 14, 2005 6:03 pm, Jason Kovacs wrote: Richard Lynch said the following on Friday, October 14, 2005 3:39 PM: I added a custom drop-down menu to FCKEditor's Link window that fills in the URL upon selecting the menu item, but this url consisted of just a path to a redirect.php script where I set a GET variable to the ID of the document, then passing through the PDF or DOC data. Though you could link the full path to the PDF in the URL, I just had my documents stored behind the web-accessible address. Every time a new document was uploaded, I decided to write the URL's statically to a file that the FCKEditor script (changed fck_link.html to fck_link.php) will read into Javascript arrays, as opposed to accessing the DB every time this Link window was viewed. I added about 50 lines of Javascript code to fck_link.php to do what I wanted in setting the URL from the Select list. Sweet! I must warn you though, every time that I upgrade FCKEditor, I have to reapply the changes I've done and there is the possibility that the FCKEditor scripts may change to cause compatibility problems. Let me know if you are interested in this route and I can post my alterations to FCKEditor, Please do! but the PDF file management is up to you. Oh yeah. That's for sure. I've had many non-technical users working with this utility just fine for about 6 months, so it works and though its not the most graceful implementation from a developer's standpoint, it makes the user interface easiest to work with. It certainly sounds like a very good solution. Be really nifty if fckEditor folks took a look at it and considered adding it as a feature. We can't be the only ones needing this kind of thing. Here's my changes to FCKEditor, and it works on version 2.0 RC3, but should work for other later versions too unless drastic changes have been made by it's developers to the affected scripts. I tried to clean it up for you as much as possible and took out my customizations using doc ID's and broadened it to use string URL's, which you'll need to write along with the doc entry's Title to a static JS file that gets read by FCKEditor (using php). The code also handles grouping uploaded documents into 1-level-deep groups, so this is something you'll have to keep track of in your upload utility. If that's not something you need or can easily figure out, just take out the JS code that deals with Option Groups and flatten the document data array. FCKEditor Customization Notes for linking Documents --- By Jason Kovacs - 2005-05-04 1. Install the FCKeditor utility to /path/to/public_html/js/FCKeditor/. 2. The directory /path/to/public_html/js/data/ must be created and have permissions of 777. 3. Set up the Document Upload utility to write static data to the file /path/to/public_html/js/data/fck_link_docdata.js with the following structure: --- var documentGroups = [Group 1,Group 2]; var documentData = [ [ [Doc Title 1,URL], [Doc Title 2,URL] ], [ [Doc Title 1,URL], [Doc Title 2,URL] ] ]; --- 4. Rename ./js/FCKeditor/editor/dialog/fck_link.html to fck_link.php and Edit it to have these changes: 4a. Below meta name=robots content=noindex, nofollow /, insert: SCRIPT Language=JavaScript!-- ? @readfile(/path/to/public_html/js/data/fck_link_docdata.js); ? //--/SCRIPT 4b. Insert the following two Table rows above the tr for Protocol: tr td nowrap=nowrap colspan=3 span fckLang=DlgLnkDocumentDocuments/spanbr / select style=WIDTH: 100% id=cmbLinkDocument onchange=SetDocumentUrl(this.value); option value=0Select a Document File/option /select /td /tr 5. Edit ./js/FCKeditor/editor/dialog/fck_link/fck_link.html to have these changes: 5a. Add these lines after LoadSelection() ; in the window.onload function() call: // Load the Documents select menu with optgroups/options from the included data arrays. LoadDocumentData() ; 5b. Before the SetLinkType function, add the following: function LoadDocumentData() { var sUrl = GetE('txtUrl').value; var docSelectObj = GetE('cmbLinkDocument'); for(var i=0; i documentGroups.length; i++) { optGroup = document.createElement('optgroup'); optGroup.label = documentGroups[i]; docSelectObj.appendChild(optGroup); for(var j=0; j documentData[i].length; j++) { var objOption = document.createElement(option); objOption.innerHTML = documentData[i][j][0]; objOption.value = documentData[i][j][1]; if(objOption.value == sUrl) objOption.selected = true; optGroup.appendChild(objOption); } } } 5c. Change the line in the function SetLinkType from: window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; To the line: window.parent.SetTabVisibility( 'Advanced' , false ) ; 5d. Change the line in the function
Re: [PHP] fckeditor and PDF and pesky users
Richard Lynch said the following on Friday, October 14, 2005 3:39 PM: So... Do I: A) Attempt to hack fckEditor to allow a PDF to get uploaded, and then display a link to the PDF instead of alink to the fckEditor output. B) Give them a separate, possibly confusing, input to upload files to tie in as links to the fckEditor area I've had success with this, creating a seperate utility to upload documents to the filesystem and keeping track of them in mysql. I chose to allow displaying the PDF's and Doc's through links in the FCKEditor content, because I have never found a way to embed the PDF data into pages. I added a custom drop-down menu to FCKEditor's Link window that fills in the URL upon selecting the menu item, but this url consisted of just a path to a redirect.php script where I set a GET variable to the ID of the document, then passing through the PDF or DOC data. Though you could link the full path to the PDF in the URL, I just had my documents stored behind the web-accessible address. Every time a new document was uploaded, I decided to write the URL's statically to a file that the FCKEditor script (changed fck_link.html to fck_link.php) will read into Javascript arrays, as opposed to accessing the DB every time this Link window was viewed. I added about 50 lines of Javascript code to fck_link.php to do what I wanted in setting the URL from the Select list. I must warn you though, every time that I upgrade FCKEditor, I have to reapply the changes I've done and there is the possibility that the FCKEditor scripts may change to cause compatibility problems. Let me know if you are interested in this route and I can post my alterations to FCKEditor, but the PDF file management is up to you. I've had many non-technical users working with this utility just fine for about 6 months, so it works and though its not the most graceful implementation from a developer's standpoint, it makes the user interface easiest to work with. -Jason Kovacs -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem w/ Hidden Input Fields
I have a input type=hidden field with a value 86 characters long. Here is the entire form: form name=frmWizard id=frmWizard method=post action= table tr tdinput type=radio name=radioKey value=2 checked=checked /Rootsweb input type=hidden name=txtKeyValue id=txtKeyValue maxlength=90 value=ABQIh2cCTTmAE6T4OXjecIFe5BQMxb4e6BwgeSB7cBu9SbVQSak6ARTgAPoctbx36BXXgbYZONZls0B1LQ / /td /tr tr tdinput type=radio name=radioKey value=2 /Other Site: input type=text name=txtKeyValue id=txtKeyOther //td /tr tr td class=center input type=button name=btnGenTemplate id=btnGenTemplate value=Generate HTML onclick=setWizardAction('genHTML.php') / /td tr td class=center input type=button name=btnPrev id=btnPrev value=lt;-- Prev disabled=true / input type=button name=btnNext id=btnNext value=Next --gt; onclick=setWizardAction('mmwizard1.php')/ input type=button name=btnFinish id=btnFinish value = Finish / /td /tr /table /form However, when I submit and do a print_r($_POST), there is no value for $_POST['txtKeyValue']. Note: the setWizardAction() function sets the form action= attribute so the Prev/Next buttons work correctly. The application is very close to being complete, so I need help ASAP. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Patch for Suexec for Virtual Hosts to use PHP with FastCGI
comments on my method, and if it's generally correct and others are interested in using it, I can post my changes to suexec.c. Thanks, Jason Kovacs
[PHP] FTPS transfers
Hello List, I'm having some issues with PHP's FTPS support. I'm using ftp_ssl_connect() to establish a connection (which is successful), however I am unable to retrieve a directory listing or upload files. Does anyone have advice for getting this to work? The uploaded file is created with a filesize of zero. My code looks something like this: $conn = ftp_ssl_connect($FTP['host']); $result = ftp_login($conn, $FTP['user'], $FTP['pass']); $file = 'test.txt'; $fp = fopen($file, 'r'); ftp_fput($conn, $file, $fp, FTP_ASCII) fclose($fp); ftp_close($conn); Thanks, Jason
Re: [PHP] FTPS transfers
On 9/26/05, Jim Moseby [EMAIL PROTECTED] wrote: Try adding ftp_pasv ( $conn, true ); JM Jim, That did the trick! Many thanks.. Jason
Re: [PHP] trying to figure out the best/efficient way to tell whoisloggedinto a site..
On 9/14/05, bruce [EMAIL PROTECTED] wrote: ben... i understand what you've stated, but i was under the impression that a number of sites (etrade, etc...) can/do track who is/is not logged into their sites.. and not just by some crude 'timeout' function... This might be possible to do with some client-side javascript. I think that eTrade and all of those sites are using an AJAX paradigm and so the client is periodically pushing requests onto the server (but just for the information that needs to be updated). Among other things I'm sure that users would be submitting the session ID that they have and eTrade can track if the browser session is still alive by doing this. However, all of this would be something to ask on a JS list instead of here. :-) Also remember that not all users will enable JS so you need to have backup functionality (i.e. rely on the timeout) so you will never have 100% accuracy, but the method described above will improve your accuracy (at the cost of extra HTTP connections) ... by your statements, you're pretty much saying that the only approach one has to this issue is to utilize some sort of timeout function, and if you don't detect user activity after your timeout, then mark the user as no longer being active, and proceed accordingly. this apporach doesn't allow an app to immediately know when a user has killed the browser. so, the question might be, how does one detect when a user has killed a session/left your app? The timeout method is still the main way to do it... but with the addition of the AJAX methods you can have the client machine *push* updates into your user session. Once you've determined that the client is enabling JS then it is pretty safe to assume they will keep JS enabled for the life of the browser session. So when your site stops getting pings from the client you could kill their session. All of this said... unless you're using AJAX throughout the entire sit already I wouldn't mess around with it. IMHO it takes a lot of extra coding and the added benefit for something like improved user count isn't going to offset the costs of coding and extra HTTP connections when it goes live.
Re: [PHP] trying to figure out the best/efficient way to tell who is logged into a site..
Close: You mix both of these ideas. Create a custom session handler. This handler creates user entries in a database. Then when you want to know how many are online you do a count on the number of user entries in the table. Play around with different gc_probability values to tune the efficiency. On 9/13/05, bruce [EMAIL PROTECTED] wrote: hi... anybody have pointers to trying to tell who/how long someone is logged into a system/site. i've thought about setting a session var, but i'm not sure how to read/tabulate this var across the entire group of people who'd be logged in. i've also thought about keeping track in a db tbl.. however, i'm still not sure that i've got a good way of tracking who's logged in, and still on... a possible approach would be to have the app periodically update the system whenever a logged in user goes from page to page... so, any thoughts/ideas/etc... -thanks bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Books / tutorials on Object Oriented Programming with PHP
On 9/9/05, Vinayakam Murugan [EMAIL PROTECTED] wrote: I am learning about Object Oriented Programming with PHP. Can you suggest any good books / tutorials? Greetings, I HIGHLY recommend PHP 5 Objects, Patterns, and Practice by Matt Zandstra [http://www.apress.com/book/bookDisplay.html?bID=358]. This was one of the best PHP books I have read and I suspect it is exactly what you are looking for. Yours, Jason Coffin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Class
I would have guessed unset($sqk); to work, but also try $sdk = null; Jason On 9/7/05, Ian Barnes [EMAIL PROTECTED] wrote: Hi, I am writing a site where I need to access multiple classes of the same name located under certain directories. The reason for each directory is because the class under that directory talks only to the files in that directory and cant do multiple (its not my software) I have it so that I choose which ones I want to post to via checkboxes. I then do a foreach loop and here it is: foreach ( $forums as $num=$val ) { $db = new db ( 'localhost' , 'user' , 'pass' , 'db' ); $sql = 'SELECT * FROM table WHERE id = '.$val.''; $result = $db-get($sql); $fetchd = mysql_fetch_array ( $result ); $forumid = $fetchd['forumid']; $posterid = $fetchd['posterid']; $title = $_POST['title']; $desc = $_POST['desc']; $post = $_POST['post']; require_once ( $fetchd['path'].'sdk/ipbsdk_class.inc.php' ); $SDK = new ipbsdk; $info = $SDK - get_info ( $posterid ); $postername = $info['name']; echo Forum ID:.$forumid; echo BRTitle:.$title; echo BRDesc:.$desc; echo BRPost:.$post; echo BRPosterID:.$posterid; echo BRPosterName:.$postername; echo BR; } See at the end of that foreach loop I need to unset the class $SDK so I can re-init it from another dir. How can I do this? I have tried some of the following: Unset ( $SDK); Unset ($GLOBALS['SDK'] ); Can anyone shed any light on my predicament ? Thanks in advance Cheers Ian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Assign values in foreach-loop
In case it hasnt been said already, as long as your array has numeric and consecutive keys, you could use 'for' instead of 'foreach'. Jason On 9/7/05, Gustav Wiberg [EMAIL PROTECTED] wrote: - Original Message - From: Sabine [EMAIL PROTECTED] To: PHP general php-general@lists.php.net Sent: Wednesday, September 07, 2005 7:14 PM Subject: [PHP] Assign values in foreach-loop Hello to all, is it possible to assign values to the array for which I do the foreach-loop? foreach ($_SESSION['arr1'] as $arr1) { foreach ($_SESSION['arr2'] as $arr2) { if ($arr1['id'] == $arr2['id']) { $arr1['selected'] = true; } } } I think $arr1 is only a temp-var, so the assignment won't reflect on $_SESSION['arr1'] . Is that right? Surely I can do it with a for-loop, but those arrays are a bit complex and a foreach would be much easier to read. Thanks in advance for your answers Sabine -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.10.18/91 - Release Date: 2005-09-06 Hi there! Why not set $_SESSION['arr1'] = true ? foreach ($_SESSION['arr1'] as $arr1) { foreach ($_SESSION['arr2'] as $arr2) { if ($arr1['id'] == $arr2['id']) { $_SESSION['arr1'] = true; } } } I think $arr1 is only a temp-var, so the assignment won't reflect on $_SESSION['arr1'] . Is that right? I might add that is not always a good thing to use true or false with sessions. Use 1 and 0 instead. (or two diffrent numbers or anything else but true or false) /G http://www.varupiraten.se/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Scope
I prefer to make the object on each page load, passing only the member id thru the session. Jason On 9/6/05, Chuck Brockman [EMAIL PROTECTED] wrote: What is the best practice for calling objects that are to be used throughout a users site visit. For example, I have a members class with two classes that extend this class. Is it best to instantiate the object in the $_Session scope or make individual calls to the class/object. For example: class members { var $iMemberID; var $iProfileID; var $dbServer; var $dbUser; var $dbPassword; var $dbDSN; var $_dbServer; var $_dbUser; var $_dbPassword; var $_dbDSN; function members($dbServer, $dbUser, $dbPassword, $dbDSN){ $this-_dbServer = $dbServer; $this-_dbUser = $dbUser; $this-_dbPassword = $dbPassword; $this-_dbDSN = $dbDSN; } } I have created a _global.php file that instantiates the object such as: if(!isset($_SESSION[objMember])){ $_SESSION[objMember] = new members($aSiteSettings[sDBServer], $aSiteSettings[sDBLogin], $aSiteSettings[sDBPassword], $aSiteSettings[sDSN]); } Or am I way off base altogether (wouldn't be too suprises)? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Apache Linux question
If you compiled it, you can goto the src directory, and log under config.log Jason On 9/6/05, Georgi Ivanov [EMAIL PROTECTED] wrote: It is no clear which option you are looking for. If it's PHP compile options use : ?php echo phpinfo(); ? This will give you information you need. On Tuesday 06 September 2005 16:39, Feris Thia C. wrote: Hi All, If I already install my Apache on linux system, then is it possible to check what configuration settings I provided when compiling the source ?? Regards, Feris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php 5 upgrade - undefined index errors EVERYWHERE
My server was upgraded to php 5 and now nothing runs because of undefined index errors all over the place.. How can I save myself from recoding for hours and hours ?? Thank you in advance for any help you can offer. -jason
Re: [PHP] CookieMonster
You can.. Dont include the expire argument.. or set it to 0. Jason On 9/1/05, Philip Hallstrom [EMAIL PROTECTED] wrote: Simple question I guess.. How do I set a cookie so it will never expire? (I don't want it to expire) You can't really... I could delete it and that would be the same as expiring it... Best you can do is set it to expire 100 years in the future or some such... see the manual for SetCookie() for more info... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] CookieMonster
You are right, ignore my post. Jason On 9/1/05, John Nichel [EMAIL PROTECTED] wrote: Jason Davidson wrote: You can.. Dont include the expire argument.. or set it to 0. No. Do this, and the cookie will expire when you close the browser window. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Saturdays and Sundays
Here is an another approach.. if you glance at a calendar, youll notice that the only times there are 5 sats in a month, is when the 1st of 30 day month falls on a fri or sat.. or in a 31 day month, a thur, fri, or say.. So, you could simply test the weekday the first of the month has, and the number of days in the month.. and the num of sats in the month is either 4.. or 5. :) Jason On 9/1/05, Brian P. O'Donnell [EMAIL PROTECTED] wrote: Sorry, I made a mistake. See below: Brian P. O'Donnell [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Shaun [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Is it possible to get the number of saturdays and sundays for a given month / year? Thanks for your help. Here's another way to do it. Each function will return either 4 or 5. If you need both Saturdays and Sundays, just call both functions: ? function get_saturdays($month, $year) { $sat = 4; // time stamp of noon on the first day of the month $first_day = mktime(12, 0, 0, $month, 1, $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $first_day) 3) { $sat++; } break; case 2: if ((date(L, $first_day) == 1) (date(w, $first_day) 5)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $first_day) 4) { $sat++; } break; } return($sat); } function get_sundays($month, $year) { $sun = 4; // time stamp of noon on the last day of the month The following line referenced a variable in the other function. DUH! It should be: $last_day = mktime(12, 0, 0, $month, date(t, mktime(12, 0, 0, $month, 1, $year)), $year); switch ($month) { case 1: case 3: case 5: case 7: case 8: case 10: case 12: if (date(w, $last_day) 3) { $sat++; } break; case 2: if ((date(L, $last_day) == 1) (date(w, $last_day) 1)) { $sat++; } break; case 4: case 6: case 9: case 11: if (date(w, $last_day) 2) { $sat++; } break; } return($sun); } ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ID based on position?
You could LIMIT your query to the record number you are looking for, and grab the last element in the array from your result set. But this is a serious hack, and I am really wondering why you need to do what your asking, it seems (without knowing more) that you are tackling the problem in the wrong direction, Jason On 8/31/05, Gustav Wiberg [EMAIL PROTECTED] wrote: Hi there! Is there any function in PHP that gives an ID from a MySQL-db based on which position the record has in the table? Let's say, there's a table like this: 1. Record1 ID 33 2. Record2 ID 76 3. Record3 ID 100 If I know position 2, I want to get ID 76. Is the only way to loop through the recordset? /G @varupiraten.se http://varupiraten.se -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unique user?
I'm going to agree with Jay... most users are lazy enough that if you just require them to have a user account then that will suffice. Since this is only for a joke site that would be my suggestion as well. However, if you really, really wanted to identify remote *computers* then you can try tracking the clock skew of the client which is making that request. If you're interested then google for clock skew tracking and you should get some hits. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: proxy security
The problem here is that you need an anonymous proxy server that you trust. Most of the ones you can trust aren't going to be free. However, once you've identified an anonymous proxy server which you *do* trust then you can just pipe the mails to them like any old email server would. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Custom session handling - bad or good idea?
This can be a fine way to go, given that you have a specific reason to do so that is not easily handled by using session_set_save_handler. The most common session handler in use (besides the default handler) is a DB session handler. You could write this handler in C and it would possibly be worth the effort. Caching DB connections in a shared module could give you a nice performance boost (although I have no idea how stable a setup like that would be, usual caveats about multi-threaded servers would apply). Hope this helps. On 8/18/05, GamblerZG [EMAIL PROTECTED] wrote: I'm not speaking about session_set_save_handler, I'm considering writing session handler from scratch. Is it a bad idea? If so, why? -- 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] Sessions Issue
We built a box about 7 months or so ago using the SuSE 9.1 cd's, straight install from the CDs. While I've read that sessions are turned on by default, when we try to call on the sessions functions (like with phpOpenChat or start_session()) we get calls to undefined function errors. This is leading me to belive that sessions are disabled for some reason. I need to enable the sessions so I have a few questions 1) Can I do this without recompiling? Don't know - Don't have SuSE In YaST, goto install/remove software and do a search on php. Is php4-session installed?? I am running SuSE 9.1 and sessions work fine for me. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec / shell_exec issues
On Saturday 30 July 2005 08:49, leonski wrote: sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory beats me how it gets inside the if, if it doesn't exist! I think the error message is trying to tell you that /usr/local/bin/mogrify does not exist. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] exec / shell_exec issues
On Saturday 30 July 2005 10:17, leonski wrote: Jason Wong wrote: On Saturday 30 July 2005 08:49, leonski wrote: sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! : No such file or directory sh: line 1: /usr/local/bin/mogrify /tmp/phpS1KCen -resize 95x72! : No such file or directory beats me how it gets inside the if, if it doesn't exist! I think the error message is trying to tell you that /usr/local/bin/mogrify does not exist. :-( yeah it does and it works under the terminal (nicely I might add, That error certainly does not come from mogrify. Just perform these simple tests: 1) /usr/local/bin/command-that-does-not-exist 2) mogrify file-that-does-not-exist; #assume mogrify in $PATH As Robert has pointed out, it is probably telling you that the file /usr/local/bin/mogrify /tmp/phpS1KCen -resize 320x240! does not exist. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for program/script to diff directories and show dates
On Thursday 28 July 2005 01:48, Chris W. Parker wrote: I was just expirementing with the diff command and was wondering if there was anything out there that does the same thing but with a more intuitive interface? The problem I want to avoid is a basic one. Which file did I update last week that I forgot to publish to the live site? No ncurses gui, but rsync would/could/should be better than diff. Plus it'll actually do the updates for you as well if you ask nicely. NB use the --dry-run option to see what files are affected (ie those that are different and will be transferred). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] preg_match - help please
On Thursday 28 July 2005 01:50, André Medeiros wrote: You can have four words to describe a first and last name... you can have other alphabets, like arabian, chinese, etc... inserting accented characters alone would make that a big, nasty regex, let alone predicting ways you can describe first/last names. I'm not saying that I have the _BEST_ sollution. All I'm saying is that there are sittuations that are out of your control, and it seems to me this might be the easiest way out, guaranteeing that there are at least two words. Most Chinese would enter their name (usually 3 words, sometimes 2. rarely 4) WITHOUT any spaces. Not sure what the OP was trying to do, but the best way to handle it (IMHO) is to give the user 2 input boxes, one for family name, the other for the rest of their name. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Only variable references should be returned by reference
On Tuesday 19 July 2005 23:17, Marc G. Fournier wrote: Just upgraded to 4.4.0 ... several legacy applications that we have installed now break with the above error message ... specifically, older installs of Horde, but I've seen reports of other apps ... Without reverting back to 4.3.11, is there a way I can temporarily fix this while working on the application issues themselves? :( Change the relevant setting in php.ini. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL password file
On Monday 18 July 2005 18:53, Lawrence Kennon wrote: In my current hosting situation I don't have the ability to store my file that contains MySQL userids/passwords in a subdirectory that is not under the server root. In order to protect it from being included from a foreign host I thought up this scheme of using the php_uname function to check that it is running on the correct host. Does this look reasonably secure? I am not hosting any kind of store, or terribly sensitive data - it will only be a bulletin board. If by foreign host you mean a remote (ie over the network) host then there is nothing for you to worry about (if your webserver is configured correctly -- see below). When using include() on a remote file you are only including the output of that file AFTER it has been processed by php. Thus in the case of the example below where you're only defining a bunch of constants there is no output and thus nothing to include. define ('DB_USER', 'username'); define ('DB_PASSWORD', 'password'); define ('DB_HOST', 'localhost'); define ('DB_NAME', 'dbname'); **Beware** if you're using a non-standard filename extension for your include files, eg .inc, and have not configured your webserver to process these using php then then it *is* possible to include and use these remotely. You can easily check this by entering the URL of the include file into a browser and then view source, what you see is what will be included by a foreign host. What you should be more concerned about if you're on a shared host is that there is a good possibility that your co-hosts are able to access your files anyway. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Only variable references should be returned by reference
On Wednesday 20 July 2005 07:32, Marc G. Fournier wrote: Which is? If its: Yep. ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function ; declaration. You're encouraged to try and turn this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by ; reference). allow_call_time_pass_reference = On The pass by reference thing works regardless of the above setting. Enabling the setting disables the warnings and vice-versa. It already is ... Are you sure that: 1) you're looking at the correct php.ini 2) the setting is not being changed elsewhere If the warning annoys you just tone down the error reporting level. Is there another one I should be looking at? :( Not that I'm aware of. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Session problems [SOLVED]
Well after a bit of tweaking of my script I realized it was not the code that was causing the problem. It was a php.ini setting, I run a few virtual hosts on my webserver and it turned out to be the session.referer_check was set to 0, modify this to equal session.referer_check = and it worked fine after a restart of the webserver. Hope this helps someone else. Jason wrote: I am having a problem with sessions. For some reason it keeps creating a new session for every page link you click and not using the original session created when session_start() gets called. Below is the code I am testing with. [one.php] ?php $SessionID = md5( uniqid( rand () ) ); session_start(); if( ( !session_is_registered( 'hash' ) ) || ( $_SESSION['hash'] != $_SESSION['chkhash'] ) ) { session_name( 'prostarinventory' ); session_register( 'hash' ); session_register( 'chkhash' ); session_register( 'count' ); $_SESSION['hash'] = $SessionID; $_SESSION['chkhash'] = $SessionID; $_SESSION['count'] = 1; } else { $_SESSION['count']++; } print_r( $_SESSION ); ? [/one.php] [test1.php] ?PHP include 'one.php'; print_r( $_SESSION ); ? form action=test.php method=postinput name=test type=textinput name= type=submit/form [/test1.php] [test.php] ?php include 'one.php'; echo SESSIONS: ; print_r( $_SESSION ); echo BRPOSTS: ; print_r( $_POST ); echo BRGETS: ; print_r( $_GET ); ? [/test.php] Any help is appreciated, so far I have found that if I use the include_once 'one.php'; and simply refresh the page sessions work fine, but if you call the test1.php then submit the form the session variables aren't found in the old session and a new one is being created on the server. -- Jason Gerfen Student Computing Marriott Library 801.585.9810 [EMAIL PROTECTED] In my opinion anyone interested in improving themselves should not rule out becoming pure energy. ~Jack Handley, The New Mexican, 1988. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session problems
I am having a problem with sessions. For some reason it keeps creating a new session for every page link you click and not using the original session created when session_start() gets called. Below is the code I am testing with. [one.php] ?php $SessionID = md5( uniqid( rand () ) ); session_start(); if( ( !session_is_registered( 'hash' ) ) || ( $_SESSION['hash'] != $_SESSION['chkhash'] ) ) { session_name( 'prostarinventory' ); session_register( 'hash' ); session_register( 'chkhash' ); session_register( 'count' ); $_SESSION['hash'] = $SessionID; $_SESSION['chkhash'] = $SessionID; $_SESSION['count'] = 1; } else { $_SESSION['count']++; } print_r( $_SESSION ); ? [/one.php] [test1.php] ?PHP include 'one.php'; print_r( $_SESSION ); ? form action=test.php method=postinput name=test type=textinput name= type=submit/form [/test1.php] [test.php] ?php include 'one.php'; echo SESSIONS: ; print_r( $_SESSION ); echo BRPOSTS: ; print_r( $_POST ); echo BRGETS: ; print_r( $_GET ); ? [/test.php] Any help is appreciated, so far I have found that if I use the include_once 'one.php'; and simply refresh the page sessions work fine, but if you call the test1.php then submit the form the session variables aren't found in the old session and a new one is being created on the server. -- Jason G. In my opinion anyone interested in improving themselves should not rule out becoming pure energy. ~Jack Handley, The New Mexican, 1988. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem serializing a mysqli_result object.
But why are you going to all of that trouble? What does the mysqli_result object have that you really need? If you just need the result set then you can fetch it as an assoc array and serialize that. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Security, Late Nights and Overall Paranoia
The typical way that forums handle this is to use what is called BBCode. In short, you have a non-HTML way for users to supply information that will produce markup instead of just plain text. So if you want to allow italics, bolds, URL's, etc. then you have some codes for it like: [i]This text will be in italics.[/i] [b]This text will be in bold.[/b] [url=http://php.net]This will be a URL that points to php.net.[/url] Mailing archives probably have some code that does this... or you could see what the maintainers of phpBB do under the hood. Ah, the beauty of Open Source! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Register globals and ini_set
[EMAIL PROTECTED] wrote: Hi, If i use, at the beginning of my scripts, ini_set('register_globals', 0), register globals will be turned off? Thanks ini_set() just doesn't make sense for that directive. register_globals takes the input data from HTTP requests and sets them in the symbol table before any of your PHP code gets parsed. PHP has already done the work. Doesn't seem too terribly efficient to just throw all of that away on every script invocation, now does it? But what you *can* do, is to ini_get('register_globals') and have your script act accordingly. You could for example extract() your $_GET and $_POST variables. http://php.net/manual/en/function.extract.php -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register globals and ini_set
Since you mention the PHP version was old (4.1) then I have to ask: were you using the $_SESSION array all along or were you using session_register to register session variables? Although you probably aren't since that would be rather easy to debug. The script in which your global_variable was set makes absolutely no difference. PHP is just looking for the SID someplace anyways (whether that's COOKIE, GET or POST) and then it goes and retrieves that session that matches that SID. OK... when you say that it fails sporadically, what do you mean exactly? Probably, based on what you've just said, you're somehow assigning into your $_SESSION variables through the use of global variables that have the same name as your $_SESSION indexes. http://php.net/manual/en/ref.session.php#ini.session.bug-compat-42 -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: iPowerWeb ISP Are they good?
Thanks guys, getting some great recommendations... From what I hear, I wont be using IpowerWeb, some people had nothing but good to say, but I found quite a few more complaints then good. eHostPros does sound very nice, I'll look into them as well. Jason E.J. Manaigre Web Site Development Coordinator | HTML God International Institute for Sustainable Development Winnipeg, Manitoba, Canada Main Web site: http://www.iisd.org Email: mailto:[EMAIL PROTECTED] | Phone: 1.204.958.7744 -Original Message- From: Terry Romine [mailto:[EMAIL PROTECTED] Sent: July 8, 2005 8:36 AM To: php-general@lists.php.net Subject: Re: [PHP] Re: iPowerWeb ISP Are they good? I had a client hosted on Powweb and I dropped that service pretty fast. Now I host primarily on eHostPros.com (past 2-3 years). I've had a few problems, but they work pretty close with the clients to handle issues. Maybe a 90-95% satisfaction rate for me. The nice thing is their billing system; they use PayPal and can charge monthly/quarterly/yearly as the customer needs. Terry -Original Message- From: chris [EMAIL PROTECTED] Sent: Jul 7, 2005 4:51 PM To: php-general@lists.php.net Subject: [PHP] Re: iPowerWeb ISP Are they good? I have used iPowerWeb for a few years now and have only had maybe 5 min. worth out outages. Even when I had a question on a Sunday, there was someone to answer the tech phone. It did take a while but still, its all good in my book. Chris Jason Manaigre [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi everyone, currently I have a site hosted with Powweb and suffice it to say, it's not good, so I wanted to get everyone's opinion here on iPowerWeb? Or can you recommend another ISP that you swear by which has similar features http://www.ipowerweb.com/products/webhosting/index.html Thanks people. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] iPowerWeb ISP Are they good?
Hi everyone, currently I have a site hosted with Powweb and suffice it to say, it's not good, so I wanted to get everyone's opinion here on iPowerWeb? Or can you recommend another ISP that you swear by which has similar features http://www.ipowerweb.com/products/webhosting/index.html Thanks people. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with preg_replace
On Tuesday 05 July 2005 02:21, Marcos Mendonça wrote: This works fine for links with id 0, 1 and 4. But i haven´t been able to figure out how to match and replace links with id 2 and 3. Works for me. Check whether $body_html really does contain what you're looking for in id 2 id 3. You may also want to consider using preg_quote() instead of str_replace(). -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] memcached and objects.
On Sunday 03 July 2005 13:10, Rodolfo Gonzalez Gonzalez wrote: :-S ? ... I've googled to see if there's some sample code for caching adodb recordsets, without success so far. adodb already has a caching mechanism, have you tried it? Is someone aware of some class to cache Adodb recordsets in memcached?. No idea. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] postgres - mysql last_inserted_id
On Friday 01 July 2005 09:55, Richard Lynch wrote: There are innumerable on-line forums that (incorrectly) state that an OID could be returned that is not connection-specific, so two HTTP requests in parallel would criss-cross OIDs. This is patently false, and any user of PostgreSQL can demonstrate that in minutes (okay, an hour for a newbie) of coding. Someone with more time than me can go search for those above-mentioned forums and judge for themselves. However regardless of whether OIDs cross-pollination is possible or not ... OIDs *can* get re-used *IF* you end up having more than 32-bits (2 billion plus) of objects in the lifetime of your application. For normal usage, that ain't a big problem, honestly... Though I should have stated it for the record, cuz maybe the OP has a site where 2 BILLION INSERTs are gonna happen. ... 4 billion (I'm assuming the postgresql guys are smart enough to use unsigned integers) isn't really as much as it looks. Remember this is shared amongst all the tables in your database making these oids even more of a precious resource ... The solutions there are the same as for not having OID in the first place -- Have some other unique identifier you generate yourself in the INSERT, or use that *with* the OID to be 100% certain you get back the same row from your 2 billion plus data set. ... and that's exactly what sequences are for. And that's why using oids for a unique id is not a smart choice when sequences are available and were designed explicitly to provide unique ids. If there's a reliable, web-safe, connection-dependent way of getting the sequence ID used in an INSERT, it sure ain't documented, and I've never seen it discussed on the PostgreSQL list (which I dropped off awhile ago, so maybe it's something new). I have already given an example(!) Though that also limits you to 2 billion plus records per table -- The current versions of postgresql allows for 8 byte sequences which provides 1.8E19 unique ids. Now *this* will take some serious database work to cycle through all the ids. Assuming you generate a million ids per second it will take only half a million years for you to start worrying about running out of ids. But by that time I'm sure you would be more worried about the billennium bug :) If you are dealing in 2 billion object PostgreSQL databases, and you don't know all this already, you're in DEEP trouble... I think I'll be quite safe as I'm using sequences ;-) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Technology Forums
On Friday 01 July 2005 20:19, Ryan A wrote: I would rather say go screw yourself you dirty spammer than just deleting it...but thats just me. People, if you feel you *need* to respond to spam, could you please snip out the spam so that it doesn't receive more coverage than it deserves? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object Oriented PHP (5)
Richard Lynch wrote: ... Ooooh. At the risk of being branded a heretic, try to pick up another language or two. Start with something a whole lot like PHP. Maybe Perl, or even C. You'll have to shove all your PHP knowledge over to one side of your brain, cram all the new stuff into the other half of your brain, and then compare/contrast. Then, for real fun, try to learn something totally whacked-out different like Lisp, Scheme, Forth, Logo, or even (blech) COBOL. This will require even more compartmentalization in your brain-space, and some serious deep thinking on what makes a program tick. Only after you really get it in a totally different programming paradigm do you achieve that deep comprehension of Programming with a capital P. Hmmm how does declensional based programming sound? Remember back when our ParrotHeadPoster was alive and squawking and ready to flap his wings right out into the news server? Well doing some searching for text classifiers led me to this really funky, weird, unusual... twisted... programming tool. The program is called crm114. It's not ugly like Perl; it's a whole different *kind* of ugly. I still am not an expert with this program (hell, the development is finally getting to where it can use autoconf), but it fits in really well as a new / active tool that does everything different. And I mean almost everything. Everything is a regex. The default regex engine is called TRE (which supports approximate matches). The language is declensional instead of parameterized. For the most part the order that you use for your arguments just don't matter. Variables look like :*:yourvariable: Releases don't follow the typical naming convention; instead, people get blamed for releases. crm114-20050628.BlameCochrane is the new release that just came out and it is the CRM114 Galactica Buzzphrase Compliant Version. It makes use of the new hyperspatial classification... just read the manual on it, ok?!?! At least one similarity to PHP though: it makes use of a JIT compiler. In short, it's a useful and interesting utility. Not just because it can sort your spam / nonspam email with greater than 99% accuracy... but because you can adapt it to other tasks by writing your own crm filters. This is no simple task (I'm still learning how to use it!), but this is mostly because the way of doing things is just different. The whole thing is like a computer science project gone mad, but at the same time it's actually very useful for something. For those that are interested, grab the new version released today: http://crm114.sourceforge.net/ H. That came out kinda stronger than I meant it... I mean, sure, the guy who learns C, and knows only C, and codes C all day is a Programmer, and I'm not knocking that. But there's this sort of hole in a guy like that, and while it doesn't hurt them or make them less a Programmer, it's there, and it's just not the same as a guy who actually groks something as bass-ackwards (that's a compliment) as Lisp as well as they do C. Well, that got long and philosophical, didn't it? Indeed. But those are some of my favorite posts to read. :) -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] reading PDF's
Richard Lynch wrote: On Fri, June 24, 2005 12:10 pm, Jon said: Is it possible to read text from a PDF file with PHP? How? ... There may be a free one, or even an OpenSource one, but I've never heard of it, possibly because they'd have to pay a license to Adobe (Macromedia this week?) to be legal... Free (as in beer): http://sourceforge.net/projects/pdfcreator/ It's built on top of Ghostscript... which AFAIK does most of the heavy lifting. Several licensing options too. ... You don't want to get to launch and find out 90% of the real PDFs simply don't work. :-( I've been using it for about 3 months with very few problems. In fact, I can't think of any problems that I've had with the library (but I don't use it with PHP... I just know that bindings are there for you to go do it yourself). -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] postgres - mysql last_inserted_id
On Friday 01 July 2005 02:55, Uroš Kristan wrote: I have an application in production, build on mysql database. I decided to migrate to postgres because of numerous reasons. Good idea :) Can you guys please guide me into the right direction? the main problem is the missing autoincrement of pgsql and getting the last record from the tabel, for linking to another tabel. How do you deal with that? The basic idea is that you use sequences which in postgresql are the equivalent of autoincrement in mysql. Something like: INSERT INTO category (category_id, category_name, category_description) VALUES (nextval('category_id_seq'), new_category_name, new_category_description); here 'category_id_seq' is the name of the sequence that produces the unique IDs for your category_id. To use your newly created category_id in another table: INSERT INTO product (product_id, product_name, product_description, category_id) VALUES (nextval('product_id_seq'), new_product_name, new_product_description, currval('category_id_seq')); nextval() and currval() are native postgresql functions which operate on sequences. Sequences are created automatically when you define a field to be of type 'serial'. If you need get the actual value of the newly created category_id for use in php then you would have to do a select query, eg: select currval('category_id_seq') as new_category_id; and do the usual pg_query() and pg_fetch_*() to process the result also, can you please recommend me some good manual, explanation or book to help me with this problem. Lookup serial types and sequences in the (postgresql) manual for the basics. Because the application uses around 250 tables in mysql and I would like to make it righ t the first time when migrating to pgsql.. I would suggest that you start off with a 'smaller' project and explore all the ways where postgresql does things differently to and/or better than mysql, then work your way up to a more complex project. This would be much better than doing a hasty migration to postgresql - which does not make the most of what postgresql has to offer - and then trying to hack the postgresql features in afterwards. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] postgres - mysql last_inserted_id
On Friday 01 July 2005 04:06, Richard Lynch wrote: last record from the tabel, for linking to another tabel. You have to use http://php.net/pg_last_oid to get the PostgreSQL internal Object ID (OID) -- You can then use the ubiquitous oid column. $query = insert ...; pg_exec($connection, $query); $oid = pg_last_oid($connection); I'm pretty sure I read somewhere that the the last OID can get messed up under some circumstances and the OID that you get is not the OID that you want. Can't remember whether this was a php-postgresql thing or simply a postgresql thing. But whatever it is, you don't need OIDs to use sequences. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: constant() - php5
Actually, thanks for pointing out this function to me because I never even knew that it existed. You learn something new every day. I have to admit that a warning seems a little unusual given that an undefined variable would result in only an E_NOTICE. Especially since the default behavior for an undefined constant (anywhere except for this function) is an E_NOTICE. Seems like you may have found a bug to report. ?php /* Causes E_WARNING */ echo constant(UNDEFINED_CONSTANT); /* Causes E_NOTICE */ echo UNDEFINED_CONSTANT; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: constant() - php5
Marek Kilimajer wrote: Jason Barnett wrote: ... ?php /* Causes E_WARNING */ echo constant(UNDEFINED_CONSTANT); The above is wrong, use: echo constant('UNDEFINED_CONSTANT'); OK, that's a good catch. But this still causes an E_WARNING. -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] constant() - php5
Richard Davey wrote: ... Isn't the warning coming from the fact that $cnst isn't defined, rather than coming from the constant() function itself? Best regards, Richard Davey Nope... tested with PHP 5.0.5-dev ?php /* Causes E_WARNING */ echo constant('UNDEFINED_CONSTANT')\n; echo constant('UNDEFINED_CONSTANT'); /* Causes E_NOTICE */ echo UNDEFINED_CONSTANT\n; echo UNDEFINED_CONSTANT; ? -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: __PHP_Incomplete_Class
Jay Wright wrote: ... My page uses a header.php5 include file to call session_start(). Next a require_once(classloader.php5) performs the autoload. Here is the problem... you need to switch the order. Load the classes / autoloader first, then session_start(). PHP was able to serialize the object because it was properly saved in the session store, but it didn't have the class definition. I'm using php5 on windows xp (also linux). The error is here: [client 127.0.0.1] PHP Fatal error: main() [a href='function.main'function.main/a]: The script tried to execute a method or access a property of an Read the next part carefully. incomplete object. Please ensure that the class definition Gallery of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition in C:\\code\\jaysphotos\\local-apache-webapp\\web\\thumbnails.php5 on line 127, referer: http://localhost/jaysphotos/thumbnails.php5?page=p2 -- NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-generalw=2 STFM | http://php.net/manual/en/index.php STFW | http://www.google.com/search?q=php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] looking for a pure startup opportunity..
OK, let me put this another way... while trying to remain polite. Let's suppose that I am an unknown (to you) member of this list and I have this great idea that I want to develop. My idea is a great one and it's going to make millions. Now since I'm the one that had the idea I think it's pretty easy for me to go find 3 friends of mine (people that I know/trust/live close to me) that have the requisite skills. After all, it's not like most programmers go hanging out with Hollywood celebrities. ;) If I really believed that my idea was so hot then I probably wouldn't be waiting around for someone on this mailing list, I'd just get started doing it. true_story Back about two years ago I was subscribed to this newsgroup with my email address from college. Back then I was just doing what I do now... answering PHP questions while I work. Except that I answered a lot more questions then because, well, I was in school still. :) I don't remember exactly how many I answered, but you can check out the marcives if you really want. Anyhow, after doing this for about a year I apparently caught someone's attention. I received an email from insert_name_of_big-shot-venture-capitalist-here / telling me that he had capital to give me if I had an idea that I wanted to develop. I politely declined, but I told him I would get back to him if a superb idea came my way... /true_story I have always felt that getting the financing is the easy part. Besides, if your goal is to get $millions in funding then you're looking at it all wrong. The goal is to make profit... and loads of it. If it just so happens that you need a lot of funding to make that happen, then you can go get it. If you have killer idea(s), then you are better off mocking up a prototype and networking with some people that can get you financing. You always have to make a profit. You always have to make a profit. At least, if you plan on doing anything that's going to catch the attention of some VC's. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php