[PHP] PHP5 Bug with DOMDocument-xinclude

2004-07-21 Thread Siddharth Hegde
Hi,

Can anyone tell me if they faced a similar problem.
When I manually save the following line into an file, it works
xi:include href=xml_file.xml parse=xml/

But if I remove this line, and add it dynamically using the following
code, and only after that call $xml_file-xinclude(); it does not work
$new_node = $xml_file-createElement('xi:include');
$new_node-setAttribute ('href', xml_file.xml);
$new_node-setAttribute ('parse', 'xml');
$parent-appendChild($new_node);

($parent was set, so the error is not there)
After all the xinclude command, I write the o/p using saveXML() and I
see the xi:include href=xml_file.xml parse=xml/ in the file
unprocessed.

Any ideas?
Any work arounds for now?

- Sid

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 Bug with DOMDocument-xinclude

2004-07-21 Thread Siddharth Hegde
Cool that worked :-) Thanks. BTW your presentation on your site was very useful.

- Sid

On Wed, 21 Jul 2004 13:25:11 +0200, Christian Stocker [EMAIL PROTECTED] wrote:
 
 
 On Wed, 21 Jul 2004 16:02:54 +0530, Siddharth Hegde [EMAIL PROTECTED] wrote:
  Hi,
 
  Can anyone tell me if they faced a similar problem.
  When I manually save the following line into an file, it works
  xi:include href=xml_file.xml parse=xml/
 
  But if I remove this line, and add it dynamically using the following
  code, and only after that call $xml_file-xinclude(); it does not work
  $new_node = $xml_file-createElement('xi:include');
  $new_node-setAttribute ('href', xml_file.xml);
  $new_node-setAttribute ('parse', 'xml');
  $parent-appendChild($new_node);
 
  ($parent was set, so the error is not there)
  After all the xinclude command, I write the o/p using saveXML() and I
  see the xi:include href=xml_file.xml parse=xml/ in the file
  unprocessed.
 
  Any ideas?
  Any work arounds for now?
 
 No workaround, just use the correct methods for inserting elements
 with a namespace ;)
 
 $new_node = $xml_file-createElementNS(XINCLUDE_NAMESPACE, 'include');
 
 XINCLUDE_NAMESPACE is of course to be replaced with tha actual
 xinclude namespace... (too lazy to look it..)
 
 chregu
 
  - Sid
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 --
 christian stocker | Bitflux GmbH | schoeneggstrasse 5 | ch-8004 zurich
 phone +41 1 240 56 70 | mobile +41 76 561 88 60  | fax +41 1 240 56 71
 http://www.bitflux.ch  |  [EMAIL PROTECTED]  |  gnupg-keyid 0x5CE1DECB


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] (PHP5) Getting parent node from a DOMnode object

2004-07-18 Thread Siddharth Hegde
Hello everyone, 

I am usinng the following code to convert an xpath to a node. I was
wondering if there is any way I can get the parent node of $node from
the code below. Is there any other way that I can convert the xpath to
the corresponding parent node?

? 
// Code for loading $dom_doc comes here

$xpath = new DOMXPath($dom_doc); 
$path = $xpath-query($path); 
$node = $path-item(0); // Get the first node always
? 

Any help will be appreciated. 

Thanks 

- Sid

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Bug ?

2004-07-03 Thread Siddharth Hegde
While we are on this topic, I have noticed that for only some keys,
the following does not work
$arr[KEY_NAME] but when I change this to $arr['KEY_NAME'] it works.
I seriosuly doubt that KEY_NAME is a restricted keyword as dreamweawer
highlights these in different colors and this happens very rarely. In
any case I will be working on PHP5 so i guess it will not happen again

On Sat, 3 Jul 2004 12:04:10 +0200, Dennis Freise
[EMAIL PROTECTED] wrote:
 On Sat, 3 Jul 2004 11:56:52 +0200
 Dennis Freise [EMAIL PROTECTED] wrote:
 
 Errr... these need to be assoc as well:
 
 
 
  $country_symbol = array( 'AU' = 'some_value' );
  $country_list = array( 'some_value', 'some_other_value' );
 
 $country_list = array( 'some_value' = 'some_other_value' );
 
  For your piece of code it would need to be:
  $country_list = array( 'some_value' = array( 'AU', 'some_other_value' );
 
 $country_list = array( 'some_value' = array( 'AU' = 'some_other_value' );
 
 --
 Dennis Freise [EMAIL PROTECTED]
 GnuPG key: 2DE8 CCEF 6E20 11D4 3B27  21EC B0BA 1749 D2C8 38ED
 Available at: http://www.final-frontier.ath.cx/?key-plain
 
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Password encyption

2004-07-03 Thread Siddharth Hegde
You could use Turck to convert the file to byte code. Not exactly
state of the art security as Turck does not have any encryption
itself, but definately a better option than plain text.

- Sid


On Fri, 2 Jul 2004 22:32:24 -0400 (EDT), Michal Migurski
[EMAIL PROTECTED] wrote:
  I realize the key needs to be stored somewhere which is part of the
  problem of how to make it a bit more secure.  I just don't feel safe if
  a password in a flat file in clear text.  Ideally the database should
  support something like an ssh style public/private Key auth where the
  private Key is stored internally to the database.
 
 Where would you store the passphrase to the key? This is a losing battle -
 at some point, anonymous requests from the outside world are going to have
 to result in some kind of access to the database.
 
 I think you'd be better off accepting the inherent security tradeoffs as a
 known variable, and working from there: write your code so it's not
 vulnerable to SQL injection or other attacks, limit the access permissions
 of the database user, put the file containing the password someplace where
 the webserver won't divulge its content (apache config or .htaccess is a
 personal favorite of mine), and (important!) back up your DB regularly so
 that you can recover from attacks cleanly.
 
 -mike.
 
 -
 michal migurski- contact info and pgp key:
 sf/cahttp://mike.teczno.com/contact.html
 
 
 
 --
 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] Protecting database passwords

2004-07-01 Thread Siddharth Hegde
Not really a direct solution, but anyways...You could use Turck
MMCache to convert the code into bytecode. That way nobody can see the
password, atleast not too easily.

- Sid

On Thu, 01 Jul 2004 16:28:57 +0100, Peter Risdon
[EMAIL PROTECTED] wrote:
 
 Bob Hockney wrote:
  Gerben wrote:
 
 
 I think he is talking about the password that is written inside the script
 in the mysql_connect statement. I think he is worried that someone could
 access it's code and find out the DB password.
 
 
  What I am concerned about is a local user on the server machine, not access through
  the web server.  It sounds like it can be done if there is a separate user or 
  group for the
  web server process, but this site specific.  It would be difficult to distribute a 
  program
  and use a generalized install routine to install the file containing the passwords 
  to be
  edited by the site admin.
 
  -Bob
 
 
 The only way I know to achieve this is to install apache with the suexec
 option. This has no effect on mod_php but does on the cgi version. So
 then install the cgi version of php. A virtual host can run with the
 effective uid and gid of the account holder (user). Scripts can then be
 installed in the cgi-bin, owned by that user with permissions 0700. No
 other user can see them yet apache will be able to execute them. The
 database password can be in your script or in an include file with these
 permissions.
 
 If you want to distribute a program, there are obvious problems - apache
 is not always installed suexec and the cgi version of php is rarely
 installed (it doesn't conflict in any way with mod_php, though. You can
 have both).
 
 Bear in mind that this issue affects every distributed php application,
 including horde, php groupware and so on. Most shared servers run a form
 of ftp that chroots users into their home directories, and this helps.
 The main thing is to keep the file with the password out of the webspace
 (an include path can be anywhere), or make an apache configuration file
 part of your distribution, to be included in httpd.conf (viz horde),
 that restricts access to a directory that is intended for configuration
 files.
 
 Peter.
 
 
 
 --
 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] PHP5 contest

2004-07-01 Thread Siddharth Hegde
Hi,

Does anyone know who to contact if they have any Qs regarding the PHP5
contest. One of the Qs I had - Are we allowed to use Pear library and
classes.

Thanks,

- Sid

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP5 contest

2004-07-01 Thread Siddharth Hegde
Do you mean the Zend PHP5 contest?
Yes,

Thank you

On Thu, 1 Jul 2004 19:28:02 +0100, Richard Davey [EMAIL PROTECTED] wrote:
 
 Hello Siddharth,
 
 Thursday, July 1, 2004, 7:17:52 PM, you wrote:
 
 SH Does anyone know who to contact if they have any Qs regarding the PHP5
 SH contest. One of the Qs I had - Are we allowed to use Pear library and
 SH classes.
 
 Do you mean the Zend PHP5 contest? If so, yes you can use PEAR
 libraries.
 
 Best regards,
 
 Richard Davey
 --
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde
 
 --
 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] CSR file

2003-07-03 Thread Siddharth Hegde
Hello,

Does any one know how to decode a CSR ( Certificate Signing Request) file in PHP and 
get the ifo out from the server?

- Sid

[PHP] Securing PHP code

2003-06-25 Thread Siddharth Hegde
Hello everyone,
 
I am getting started on a project on PHP that requires very very high levels of 
security. I cannot give you exact details but the basics is that it deals with credit 
cards.
 
I want some advice and tips from experts on the following
The server will be Red Hat Linux 7.3
 
1) The site will have to take very high traffic and possibly thousands of transactions 
per hour
- Which is the best free db to use (I am guessing MySQL)
- Which is the best paid database (Other than MySQL)
2) I store the db password and login info in a database.inc.php file. Is there any way 
I can prevent a person from getting the db pass even after he gets this file?
3) Does anyone know a book that focuses of writing secure code.
4)What about Zend source safe. Is that recommended. How exactly does it work and what 
exactly does this do. Will it help to keep my database.inc.php file safe?
5)How do I know the code that I am writing and my server is safe. Are there any 
services out there that would help me evaluate this.

Although this is a high profile project, our budget is super small and A LOT depends 
on this project taking off within a small budget, but at the same time don't want to 
compromise on security.
 
I have tons of other questions going through my mind. I think I should just go and buy 
a book or something. Any suggestions? I will also be securing the Linux server so any 
book on this topic also would help (I am sure they are a couple of good books ).
 
- Sid

Re: [PHP] newbie: installing gd in php4

2003-02-26 Thread Siddharth Hegde
I think you have installed GD properly. This is actually due to bad 
documentation. The function is actually

imagecreate() not ImageCreate() C the difference?

Let me know if this helps

- Original Message -
From: Anthony Ritter [EMAIL PROTECTED]
Date: Wednesday, February 26, 2003 9:45 pm
Subject: [PHP] newbie: installing gd in php4

 Using MS Win 98 / PHP 4 and Apache.
 
 I tried running the following script but got an undefined call to:
 
 ImageCreate()
 
 The following copy is located in my php.ini file...one of which is:
 
 ..
 ;extension=php_gd.dll
 ..
 
 I tried uncommenting this line to no avail.
 
 What is the best way to install php_gd.dll so that I can make use 
 of the
 image library.
 Many thanks.
 
 Tony Ritter
 
 
 
 ;;
 ; Dynamic Extensions ;
 ;;
 ; if you wish to have an extension loaded automaticly, use the
 ; following syntax:  extension=modulename.extension
 ; for example, on windows,
 ; extension=msql.dll
 ; or under UNIX,
 ; extension=msql.so
 ; Note that it should be the name of the module only, no directory
 information
 ; needs to go here.  Specify the location of the extension with the
 extension_dir directive above.
 
 
 ;Windows Extensions
 ;extension=php_mysql.dll
 ;extension=php_nsmail.dll
 ;extension=php_calendar.dll
 ;extension=php_dbase.dll
 ;extension=php_filepro.dll
 ;extension=php_gd.dll
 ;extension=php_dbm.dll
 ;extension=php_mssql.dll
 ;extension=php_zlib.dll
 ;extension=php_filepro.dll
 ;extension=php_imap4r2.dll
 ;extension=php_ldap.dll
 ;extension=php_crypt.dll
 ;extension=php_msql2.dll
 ;extension=php_odbc.dll
 
 --
 
 
 
 
 
 -- 
 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] reminder mail when date is within a month of today.

2003-02-25 Thread Siddharth Hegde


 -Original Message-
 From: Petre Agenbag [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, February 25, 2003 2:38 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] reminder mail when date is within a month of today.
 
 HI
 I'm having a bad thinking day. I know it's going to be a very easy
 solution, but please humour me.
 I have a mysql table with a bunch of subscribers and the date that
they
 subscribed.
 I want to query the table to find all the subscribers who will come up
 for renewal within the current month. So, each time I access the page,
 it must generate a table with those who's subscription is going to
 expire in this month, as well as those who might already be past the
 renewal date.
 I can handle the generation of the table and all, I'm just not coping
 with the query string.
 
 Thanks
 
 
 
 
 
 --
 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] Re: rewrite rule help anyone?

2003-02-25 Thread Siddharth Hegde
Sorry did not get you there specifically this part

  ---This:
  index.php?file=testcmd=displaywhat=all
  ---Becomes:
  index-get-file-is-test+cmd-is-display+what-is-all.html

Anyway, I have written a rewrite rule to rewrite
www.subdomain.some-domain.com to
www.some-domain.com/index.php?somevar=sub-domain

Is this what you are looking for?

- Sid

 -Original Message-
 From: Shawn McKenzie [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 24, 2003 4:07 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Re: rewrite rule help anyone?
 
 No takers???
 
 Did I say, Please!
 
 Thanks!
 Shawn
 
 Shawn McKenzie [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Slightly off topic, but I have some PHP also ;-)
 
  I am trying to make search engine friendly URLs for a site, but want
 this
 to
  be fairly dynamic and work with any new script and vars.
 
  If anyone would be willing, I need help on a mod_rewrite rule or
rules?
 I'm
  thinking it should be fairly simple, but I know nothing about reg
  expressions.  Maybe not the greatest, but here's the code that
generates
 the
  HTML with altered URLs.  This works great, but then I need Apache to
 rewrite
  these.
 
  ---This:
  index.php?file=testcmd=displaywhat=all
  ---Becomes:
  index-get-file-is-test+cmd-is-display+what-is-all.html
 
  --Here's the code:
 
  ob_start();
  echo $htmlpage;
  $newdisplay = ob_get_contents();
  ob_clean_flush();
  echo rewrite($newdisplay);
 
  function rewrite($newdisplay)
  {
  $search = array(
  .php?, .php, =, amp;, );
 
  $replace = array(
  -get-, , -is-, +, +);
 
  $hrefs = find_hrefs($newdisplay);
  $tmphrefs = str_replace($search, $replace, $hrefs);
  foreach($tmphrefs as $key = $array) {
  $newhrefs[$key] = $array..html;
  }
  $newdisplay = str_replace($hrefs, $newhrefs, $newdisplay);
 
  return $newdisplay;
  }
 
  //finds href= in the string containing the html
  function find_hrefs($tmpcontent)
  {
  while($start = strpos($tmpcontent, 'href=', $end)) {
  $start = $start +6;
  $end = strpos($tmpcontent, '', $start);
  $href[] = substr($tmpcontent, $start, $end - $start);
  }
  return $href;
  }
 
  TIA,
  Shawn
 
 
 
 
 
 --
 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] Creating my own super global variables

2003-02-24 Thread Siddharth Hegde
Hello,

Is there any way I can creat my very own super global variables?

- Sid



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Creating my own super global variables

2003-02-24 Thread Siddharth Hegde
U'r 100% right Mr Ernest.

- Siddharth

 -Original Message-
 From: Ernest E Vogelsinger [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 24, 2003 10:45 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Creating my own super global variables
 
 At 17:54 24.02.2003, Jason Wong spoke out and said:
 [snip]
 On Tuesday 25 February 2003 00:07, Siddharth Hegde wrote:
 
  Is there any way I can creat my very own super global variables?
 
 All variables defined in the global scope can be accessed via
$GLOBALS.
 
 So:
 
   $my_very_own_variable = 'whatnot';
 
 can be accessed anywhere as:
 
   $GLOBALS['my_very_own_variable']
 
 For consistency you might want to always refer to it as
 $GLOBALS['my_very_own_variable'], so:
 
   $GLOBALS['my_very_own_variable'] = 'whatnot';
 [snip]
 
 Yes, but the question was for a superglobal, like $_REQUEST, $_POST,
 $_GET, or $_SERVER, so he wants something like $_MYSUPERGLOBAL which
is
 not
 possible afaik.
 
 If you have a look in main/main.c, there's an array called
 short_track_vars_names at the very beginning, which is later on
looped
 and tits contents passed to zend_register_auto_global(), which in turn
 adds
 the name to a hash structure for autoglobal identifier lookup. These
names
 are hardcoded and cannot be changed (except when you modify the
 distribution source code and recompile).
 
 
 --
O Ernest E. Vogelsinger
(\) ICQ #13394035
 ^ http://www.vogelsinger.at/
 
 
 --
 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] Retrieving data via a proxy server

2003-02-22 Thread Siddharth Hegde
Hello,

I am a bit new to the concept of a proxy server. Could someone tell me
how to
a) Connect to a Web Server and retrieve data from it
b) Connect to an mail server and send an e-mail (via a proxy)

I know how to do these tasks without a proxy server, but not behing one.

Thanks

- Sid



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] dynamic website screenshot/screen capture

2003-02-22 Thread Siddharth Hegde
My company researched on the topic sometime back. We even did a test run
(on our local machines where there are no user restrictions set). The
machine running this will need IE 5.x or above and another software
(um... forgot its name) that uses this IE engine to capture whatever IE
see into an .jpg file. We then copy this jpeg file and generate
thumbnails using the  GD library.

Since we tried this only on our local machines, we are not sure if we
would be able to install a third party software on a server (unless it
was dedicated). Anyways this was just done in some free time, so we
never really pursued the matter any further.

- Sid

 -Original Message-
 From: olinux [mailto:[EMAIL PROTECTED]
 Sent: Saturday, February 22, 2003 12:25 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] dynamic website screenshot/screen capture
 
 Hi all -
 While I know that this is not possible with PHP alone,
 Does anyone know how to capture website screen shots
 using PHP. I have recieved many spam mails featuring a
 screen shot of our company website and I imagine that
 it would be quite possible combined with some sort of
 web browser.
 
 It would be great for a couple projects I'm working on
 to use this in the same style as alexa.com. (featuring
 screenshots next to search results.).
 
 thanks for any info!
 
 olinux
 
 __
 Do you Yahoo!?
 Yahoo! Tax Center - forms, calculators, tips, more
 http://taxes.yahoo.com/
 
 --
 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] Displaying images

2003-02-22 Thread Siddharth Hegde
I had the same problem. This is due to bad documentation I think. Just
ImageCreateFromxxx to imagecreatefromxxx and DW MX will show it as a
valid func AND more importantly, it will work.

Let me know if this helps

- Sid

 -Original Message-
 From: Robert Stermer-Cox [mailto:[EMAIL PROTECTED]
 Sent: Saturday, February 22, 2003 10:50 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Displaying images
 
 Greetings, All,
 
 I'm a newbe to php and am trying to develop a routine to display
artwork
 on
 my wife's site.  I want to load from a flat file information about the
 artwork and image file names of the pieces.  Then using the image file
 name,
 I want to display the image to the browser.  I've figured out how to
load
 the data from the file, but I could only find (PHP and MySQL Web
 Development, Welling  Thomson) two functions to display the images:
 ImageCreateFromxxx or Imagexxx.  Neither one works.  In fact,
Dreamweaver
 MX
 doesn't even show them as valid php functions.
 
 Any suggestions would be greatly appreciated
 
 Robert
 
 
 
 --
 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] timer problem

2003-02-22 Thread Siddharth Hegde
Just a little curious. Is there any other way other than cron to do
this. Is it possible to run a PHP script in an endless loop and when the
clock strikes, run another script?

- Sid

 -Original Message-
 From: John W. Holmes [mailto:[EMAIL PROTECTED]
 Sent: Saturday, February 22, 2003 9:40 PM
 To: 'Michael Gaab'; [EMAIL PROTECTED]
 Subject: RE: [PHP] timer problem
 
  i want to automate some activities by date.  on a certain date i
want
 to
  do
  some specific processing. the application is web based using apache.
i
  guess
  i would need some way of calling the program daily to see if today
is
 the
  day.  thread/daemon?  any suggestions appreciated.
 
 Use cron  on *nix, or Task Scheduler if on Windows.
 
 ---John W. Holmes...
 
 PHP Architect - A monthly magazine for PHP Professionals. Get your
copy
 today. http://www.phparch.com/
 
 
 
 --
 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