[PHP] Getting values from the Javascript namespace

2005-03-27 Thread Daniel Lahey
Is there any way to get values from the Javascript namespace into PHP?  
I want to use a value passed into a Javascript function in a query 
within some PHP code in the function which is used to dynamically 
populate a select's options.

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


[PHP] Re: So this isnt a bug?

2005-03-27 Thread Aaron
Ive made it clear.

If I use the success_box function that uses java to redirect it works 
perfectly, but if I use the header command the variables are stripped.

This is only when a $_FILE is passed.


A. S. Milnes [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
 Aaron wrote:
 http://bugs.php.net/bug.php?id=32449
 I dont see how its not a bug.

 You might find the advice here helpful as well:-

 http://www.catb.org/~esr/faqs/smart-questions.html

 Alan 

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



[PHP] Illegal string offset error in array

2005-03-27 Thread Johannes Findeisen
Hello all,

sorry if this has been asked allready but i didn't find any usefull 
information in the web.

Why is this function not working in PHP5?

function getNavigationContent($content_path) {
$i = 0;
$dir = opendir($content_path);
while ($file = readdir ($dir)){
if ($file != .  $file != ..  !in_array($file, explode(',', 
$this-arrConf['default_filtered_files']))) {
$arrAvailableContent[$i] = $file;
if(is_dir($content_path . $file)) {
echo $n = 0;
$subdir = opendir($content_path . $file);
while ($subfile = readdir ($subdir))  {
if ($subfile != .  $subfile != ..) {

/*
 * This line does not work in PHP5 cause off an 
illegal string offset in an array ERROR
 */
$arrAvailableContent[$i]['submenu'][$n]['file'] = 
$subfile;
$n++;
}
}
closedir($subdir);
}
$i++;
}
}
closedir($dir);
return $arrAvailableContent;
}

Can someone help?

Regards

-- 
# Johannes Findeisen

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



[PHP] Re: Avoiding SQL injections: htmlentities() ?

2005-03-27 Thread Raj Shekhar
[EMAIL PROTECTED] writes:


 
 So if I could broaden the question and ask, in general, what people
 recommend for pre-processing data before it goes into a SQL
 statement.. for security and for things like making sure
 singlequotes and other special characters are escaped properly?
 
 
 htmlentities()
 addslashes() (if magic quotes isn't turned on right?)
 
 What else?
 

Using some sort of database abstraction library (Pear::Db, Aoddb) also
helps.  At least Adodb escapes the slashes in a SQL statement before
it is sent for execution. Using a library also provides a choke point
and you can add your own additional checks in the library without
letting the developers worry if they have done all the checks and
validations correctly.

-- 
Raj Shekhar  Y!   : Operations Engineer
MySQL DBA, programmer and  slacker   Y!IM : lunatech3007
home : http://rajshekhar.net blog : http://rajshekhar.net/blog/

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



[PHP] world write access

2005-03-27 Thread Evert - Rooftop Solutions
Hi people,
I'm trying to think of a way to make an auto-updater for my distributed 
scripts. If I wanted to do this, I'd have to give write access to the 
php scripts to the apache user or world.
Everywhere I read that you shouldn't to that, but I'm thinking that if 
you script your stuff right, there shouldn't be any problem. The 
numerous places I read that I shouldn't do that gives me certain doubts 
though.

any comments on this?
regards,
Evert
--
Rooftop Solutions - Web Applications on Demand
tel. (+31)628962319 fax. (+31)842242474
http://www.rooftopsolutions.nl
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] trustudio - eclipse IDE + CVS

2005-03-27 Thread D_C
I am using the trustudio IDE (an eclipse plugin basically) 

it has a really nice feature where it will give popups for argument
list for your functions.
however, when i am using a project from CVS rather than the local file
system, this breaks, and i get an error
"The resource is not on build path of a java project"

or "the compilation unit is not on the build path of a script project".

is anyone using this IDE, that can tell me how to create this setting? 

Also, has anyone got experience running the other "PHP eclipse" (
http://www.phpeclipse.de/ ) IDE, or having both running as eclipse PHP
plugins on the same machine?

Thanks!

/dc

-- 
___
   David "DC" Collier
mobile business creator |モバイル・ビジネス・クリエーター
   [EMAIL PROTECTED]
   skype: callto://d3ntaku
   http://www.pikkle.com
new number! 
   +81 (0)80 6521 9559

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

Re: [PHP] world write access

2005-03-27 Thread Johannes Findeisen
Hello,

It is generally not a good idea to make scripts to everybody writeable. I 
think that if you're implementing auto-update features in PHP scripts they 
only could be insecure. Okay, you have one more feature but what if this 
feature goes out of control? Be really carefull when writing such 
applications. Maybe there are nice and secure solutions which maybe work but 
you really should set a focus on security.

More info:
http://www.php.net/manual/en/function.chmod.php

Regards

hanez

On Sunday 27 March 2005 19:08, Evert - Rooftop Solutions wrote:
 Hi people,

 I'm trying to think of a way to make an auto-updater for my distributed
 scripts. If I wanted to do this, I'd have to give write access to the
 php scripts to the apache user or world.
 Everywhere I read that you shouldn't to that, but I'm thinking that if
 you script your stuff right, there shouldn't be any problem. The
 numerous places I read that I shouldn't do that gives me certain doubts
 though.

 any comments on this?

 regards,
 Evert

 --
 Rooftop Solutions - Web Applications on Demand
 tel. (+31)628962319 fax. (+31)842242474
 http://www.rooftopsolutions.nl

-- 
# Johannes Findeisen

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



[PHP] Still fighting setcookie

2005-03-27 Thread John Hinton
OK, I created this most simplistic script..
 Begin Script---
?php
if(isset($value))
{
 setcookie(mycookie,$value);
}
define (Login, 0);
define (DataReturn, 1);
function login() {
echo form ACTION=\$_SERVER[PHP_SELF]?action=1\ METHOD=\post\ 
ENCTYPE=\multipart/form-data\;
echo Type value: input name=\value\ type=\text\;
echo input name=\submit\ type=\submit\;
echo /form;
}

function datareturn(){
print_r($_COOKIE);
echo  is the \$_COOKIE data;
}
if (empty ($action))
  $action = 0;
switch ($action) {
case Login:
  login();
  break;
case DataReturn:
  datareturn();
  break;
default:
  die (Unknown action code ($action));
}
?
End Script
I would expect the return on action=1 to report the set cookie, but 
instead, it has no data. If I then reload the browser, the cookie 
appears. How can I get the cookie to set without this reload? What am I 
missing?

Thanks a bunch...
John Hinton
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] setcookie issue

2005-03-27 Thread Chris Shiflett
John Hinton wrote:
The thing is, on the next action switch
print_r($_COOKIE);
returns empty until I refresh the browser. So, thusly, the second page
load brings in the cookies.
$_COOKIES is a convenient array that contains the contents of the Cookie 
header, nicely parsed.

Whenever you set a cookie, you're really adding a Set-Cookie header to 
the response. Thus, the browser has no way of knowing your intent until 
it receives the response. This data won't be in $_COOKIES until a 
subsequent request is made in which that cookie is included in the 
Cookie request header.

This chapter of HTTP Developer's Handbook explains cookies:
http://shiflett.org/books/http-developers-handbook/chapters/11
See Figure 11.3 for an illustration of the exchange I just described.
Hope that helps.
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Maximum Execution Time Exceeded

2005-03-27 Thread mikeytf
I would like to know if you could help me..  I don't understand what is wrong!  
I made a file that is supposed to list 2 categories with the boards that go to 
them under them.  I get a Fatal Error: Maxmimum execution time of 30 seconds 
exceeded.  Here is the file that gives me the error: 
http://subzer0.net/php/index.php
 
Here is the source code for the file:
 
http://subzer0.net/php/index.phps
 
Thanks.
 
 
~Mike


Re: [PHP] world write access

2005-03-27 Thread Evert | Rooftop Solutions
Thanx Johannes,
how about making the webserver the owner of the files? Would that be a 
good idea?
The problem is that I have a framework deployed at several clients. 
Because this are some big clients and demand high security they won't 
give me a login to their ftp or consoles.
Understandable, but everytime there's an update I need to mail the files 
and they have to install it. Imagine how much time that costs when 
there's a problem after the update and they need files again. Very annoying.

I consider myself a good php scripter and I will be able to make my 
scripts secure, so I need a good reason not to build in the 
auto-updater. I can tell the server is a dedicated server for my 
project, only has a webserver running (apache).

Argue with me :)
grt,
Evert
Johannes Findeisen wrote:
Hello,
It is generally not a good idea to make scripts to everybody writeable. I 
think that if you're implementing auto-update features in PHP scripts they 
only could be insecure. Okay, you have one more feature but what if this 
feature goes out of control? Be really carefull when writing such 
applications. Maybe there are nice and secure solutions which maybe work but 
you really should set a focus on security.

More info:
http://www.php.net/manual/en/function.chmod.php
Regards
hanez
 

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


[PHP] Re: Getting values from the Javascript namespace

2005-03-27 Thread Jasper Bryant-Greene
Daniel Lahey wrote:
Is there any way to get values from the Javascript namespace into PHP?  
I want to use a value passed into a Javascript function in a query 
within some PHP code in the function which is used to dynamically 
populate a select's options.

TIA
JavaScript is parsed on the client side, and PHP on the server side. 
Because HTTP is stateless, you'd have to call the server again from the 
JavaScript, as the JavaScript isn't parsed until after the request is 
complete.

You might like to investigate the XMLHTTP object for calling the server 
from JavaScript, but it might be better to figure out an alternative way 
to do it without requiring the second call back to the server. I can't 
really help any more without more specifics (maybe some code).

HTH
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Illegal string offset error in array

2005-03-27 Thread Jasper Bryant-Greene
Johannes Findeisen wrote:
Hello all,
sorry if this has been asked allready but i didn't find any usefull 
information in the web.

Why is this function not working in PHP5?
 [snip]

/*
 * This line does not work in PHP5 cause off an 
illegal string offset in an array ERROR
 */
$arrAvailableContent[$i]['submenu'][$n]['file'] = 
$subfile;
 [snip]
Can someone help?
You can't access string offsets with square brackets [] in PHP5. You 
need to use curly braces {} instead.

Square brackets [] for arrays, curly braces {} for string offsets.
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] mysql_fetch_row not working?

2005-03-27 Thread mikeytf
?php
$category=mysql_query(SELECT * FROM categories ORDER BY catid ASC) or 
die(mysql_error());
while($get_cat=mysql_fetch_row($category))
$board=mysql_query(SELECT * FROM boards WHERE hidden='No' AND 
catid='.$get_cat[0].' ORDER BY boardid ASC) or die(mysql_error());
while($board=mysql_fetch_row($board))
echo '/tabletable border=0 width=100% align=centertr 
class=cell2tdbi'.$get_cat[1].'/i/b/td/tr/tabletable 
border=0 align=center width=100%tr ',shading(),'tda 
href=/php/topics.php?board='.$get_board[0].''.$get_board[1].'/abr 
/small'.$get_board[2].'/small/tdtd'.$get_board[3].'/tdtd'.$get_board[4].'/tdtd'.$get_board[5].'/td/tr/table';
?
 
That is in my index file.  This is my index: http://subzer0.net/php
 
There are 2 categories in the db and 4 boards.  I don't know why they aren't 
showing!  _
 
Please help!
 
~Mike


[PHP] Re: Still fighting setcookie

2005-03-27 Thread Jasper Bryant-Greene
John Hinton wrote:
OK, I created this most simplistic script..
 [snip]
I would expect the return on action=1 to report the set cookie, but 
instead, it has no data. If I then reload the browser, the cookie 
appears. How can I get the cookie to set without this reload? What am I 
missing?

Thanks a bunch...
John Hinton
When you use setcookie(), it sets a Set-Cookie header in the response to 
the browser. The browser will then send the Cookie header with 
subsequent requests.

The server has no way of knowing about the cookie until a subsequent 
request, but you could either code around it or write your own setcookie 
wrapper, something like:

function setcookie2($name, $value=, $expire=, $path=, $domain=, 
$secure=false) {
	$_COOKIES[$name] = $value;
	return setcookie($name, $value, $expire, $path, $domain, $secure);
}

It's probably better just to think up an alternative way to do it though.
Best regards
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: Still fighting setcookie

2005-03-27 Thread Jasper Bryant-Greene
Jasper Bryant-Greene wrote:
 [snip]
function setcookie2($name, $value=, $expire=, $path=, $domain=, 
$secure=false) {
$_COOKIES[$name] = $value;
return setcookie($name, $value, $expire, $path, $domain, $secure);
}
 [snip]
Sorry, that should be:
$_COOKIE[$name] = $value;
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread Rasmus Lerdorf
Jasper Bryant-Greene wrote:
Johannes Findeisen wrote:
Hello all,
sorry if this has been asked allready but i didn't find any usefull 
information in the web.

Why is this function not working in PHP5?
 [snip]
/*
 * This line does not work in PHP5 cause off 
an illegal string offset in an array ERROR
 */

$arrAvailableContent[$i]['submenu'][$n]['file'] = $subfile;
 [snip]
Can someone help?

You can't access string offsets with square brackets [] in PHP5. You 
need to use curly braces {} instead.
Not sure where you got that idea.  This is not true.
-Rasmus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread Jasper Bryant-Greene
Rasmus Lerdorf wrote:
Jasper Bryant-Greene wrote:
You can't access string offsets with square brackets [] in PHP5. You 
need to use curly braces {} instead.
Not sure where you got that idea.  This is not true.
-Rasmus
Actually, it is. See the following URL:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr
Best regards
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread Rasmus Lerdorf
Jasper Bryant-Greene wrote:
Rasmus Lerdorf wrote:
Jasper Bryant-Greene wrote:
You can't access string offsets with square brackets [] in PHP5. You 
need to use curly braces {} instead.

Not sure where you got that idea.  This is not true.
-Rasmus

Actually, it is. See the following URL:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr 
Yes, please read that link again.  The syntax is deprecated.  That 
doesn't mean it doesn't work as you indicated.  If we broke this most of 
the scripts written for PHP4 would break.

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


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread Jasper Bryant-Greene
Rasmus Lerdorf wrote:
Jasper Bryant-Greene wrote:
You can't access string offsets with square brackets [] in PHP5. You 
need to use curly braces {} instead.
Not sure where you got that idea.  This is not true.
-Rasmus
Actually, it is. See the following URL:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr 
Yes, please read that link again.  The syntax is deprecated.  That 
doesn't mean it doesn't work as you indicated.  If we broke this most of 
the scripts written for PHP4 would break.

-Rasmus
Yes, but he's talking about PHP5. He probably has E_STRICT on, which is
why he's getting that error.
I was telling him to use the correct syntax, which will cause him to not
get that error.
Best regards
--
Jasper Bryant-Greene
Cabbage Promotions
www:   www.cabbage.co.nz
email: [EMAIL PROTECTED]
phone: 021 232 3303
public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread Rasmus Lerdorf
Jasper Bryant-Greene wrote:
Rasmus Lerdorf wrote:
Jasper Bryant-Greene wrote:
You can't access string offsets with square brackets [] in PHP5. 
You need to use curly braces {} instead.

Not sure where you got that idea.  This is not true.
-Rasmus

Actually, it is. See the following URL:
http://www.php.net/manual/en/language.types.string.php#language.types.string.substr 

Yes, please read that link again.  The syntax is deprecated.  That 
doesn't mean it doesn't work as you indicated.  If we broke this most 
of the scripts written for PHP4 would break.

-Rasmus

Yes, but he's talking about PHP5. He probably has E_STRICT on, which is
why he's getting that error.
I was telling him to use the correct syntax, which will cause him to not
get that error.
I know we are talking about PHP5, and that syntax does not throw an 
E_STRICT error.

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


Re: [PHP] Re: Illegal string offset error in array

2005-03-27 Thread James Kaufman
On Mon, Mar 28, 2005 at 11:29:28AM +1200, Jasper Bryant-Greene wrote:
 Rasmus Lerdorf wrote:
 Jasper Bryant-Greene wrote:
 You can't access string offsets with square brackets [] in PHP5. You 
 need to use curly braces {} instead.
 
 Not sure where you got that idea.  This is not true.
 
 -Rasmus
 
 Actually, it is. See the following URL:
 
 http://www.php.net/manual/en/language.types.string.php#language.types.string.substr
  
 
 Yes, please read that link again.  The syntax is deprecated.  That 
 doesn't mean it doesn't work as you indicated.  If we broke this most of 
 the scripts written for PHP4 would break.
 
 -Rasmus
 
 Yes, but he's talking about PHP5. He probably has E_STRICT on, which is
 why he's getting that error.
 
 I was telling him to use the correct syntax, which will cause him to not
 get that error.
 
 Best regards
 
 -- 
 Jasper Bryant-Greene
 Cabbage Promotions
 www:   www.cabbage.co.nz
 email: [EMAIL PROTECTED]
 phone: 021 232 3303
 
 public key:  Jasper Bryant-Greene [EMAIL PROTECTED] keyID 0E6CDFC5
 fingerprint: 2313 5641 F8F6 5606 8844 49C0 1D6B 2924 0E6C DFC5
 

You do realize you're arguing with Rasmus, right?

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619, CISSP# 65668

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



[PHP] Converting hexadecimal string

2005-03-27 Thread Ashley M. Kirchner
   Short (possibly simple) question:
   How do I convert a hexadecimal string back into it's ascii 
representation?

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


[PHP] array sorting

2005-03-27 Thread Merlin
Hi there,
I would like to save some db power by putting values into a file which are often 
used. They basicly populate a select field.
So I placed those values into associative arrays:
$code[language]	= array(1= php, 2= asp);

Now I would like to sort those for displaying after my preference, not by lets 
say alphabet. The easiest thing I could think of, is just to move the entry:
$code[language]	= array(2= asp, 1= php);

But this of course does not work. I would like to be able to place values later 
on inbetween. So if somebody comes up with a language called .net :-) I would 
like to place it in the middle, but I cant get it to work like that :-(

To build the select box I use following code:
select name=education
	option value =0 selected---/option
';

# build the select field
for ($i=1; $i = count($code[education]); $i++){
	if ($education)
		$isselected = ($i == $education) ?  selected : ; // select the active row
	else
		$isselected = FALSE;
	printf (option value =\%s\%s%s/option\n, $i, $isselected, 
$code[education][$i]);
};
		
echo'
/select	

Has anybody an idea which could help me on that? Thank you for any help.
Merlin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php