[PHP] AMF PHP
Hi! Did any of you guys work with AMF PHP? I have been using AMF PHP for flash remoting and I am unable to propagate cookieless sessions from my web application to flash. Any suggestions? I am using Tufat.com's AMF Flash Chat as the flash app. Regards, Yaswanth -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and Flash Remoting
Hi! I am using amfchat from tufat.com, and wanted to integrate it with my site's session data. amfchat uses flash remoting to communicate to the server. It initally sends sessionid=time() to gateway.php gateway.php starts a session using: function session($name=false){ if($name){ $prev_name = session_name(); if($prev_name != $name){ session_name($name); } } @session_start(); } And accesses the session variables in another function thats called using flash remoting. as $_SESSION['username']; I wanted to replace all this and I have made gateway.php start a session as follows: $prev_name = session_name(); session_start(); But I am not able to access my session variables in the functions using $_SESSION['login'] This is the function I have modified: $session_name = session_name(); session_start(); $username=$_SESSION['login']; $password=$_SESSION['passwd']; $result['description'] = User= $username, Password: $password, Session: $session_name When flash prints the 'result' arrary, the output for description is as follows User= , Password: , Session: PHPSESSID Can any one tell me if I am making a mistake some where or give me a solution? Regards, Yaswanth -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SQL Password() function
Hi! Is there a function (or a code snippet) in PHP for mysql password() function? I 'dont' want to use something like select * from table where table.passwd=password($passwd); Is there any other alternate way to do it? Regards, Yaswanth -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there a way to determine wich browser a visitor uses in php?
Dirty Code if((ereg(Nav, getenv(HTTP_USER_AGENT))) || (ereg(Gold, getenv(HTTP_USER_AGENT))) || (ereg(X11, getenv(HTTP_USER_AGENT))) || (ereg(Mozilla, getenv( HTTP_USER_AGENT))) || (ereg(Netscape, getenv(HTTP_USER_AGENT))) AND (!ereg(MSIE, getenv(HTTP_USER_AGENT $c_browser = Netscape; elseif(ereg(MSIE, getenv(HTTP_USER_AGENT))) $c_browser = MSIE; elseif(ereg(Lynx, getenv(HTTP_USER_AGENT))) $c_browser = Lynx; elseif(ereg(Opera, getenv(HTTP_USER_AGENT))) $c_browser = Opera; elseif(ereg(WebTV, getenv(HTTP_USER_AGENT))) $c_browser = WebTV; elseif(ereg(Konqueror, getenv(HTTP_USER_AGENT))) $c_browser = Konqueror; elseif((eregi(bot, getenv(HTTP_USER_AGENT))) || (ereg(Google, getenv(HTTP_USER_AGENT))) || (ereg(Slurp, getenv(HTTP_USER_AGENT))) || (ereg(Scooter, getenv(HTTP_USER_AGENT))) || (eregi(Spider, getenv(HTTP_USER_AGENT))) || (eregi(Infoseek, getenv(HTTP_USER_AGENT $c_browser = Bot; else $c_browser = Other; On 11/23/05, Frank Armitage [EMAIL PROTECTED] wrote: twistednetadmin wrote: Thanks guys. That helps alot! But this: ?php print $_SERVER['HTTP_USER_AGENT']; ? Returned this using Mozilla: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 And this using IE: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) Does that just mean that it's not completely accurate? Try get_browser() http://php.net/manual/en/function.get-browser.php HTH Frank -- tradeOver | http://www.tradeover.net ready to become the King of the World? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Server Client Architecture, best parctice
Hi! I would like to know what does the community think of the best architecture for server client communication and why? That is, if there is a server in C++ (say a game server) and the PHP has to 'read' data 'from' the server then what is the best form of communication? a) Shared Memory : Server opens the shared memory in write and the PHP scripts open it in read and gets the data b) TMPFS (just like shared memory): Server opens a file in tmpfs in write and PHP in read c) Databases: Server Updates a table in the DB and client reads from the table d) Files: Same as TMPFS Regards, Yaswanth -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shared Memory Problem
Hi Curt, These are my open shared memories in the server output of ipcs command. -- Shared Memory Segments keyshmid owner perms bytes nattch status 0x 18645001 gOLeM 600393216 2 dest 0x162e 18808842 root 66630 1 The last one the the sharedmem the php will be using. the key is 5678 and as you said I have modified my code to $shm_id = shmop_open(intval($shm_key), a,666,0) or die(FATAL ERROR:: $php_errormsg); U obtain the shm_key from a file. The key I am using is 5678 and it is getting that value from the file. I even hardcoded the value, but the error is not getting solved. Is this a proble with any of the server configs? Coz we have downloaded an example C file and this is also not working with the PHP. Where as if the server and client both written in C are able to communicate using the shared memory. Any clue any one?? Ok...just a crazy query...does it have anything to do with Notice: import_request_variables(): No prefix specified - possible security hazard in which occurs due to register_globals set to Off?? On 11/16/05, Curt Zirzow [EMAIL PROTECTED] wrote: On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote: Hi! I have a server written in C++ and my webpages are in PHP. The PHP has to communicate with the server using shared memory. This was working fine on the server running FC-1 with php-4.3.8. We recently migrated to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it displays is as follows: shmop_open(): unable to attach or create shared memory segment in /var/www/html/sharedmem.php on line 2 The server opens the shm in 666 (originally was 644) even then it was not working. I can see the shared mem open using 'ipcs' command. ... $shm_id = shmop_open($shm_key, a,0,0) or die(FATAL ERROR:: Unable to Access Shared Memory); You might want to try to open it within the same mode that the server created it in: 1) $shm_id = shmop_open($shm_key, a,0666,0); 2) are you 100% sure the key is valid? the error message you are getting seems to point in this direction since the shmop_open is failing on the C call to shmget(), wich usually fails when either you dont have enough memory to create it (which you arn't doing), some other creation problems, or that the key supplied wasn't found. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shared Memory Problem
Hi! There is a strange problem now. This is the error message my php file gives. kernel not configured for shared memory kernel not configured for semaphores kernel not configured for message queues The source is as follows: ?php $shm_id = shmop_open(5678, a, 0, 0); if (!$shm_id) { echo Couldn't create shared memory segment\n : $php_errormsg; } print br; print system(ipcs); ? when I logged into my machine as user apache and tried ipcs command it was working fine (I changed the shell of apache from /sbin/nologin to /bin/bash) Any clue?? Regards, Yaswanth On 11/16/05, Yaswanth Narvaneni [EMAIL PROTECTED] wrote: Hi Curt, These are my open shared memories in the server output of ipcs command. -- Shared Memory Segments keyshmid owner perms bytes nattch status 0x 18645001 gOLeM 600393216 2 dest 0x162e 18808842 root 66630 1 The last one the the sharedmem the php will be using. the key is 5678 and as you said I have modified my code to $shm_id = shmop_open(intval($shm_key), a,666,0) or die(FATAL ERROR:: $php_errormsg); U obtain the shm_key from a file. The key I am using is 5678 and it is getting that value from the file. I even hardcoded the value, but the error is not getting solved. Is this a proble with any of the server configs? Coz we have downloaded an example C file and this is also not working with the PHP. Where as if the server and client both written in C are able to communicate using the shared memory. Any clue any one?? Ok...just a crazy query...does it have anything to do with Notice: import_request_variables(): No prefix specified - possible security hazard in which occurs due to register_globals set to Off?? On 11/16/05, Curt Zirzow [EMAIL PROTECTED] wrote: On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote: Hi! I have a server written in C++ and my webpages are in PHP. The PHP has to communicate with the server using shared memory. This was working fine on the server running FC-1 with php-4.3.8. We recently migrated to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it displays is as follows: shmop_open(): unable to attach or create shared memory segment in /var/www/html/sharedmem.php on line 2 The server opens the shm in 666 (originally was 644) even then it was not working. I can see the shared mem open using 'ipcs' command. ... $shm_id = shmop_open($shm_key, a,0,0) or die(FATAL ERROR:: Unable to Access Shared Memory); You might want to try to open it within the same mode that the server created it in: 1) $shm_id = shmop_open($shm_key, a,0666,0); 2) are you 100% sure the key is valid? the error message you are getting seems to point in this direction since the shmop_open is failing on the C call to shmget(), wich usually fails when either you dont have enough memory to create it (which you arn't doing), some other creation problems, or that the key supplied wasn't found. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shared Memory Problem
Hi! I found the solution to my prob. SELinux was enabled in the server which needs disabling. After disabling SELinux it was working great. Thanks for your help guys. Another small query though, is there anyway to enable SELinux and as well use shared memory between PHP and C++? I know using Zend engine would solve the prob, but we need to buy zend which is very costly for me, any other solution is welcome. Regards, Yaswanth On 11/16/05, Curt Zirzow [EMAIL PROTECTED] wrote: On Wed, Nov 16, 2005 at 03:33:22AM +0530, Yaswanth Narvaneni wrote: Hi! I have a server written in C++ and my webpages are in PHP. The PHP has to communicate with the server using shared memory. This was working fine on the server running FC-1 with php-4.3.8. We recently migrated to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it displays is as follows: shmop_open(): unable to attach or create shared memory segment in /var/www/html/sharedmem.php on line 2 The server opens the shm in 666 (originally was 644) even then it was not working. I can see the shared mem open using 'ipcs' command. ... $shm_id = shmop_open($shm_key, a,0,0) or die(FATAL ERROR:: Unable to Access Shared Memory); You might want to try to open it within the same mode that the server created it in: 1) $shm_id = shmop_open($shm_key, a,0666,0); 2) are you 100% sure the key is valid? the error message you are getting seems to point in this direction since the shmop_open is failing on the C call to shmget(), wich usually fails when either you dont have enough memory to create it (which you arn't doing), some other creation problems, or that the key supplied wasn't found. Curt. -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- In theory there is no difference between theory and practice. In practice there is. -- Fortune Cookie -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shared Memory Problem
Hi! I have a server written in C++ and my webpages are in PHP. The PHP has to communicate with the server using shared memory. This was working fine on the server running FC-1 with php-4.3.8. We recently migrated to CentOS 4.1 (Equivalent to RHEL 4.1) running php-4.3.9. The error it displays is as follows: shmop_open(): unable to attach or create shared memory segment in /var/www/html/sharedmem.php on line 2 The server opens the shm in 666 (originally was 644) even then it was not working. I can see the shared mem open using 'ipcs' command. The source code of PHP is as follows: ?php /*Sem Key is read from this file*/ $SEMROUTE = /var/www/html/sharedmem/; $filename = $SEMROUTE.id; $handle = fopen($filename, r); $contents = fread($handle, filesize($filename)); fclose($handle); $contents = chop($contents); $shm_key = $contents; /*DEBUG:: The Contents of the file*/ print $shm_key.br; // These are fine # print $shm_key; $shm_id = shmop_open($shm_key, a,0,0) or die(FATAL ERROR:: Unable to Access Shared Memory); /*$shm_size = shmop_size($shm_id); DEBUG:: print (Shared Memory Block Size: . $shm_size.\n); */ // Now lets read the string back $data = shmop_read($shm_id, 0, $shm_size); if (!$data) { echo FATAL ERROR:: Couldn't read from shared memory\n; exit; } ? The PHPInfo of the servers are as follows (if it will help): - Server where its working fine - -- Start -- './configure' '--host=i386-redhat-linux' '--build=i386-redhat-linux' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-regex=system' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-unixODBC=shared' '--enable-memory-limit' '--enable-bcmath' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--enable-mcal' '--enable-mbstring=shared' '--enable-mbstr-enc-trans' '--enable-mbregex' '--with-apxs2=/usr/sbin/apxs' -- End -- - Config of Server on which it Fails - -- Start -- './configure' '--build=i686-redhat-linux-gnu' '--host=i686-redhat-linux-gnu' '--target=i386-redhat-linux-gnu' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--enable-force-cgi-redirect' '--disable-debug' '--enable-pic' '--disable-rpath' '--enable-inline-optimization' '--with-bz2' '--with-db4=/usr' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd=shared' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-ncurses=shared' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-xml' '--with-expat-dir=/usr' '--with-dom=shared,/usr' '--with-dom-xslt=/usr' '--with-dom-exslt=/usr' '--with-xmlrpc=shared' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-pear=/usr/share/pear' '--with-imap=shared' '--with-imap-ssl' '--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql=shared' '--with-snmp=shared,/usr' '--with-snmp=shared'