Re: [PHP] javascript cookie dissapears when adding session_start()

2013-03-20 Thread ma...@behnke.biz
Please re-send the link for your code.

> Norah Jones  hat am 20. März 2013 um 15:19 geschrieben:
>
>
> I've been working on a PHP/Javascript Cookie Notify (Including multiple
> language support). Now I have one small problem, when session_start() is not
> at the top, the cookie message works as it should be.
> Now I am trying to add session_start(); at the top, as this will load the
> current language file the visitor has set it to. But then the cookie message
> will not show.
> I've cleaned all my cookies, and still can't get it to work ...
> I've put up a small code on jsFiddle, but when session_start(); is at the top,
> it launches correctly in jsFiddle. which can be viewed (here).
> Does anyone know what i'm doing wrong? And would you be able to explain me
> what I am doing wrong?
>
> Thanks
>

--
Marco Behnke
Dipl. Informatiker (FH), SAE Audio Engineer Diploma
Zend Certified Engineer PHP 5.3

Tel.: 0174 / 9722336
e-Mail: ma...@behnke.biz

Softwaretechnik Behnke
Heinrich-Heine-Str. 7D
21218 Seevetal

http://www.behnke.biz

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



[PHP] javascript cookie dissapears when adding session_start()

2013-03-20 Thread Norah Jones
I've been working on a PHP/Javascript Cookie Notify (Including multiple 
language support). Now I have one small problem, when session_start() is not at 
the top, the cookie message works as it should be. 
Now I am trying to add session_start(); at the top, as this will load the 
current language file the visitor has set it to. But then the cookie message 
will not show.
I've cleaned all my cookies, and still can't get it to work ...
I've put up a small code on jsFiddle, but when session_start(); is at the top, 
it launches correctly in jsFiddle. which can be viewed (here).
Does anyone know what i'm doing wrong? And would you be able to explain me what 
I am doing wrong?

Thanks



Re: [PHP] Javascript detection

2011-04-28 Thread Geoff Lane
On Thursday, April 28, 2011, Ashley Sheridan wrote:

> I'm not sure if my earlier reply got through, but here it is again (or
> at least the general gist of it)

Many thanks. I got your info the first time around but didn't respond
directly to you as Tedd made similar comments and I'd responded to his
post.

> Like everyone has mentioned thus far, it's better to use progressive
> enhancement or try to avoid relying on Javascript at all. Even a website
> as complex as Facebook allows users to go on it without needing a
> browser that runs Javascript. Something as complex as Google Docs has a
> very clear need for Javascript though, so you wouldn't expect that to
> work without it.

In my case, one of the controls I'm considering is a tiled map with up
to 16 tiles. This is on a page with four tabbed sections that takes
several seconds to load at broadband speeds. Also, the nature of the
site means that people may need to access it and use this form while
connected via mobile broadband or even GSM; connection media that are
usually both slow and paid for per unit of data transfer. I need to
record in hidden input fields the location of where a user clicks on
the map and also echo that click back in the form of a marker overlaid
on the clicked tile. Using AJAX, I can update just the two fields plus
one image. Without Javascript, the extra bandwidth needed to
unnecessarily download the entire page multiple times will cost my
users both time and money. So while I must ensure the site works
without Javascript, I really need the optimisation that JS brings.

> Lastly, if you're creating the website for a government or business, you
> really need to make it work without Javascript, as a lot of countries
> make it illegal to discriminate against a disability, which you would be
> doing if you made a site that was unusable without Javascript. After
> all, there are many speech and Braille browsers out there that can't
> take advantage of Javascript, and a lot of Javascript apps which require
> mouse interaction to run (mouseover/hover events, etc)

AIUI, a lot of countries (mine included) make it unlawful to knowingly
discriminate against the disabled. However, The Disability
Discrimination Act requires only that reasonable steps be taken to
avoid discrimination ... and making stuff accessible to the disabled
at considerable inconvenience and/or expense to everyone else is not
considered reasonable. Now where I can, I'll produce stuff that is
enhanced by images, colour, JS etc. but will still be usable in Lynx.
However, some stuff (e.g. mapping) won't work without graphics and so
is inherently unavailable to the visually impaired. It makes no sense
whatever to try to make such content work in speech and Braille
browsers. Thus making a site that's unusable without Javascript
doesn't necessarily constitute unlawful discrimination!

-- 
Geoff


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



Re: [PHP] Javascript detection

2011-04-28 Thread Ashley Sheridan
On Thu, 2011-04-28 at 10:17 -0400, tedd wrote:

> At 9:02 AM +0100 4/28/11, Geoff Lane wrote:
> >
> >FWIW, it's possible to detect whether or not Javascript is available,
> >but not AFAICT at 'first contact' because you need the 'first contact'
> >page to do something to prove that JS is available, from which you can
> >assume that JS is not should that something not be done. For example,
> >you can make the link to a page into a form submission - e.g:
> >
> >   
> >   
> >   
> >>onClick="document.forms['jstest'].submit();return(false);">
> >   Click Here
> >
> >The form is submitted if the browser has JS and so the hidden input
> >field is posted. However, if the browser doesn't have JS the default
> >behaviour occurs when the link is clicked and so the field is not
> >posted. Hence we can use isset($_POST['wehavejs']) to determine
> >whether or not the browser has JS capability.
> >
> >Thanks again,
> >
> >--
> >Geoff
> 
> Geoff:
> 
> You are correct about "first contact" -- you need to launch the 
> browser to check to see if the browser has javascript enabled. 
> There's currently no way for the server to see what the user has 
> selected for their browser before the browser launches.
> 
> It is true that the $_SERVER global provides all sorts of information 
> about the requester and I suppose it could also contain the browser's 
> javascript configuration, but it doesn't.
> 
> However, JavaScript detection doesn't require a user's response, as 
> you have proposed via a form.
> 
> Instead, you can simply add an "onload()" operation to the page and 
> detect javascript, such as:
> 
> http://www.webbytedd.com/b1/ajax-js-dection/
> 
> Or do it unobtrusively as I have shown before.
> 
> Cheers,
> 
> tedd
> 
> 
> -- 
> ---
> http://sperling.com/
> 


I'm not sure if my earlier reply got through, but here it is again (or
at least the general gist of it)

There are ways you can detect if a browser is *capable* of running
Javascript using $_SERVER['HTTP_USER_AGENT'] and an up-to-date
browscap.ini file. This will allow you to check if the browser indicated
by the user agent. However, there are caveats to this approach:


  * A browser might be sending the wrong user agent string, there
are plenty of plugins which do this
  * A browser might be capable of running Javascript but might have
it turned off or otherwise blocked
  * Filtering may be going on by a proxy server or firewall that
strips out Javascript (sounds stupid but happens in paranoid
businesses)


Like everyone has mentioned thus far, it's better to use progressive
enhancement or try to avoid relying on Javascript at all. Even a website
as complex as Facebook allows users to go on it without needing a
browser that runs Javascript. Something as complex as Google Docs has a
very clear need for Javascript though, so you wouldn't expect that to
work without it.

Lastly, if you're creating the website for a government or business, you
really need to make it work without Javascript, as a lot of countries
make it illegal to discriminate against a disability, which you would be
doing if you made a site that was unusable without Javascript. After
all, there are many speech and Braille browsers out there that can't
take advantage of Javascript, and a lot of Javascript apps which require
mouse interaction to run (mouseover/hover events, etc)

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] Javascript detection

2011-04-28 Thread tedd

At 9:02 AM +0100 4/28/11, Geoff Lane wrote:


FWIW, it's possible to detect whether or not Javascript is available,
but not AFAICT at 'first contact' because you need the 'first contact'
page to do something to prove that JS is available, from which you can
assume that JS is not should that something not be done. For example,
you can make the link to a page into a form submission - e.g:

  
  
  
  onClick="document.forms['jstest'].submit();return(false);">

  Click Here

The form is submitted if the browser has JS and so the hidden input
field is posted. However, if the browser doesn't have JS the default
behaviour occurs when the link is clicked and so the field is not
posted. Hence we can use isset($_POST['wehavejs']) to determine
whether or not the browser has JS capability.

Thanks again,

--
Geoff


Geoff:

You are correct about "first contact" -- you need to launch the 
browser to check to see if the browser has javascript enabled. 
There's currently no way for the server to see what the user has 
selected for their browser before the browser launches.


It is true that the $_SERVER global provides all sorts of information 
about the requester and I suppose it could also contain the browser's 
javascript configuration, but it doesn't.


However, JavaScript detection doesn't require a user's response, as 
you have proposed via a form.


Instead, you can simply add an "onload()" operation to the page and 
detect javascript, such as:


http://www.webbytedd.com/b1/ajax-js-dection/

Or do it unobtrusively as I have shown before.

Cheers,

tedd


--
---
http://sperling.com/

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



Re: [PHP] Javascript detection

2011-04-28 Thread Per Jessen
tedd wrote:

> As Yogi Berra once said; "It's always hard to predict things
> especially when it deals with the future."
> 

He was quoting Niels Bohr:

http://www.quotationspage.com/quote/26159.html



-- 
Per Jessen, Zürich (10.2°C)


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



Re: [PHP] Javascript detection

2011-04-28 Thread Geoff Lane
 On Thursday, April 28, 2011, tedd wrote:
 
> To answer your question in a new thread.

> No, the $_SERVER super-global isn't going to give you anything nor is 
> anything else like it.

> You see, PHP has a difficult time detecting IF Javascript is turned 
> ON in the client's browser because PHP is history by the time the 
> browser does anything, including running Javascript.

Thanks, Tedd. That's how I suspected things to be. However, the list
was very quiet, I might have missed something, and so I felt it
couldn't hurt to ask. TBH I'd already done:

 echo "";
 print_r ($_SERVER);
 echo "";

and didn't spot anything there that I thought would give me the info I
sought - but then I don't know the purpose of every element of that
array and $_SERVER is not the only superglobal!

> As Yogi Berra once said; "It's always hard to predict things 
> especially when it deals with the future."

However, once the browser has requested a transfer via HTTP that
request is in the past and that request is where stuff that lets you
know some of the browser's capabilities (e.g. HTTP_ACCEPT) comes from.
So it would be possible by a similar mechanism for a browser to tell
your script whether or not Javascript (or any other language for that)
is available.

> However, there are two ways to "kind-of" doing it:

> Way 1 --  I place an element in html that is hidden from the user's 
> view via css (display:none) and if Javascript is ON then Javascript 
> changes the css so that the element is shown to the user 
> (display:block). Here's an example:

This is the reverse of part of what I've done for the page in
question. I had a tabbed interface similar to:


[stuff]


[stuff]

...

However, the second div must be visible if JS isn't available
otherwise the user can't access that section. So I've changed the
style of the second and subsequent divs to display:block and then used
an onLoad routine to change the .style.display and .style.visibility
attributes of the second and subsequent divs to none and hidden
respectively so that those who have JS get the full DHTML.

Now I also using AJAX on that page. However, I can use the fact that
the trigger events aren't handled if JS isn't available to just
retrieve what's actually needed at the time via AJAX if JS is
available or submit the full form if it's not. Of course, that
complicates things in the PHP on the server as the script then has to
handle both interim and final form submission.

FWIW, it's possible to detect whether or not Javascript is available,
but not AFAICT at 'first contact' because you need the 'first contact'
page to do something to prove that JS is available, from which you can
assume that JS is not should that something not be done. For example,
you can make the link to a page into a form submission - e.g:

  
  
  
  
  Click Here

The form is submitted if the browser has JS and so the hidden input
field is posted. However, if the browser doesn't have JS the default
behaviour occurs when the link is clicked and so the field is not
posted. Hence we can use isset($_POST['wehavejs']) to determine
whether or not the browser has JS capability.

Thanks again,

-- 
Geoff


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



[PHP] Javascript detection

2011-04-27 Thread tedd

At 6:42 PM +0100 4/27/11, Geoff Lane wrote:

However, I do have one residual question. I suspect the short answer
to this is "No", but since the list is quiet I'll ask anyway:

Q: Is it possible to check whether Javascript is available on the
client without using client-side Javascript to create a form and hence
pass a variable that will only be set if Javascript is available on
the client? Is there something in $_SERVER etc. that can provide this
info?


Geoff:

To answer your question in a new thread.

No, the $_SERVER super-global isn't going to give you anything nor is 
anything else like it.


You see, PHP has a difficult time detecting IF Javascript is turned 
ON in the client's browser because PHP is history by the time the 
browser does anything, including running Javascript.


As Yogi Berra once said; "It's always hard to predict things 
especially when it deals with the future."


However, there are two ways to "kind-of" doing it:

Way 1 --  I place an element in html that is hidden from the user's 
view via css (display:none) and if Javascript is ON then Javascript 
changes the css so that the element is shown to the user 
(display:block). Here's an example:


http://php1.net/b/show-hide/

Try clicking "MORE"

That way Javascript routines are shown to the user only if the user's 
browser is capable of running Javascript. If Javascript is OFF then 
nothing happens.


Way 3 -- another way is to use unobtrusive Javascript -- here's an 
example I did for my students:


http://www.webbytedd.com/aa/add-onclick-button/index.php

If Javascript is OFF, then the "Add Another Record" button is not 
seen by the user -- because it's not in the html.


However, if JavaScript is turned on, then the "Add Another Record" 
button is shown and becomes available as another option via DOM 
scripting. That's called unobtrusive Javascript.


Try it!

Now that doesn't mean that JavaScript can't call PHP, because it can 
-- look here:


http://webbytedd.com/b/timed-php/

and here:

http://webbytedd.com/a/ajax-site/

Those are examples of JavaScript running PHP scripts.

So, the world of mixing JavaScript and PHP is quite vast, but you 
have to know what run's what and when.


HTH,

tedd


--
---
http://sperling.com/

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



Re: [PHP] JavaScript Injection ???

2011-04-25 Thread tedd

At 7:45 PM -0400 4/25/11, Daniel Brown wrote:

On Mon, Apr 25, 2011 at 19:12, Nathan Rixham  wrote:


 It is the browser, chrome will prevent execution because the code was sent
 in the request, just check the javascript console and you'll see something
 like:

  "Refused to execute a JavaScript script. Source code of script found within
 request."


Easy way to get around that, depending on where it lied and how it
was stored and accessed, is to inject it into the session.  Chrome
would obviously have no notion of session data.  An added step, but
proof positive that ALL data needs to be sanitized, not just GPC and
database.

--



Most excellent point!

Cheers,

tedd
--
---
http://sperling.com/

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



Re: [PHP] JavaScript Injection ???

2011-04-25 Thread Daniel Brown
On Mon, Apr 25, 2011 at 19:12, Nathan Rixham  wrote:
>
> It is the browser, chrome will prevent execution because the code was sent
> in the request, just check the javascript console and you'll see something
> like:
>
>  "Refused to execute a JavaScript script. Source code of script found within
> request."

Easy way to get around that, depending on where it lied and how it
was stored and accessed, is to inject it into the session.  Chrome
would obviously have no notion of session data.  An added step, but
proof positive that ALL data needs to be sanitized, not just GPC and
database.

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] JavaScript Injection ???

2011-04-25 Thread Nathan Rixham

Stuart Dallas wrote:
On Monday, 18 April 2011 at 20:50, tedd wrote: 

The form "as-is" produced a javascript alert() and now it doesn't.


This is not a browser change because it's happening before the browser sees the 
response (try it with curl).


It is the browser, chrome will prevent execution because the code was 
sent in the request, just check the javascript console and you'll see 
something like:


  "Refused to execute a JavaScript script. Source code of script found 
within request."


Best,

Nathan


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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Paul M Foster
On Mon, Apr 18, 2011 at 02:42:09PM -0400, tedd wrote:


[snip]

> 
> No, I had a simple form where IF the user entered:
> 
>  alert("Evil Code");
> 
> -- into the form's text field (i.e., $_POST['text'] ) AND clicked
> Submit, the form would
> 
> echo( $_POST['text'] );
> 
> -- and that would produce a JavaScript Alert.
> 
> Here's the form:
> 
> http://php1.net/a/insecure-form/index.php
> 
> It was a simple working example of JavaScript Injection. But it no
> longer works and I want to find out why. The most popular reason
> thus far is "Browsers have changed", but I'm not sure as to what did
> change.

No longer works for *you*. Works fine for me. Ergo, I have to assume
it's a browser issue.

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread tedd

At 4:44 PM -0400 4/18/11, Daniel Brown wrote:

On Mon, Apr 18, 2011 at 15:50, tedd  wrote:


 It doesn't make any difference if I use stripslashes() or not, it still will
 NOT produce a javascript alert as it used to do.


Interestingly enough, I copied your index.php file to index2.php
on the server and modified it to use stripslashes() and, as you said,
it didn't work for me, regardless of how many times I tried.

In Chrome.

Switched over to Firefox and - wouldn't you know? - it worked like
a charm, exactly as expected, when stripslashes() was employed.  Of
course, without the call, it wouldn't work in any browser, but this is
now confirmed to be a browser issue.  Are you using Safari on your
Mac?  If so, give it a shot with Firefox and/or Internet Exploder.

--



Bingo!

That did it!

You see, I'm writing a report for my student showing them the 
security hazards of forms. I figured it would be nice if I could show 
them and example of JavaScript injection. Now, iF FF for windows does 
the same thing, then that will be great.


You know, this teaching thing is a lot of work -- I'm below minimum wage now.

Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Daniel Brown
On Mon, Apr 18, 2011 at 15:50, tedd  wrote:
>
> It doesn't make any difference if I use stripslashes() or not, it still will
> NOT produce a javascript alert as it used to do.

Interestingly enough, I copied your index.php file to index2.php
on the server and modified it to use stripslashes() and, as you said,
it didn't work for me, regardless of how many times I tried.

In Chrome.

Switched over to Firefox and - wouldn't you know? - it worked like
a charm, exactly as expected, when stripslashes() was employed.  Of
course, without the call, it wouldn't work in any browser, but this is
now confirmed to be a browser issue.  Are you using Safari on your
Mac?  If so, give it a shot with Firefox and/or Internet Exploder.

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Stuart Dallas
On Monday, 18 April 2011 at 20:50, tedd wrote: 
> Daniel et al:
> 
> Sorry -- I'm not making myself clear.
> 
> The form "as-is" produced a javascript alert() and now it doesn't.
> 
> It doesn't make any difference if I use stripslashes() or not, it 
> still will NOT produce a javascript alert as it used to do.
> 
> Seriously, try this:
> 
>  
> $insecure = $_POST['insecure'];
> //$insecure = stripslashes($insecure);
> ?>
> 
> tedd's Secure v Insecure form demo
> 
> 
> Enter (cut/paste the red)   in the field below
> and see what happens. The red is javascript code.
> 
> 
> 
> 
> Field: 
> 
> 
> 
> 
> 
> 
>  
> if ($insecure != null)
> {
> echo("This is what you entered:");
> echo("Input: $insecure");
> echo("");
> $insecure = htmlentities($insecure);
> echo("Input after htmlentites: $insecure");
> echo("");
> }
> ?>
> 
> 
> 
> You can un-comment the stripslashes() function and it will still not 
> produce a javascript alert.
Looks like some form of variable tainting. There was a proposal and a patch a 
while back, but all it did was emit a warning. I've looked at the PHP5 
changelog to see if this was added but can't find any reference to it being 
merged in.

This is not a browser change because it's happening before the browser sees the 
response (try it with curl).

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/


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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread tedd

At 2:46 PM -0400 4/18/11, Daniel Brown wrote:

On Mon, Apr 18, 2011 at 14:42, tedd  wrote:


 No, I had a simple form where IF the user entered:

  alert("Evil Code");

 -- into the form's text field (i.e., $_POST['text'] ) AND clicked Submit,
 the form would

 echo( $_POST['text'] );

 -- and that would produce a JavaScript Alert.

 Here's the form:

 http://php1.net/a/insecure-form/index.php

 It was a simple working example of JavaScript Injection. But it no longer
 works and I want to find out why. The most popular reason thus far is
 "Browsers have changed", but I'm not sure as to what did change.


Look at the post-processing source --- note the slashes.  Apply
stripslashes() to the output on the PHP side and all should be right
again with the world.

--



Daniel et al:

Sorry -- I'm not making myself clear.

The form "as-is" produced a javascript alert() and now it doesn't.

It doesn't make any difference if I use stripslashes() or not, it 
still will NOT produce a javascript alert as it used to do.


Seriously, try this:



tedd's Secure v Insecure form demo


Enter (cut/paste the red)    in the field below

and see what happens. The red is javascript code.




Field: 






This is what you entered:");
echo("Input: $insecure");
echo("");
$insecure = htmlentities($insecure);
echo("Input after htmlentites: $insecure");
echo("");
}
?>



You can un-comment the stripslashes() function and it will still not 
produce a javascript alert.


Cheers,

tedd

--
---
http://sperling.com/

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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Ashley Sheridan
On Mon, 2011-04-18 at 14:42 -0400, tedd wrote:

> At 1:09 PM -0400 4/18/11, Joshua Kehn wrote:
> >On Monday, April 18, 2011 at 1:06 PM, tedd wrote:
> >
> >>Hi gang:
> >>
> >>Quite some time ago I had a demo that showed Javascript injection. It
> >>was where a user could type in:
> >>
> >> alert("Evil Code");
> >>
> >>and a JavaScript alert would be shown.
> >>
> >>But now my demo no longer works. So, what happened? Was there a php
> >>update that prohibited that sort of behavior or did hosts start
> >>setting something to OFF, or what?
> >>
> >>If you know, please explain.
> >>
> >>Thanks,
> >>
> >>tedd
> >>--
> >>---
> >>http://sperling.com/
> >>
> >Not that I know of. Are you talking about on-page injection, like 
> >comments and such? Normally JS injection would be that (bad scripts 
> >inserted by the user on a comment form or review page) or where you 
> >are using eval() and they dump bad code into there.
> >
> >Regards,
> >
> >-Josh
> 
> No, I had a simple form where IF the user entered:
> 
>  alert("Evil Code");
> 
> -- into the form's text field (i.e., $_POST['text'] ) AND clicked 
> Submit, the form would
> 
> echo( $_POST['text'] );
> 
> -- and that would produce a JavaScript Alert.
> 
> Here's the form:
> 
> http://php1.net/a/insecure-form/index.php
> 
> It was a simple working example of JavaScript Injection. But it no 
> longer works and I want to find out why. The most popular reason thus 
> far is "Browsers have changed", but I'm not sure as to what did 
> change.
> 
> Cheers,
> 
> tedd
> 
> -- 
> ---
> http://sperling.com/
> 


>From the looks of it you're only outputting the htmlentities version of
it, so it's outputting those 

Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Daniel Brown
On Mon, Apr 18, 2011 at 14:42, tedd  wrote:
>
> No, I had a simple form where IF the user entered:
>
>  alert("Evil Code");
>
> -- into the form's text field (i.e., $_POST['text'] ) AND clicked Submit,
> the form would
>
> echo( $_POST['text'] );
>
> -- and that would produce a JavaScript Alert.
>
> Here's the form:
>
> http://php1.net/a/insecure-form/index.php
>
> It was a simple working example of JavaScript Injection. But it no longer
> works and I want to find out why. The most popular reason thus far is
> "Browsers have changed", but I'm not sure as to what did change.

Look at the post-processing source --- note the slashes.  Apply
stripslashes() to the output on the PHP side and all should be right
again with the world.

-- 

Network Infrastructure Manager
http://www.php.net/

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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread tedd

At 1:09 PM -0400 4/18/11, Joshua Kehn wrote:

On Monday, April 18, 2011 at 1:06 PM, tedd wrote:


Hi gang:

Quite some time ago I had a demo that showed Javascript injection. It
was where a user could type in:

 alert("Evil Code");

and a JavaScript alert would be shown.

But now my demo no longer works. So, what happened? Was there a php
update that prohibited that sort of behavior or did hosts start
setting something to OFF, or what?

If you know, please explain.

Thanks,

tedd
--
---
http://sperling.com/

Not that I know of. Are you talking about on-page injection, like 
comments and such? Normally JS injection would be that (bad scripts 
inserted by the user on a comment form or review page) or where you 
are using eval() and they dump bad code into there.


Regards,

-Josh


No, I had a simple form where IF the user entered:

 alert("Evil Code");

-- into the form's text field (i.e., $_POST['text'] ) AND clicked 
Submit, the form would


echo( $_POST['text'] );

-- and that would produce a JavaScript Alert.

Here's the form:

http://php1.net/a/insecure-form/index.php

It was a simple working example of JavaScript Injection. But it no 
longer works and I want to find out why. The most popular reason thus 
far is "Browsers have changed", but I'm not sure as to what did 
change.


Cheers,

tedd

--
---
http://sperling.com/

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



RE: [PHP] JavaScript Injection ???

2011-04-18 Thread Ashley Sheridan
On Mon, 2011-04-18 at 14:11 -0400, ad...@buskirkgraphics.com wrote:

> Yes Alert works fine on my browsers but the hack to change the alert on
> someone else's website has been fixed from browser updates.
> 
> 
> Richard L. Buskirk
> 
> You can't grow your business with systems that are on life support...
> 
> 
> -Original Message-
> From: Jim Giner [mailto:jim.gi...@albanyhandball.com] 
> Sent: Monday, April 18, 2011 2:03 PM
> To: php-general@lists.php.net
> Subject: Re: [PHP] JavaScript Injection ???
> 
> 
>  wrote in message 
> news:005501cbfdeb$457839c0$d068ad40$@com...
> > Javascript:alert("Hello World");
> > The browsers have had many updates since last I seen this work.
> >
> 
> ?? You're saying that "alert" doesn't work on your browse?  Gee - it works 
> on mine. 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 


I think it might have something to do with the origin of the data, as
running a quick example file works fine in Fx, Opera, Konqueror and
SeaMonkey on my computer, and even seem to work OK when run from my
local server (same machine but served from Apache instead of through the
local file:// protocol)

One other thing it could be is some sort of security mod (in PHP or
Apache) that is altering the actual HTML and isn't outputting what you
expect.
-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




RE: [PHP] JavaScript Injection ???

2011-04-18 Thread admin
Yes Alert works fine on my browsers but the hack to change the alert on
someone else's website has been fixed from browser updates.


Richard L. Buskirk

You can't grow your business with systems that are on life support...


-Original Message-
From: Jim Giner [mailto:jim.gi...@albanyhandball.com] 
Sent: Monday, April 18, 2011 2:03 PM
To: php-general@lists.php.net
Subject: Re: [PHP] JavaScript Injection ???


 wrote in message 
news:005501cbfdeb$457839c0$d068ad40$@com...
> Javascript:alert("Hello World");
> The browsers have had many updates since last I seen this work.
>

?? You're saying that "alert" doesn't work on your browse?  Gee - it works 
on mine. 



-- 
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] JavaScript Injection ???

2011-04-18 Thread Jim Giner

 wrote in message 
news:005501cbfdeb$457839c0$d068ad40$@com...
> Javascript:alert("Hello World");
> The browsers have had many updates since last I seen this work.
>

?? You're saying that "alert" doesn't work on your browse?  Gee - it works 
on mine. 



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



Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Ashley Sheridan
On Mon, 2011-04-18 at 22:43 +0530, Shreyas Agasthya wrote:

> Is someone up to Cross Site Scripting? ;)
> 
> --Shreyas
> 
> On Mon, Apr 18, 2011 at 10:39 PM, Joshua Kehn  wrote:
> 
> > On Monday, April 18, 2011 at 1:06 PM, tedd wrote:
> > Hi gang:
> > >
> > > Quite some time ago I had a demo that showed Javascript injection. It
> > > was where a user could type in:
> > >
> > >  alert("Evil Code");
> > >
> > > and a JavaScript alert would be shown.
> > >
> > > But now my demo no longer works. So, what happened? Was there a php
> > > update that prohibited that sort of behavior or did hosts start
> > > setting something to OFF, or what?
> > >
> > > If you know, please explain.
> > >
> > > Thanks,
> > >
> > > tedd
> > > --
> > > ---
> > > http://sperling.com/
> > Not that I know of. Are you talking about on-page injection, like comments
> > and such? Normally JS injection would be that (bad scripts inserted by the
> > user on a comment form or review page) or where you are using eval() and
> > they dump bad code into there.
> >
> > Regards,
> >
> > -Josh___
> > Joshua Kehn | josh.k...@gmail.com
> > http://joshuakehn.com
> >
> >
> >
> 
> 


I believe the reason for it not working now is because most browsers
won't pop up an alert without being triggered by something, i.e. a mouse
event, page load, etc. You might be able to change the code to do
something else like output to the firebug console, use document.write,
or change the status bar text (although for that to work you'll need to
change browser settings in most modern browsers like Opera, Fx, Chrome,
etc)

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] JavaScript Injection ???

2011-04-18 Thread Shreyas Agasthya
Is someone up to Cross Site Scripting? ;)

--Shreyas

On Mon, Apr 18, 2011 at 10:39 PM, Joshua Kehn  wrote:

> On Monday, April 18, 2011 at 1:06 PM, tedd wrote:
> Hi gang:
> >
> > Quite some time ago I had a demo that showed Javascript injection. It
> > was where a user could type in:
> >
> >  alert("Evil Code");
> >
> > and a JavaScript alert would be shown.
> >
> > But now my demo no longer works. So, what happened? Was there a php
> > update that prohibited that sort of behavior or did hosts start
> > setting something to OFF, or what?
> >
> > If you know, please explain.
> >
> > Thanks,
> >
> > tedd
> > --
> > ---
> > http://sperling.com/
> Not that I know of. Are you talking about on-page injection, like comments
> and such? Normally JS injection would be that (bad scripts inserted by the
> user on a comment form or review page) or where you are using eval() and
> they dump bad code into there.
>
> Regards,
>
> -Josh___
> Joshua Kehn | josh.k...@gmail.com
> http://joshuakehn.com
>
>
>


-- 
Regards,
Shreyas Agasthya


RE: [PHP] JavaScript Injection ???

2011-04-18 Thread admin
Javascript:alert("Hello World");
The browsers have had many updates since last I seen this work.

PHP Server side.
JavaScript Client/Browser Side.




Richard L. Buskirk

You can't grow your business with systems that are on life support...

-Original Message-
From: tedd [mailto:t...@sperling.com] 
Sent: Monday, April 18, 2011 1:06 PM
To: php-general@lists.php.net
Subject: [PHP] JavaScript Injection ???

Hi gang:

Quite some time ago I had a demo that showed Javascript injection. It 
was where a user could type in:

 alert("Evil Code");

and a JavaScript alert would be shown.

But now my demo no longer works. So, what happened? Was there a php 
update that prohibited that sort of behavior or did hosts start 
setting something to OFF, or what?

If you know, please explain.

Thanks,

tedd
-- 
---
http://sperling.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] JavaScript Injection ???

2011-04-18 Thread Joshua Kehn
On Monday, April 18, 2011 at 1:06 PM, tedd wrote:
Hi gang:
> 
> Quite some time ago I had a demo that showed Javascript injection. It 
> was where a user could type in:
> 
>  alert("Evil Code");
> 
> and a JavaScript alert would be shown.
> 
> But now my demo no longer works. So, what happened? Was there a php 
> update that prohibited that sort of behavior or did hosts start 
> setting something to OFF, or what?
> 
> If you know, please explain.
> 
> Thanks,
> 
> tedd
> -- 
> ---
> http://sperling.com/
Not that I know of. Are you talking about on-page injection, like comments and 
such? Normally JS injection would be that (bad scripts inserted by the user on 
a comment form or review page) or where you are using eval() and they dump bad 
code into there.

Regards,

-Josh___
Joshua Kehn | josh.k...@gmail.com
http://joshuakehn.com




[PHP] JavaScript Injection ???

2011-04-18 Thread tedd

Hi gang:

Quite some time ago I had a demo that showed Javascript injection. It 
was where a user could type in:


 alert("Evil Code");

and a JavaScript alert would be shown.

But now my demo no longer works. So, what happened? Was there a php 
update that prohibited that sort of behavior or did hosts start 
setting something to OFF, or what?


If you know, please explain.

Thanks,

tedd
--
---
http://sperling.com/

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



[PHP] PHP/Javascript Job in Madrid

2009-06-03 Thread barbara

Hi all,
I am Bárbara Vilela and I work at Tuenti in the Human Resources 
department in Madrid. Tuenti is a social application and our mission is 
to improve the communication and transmission of information between 
people who know each other. Already the #6 most-trafficked website in 
Spain, Tuenti is also one of the fastest-growing Alexa Top 500 sites and 
one of the largest invite-only websites worldwide.
I am writing you because we have job opportunities for PHP/JavaScript 
Engineers that could be interesting for you.

You can find more information about this position here:
http://tbe.taleo.net/NA11/ats/careers/requisition.jsp?org=TUENTITECHNOLOGIES&cws=1&rid=25 

If you think you fit for this job please send me an e-mail with your CV 
and I´ll get in contact with you soon.

Thank you very much,
Bárbara Vilela Fernandes


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



Re: [PHP] Javascript question

2009-03-02 Thread Michael A. Peters

Boyd, Todd M. wrote:

Before some of you newbies feel like being heroes and jump all over me:

I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION, DON'T
ANSWER IT.

Now that that's out of the way... I have a Javascript question (and
maybe a Browser/DOM question) for you folks. I'm not sure this is
anything they teach you in any online/in-seat/self-taught Javascript
course that I've ever seen before, so I figured I would bring it here.

My boss asked me if I knew of a tool that would change the  of
a page on-the-fly to test validation in different schemes (i.e., XHTML
Strict, Transitional, Loose, etc.).


The validators generally don't trigger javascript.

I use DOMDocument to create a valid xhtml page and then before sending 
it to the browser - if the browser does not report accepting valid xhtml 
(or I specify I want html) it filters the page to valid html 4.01.


That's probably what you want to do - code for valid xhtml and filter 
the output to other DTD's you want to make available server side rather 
than trying to use JS to alter the DOCTYPE.


Remember, the proper header to send also relies on the DOCTYPE so if you 
sent a header for xhtml but send html (or vice versa) you are still 
breaking the standard regardless of how pristine your output is.


Another advantage to building the document ahead of time and doing any 
translations server side is you can also filter the output for XSS in 
case you missed validating some input.


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



RE: [PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
> -Original Message-
> From: Michael A. Peters [mailto:mpet...@mac.com]
> Sent: Monday, March 02, 2009 4:42 PM
> To: Boyd, Todd M.
> Cc: PHP General list
> Subject: Re: [PHP] Javascript question
> 
> Boyd, Todd M. wrote:
> > Before some of you newbies feel like being heroes and jump all over
> me:
> >
> > I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION,
> DON'T
> > ANSWER IT.
> >
> > Now that that's out of the way... I have a Javascript question (and
> > maybe a Browser/DOM question) for you folks. I'm not sure this is
> > anything they teach you in any online/in-seat/self-taught Javascript
> > course that I've ever seen before, so I figured I would bring it
> here.
> >
> > My boss asked me if I knew of a tool that would change the

> of
> > a page on-the-fly to test validation in different schemes (i.e.,
> XHTML
> > Strict, Transitional, Loose, etc.).
> 
> The validators generally don't trigger javascript.
> 
> I use DOMDocument to create a valid xhtml page and then before sending
> it to the browser - if the browser does not report accepting valid
> xhtml
> (or I specify I want html) it filters the page to valid html 4.01.
> 
> That's probably what you want to do - code for valid xhtml and filter
> the output to other DTD's you want to make available server side
rather
> than trying to use JS to alter the DOCTYPE.
> 
> Remember, the proper header to send also relies on the DOCTYPE so if
> you
> sent a header for xhtml but send html (or vice versa) you are still
> breaking the standard regardless of how pristine your output is.
> 
> Another advantage to building the document ahead of time and doing any
> translations server side is you can also filter the output for XSS in
> case you missed validating some input.

I think you guys are missing the point--this is not for proprietary use
on our own server with our own pages. I wanted to write a bookmarklet
that would work for any page, on any server. I'm beginning to think
that's not necessarily possible (using just JS and the browser).

Thanks for all of your suggestions, anyway. :)


// Todd

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



RE: [PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
> -Original Message-
> From: Robert Cummings [mailto:rob...@interjinn.com]
> Sent: Monday, March 02, 2009 4:18 PM
> To: Boyd, Todd M.
> Cc: PHP General list
> Subject: Re: [PHP] Javascript question
> 
> On Mon, 2009-03-02 at 16:11 -0600, Boyd, Todd M. wrote:
> > Before some of you newbies feel like being heroes and jump all over
> me:
> >
> > I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION,
> DON'T
> > ANSWER IT.
> >
> > Now that that's out of the way... I have a Javascript question (and
> > maybe a Browser/DOM question) for you folks. I'm not sure this is
> > anything they teach you in any online/in-seat/self-taught Javascript
> > course that I've ever seen before, so I figured I would bring it
> here.
> >
> > My boss asked me if I knew of a tool that would change the

> of
> > a page on-the-fly to test validation in different schemes (i.e.,
> XHTML
> > Strict, Transitional, Loose, etc.). After a bit of looking around,
> this
> > is the solution I came up with (as a bookmarklet):
> >
> > javascript:document.write(' 1.0
> > Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>' +
> > document.getElementsByTagName('html')[0].innerHTML);
> >
> > However, I'm not sure it will fire any validation events, since
> > technically the page has already been loaded (Javascript is just
> adding
> > more text). I fear the case will be the same if the current page's
> > source is sent to a new browser window.
> >
> > I'm not asking for any coding suggestions, necessarily--just curious
> as
> > to whether or not anyone knew if this will invoke browser validation
> > events or not. Comments and questions are more than welcome, though.
> :)
> 
> Can't you do it via PHP using a GET parameter? Seems more likely to
> work
> properly since it requires the page be reloaded on a fresh slate.
While
> at the same time, it will easily jump through the doctypes that the
> server deems suitable given the parameter
> 
> http://www.www.www/foo.php?doctype=xmlstrict1.0

Rob,

Absolutely. However, requiring a server-side script was something I was
hoping to avoid. It may be useful as an intranet utility somewhere down
the road, but a bookmarklet was what I was shooting for for this first
test.

Great minds think alike, eh? :)


// Todd

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



Re: [PHP] Javascript question

2009-03-02 Thread Robert Cummings
On Mon, 2009-03-02 at 16:11 -0600, Boyd, Todd M. wrote:
> Before some of you newbies feel like being heroes and jump all over me:
> 
> I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION, DON'T
> ANSWER IT.
> 
> Now that that's out of the way... I have a Javascript question (and
> maybe a Browser/DOM question) for you folks. I'm not sure this is
> anything they teach you in any online/in-seat/self-taught Javascript
> course that I've ever seen before, so I figured I would bring it here.
> 
> My boss asked me if I knew of a tool that would change the  of
> a page on-the-fly to test validation in different schemes (i.e., XHTML
> Strict, Transitional, Loose, etc.). After a bit of looking around, this
> is the solution I came up with (as a bookmarklet):
> 
> javascript:document.write(' Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>' +
> document.getElementsByTagName('html')[0].innerHTML);
> 
> However, I'm not sure it will fire any validation events, since
> technically the page has already been loaded (Javascript is just adding
> more text). I fear the case will be the same if the current page's
> source is sent to a new browser window.
> 
> I'm not asking for any coding suggestions, necessarily--just curious as
> to whether or not anyone knew if this will invoke browser validation
> events or not. Comments and questions are more than welcome, though. :)

Can't you do it via PHP using a GET parameter? Seems more likely to work
properly since it requires the page be reloaded on a fresh slate. While
at the same time, it will easily jump through the doctypes that the
server deems suitable given the parameter

http://www.www.www/foo.php?doctype=xmlstrict1.0

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



[PHP] Javascript question

2009-03-02 Thread Boyd, Todd M.
Before some of you newbies feel like being heroes and jump all over me:

I KNOW THIS IS A PHP-RELATED LIST. IF YOU DON'T LIKE MY QUESTION, DON'T
ANSWER IT.

Now that that's out of the way... I have a Javascript question (and
maybe a Browser/DOM question) for you folks. I'm not sure this is
anything they teach you in any online/in-seat/self-taught Javascript
course that I've ever seen before, so I figured I would bring it here.

My boss asked me if I knew of a tool that would change the  of
a page on-the-fly to test validation in different schemes (i.e., XHTML
Strict, Transitional, Loose, etc.). After a bit of looking around, this
is the solution I came up with (as a bookmarklet):

javascript:document.write('http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>' +
document.getElementsByTagName('html')[0].innerHTML);

However, I'm not sure it will fire any validation events, since
technically the page has already been loaded (Javascript is just adding
more text). I fear the case will be the same if the current page's
source is sent to a new browser window.

I'm not asking for any coding suggestions, necessarily--just curious as
to whether or not anyone knew if this will invoke browser validation
events or not. Comments and questions are more than welcome, though. :)

Cheers!


// Todd

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



Re: [PHP] PHP Javascript header

2009-01-15 Thread Shawn McKenzie
Applejus wrote:
> Hello there,
> 
> Kind of newbie to PHP and javascript... I have this problem:
> 
> I want to pass a javascript variable to a PHP code.
> I am inside a javascript function that is creating HTML elements
> dynamically. After creating a  tag, I want to populate it with a
> list of variable names from $_SESSION['subgroupcolumn'] .
> Here is part of the code:
> 
> .
> .
> .
> location.href="subgroup.php?m=" + m;
> var linner= "for ($c=1; $c < $_SESSION['rows']; $c++){ echo( ' value=' . $c . '>' . $_SESSION['subgroupcolumn'][$c][0] . '\n' );
> }" ;
> document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner
> ;
> .
> .
> .
> Since we cannot pass a javascript var to PHP directly, I am redirecting to
> subgroup.php and sending the variable ("m") and getting it there using a
> $_GET. Now the question: 
> In subgroup.php, after I get the variable m, I create the
> $_SESSION['subgroupcolumn'] array then I redirect to the initial page.
> Obviously it's not working because the code after
> location.href="subgroup.php?m=" + m; is not executing after coming back to
> the initial page
> 
> How do I make it to continue executing the javascript code?
> 
> I hope it's clear...
> 
> Thanks for your help.
> 
> 

The problem is that you are changing the location of the page and then
chaning the location back.  Really you need an AJAX call using
XMLHttpRequest.  There are probably easier examples, but here is one:

http://www.w3schools.com/PHP/php_ajax_suggest.asp

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] PHP Javascript header

2009-01-15 Thread Applejus

Hello there,

Kind of newbie to PHP and javascript... I have this problem:

I want to pass a javascript variable to a PHP code.
I am inside a javascript function that is creating HTML elements
dynamically. After creating a  tag, I want to populate it with a
list of variable names from $_SESSION['subgroupcolumn'] .
Here is part of the code:

.
.
.
location.href="subgroup.php?m=" + m;
var linner= "for ($c=1; $c < $_SESSION['rows']; $c++){ echo( '' . $_SESSION['subgroupcolumn'][$c][0] . '\n' );
}" ;
document.getElementById(selectedSubsetText + hitcounter).innerHTML = linner
;
.
.
.
Since we cannot pass a javascript var to PHP directly, I am redirecting to
subgroup.php and sending the variable ("m") and getting it there using a
$_GET. Now the question: 
In subgroup.php, after I get the variable m, I create the
$_SESSION['subgroupcolumn'] array then I redirect to the initial page.
Obviously it's not working because the code after
location.href="subgroup.php?m=" + m; is not executing after coming back to
the initial page

How do I make it to continue executing the javascript code?

I hope it's clear...

Thanks for your help.


-- 
View this message in context: 
http://www.nabble.com/PHP-Javascript-header-tp21483721p21483721.html
Sent from the PHP - General mailing list archive at Nabble.com.


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



Re: [PHP] table mixing PHP, javascript, ajax and CSS

2008-12-28 Thread Benjamin Hawkes-Lewis

On 28/12/08 13:33, Alain Roger wrote:


i'm currently working on some project which needs in several pages, a table
to display query results...till now nothing special.
however, in order to not create several time the table and features i've
decided to create my own templates including PHP classes, CSS and
javascript.

this "table" class should have filter, colors schemes, multi selection and
header/paging header.


An appropriate set of classes (data types, field names, even/odd 
designators for zebra styling) plus CSS is everything you need for color 
schemes.


Can you elaborate on what you mean by "multi selection" and "paging header"?


I would like to know what are your suggestions, recommendations or tips to
have something easy to deploy and upgrade ?


I'd look into:

http://developer.yahoo.com/yui/datatable/

It includes filtering.

I usually write my own code for generating raw table markup - that could 
be used by as a progressive enhancement by YUI datatable - with a 
minimum of repetition.


http://www.webaim.org/techniques/tables/data.php has information about 
what constitutes good markup for data tables.



i was thinking to have a common (framework) base : a simple html file having
3 divs, each div receiving a particular php file (header, pagin, or the
table itself)
header, paging or table PHP files could be located in some folder being
different for each template... main changes in templates are usually for the
table it self (in terms of columns amount, of presented data record,...)

the user will have only to run a js function which will include the
frame.php file into his own webpage with the template given as parameter.


The use of JS as an include mechanism is largely pernicious. Couldn't 
they just use include()?


--
Benjamin Hawkes-Lewis

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



[PHP] table mixing PHP, javascript, ajax and CSS

2008-12-28 Thread Alain Roger
Hi,

i'm currently working on some project which needs in several pages, a table
to display query results...till now nothing special.
however, in order to not create several time the table and features i've
decided to create my own templates including PHP classes, CSS and
javascript.

this "table" class should have filter, colors schemes, multi selection and
header/paging header.
I would like to know what are your suggestions, recommendations or tips to
have something easy to deploy and upgrade ?

i was thinking to have a common (framework) base : a simple html file having
3 divs, each div receiving a particular php file (header, pagin, or the
table itself)
header, paging or table PHP files could be located in some folder being
different for each template... main changes in templates are usually for the
table it self (in terms of columns amount, of presented data record,...)

basically my structure is the following one:
/folder_to_include_by_user_in_his_development_environment
   /templates
  /template1
 pager.php
 table.php
  /template2
 pager.php
 table.php
  header.php
   frame.php
   /class
  table_class.php
  helping_classes.php
  ...
   /js_and_ajax
 function.js

the user will have only to run a js function which will include the
frame.php file into his own webpage with the template given as parameter.

thx for any suggestion.

-- 
Alain
---
Windows XP x64 SP2 / Fedora 10 KDE 4.2
PostgreSQL 8.3.5 / MS SQL server 2005
Apache 2.2.10
PHP 5.2.6
C# 2005-2008


Re: [PHP] Javascript mailing list

2008-08-30 Thread Shiplu
May be jsninja has mailing list.
I am fond of jquery. so i recommend it too.
-- 
Blog: http://talk.cmyweb.net/
Follow me: http://twitter.com/shiplu


Re: [PHP] Javascript mailing list

2008-08-30 Thread mike
look at jquery - it will make working with javascript so much easier
and has it's own community around it too.

On 8/30/08, Richard Heyes <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can anyone recommend a good Javascript related mailing list?
>
> Thanks.
>
> --
> Richard Heyes
>
> HTML5 Graphing:
> http://www.phpguru.org/RGraph
>
> --
> 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] Javascript mailing list

2008-08-30 Thread Benjamin Hawkes-Lewis

Richard Heyes wrote:

Can anyone recommend a good Javascript related mailing list?


http://lists.evolt.org/mailman/listinfo/javascript perhaps.

--
Benjamin Hawkes-Lewis


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



[PHP] Javascript mailing list

2008-08-30 Thread Richard Heyes
Hi,

Can anyone recommend a good Javascript related mailing list?

Thanks.

-- 
Richard Heyes

HTML5 Graphing:
http://www.phpguru.org/RGraph

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



Re: [PHP] Javascript control on Firefox 2/3 with flash 9

2008-05-29 Thread Wolf

 [EMAIL PROTECTED] wrote: 
> 
> my page include some javascript to control the play,rewind..and other 
> functions of the swffile showEdit.swf, it works in Safari/IE with 
> flash-plugin 8/9 installed but  not works in Firefox  with flash plugin 
> 9(would reports obj.play() is not a function, is any one point out what is 
> the problem or there are techniques i can use?
> 
> >>>the source codes>>
> 
> function show(){
>  var obj=document.getElements("showEdit");//it works in Firefox
>  obj.play();//it works in IE,but not in Firefox.
> }
> 

Sure, GO CHECK WITH A JAVASCRIPT LIST!

There is no PHP code anywhere here.

HTH,
Wolf


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



[PHP] Javascript control on Firefox 2/3 with flash 9

2008-05-29 Thread jencisson

my page include some javascript to control the play,rewind..and other functions 
of the swffile showEdit.swf, it works in Safari/IE with flash-plugin 8/9 
installed but  not works in Firefox  with flash plugin 9(would reports 
obj.play() is not a function, is any one point out what is the problem or there 
are techniques i can use?

>>>the source codes>>

function show(){
 var obj=document.getElements("showEdit");//it works in Firefox
 obj.play();//it works in IE,but not in Firefox.
}

>
  http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0";
 width="202" height="498" id="showEdit">





http://www.macromedia.com/go/getflashplayer"; 
type="application/x-shockwave-flash" allowscriptAccess="sameDomain" 
FlashVars="userid=rasy" name="FlashVars" name="showEdit">

  

_
多个邮箱同步管理,live mail客户端万人抢用中
http://get.live.cn/product/mail.html

RE: [PHP] JavaScript and PHP

2008-05-16 Thread tedd

At 4:01 PM +0100 5/16/08, Ford, Mike wrote:

On 14 May 2008 21:21, tedd advised:


 At 7:31 PM +0100 5/14/08, Mário Gamito wrote:

 Hi,

 I have this HTML/JS page that switches images
 clicking on the radio buttons and call
 template.php with the image ID as parameter:
 http://portulan-online.net/einstein.html

 Now, I need to make it a PHP page, because it is
 going to receive a parameter from the URL that
 calls it and pass it as is to template.php


 Mário:

 The key here to remember is that javascript uses
 ID and php uses NAME for inputs.


That's incorrect.  A form will function 
perfectly well with only name= attributes, and 
no ids, and it's quite possible for JavaScript 
to address the form elements using only the 
names (in fact, it's easier than via the ids as 
there's a short syntax for it!).


Incorrect or not, it works.

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] JavaScript and PHP

2008-05-16 Thread Ford, Mike
On 16 May 2008 16:12, Boyd, Todd M. advised:

>> -Original Message-
> 
> 8< snip!
> 
>> That's incorrect.  A form will function perfectly well with only
name=
>> attributes, and no ids, and it's quite possible for JavaScript to
>> address the form elements using only the names (in fact, it's easier
>> than via the ids as there's a short syntax for it!).
>> 
>> CSS and the DOM, however, use the ids as primary identifier, so use
of
>> either of those may demand the presence of ids.
> 
> 8< snip!
> 
> True, you can access an input named "myInput" in a form named "myForm"
by
> simply writing: 
> 
>   document.myForm.myInput.value = "Hello!";
> 
> BUT... for CSS, it's also quite easy to reference something by name:
> 
>   [name="myElement"]
>   {
>   color: blue;
>   font-size: 10pt;
>   }

Well, true -- hence the qualifiers in "*primary* identifier" and "*may*
demand"!

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



RE: [PHP] JavaScript and PHP

2008-05-16 Thread Boyd, Todd M.
> -Original Message-

8< snip!

> That's incorrect.  A form will function perfectly well with only name=
> attributes, and no ids, and it's quite possible for JavaScript to
> address the form elements using only the names (in fact, it's easier
> than via the ids as there's a short syntax for it!).
> 
> CSS and the DOM, however, use the ids as primary identifier, so use of
> either of those may demand the presence of ids.

8< snip!

True, you can access an input named "myInput" in a form named "myForm"
by simply writing:

document.myForm.myInput.value = "Hello!";

BUT... for CSS, it's also quite easy to reference something by name:

[name="myElement"]
{
color: blue;
font-size: 10pt;
}


Todd Boyd
Web Programmer

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



RE: [PHP] JavaScript and PHP

2008-05-16 Thread Ford, Mike
On 14 May 2008 21:21, tedd advised:

> At 7:31 PM +0100 5/14/08, Mário Gamito wrote:
>> Hi,
>> 
>> I have this HTML/JS page that switches images
>> clicking on the radio buttons and call
>> template.php with the image ID as parameter:
>> http://portulan-online.net/einstein.html
>> 
>> Now, I need to make it a PHP page, because it is
>> going to receive a parameter from the URL that
>> calls it and pass it as is to template.php
> 
> Mário:
> 
> The key here to remember is that javascript uses
> ID and php uses NAME for inputs.

That's incorrect.  A form will function perfectly well with only name= 
attributes, and no ids, and it's quite possible for JavaScript to address the 
form elements using only the names (in fact, it's easier than via the ids as 
there's a short syntax for it!).

CSS and the DOM, however, use the ids as primary identifier, so use of either 
of those may demand the presence of ids.

Cheers!

Mike

 --
Mike Ford,  Electronic Information Developer,
C507, Leeds Metropolitan University, Civic Quarter Campus, 
Woodhouse Lane, LEEDS,  LS1 3HE,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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



Re: [PHP] JavaScript and PHP

2008-05-14 Thread tedd

At 7:31 PM +0100 5/14/08, Mário Gamito wrote:

Hi,

I have this HTML/JS page that switches images 
clicking on the radio buttons and call 
template.php with the image ID as parameter: 
http://portulan-online.net/einstein.html


Now, I need to make it a PHP page, because it is 
going to receive a parameter from the URL that 
calls it and pass it as is to template.php


Mário:

The key here to remember is that javascript uses 
ID and php uses NAME for inputs. So, if you put 
your variables in that form and they will work 
between javascript and php. Such as:


onclick="javascript:GetImage(this);">Einstein 2


Note the change of "this" in your js call -- you 
can do that and not have to provide the number.


Also put in an action="whatever" into your form 
and collect the selection via $_POST['rad'];


That will do what you want.

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] JavaScript and PHP

2008-05-14 Thread Dan Joseph
On Wed, May 14, 2008 at 2:31 PM, Mário Gamito <[EMAIL PROTECTED]> wrote:

> Hi,
>
> I have this HTML/JS page that switches images clicking on the radio buttons
> and call template.php with the image ID as parameter:
> http://portulan-online.net/einstein.html
>
> Now, I need to make it a PHP page, because it is going to receive a
> parameter from the URL that calls it and pass it as is to template.php
>
>
> So, einstein.php will be called with a parameter (satellite):
> http://portulan-online.net/einstein.php?satellite=123
>
> After that, in einstein.php, I do:
>
> $satellite = $_REQUEST['satellite'];
>
> Next thing, I need the action in the JavaScript to be, for example:
> http://portulan-online.net/template.php?id=3&satellite=123
>
> What I don't know is how to mix the "PHP variable" satellite with the image
> ID here:
> document.getElementById('image1').src = "
> http://portulan-online.net/einstein-"; + ID + ".png";
>
> I've tried putting einstein.php all inside an "echo", but the radio buttons
> and the submit button stopped working.
>
> Does anyone knows how to do this ?
>
> Any help would be appreciated.
>
> Warm Regards,
> Mário Gamito
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
document.getElementById('image1').src = "
http://portulan-online.net/einstein-"; +  +
".png";

You could do that.  Also, I'd suggest using $_GET instead of $_REQUEST.
Request works,b ut it is very broad.  $_GET is more specific/secure.


-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month. Reseller plans and
Dedicated servers available.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."


[PHP] JavaScript and PHP

2008-05-14 Thread Mário Gamito

Hi,

I have this HTML/JS page that switches images clicking on the radio 
buttons and call template.php with the image ID as parameter: 
http://portulan-online.net/einstein.html


Now, I need to make it a PHP page, because it is going to receive a 
parameter from the URL that calls it and pass it as is to template.php



So, einstein.php will be called with a parameter (satellite): 
http://portulan-online.net/einstein.php?satellite=123


After that, in einstein.php, I do:

$satellite = $_REQUEST['satellite'];

Next thing, I need the action in the JavaScript to be, for example:
http://portulan-online.net/template.php?id=3&satellite=123

What I don't know is how to mix the "PHP variable" satellite with the 
image ID here:
document.getElementById('image1').src = 
"http://portulan-online.net/einstein-"; + ID + ".png";


I've tried putting einstein.php all inside an "echo", but the radio 
buttons and the submit button stopped working.


Does anyone knows how to do this ?

Any help would be appreciated.

Warm Regards,
Mário Gamito

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



Re: [PHP] OT Re: [PHP] javascript in or in ?

2007-08-13 Thread Daniel Brown
On 8/12/07, tedd <[EMAIL PROTECTED]> wrote:
> For example, if your wife says (and you're not listening as usual)
> "Do these pants make my butt look big?" Neither answer is going to
> help much. But, if said separately, you at least have a chance of
> surviving the ordeal.

And I'll also point out that they will work in either order in
most cases - including the one Tedd gave as an example.  To
demonstrate:

"Do these pants make my butt look big?"
"Yes, dear."
"WHAT?!?"
"I'm sorry!"

- or -

"Do this pants make my butt look big?"
"I'm sorry yes, dear."

However, note that it is NEVER alright to say one of the following:
"No, your fat ass makes it look big."
"No, but that second piece of cheesecake did."
"Hell yeah!"
"How the hell did you pull those up?"
"I didn't want to say anything, but that's why I always want to be on top."

-- 
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Hey, PHP-General list
50% off for life on web hosting plans $10/mo. or more at
http://www.pilotpig.net/.
Use the coupon code phpgeneralaug07
Register domains for about $0.01 more than what it costs me at
http://domains.pilotpig.net/.

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



Re: [PHP] javascript in or in ?

2007-08-12 Thread Robert Cummings
On Sun, 2007-08-12 at 21:27 -0400, tedd wrote:
> At 1:26 PM -0400 8/11/07, Robert Cummings wrote:
> >On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
> >  > Always (fishing for another apology opportunity) place javascript in
> >>  external files and call them in via the header. Keep the code
> >>  unobtrusive. There are ways to use javascript without having to mix
> >>  it into your html -- look up DOM scripting.
> >
> >I absolutely agree with unobtrusive JavaScript, but I do disagree with
> >you slightly on using external files. Generally speaking i keep large
> >bits of code (Especially libs) in external files, but a few lines of
> >script for a form that appears on one page I'll often be put in the head
> >section. This way the JavaScript is in the same file as the template for
> >which it is associated. My template engine will relocate the JavaScript
> >to the  section at compile time.
> 
> That's clever. I assume that for production work (i.e., for a 
> client), you can isolate the files you need and be totally 
> unobtrusive if you want.
> 
> I just described my method off-list to another person and it went like this:
> 
> I have a system for my site development work such that I simply 
> include one header and one footer and no matter where the project 
> directory is that I'm currently working on, the process will find the 
> one main common header and common footer and will add them to my demo 
> automagically.
> 
> My code to start, looks like this:
> 
> 
>  Hi 
> 
> 
>  From there I have a complete page -- from doctype to copyright, it's 
> all there and it validates.
> 
> If I need a javascript file locally, then I add it to the local 
> working directory by naming the file "a.js". Likewise, if I need an 
> additional css file, then I name it "a.css" and it's also included in 
> the call.
> 
> However, if I don't need those files, then none are included in my 
> local working directory and attempts to load those files will fail -- 
> however -- it doesn't matter if an attempt to load fails or not as 
> long as the files are not needed.
> 
> I think that's kind of clever, but I like Rocky and Bullwinkle as well.

I don't use a script to find my JavaScript files and CSS but I do
something similar to your includes for header and footer. The difference
being that my template engine will pull them in at compile time and not
at run-time. A lot of static content is pulled in this way and relocated
using compile-time accumulators. Then I use run-time accumulators to
flush content at run-time into the appropriate areas if necessary. This
allows me to create a layout that is compiled once at compile time but
with flush hooks for run-time. For instance for simplicity I use the
following tag in the  area to set up JavaScript:



This is the same as doing the following manually:









function javaScriptOnLoad()
{


}


-

The body tag will have an onload="javaScriptOnLoad()". Then in a content
file I can add the following:



// some javascript code to modify the DOM



And it will get relocated at compile time to the location of the static
flush statement: 

Similarly within my code at run-time I can do the following:

$mAcc = &$this->getServiceRef( 'accManager' );
$acc = &$mAcc->getRef( 'javaScriptOnLoad' );

$acc->append
(
' // some javascript to modify the DOM '
)

And it will be get flushed into the content at the location of the
dynamic flush statement:



So all in all, it's very simple for me to put JavaScript (and any
content for that matter) anywhere I please. I often use it for layout
areas (such as left pane, right pane, etc), menus, visitor notices, etc.

BTW if you're wondering why I have a  tag it's because
who wants to remember the following:

---

---

:)

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



[PHP] OT Re: [PHP] javascript in or in ?

2007-08-12 Thread tedd

At 10:21 PM +0930 8/12/07, David Robley wrote:

tedd wrote:

 >

 At this rate, by the time I reach the end of my life, I'll know only
 two sentences, namely "I'm sorry" and "Yes, Dear".


Seems to me you could rather easily condense that to just one sentence with
the same degree of functionality. :-)



Unfortunately, it doesn't work that way. You must keep them in two 
separate sentences.


For example, if your wife says (and you're not listening as usual) 
"Do these pants make my butt look big?" Neither answer is going to 
help much. But, if said separately, you at least have a chance of 
surviving the ordeal.


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] javascript in or in ?

2007-08-12 Thread tedd

At 1:26 PM -0400 8/11/07, Robert Cummings wrote:

On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
 > Always (fishing for another apology opportunity) place javascript in

 external files and call them in via the header. Keep the code
 unobtrusive. There are ways to use javascript without having to mix
 it into your html -- look up DOM scripting.


I absolutely agree with unobtrusive JavaScript, but I do disagree with
you slightly on using external files. Generally speaking i keep large
bits of code (Especially libs) in external files, but a few lines of
script for a form that appears on one page I'll often be put in the head
section. This way the JavaScript is in the same file as the template for
which it is associated. My template engine will relocate the JavaScript
to the  section at compile time.


That's clever. I assume that for production work (i.e., for a 
client), you can isolate the files you need and be totally 
unobtrusive if you want.


I just described my method off-list to another person and it went like this:

I have a system for my site development work such that I simply 
include one header and one footer and no matter where the project 
directory is that I'm currently working on, the process will find the 
one main common header and common footer and will add them to my demo 
automagically.


My code to start, looks like this:


Hi 


From there I have a complete page -- from doctype to copyright, it's 
all there and it validates.


If I need a javascript file locally, then I add it to the local 
working directory by naming the file "a.js". Likewise, if I need an 
additional css file, then I name it "a.css" and it's also included in 
the call.


However, if I don't need those files, then none are included in my 
local working directory and attempts to load those files will fail -- 
however -- it doesn't matter if an attempt to load fails or not as 
long as the files are not needed.


I think that's kind of clever, but I like Rocky and Bullwinkle as well.

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] javascript in or in ?

2007-08-12 Thread David Robley
tedd wrote:

> At 9:29 PM +0200 8/7/07, Tijnema wrote:
>>On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
>>  > Yeah!! This list is for public apologies and Copyright discussion.
>>>
>>>  Cheers,
>>>  Rob.
>>>  --
>>
>>Oh yeah, Tedd is only the first of thousands of people that need to
>>apologize... :P
>>
>>Tijnema
> 
> 
> Ah crap, have I got something else to apologize for?
> 
> At this rate, by the time I reach the end of my life, I'll know only
> two sentences, namely "I'm sorry" and "Yes, Dear".

Seems to me you could rather easily condense that to just one sentence with
the same degree of functionality. :-)




Cheers
-- 
David Robley

This isn't hell, but I can see it from here.
Today is Prickle-Prickle, the 5th day of Bureaucracy in the YOLD 3173. 
Celebrate Zaraday

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



Re: [PHP] javascript in or in ?

2007-08-11 Thread Robert Cummings
On Sat, 2007-08-11 at 12:15 -0400, tedd wrote:
> At 9:29 PM +0200 8/7/07, Tijnema wrote:
> >On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> >  > Yeah!! This list is for public apologies and Copyright discussion.
> >>
> >>  Cheers,
> >>  Rob.
> >>  --
> >
> >Oh yeah, Tedd is only the first of thousands of people that need to
> >apologize... :P
> >
> >Tijnema
> 
> 
> Ah crap, have I got something else to apologize for?
> 
> At this rate, by the time I reach the end of my life, I'll know only 
> two sentences, namely "I'm sorry" and "Yes, Dear".
> 
> Oh, to bring this off-topic question back to on-topic (?)
> 
> Always (fishing for another apology opportunity) place javascript in 
> external files and call them in via the header. Keep the code 
> unobtrusive. There are ways to use javascript without having to mix 
> it into your html -- look up DOM scripting.

I absolutely agree with unobtrusive JavaScript, but I do disagree with
you slightly on using external files. Generally speaking i keep large
bits of code (Especially libs) in external files, but a few lines of
script for a form that appears on one page I'll often be put in the head
section. This way the JavaScript is in the same file as the template for
which it is associated. My template engine will relocate the JavaScript
to the  section at compile time.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] javascript in or in ?

2007-08-11 Thread tedd

At 9:29 PM +0200 8/7/07, Tijnema wrote:

On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
 > Yeah!! This list is for public apologies and Copyright discussion.


 Cheers,
 Rob.
 --


Oh yeah, Tedd is only the first of thousands of people that need to
apologize... :P

Tijnema



Ah crap, have I got something else to apologize for?

At this rate, by the time I reach the end of my life, I'll know only 
two sentences, namely "I'm sorry" and "Yes, Dear".


Oh, to bring this off-topic question back to on-topic (?)

Always (fishing for another apology opportunity) place javascript in 
external files and call them in via the header. Keep the code 
unobtrusive. There are ways to use javascript without having to mix 
it into your html -- look up DOM scripting.


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] javascript in or in ?

2007-08-07 Thread Richard Lynch
On Tue, August 7, 2007 2:48 pm, Tijnema wrote:
> On 8/7/07, Greg Donald <[EMAIL PROTECTED]> wrote:
>> On 8/7/07, Tijnema <[EMAIL PROTECTED]> wrote:
>> > Uhh, do you know which list this is?
>>
>> I give up..  Is it the one where I get as many [OT] labeled emails
>> as
>> I do on-topic ones?
>>
>> People have been asking basic html questions here for (over?) a
>> decade, and it probably won't stop anytime soon.  Newcomers don't
>> know
>> it's wrong because they haven't seen anyone be smacked down for it.
>> So until you can smack someone down in advance, it won't stop.
>
> What about a php-html list? or php-js? :P

This might drain off some of the not really on topic questions from
newbies who don't understand how the jigsaw puzzle pieces fit
together...

But the number of actual on-topic questions invovling PHP and HTML or
PHP and JS is pretty dang low...

So they'd still be off-topic, just on another list.

And would anybody who knows enough to say they're off-topic even
subscribe?

Or would the lists just sort of wither and die and then we'd just get
the same questions back here again?

PS
As a common courtesy, if you're going to tell somebody they are
off-topic, a recommendation for where it might be on topic or some
indication of what subject matter they ARE talking about would
probably be much more useful than just "that's OT!"

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Richard Lynch
On Tue, August 7, 2007 3:19 pm, C.R.Vegelin wrote:
> Are there any rules when to include javascript in  or in 
> ?
> For example,
> 
> function reload(form)
> {  var
> val=form.Chapter.options[form.Chapter.options.selectedIndex].value;
>self.location='QueryForm.php?Chapter=' + val ;
> }
> 

Yes.

But this is a general HTML/Javascript question, and not a PHP question.

The best short answer I can provide is this:

When in doubt, it belongs in 

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Stut

Richard Davey wrote:

Tuesday, August 7, 2007, 9:52:28 PM, you wrote:


PHP is the absolute worst language to do any sort of OO programming
in.


Ignoring the digg user mentality of that statement, try ASP if you
want to see OO suck *royally*


ASP is not a language, it's most like a framework. I think you meant VB6.

-Stut

--
http://stut.net/

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



Re[2]: [PHP] javascript in or in ?

2007-08-07 Thread Richard Davey
Hi Greg,

Tuesday, August 7, 2007, 9:52:28 PM, you wrote:

> PHP is the absolute worst language to do any sort of OO programming
> in.

Ignoring the digg user mentality of that statement, try ASP if you
want to see OO suck *royally*

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 15:52 -0500, Greg Donald wrote:
> On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> > Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.
> 
> You mean how both Ruby and Python list serv traffic is way up while
> PHP's is way down?

Way up and way down are trends. Trends may be fads or they may be
sustained cultural changes. Time will tell, but it certainly hasn't told
yet. I hardly consider list serv traffic an indicator of language
superiority... especially when high traffic may be an indicator of bugs.

>   Even the PHP dev list is really slowed the past
> year or so.. just some guy named Richard bothering them about random
> stuff every once in a while, that's about it.  Oh, and the occasional
> namespace discussion.  To namespace or not to namespace, who really
> cares.

Those who discuss it *lol*.

> But to clarify the obvious for those without their own clue bat with
> which to beat one's self, I was referring to language quality with
> regard to OO.  PHP is a cluster-fuck in comparison to pretty much
> anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
> and tell me that's not Java by another name.

I dunno, I don't use it. Haven't found a need for it yet.

> PHP is the absolute worst language to do any sort of OO programming in.

That's a very subjective statement. I've had no trouble writing OOP
since PHP3. I like references in PHP4, and it's nice that PHP5 uses
automatic references when assigning objects by value. But that's just
cake icing. OOP is a programming style, not necessarily a language
construct.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Borokov Smith

Yes. Just yes.

regards,

boro

Greg Donald schreef:

On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
  

Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.



You mean how both Ruby and Python list serv traffic is way up while
PHP's is way down?  Even the PHP dev list is really slowed the past
year or so.. just some guy named Richard bothering them about random
stuff every once in a while, that's about it.  Oh, and the occasional
namespace discussion.  To namespace or not to namespace, who really
cares.

But to clarify the obvious for those without their own clue bat with
which to beat one's self, I was referring to language quality with
regard to OO.  PHP is a cluster-fuck in comparison to pretty much
anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
and tell me that's not Java by another name.

PHP is the absolute worst language to do any sort of OO programming in.


  


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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Greg Donald
On 8/7/07, Robert Cummings <[EMAIL PROTECTED]> wrote:
> Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.

You mean how both Ruby and Python list serv traffic is way up while
PHP's is way down?  Even the PHP dev list is really slowed the past
year or so.. just some guy named Richard bothering them about random
stuff every once in a while, that's about it.  Oh, and the occasional
namespace discussion.  To namespace or not to namespace, who really
cares.

But to clarify the obvious for those without their own clue bat with
which to beat one's self, I was referring to language quality with
regard to OO.  PHP is a cluster-fuck in comparison to pretty much
anything out there.. except maybe Perl's OO.  And go look at PHP SPL,
and tell me that's not Java by another name.

PHP is the absolute worst language to do any sort of OO programming in.


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

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 14:58 -0500, Greg Donald wrote:
> On 8/7/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> > "Later this week on Php-General, witness the revolutionary
> > confessions of a PHP Programmer stuck in the middle of a lovers
> > triangle of OOP, and Procedural"
> 
> That's a re-run.  Python wins with Ruby coming in second place.  PHP
> gets renamed to Java, etc.

Yeah, the numbers really show Python and Ruby winning... NOT *LOL*.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Robert Cummings
On Tue, 2007-08-07 at 15:50 -0400, [EMAIL PROTECTED] wrote:
> 
> 3. If you're executing JS in order to output something, you're going
> to need to put it whereever in your HTML you'll need the output.  If
> you're just defining functions to be called later, then you can put
> it whereever (probably above where you're calling the functions.. see
> #1).

That's not true. You can still have it in the head and use javascript to
target specific content to a tag with an ID.

In fact, I'd say that's a better option when used in conjunction with
onload() since you can be certain all of your libraries are loaded.
Additionally it allows you to place default content in the event that
your visitor doesn't have JavaScript enabled.

Cheers,
Rob.
-- 
...
SwarmBuy.com - http://www.swarmbuy.com

Leveraging the buying power of the masses!
...

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread Greg Donald
On 8/7/07, Jason Pruim <[EMAIL PROTECTED]> wrote:
> "Later this week on Php-General, witness the revolutionary
> confessions of a PHP Programmer stuck in the middle of a lovers
> triangle of OOP, and Procedural"

That's a re-run.  Python wins with Ruby coming in second place.  PHP
gets renamed to Java, etc.


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

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



Re: [PHP] javascript in or in ?

2007-08-07 Thread tg-php
Ok, you got the obligatory 'wrong list' comments.  It is the wrong list, but 
for the sake of public completeness... how about an answer to the question.

You can put it anywhere but a couple of considerations:

1. I believe if you put it AFTER where the JS functions defined in that block 
are called, it may try to call the functions before the functions appear.  So 
close to the top is always good.  I could be wrong on this, but there was some 
kind of condition along those lines and I think it was with JS and positioning.

2. Non JS compliant browsers.  If you put it in the , they're likely to 
ignore the  tags and just blatantly display the JS as if it was meant 
for output.  This can be mitigated by using HTML comment blocks around the JS. 
Since they're different than JS comment blocks, it won't interfere with the JS. 
 But putting your