Re: [PHP] Window close.

2006-02-07 Thread Jason Petersen
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] ID vs NAME in different browsers

2006-01-28 Thread Jason Petersen
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?

2006-01-28 Thread Jason Petersen
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


Re: [PHP] Help getting PHP and GPG to work

2006-01-09 Thread Jason Petersen
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

2006-01-09 Thread Jason Petersen
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] What software do you use for writing PHP?

2005-12-06 Thread Jason Petersen
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

2005-12-05 Thread Jason Petersen
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] FTPS transfers

2005-09-26 Thread Jason Petersen
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

2005-09-26 Thread Jason Petersen
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] Objects in Arrays (without the READ prompt)

2005-05-05 Thread Jason Petersen
Hi, 

I think you need to serialize your objects.

http://us3.php.net/manual/en/language.oop.serialization.php

Jason


On 5/5/05, Stuart Nielson [EMAIL PROTECTED] wrote:
 Sorry to everyone about the stupid READ notification on the posting.  I
 completely forgot that it was enabled.  This one shouldn't have that
 problem.
 
 I am using PHP version 4.3.4.
 
 I'm creating an authorization module that uses a users object, that
 includes the username, usertype, etc.  I want to store this in a session
 variable (i.e. $_SESSION['objects']['auth'] = new Authorization();) so
 that I can keep the information from page to page.  However, I get an
 error that it is an incomplete class everytime I try to access a
 function from the object like this:
 $_SESSION['objects']['auth']-Login();.  It works fine when it's not
 stored in the array.  Is this a PHP 4 issue?  Or is there something I'm
 doing wrong?
 
 Any pointers would be helpful.  If this doesn't work, I'll have to
 rework
 things to just store in arrays.
 
 Stuart
 


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



Re: [PHP] PHP RegExp and HTML tags attributes values etc...

2005-03-10 Thread Jason Petersen
On Thu, 10 Mar 2005 00:18:05 +0100, BlackDex [EMAIL PROTECTED] wrote:
 Hello ppl,
 
 I have a question about regex and html parsing.
 
 I have the following code:
 ---
 p class=MsoNormalfont size=3 face=Comic Sans MSspan lang=NL
 style='font-size:12.0pt;font-family:Comic Sans MS'nbsp;/span/font/p

I'm guessing that you're writing a function to parse HTML that users
upload via a web form? I would start with a look at this Perl script
to fix code generated by MS products:

http://www.fourmilab.ch/webtools/demoroniser/

Also, PHP's libtidy extension might be useful for you, although I
haven't used it personally.

http://us2.php.net/manual/en/ref.tidy.php

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



Re: [PHP] line feed

2005-03-04 Thread Jason Petersen
On Fri, 04 Mar 2005 14:38:20 +, Bruno Santos
[EMAIL PROTECTED] wrote:
 Hello.
 
 How do i print a line return using the echo command, for when i see the
 page source,
 i get the code line by line and not all in the same line.
 
 using double quotes (  ), i can put \n at the end and i get the result
 i want,
 but, using sinle quotes ( ' ), \n doesnt work.

Maybe you could use the HEREDOC format?

echo END
table border=0 width=100%
  trtdsome table stuff/td/tr
/table

END;

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



Re: [PHP] sql query

2005-03-02 Thread Jason Petersen
On Wed, 2 Mar 2005 13:02:39 +0200, William Stokes [EMAIL PROTECTED] wrote:
 Hello
 
 Can someone explain this to me. I don't know how to read this.
 
 if (!$variable = mysql_query(select id,sessid from users where ...
 
 What is this if(!

This is a way to run a SQL query, capture the return value, and
perform an action if the query failed. For code readability, I would
probably write that as two statements:

$variable = mysql_query(SELECT * FROM blah);
if(!$variable) { error_handler(mysql_error()); }

See the documentation for information on mysql_query return values:
http://us2.php.net/manual/en/function.mysql-query.php

Jason

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



Re: [PHP] mysql query

2005-02-17 Thread Jason Petersen
On 17 Feb 2005 19:28:18 -0600, Bret Hughes [EMAIL PROTECTED] wrote:
 On Thu, 2005-02-17 at 18:24, Sebastian wrote:
  Hello,
  im working on an article system and looking to avoid running three queries.
  example, i have this query:
 
  SELECT id,title FROM articles WHERE id=$_GET[id]
 
  now say $_GET[id] = 5
 
  I would like to get the previous id 4 and the next id 6 (if there is one)
  so i can do something like:

I would do something like:

$theId = $_GET['id'];
$ids = $theId-1 . , . $theId  , . $theId+1;
$query = SELECT id, title FROM articles WHERE id IN ($ids);

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