php-general Digest 28 May 2007 06:59:17 -0000 Issue 4815

2007-05-28 Thread php-general-digest-help

php-general Digest 28 May 2007 06:59:17 - Issue 4815

Topics (messages 255702 through 255702):

PHP5 oop question...
255702 by: Andrei

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

To post to the list, e-mail:
[EMAIL PROTECTED]


--
---BeginMessage---

Hi list,

I have a class which I use to parse simple bbcode inside some comments.
I noticed on PHP5 that scope of preg_replace function is changed
when function is called inside a class. To the point:

[CODE]
class PHS_editor
{
...

function parse_content( $str = null )
{
$from_arr = array( @\[B\](.*?)\[\/[EMAIL PROTECTED],
@\[U\](.*?)\[\/[EMAIL PROTECTED], @\[I\](.*?)\[\/[EMAIL PROTECTED],
   @\[URL=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED],
   @\[IMG=([^\]]*)[EMAIL PROTECTED],
   @\[QUOTE=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]
);

$to_arr = array( 'b\1/b', 'u\1/u', 'i\1/i',

 'a href=\1 target=_blank\2/a',

 'img src=\'.stripslashes(
\*$this-get_image_location*( '\\1' ) ).'\ border=\0\',

 'table width=\98%\ align=\center\
cellpadding=\1\ cellspacing=\0\ border=\0\ class=\form_type\.
  tr.
td class=\maintext\'.stripslashes(
\*$this-remove_mytags*( '\\2' ) ).'/td.
 /tr.
 /table'

 );

if( is_null( $str ) )
$str = $this-editor_content;
   
return preg_replace( $from_arr, $to_arr, str_replace(   , 
nbsp;, nl2br( $str ) ) );
}

...
}
[/CODE]

When it gets to parse [IMG] tags I get Fatal error: Using $this
when not in object context in  So it seems they changed the scope
for preg_replace callback functions. As this function is called inside
the method shouldn't it have the scope of the class?
Is there a workaround for this? I cannot declare a function
get_image_location which will staticly call the method bcuz I use
variables from instanced class.

Thnx,
Andy

---End Message---


[PHP] Re: Protected Mail Request

2007-05-28 Thread nlopess

Forwarded message is available.



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

[PHP] alert pcinfinity

2007-05-28 Thread Heiko Sudar
hi all,

does someone ever hear of an internet explorer alert pcinfinity?
I really didn´t find anything in forums and search engines, so maybe
somebody in this list knows better...

thanks for answers
heiko

---
„lernen ist wie rudern gegen den strom – 
hört man damit auf, treibt man zurück!“
(laotse)
---
heiko sudar
kranzhornstraße 4a
85567 grafing
 
08092 860585 (t)
08092 860587 (f)
0179 6863181 (m)
 
www.countingstation.de
www.applico.biz
www.lokalitaeten.net

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



Re: [PHP] PHP5 oop question...

2007-05-28 Thread Stut

Andrei wrote:

Hi list,

I have a class which I use to parse simple bbcode inside some comments.
I noticed on PHP5 that scope of preg_replace function is changed
when function is called inside a class. To the point:

[CODE]
class PHS_editor
{
...

function parse_content( $str = null )
{
$from_arr = array( @\[B\](.*?)\[\/[EMAIL PROTECTED],
@\[U\](.*?)\[\/[EMAIL PROTECTED], @\[I\](.*?)\[\/[EMAIL PROTECTED],
   @\[URL=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED],
   @\[IMG=([^\]]*)[EMAIL PROTECTED],
   @\[QUOTE=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]
);

$to_arr = array( 'b\1/b', 'u\1/u', 'i\1/i',

 'a href=\1 target=_blank\2/a',

 'img src=\'.stripslashes(
\*$this-get_image_location*( '\\1' ) ).'\ border=\0\',

 'table width=\98%\ align=\center\
cellpadding=\1\ cellspacing=\0\ border=\0\ class=\form_type\.
  tr.
td class=\maintext\'.stripslashes(
\*$this-remove_mytags*( '\\2' ) ).'/td.
 /tr.
 /table'

 );

if( is_null( $str ) )
$str = $this-editor_content;
   
return preg_replace( $from_arr, $to_arr, str_replace(   , 

nbsp;, nl2br( $str ) ) );
}

...
}
[/CODE]

When it gets to parse [IMG] tags I get Fatal error: Using $this
when not in object context in  So it seems they changed the scope
for preg_replace callback functions. As this function is called inside
the method shouldn't it have the scope of the class?
Is there a workaround for this? I cannot declare a function
get_image_location which will staticly call the method bcuz I use
variables from instanced class.


How are you trying to use this class? It sounds like you're trying to 
use the method statically. When a method is called statically it does 
not have a $this.


-Stut

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



Re: [PHP] alert pcinfinity

2007-05-28 Thread Stut

Heiko Sudar wrote:

does someone ever hear of an internet explorer alert pcinfinity?
I really didn´t find anything in forums and search engines, so maybe
somebody in this list knows better...


I'm not sure what you mean by internet explorer alert, but it sounds 
like either advertising or you have some malware. Either way this is 
definitely not the right place to ask.


-Stut

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



Re: [PHP] PHP5 oop question...

2007-05-28 Thread Andrei

Stut wrote:
 Andrei wrote:
 Hi list,

 I have a class which I use to parse simple bbcode inside some
 comments.
 I noticed on PHP5 that scope of preg_replace function is changed
 when function is called inside a class. To the point:

 [CODE]
 class PHS_editor
 {
 ...

 function parse_content( $str = null )
 {
 $from_arr = array( @\[B\](.*?)\[\/[EMAIL PROTECTED],
 @\[U\](.*?)\[\/[EMAIL PROTECTED], @\[I\](.*?)\[\/[EMAIL PROTECTED],
@\[URL=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED],
@\[IMG=([^\]]*)[EMAIL PROTECTED],
   
 @\[QUOTE=([^\]]*)\]([^\[]*?)\[\/[EMAIL PROTECTED]
 );

 $to_arr = array( 'b\1/b', 'u\1/u', 'i\1/i',

  'a href=\1 target=_blank\2/a',

  'img src=\'.stripslashes(
 \*$this-get_image_location*( '\\1' ) ).'\ border=\0\',

  'table width=\98%\ align=\center\
 cellpadding=\1\ cellspacing=\0\ border=\0\ class=\form_type\.
   tr.
 td class=\maintext\'.stripslashes(
 \*$this-remove_mytags*( '\\2' ) ).'/td.
  /tr.
  /table'

  );

 if( is_null( $str ) )
 $str = $this-editor_content;
return preg_replace( $from_arr, $to_arr, str_replace(
   , 
 nbsp;, nl2br( $str ) ) );
 }

 ...
 }
 [/CODE]

 When it gets to parse [IMG] tags I get Fatal error: Using $this
 when not in object context in  So it seems they changed the scope
 for preg_replace callback functions. As this function is called inside
 the method shouldn't it have the scope of the class?
 Is there a workaround for this? I cannot declare a function
 get_image_location which will staticly call the method bcuz I use
 variables from instanced class.

 How are you trying to use this class? It sounds like you're trying to
 use the method statically. When a method is called statically it does
 not have a $this.

 -Stut

Yes, method was called staticly. Strange tho in php 4 it worked.
Thnx for enlighting me with this.

Andy

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



[PHP] [TEST] LINKS EXCHANGE

2007-05-28 Thread Marco Sottana
i would like to test 
www.3viso.com/addurl 
try to input your link and categories and tell me what you think about it 
thank a lot

[PHP] Tracking exit links with php?

2007-05-28 Thread Merlin

Hi there,

I am wondering if it is possible to track links on for example google 
adsense as exit URLs with PHP. You can track referers, I know, but what 
about the adsense banner on your pages. Did you ever wonder which page 
exactly leads to a click?


I would like to track which adsense link they clicked on what page.
Is this even possible? The ads are implemented into the publisher pages, 
but the ad itself is delivered by there adservers, so there is no 
logentry or similar on my server.


Any ideas on how to track that?

Thanx for any hint.

Best regards, Merlin

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



[PHP] Re: PHP5 oop question...

2007-05-28 Thread Jared Farrish

When in-scope and using static functions, use self:

code

class Static_Ex {
   private static $variable = 'This is a static variable';
   public static function tryStatic() {
   return self::$variable;
   }
}
echo Static_Ex::tryStatic();

/code

If you think about it, there is no $this in a static function. If static
functions do not need an instatiated object to access class code, you don't
refer to them the same, nor do you use $this internally inside the functions
that are static.

Using static functions and variables is quite tricky. Static methods and
variables make tasks like programming a singleton to point to a single
database connection for all database activities on a website simple and
easy. But if it has to interact with the internals of an instantiated object
within it's own class, then you need to either pass in all variables
(Static_Ex::method($this) when in scope to an instantiated object should
work), and/or make it work entirely on it's own without $this.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Tracking exit links with php?

2007-05-28 Thread Jared Farrish

Any ideas on how to track that?


Two things:

1) This is probably going to have to some kind of javascript spy that
reports to a (php/asp/python/ruby) page for recording onUnload().
2) You might read the Google AdSense legalese to see if they allow it, or if
they provide it (maybe for a fee). What you want is access to their redirect
page log.

You also might look into Urchin and the ISP's that support it.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Tracking exit links with php?

2007-05-28 Thread Tijnema

On 5/28/07, Merlin [EMAIL PROTECTED] wrote:

Hi there,

I am wondering if it is possible to track links on for example google
adsense as exit URLs with PHP. You can track referers, I know, but what
about the adsense banner on your pages. Did you ever wonder which page
exactly leads to a click?

I would like to track which adsense link they clicked on what page.
Is this even possible? The ads are implemented into the publisher pages,
but the ad itself is delivered by there adservers, so there is no
logentry or similar on my server.

Any ideas on how to track that?

Thanx for any hint.

Best regards, Merlin



You would need to edit the javascript code from google, this is
possible, but I don't think google will be happy with it, and they
will probably say that you were doing illegal actions by modifing the
code and you won't get any money ...

Tijnema

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



[PHP] php and Ajax problem

2007-05-28 Thread Richard Kurth
I can not figure out way this is not working can somebody help?
 
html
head
 titleUntitled/title
script language=JavaScript
function createRequestObject() {
 
   var req;
 
   if(window.XMLHttpRequest){
  // Firefox, Safari, Opera...
  req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
  // Internet Explorer 5+
  req = new ActiveXObject(Microsoft.XMLHTTP);
   } else {
  // There is an error creating the object,
  // just as an old browser is being used.
  alert('Problem creating the XMLHttpRequest object');
   }
 
   return req;
 
}
 
// Make the XMLHttpRequest object
var http = createRequestObject();
 
function sendRequest(action,arg) {
   // Open PHP script for requests
   http.open('get', 'eventaction.php?takeaction='+action+'uid='+arg);
   http.onreadystatechange = handleResponse;
   http.send(null);
 
}
 
function handleResponse() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
 
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById(update[0]).innerHTML = update[1];
}
}
}
/script
/head
 
body
?php 
 $event['deleteevent']='a
href=javascript:sendRequest(delete,32423434234234234324)Delete this
event/a';
 
 echo $event['deleteevent'];
?
/body
/html
 
 
 
this  is the 'eventaction.php script yo test if the ajax script works
?
if($_GET['takeaction']==delete){
$uid=$_GET['uid'];
echo $uid;
exit;
}
 

?


[PHP] Unknown number of check boxes?

2007-05-28 Thread Søren Neigaard

Hi

I would like to have a unknown number of generated check boxes like  
this:


input type=checkbox name=chk01 /
input type=checkbox name=chk02 /
input type=checkbox name=chk0X /

And the name will be generated chk01 to chk99, but how do I make  
the receiving PHP script that scans for post variables that are  
sent, so that I can work on this information?


Best regards
Søren

smime.p7s
Description: S/MIME cryptographic signature


[PHP] Upload a ppt file

2007-05-28 Thread tedd

Hi Gang:

I can upload a text file and an image file via a html form, but I am 
having problems uploading a PowerPoint file. Apparently, that's a 
different critter.


Does any have any references or an example to show me?

Thanks,

Cheers,

tedd

--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Unknown number of check boxes?

2007-05-28 Thread Stephen

Søren Neigaard wrote:

I would like to have a unknown number of generated check boxes like this:

input type=checkbox name=chk01 /
input type=checkbox name=chk02 /
input type=checkbox name=chk0X /

And the name will be generated chk01 to chk99, but how do I make the 
receiving PHP script that scans for post variables that are sent, so 
that I can work on this information?



The form posting agent will only return values for boxes that are checked.

You can do isset in a loop up to the maximum possible value.

But I suspect that you are generating the form dynamically. If that is 
the case, add a hidden input with a value of the number of checkboxes. 
That would be the upper limit of your loop.


Stephen

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



[PHP] Re: Upload a ppt file

2007-05-28 Thread Jared Farrish

Does any have any references or an example to show me?


Well, I think we need a description of the error or the invalid response
you're having. It could be a file-size issue (your php.ini configuration
won't allow file sizes  8mb's, for instance).

Have you googled it?

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] php and Ajax problem

2007-05-28 Thread Stut
Not even slightly a PHP question, but since it's a bank holiday I seem 
to temporarily be in a more helpful mood.


Richard Kurth wrote:
?php 
 $event['deleteevent']='a

href=javascript:sendRequest(delete,32423434234234234324)Delete this
event/a';
 
 echo $event['deleteevent'];

?


I'm thinking you need some quotes aroung delete, and possibly around the 
number given its size.


-Stut

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



Re: [PHP] php and Ajax problem

2007-05-28 Thread Tijnema

On 5/28/07, Richard Kurth [EMAIL PROTECTED] wrote:

I can not figure out way this is not working can somebody help?

html
head
 titleUntitled/title
script language=JavaScript
function createRequestObject() {

  var req;

  if(window.XMLHttpRequest){
 // Firefox, Safari, Opera...
 req = new XMLHttpRequest();
  } else if(window.ActiveXObject) {
 // Internet Explorer 5+
 req = new ActiveXObject(Microsoft.XMLHTTP);
  } else {
 // There is an error creating the object,
 // just as an old browser is being used.
 alert('Problem creating the XMLHttpRequest object');
  }

  return req;

}

// Make the XMLHttpRequest object
var http = createRequestObject();

function sendRequest(action,arg) {
  // Open PHP script for requests
  http.open('get', 'eventaction.php?takeaction='+action+'uid='+arg);
  http.onreadystatechange = handleResponse;
  http.send(null);

}

function handleResponse() {
   if(http.readyState == 4){
   var response = http.responseText;
   var update = new Array();

   if(response.indexOf('|' != -1)) {
   update = response.split('|');
   document.getElementById(update[0]).innerHTML = update[1];
   }
   }
}
/script
/head

body
?php
 $event['deleteevent']='a
href=javascript:sendRequest(delete,32423434234234234324)Delete this
event/a';

 echo $event['deleteevent'];
?
/body
/html



this  is the 'eventaction.php script yo test if the ajax script works
?
if($_GET['takeaction']==delete){
$uid=$_GET['uid'];
echo $uid;
exit;
}


?



Try firefox and take a look at the javascript console, it points you
to any javascript syntax errors.

Tijnema

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



[PHP] Re: Unknown number of check boxes?

2007-05-28 Thread Jared Farrish

Stephen Neigaard wrote:

I would like to have a unknown number of generated check boxes like this:

input type=checkbox name=chk01 /
input type=checkbox name=chk02 /
input type=checkbox name=chk0X /

And the name will be generated chk01 to chk99, but how do I make the
receiving PHP script that scans for post variables that are sent, so
that I can work on this information?


Inspect this code example to see a way to handle this problem using magic
form variables in contained POST arrays:

code
h4Test of Multiple Checkboxes/h4
form method=post action=?php echo($_SERVER['PHP_SELF']); ?
?php

function getCheckboxes() {
   for ($i = 100; $i  0; $i--) {
   $tr = $i % 5 === 0 ? Array('','') : Array('tr','/tr');
   $str .= labelinput type=\checkbox\  .
   name=\form[checks][]\ value=\$i\ / Input
#$i/label\n;
   }
   return $str;
}
echo(getCheckBoxes());

?
pinput type=submit //p
/form
hr /
pre
?php

if (!empty($_POST)) {
   print_r($_POST);
}
?
/pre
h4Consuming of form post/h4
pAn example of inverting a posted checkbox array to support $checked[45]
=== true behavior, making it easier to access and test the posted
content/p
pre
?php

// This will return an array that has inverted the posted
// items that were in checkboxes and had a state of
// checked=true
function consumeFormChecks($arr) {
   $consume = Array();
   for ($i = 0; $i  count($arr); $i++) {
   $consume[$arr[$i]] = true;
   }
   return $consume;
}
if (!empty($_POST)) {
   print_r(consumeFormChecks($_POST['form']['checks']));
}else {
   echo('h4Please select some random checkboxes above' .
' and submit the form/h4');
}

?
/pre
/code
--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Re: Unknown number of check boxes?

2007-05-28 Thread Jared Farrish

On 5/28/07, Jared Farrish [EMAIL PROTECTED] wrote:


$tr = $i % 5 === 0 ? Array('','') : Array('tr','/tr');



Ignore this line, it was from an earlier iteration of that function.

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


Re: [PHP] Upload a ppt file

2007-05-28 Thread Tijnema

On 5/28/07, tedd [EMAIL PROTECTED] wrote:

Hi Gang:

I can upload a text file and an image file via a html form, but I am
having problems uploading a PowerPoint file. Apparently, that's a
different critter.

Does any have any references or an example to show me?

Thanks,

Cheers,

tedd


It should work with the same form you used for image  text files, but
make sure you still have enctype set to multipart/form-data.
Also, like Jared said, make sure it isn't limited by any option, this
could be the upload filesize limit, but also memory limit if you were
planning to upload big files :)

Tijnema

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



[PHP] Tuning LAMP systems: Optimizing Apache and PHP

2007-05-28 Thread Daevid Vincent
I saw this on article on Digg. 
Reposting here in case anyone is interested or missed it being a holiday
today and all...
http://digg.com/programming/Optimize_PHP_and_Accelerate_Apache
 
Direct links:
http://www.ibm.com/developerworks/linux/library/l-tune-lamp-1/index.html
http://www.ibm.com/developerworks/linux/library/l-tune-lamp-2.html
and it seems there will be one more on the way...

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



[PHP] Web Application Design Literature

2007-05-28 Thread Steve Finkelstein
Hello -

I'm looking for recommendations on literature which will give me ideas
on best practices for design and implementation of web applications,
with if possible, PHP as its core reference language.

Syntax has never been the challenge for me, like for most, it's always
been the most practical and intelligent way to break up an application
and focus on how to putting it all together for reusability and
maintaining the application.

Anyhow, suggestions are appreciated.

Cheers!

- sf

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



[PHP] exec dont work for svn

2007-05-28 Thread Manolet Gmail

hi, i want to do a svn update (subversion) from php using exec (or system)

now, this works:

exec(ls; pwd,$out);
foreach($out as $line)echobr/$line\n;

and this also works and print me the help from subversion:

exec(svn help,$out);
foreach($out as $line)echobr/$line\n;

but this doesnt work:

exec(svn update,$out);
foreach($out as $line)echobr/$line\n;

dont print anything... dont update the files, pwd returns me the
correct path...

any ideas? im using cpanel... php5 and fedora 4 php runs as nobody...

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



[PHP] Re: Web Application Design Literature

2007-05-28 Thread Jared Farrish

I'm looking for recommendations on literature which will give me ideas
on best practices for design and implementation of web applications,
with if possible, PHP as its core reference language.

Syntax has never been the challenge for me, like for most, it's always
been the most practical and intelligent way to break up an application
and focus on how to putting it all together for reusability and
maintaining the application.

Anyhow, suggestions are appreciated.


Check out www.opensourcecms.org and look for the type of app you need for
suggestions of different prebuilt php projects.

http://www.opensourcecms.com/

I like the Harry Fuecks books on sitepoint, as well as the O'Reilly books.
Professional PHP5 from Wrox is pretty good, too.

For a general framework-style, I like seagull:

http://www.seagullproject.org

If you're going to be doing object-oriented programming techniques, keep in
mind PHP is quite a bit different from other languages (such as C#) in the
way it implements some details of objects, and that PHP4 and PHP5 are quite
significantly different versions, vis-a-vis objects and classes.

Good luck!

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] php execute command on server

2007-05-28 Thread Jody Gugelhupf
hi ppl :)
i run apache 2 on ubuntu feisty with php 5, i have website on which i have 2 
links, the first is a
php which should start a vlc stream server on my server (see below), streaming 
from my tvcard, the
vlc command itself executed on my machine from the console shows that the 
command works fine, this
probably means that somehting is wrong with my php file.
the second command opens the vlc stream from the server, which works fine too
anyhow back to the first command the vlc stream server executer, i can see it 
in the list of the
running processes on my machine, but the stream does not work, i don't know 
why, either there is
somehting wrong with my php:

?php
// outputs the username that owns the running php/httpd process
// (on a system with the whoami executable in the path)
echo system('vlc
v4l:/dev/video0:norm=pal:frequency=767250:size=320x240:channel=0:adev=/dev/dsp:audio=0
 --sout
\'#transcode{vcodec=mp4v,acodec=mpga,vb=3000,ab=256,vt=80,keyint=80,deinterlace=blend}:std{access=http,mux=ts,url=10.0.0.1:8082}\'
--ttl 12 -I dummy');
?

or does the www-data (apache) user needs special user permissions to access the 
devices
/dev/video0  /dev/dsp ? i have no clue, is there a way to see some output? thx 
for the help :)
katie


  Get news delivered with the All new Yahoo! Mail.  Enjoy RSS feeds right 
on your Mail page. Start today at http://mrd.mail.yahoo.com/try_beta?.intl=ca

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



[PHP] a question on session ID and security

2007-05-28 Thread Davis Chan
Hi! I am developing a site with some authenticated users only features. 
I would like to know if the following is true:


1. script for login process is located on a SSL-enabled server, so 
usernames and passwords are encrypted.
2. upon successful login, user is relocated to a non-SSL-enabled server 
which hosts the scripts that contain the authenticated-user-only features.


So, while usernames and passwords are protected by SSL, the PHPSESSID is 
not. In other words, anyone who captures that HTTP GET packet can get 
the session ID. Is that true?
Another question is while that session ID is valid only before an 
unset() and a session_destroy(). So the attacker who has the session ID 
must fake the session before the real user logout. Is that true?


Thanks in advance for any help offered.

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



[PHP] Re: a question on session ID and security

2007-05-28 Thread Jared Farrish

1. script for login process is located on a SSL-enabled server, so
usernames and passwords are encrypted.

https:// is an envelope encryption, so POST data, which is a part of the
packet data, not packet headers, is encrypted. As long as you POST or COOKIE
data that needs encryption, you're fine. GET is not secure.


2. upon successful login, user is relocated to a non-SSL-enabled server
which hosts the scripts that contain the authenticated-user-only features.

If this is what you're doing (header() or a meta-refresh html tag).


So, while usernames and passwords are protected by SSL, the PHPSESSID is
not. In other words, anyone who captures that HTTP GET packet can get
the session ID. Is that true?

There are a few different attack vectors with SESSION data. Needless to say,
never store or authenticate by a PHP SESSION id only; use cookies or encrypt
a page with script and include() the content per page, and force users to
login every page change.


Another question is while that session ID is valid only before an
unset() and a session_destroy(). So the attacker who has the session ID
must fake the session before the real user logout. Is that true?

Before the session is destroyed and the temp file where it is stored is
deleted from the harddrive. Do not store sensitive information or use a
SESSION id to authenticate a user.


--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: If the only tool you have is a hammer, you tend to see
every problem as a nail. $$


[PHP] Client does not support authentication protocol...

2007-05-28 Thread Tom
Hi, as always, I'm trying to connect to a MySQL database in the following 
way:

mysql_connect('host','user','password');

In my local PC this Works perfectly, but in the server I receipt the 
following error:

mysql_connect(): Client does not support authentication protocol requested 
by server; consider upgrading MySQL client

Which can the cause of this error be?
Am I able to make something to solve it or does a problem belong exclusively 
to the administrator of the server?

Thank you very much,

Tom. 

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



Re: [PHP] Client does not support authentication protocol...

2007-05-28 Thread Chris

Tom wrote:
Hi, as always, I'm trying to connect to a MySQL database in the following 
way:


mysql_connect('host','user','password');

In my local PC this Works perfectly, but in the server I receipt the 
following error:


mysql_connect(): Client does not support authentication protocol requested 
by server; consider upgrading MySQL client


Did you search google and look at the mysql website to see what the 
problem is?


--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Streaming download to IE doesn't work

2007-05-28 Thread Daniel Kasak
Hi all.

I'm streaming a file ( location of which is to be hidden from clients,
hence the need to stream ). Basically I'm doing:

---

session_start();
// some authentication stuff and figuring out the path goes here
// ...
// ...
$source = /accounts_reports/ . $_GET['id'] . .bin;
header( Content-Disposition: attachment; filename=\ . $orig . \ );
header( Content-Length:  .filesize( $source ) );
header( Content-Type: application/octet-stream );
header( Pragma: no-cache );
header( Expires: 0 );
readfile( $source );

---

This works *perfectly* with firefox. It doesn't work at all with
Internet Explorer. Also ( not sure if this matters or not ), the site is
accessed via https ONLY.

When I click the link to my download php script, I get a dialog asking
if I want to open or save the file, and then whnatever I click, I get:


 Internet Explorer cannot download download.php?id=32 from IP_ADDRESS.
 
 Internet Explorer was not able to open this Internet site. The
 requested site is either unavailable or cannot be found. Please try
 again later.

However, a quick check of apache's ssl access log shows that IE did in
fact 'find' the site. Also, IE is producing the download dialog, which
suggests that it's 'found' the download.php script fine.

Now, before I get a litany of 'just use firefox then' responses, rest
assured that I would take this approach if I could, but the site is for
a customer, and they are in turn doing it for their customers, and this
just isn't going to fly. It MUST work with IE.

Who knows WTF is wrong and how I can work around it?

--
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: [EMAIL PROTECTED]
website: http://www.nusconsulting.com.au

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



Re: [PHP] Client does not support authentication protocol...

2007-05-28 Thread Chris

Firstly always CC the mailing list - others can learn from the info as well.

Ing. Tomás Liendo wrote:
Yes, but the solutions that figure in the Web are only applicable if one 
has access like administrator to the server.

I can't make things like upgrade versions or configure MySQL or PHP.
What I want to know is if I can make something as programmer or I need 
to contact the administrator of the server.


Basically you have a mismatch between the client library and the server 
version.


eg you have something like:

mysql5-client
mysql4-server

which isn't going to work.


Nothing you can do as a programmer but point the server-admin to the 
mysql site and say please fix.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] php execute command on server

2007-05-28 Thread Greg Donald

On 5/28/07, Jody Gugelhupf [EMAIL PROTECTED] wrote:

or does the www-data (apache) user needs special user permissions to access the 
devices
/dev/video0  /dev/dsp ? i have no clue, is there a way to see some output? thx 
for the help :)


You can become the user you want to test permissions for:

sudo su -

su - www-data

On my Feisty install the www-data user does not have the permissions
you require.

cat /dev/dsp
cat: /dev/dsp: Permission denied

To access /dev/dsp the www-data user needs to be a member of the audio
group.  You can use usermod to add the audio group to the www-data
user:

usermod -G www-data,audio www-data

After this I begin to get output from /dev/dsp as the www-data user.

Hope that help.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] exec dont work for svn

2007-05-28 Thread Greg Donald

On 5/28/07, Manolet Gmail [EMAIL PROTECTED] wrote:

but this doesnt work:

exec(svn update,$out);
foreach($out as $line)echobr/$line\n;

dont print anything... dont update the files


Is it possible you need to provide some type of authentication?  `svn
update` may be asking for input your exec call isn't providing.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] php and Ajax problem

2007-05-28 Thread Jim Lucas

Richard Kurth wrote:

I can not figure out way this is not working can somebody help?
 
html

head
 titleUntitled/title
script language=JavaScript
function createRequestObject() {
 
   var req;
 
   if(window.XMLHttpRequest){

  // Firefox, Safari, Opera...
  req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
  // Internet Explorer 5+
  req = new ActiveXObject(Microsoft.XMLHTTP);
   } else {
  // There is an error creating the object,
  // just as an old browser is being used.
  alert('Problem creating the XMLHttpRequest object');
   }
 
   return req;
 
}
 
// Make the XMLHttpRequest object

var http = createRequestObject();
 
function sendRequest(action,arg) {

   // Open PHP script for requests
   http.open('get', 'eventaction.php?takeaction='+action+'uid='+arg);
   http.onreadystatechange = handleResponse;
   http.send(null);
 
}
 
function handleResponse() {

if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
 
if(response.indexOf('|' != -1)) {


So, if it doesn't find a | (pipe) in the returned page, it won't do 
anything!



update = response.split('|');
document.getElementById(update[0]).innerHTML = update[1];
}
}
}
/script
/head
 
body
?php 
 $event['deleteevent']='a

href=javascript:sendRequest(delete,32423434234234234324)Delete this
event/a';
 
 echo $event['deleteevent'];

?
/body
/html
 
 
 
this  is the 'eventaction.php script yo test if the ajax script works

?


Does your server allow for short_tags = On ???

if($_GET['takeaction']==delete){
$uid=$_GET['uid'];
echo $uid;


Well, as mentioned above, where is the | (pipe) that your JS code is 
expecting???


Plus, where is the name of the object that you are wanting to take 
action upon?  Looks like your JS is needing something like this.


echo {$div_id}|{$uid};

Hope this helps


exit;
}
 


?



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



Re: [PHP] Uploading Files into MySQL

2007-05-28 Thread Greg Donald

On 5/24/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

I am working on a script to upload files into MySQL db.  The following
script uploads to a file system how do I go about uploading the file
into the DB?  Where do I put the SQL statement in the code below?

move_uploaded_file($_FILES['myfile']['tmp_name'],
/var/www/.$_FILES['myfile']['name']);


Right here you would read the file into a string with
file_get_contents(), then write an SQL query to insert the string.


--
Greg Donald
http://destiney.com/

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



Re: [PHP] Unknown number of check boxes?

2007-05-28 Thread Jim Lucas

Søren Neigaard wrote:

Hi

I would like to have a unknown number of generated check boxes like this:

input type=checkbox name=chk01 /
input type=checkbox name=chk02 /
input type=checkbox name=chk0X /


input type=checkbox name=chk[] value=Check box One /
input type=checkbox name=chk[] value=Check box Two /
input type=checkbox name=chk[] value=Check box Three /

Then one the processor page, have it grab the array of indexed results 
being submitted.


if (isset($_REQUEST['chk']) 
is_array( $_REQUEST['chk']) 
count($_REQUEST['chk'])  0 ) {

foreach ( $_REQUEST['chk'] AS $index = $value ) {

//Do something here with the checkboxes submitted

}

}



And the name will be generated chk01 to chk99, but how do I make the 
receiving PHP script that scans for post variables that are sent, so 
that I can work on this information?


Best regards
Søren


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



Re: [PHP] Form Validation Issues

2007-05-28 Thread Greg Donald

On 5/24/07, Robert Cummings [EMAIL PROTECTED] wrote:

*lol* You must have missed the other thread... hence the wink on the
end :)


I'm guessing not everyone uses a threaded email client.  And some
people always feel the need to post their 'thoughts' no matter how
well the question has already been beaten to death.  :)


--
Greg Donald
http://destiney.com/

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