Re: [PHP] Session variables

2009-02-07 Thread Stuart
2009/2/7 Paul M Foster :
> I'm not too clear on HTTP headers, cookies, and such. So here are
> questions related to that. Let's say I generate a random number that I
> want the user to enter in a form. When I generate the number, I store it
> in a session variable ($_SESSION). When the user submits the form, I
> check the number they enter with what I've stored in the session
> variable.
>
> Since this session variable survives across page loads (assuming
> session_start() is appropriately called), how is it stored and recalled?
>
> Is it automatically stored as a cookie on the user's system?
>
> Or is it stored on the server?
>
> And how does a server "get" a cookie?
>
> Is it a separate request made by the server to the client?
>
> If the value I've asked the user for is *not* stored as a cookie, then
> is it passed as part of the HTTP submission or what?
>
> Thanks for any enlightenment on this.

Session data is stored on the server and tied to a browser using a
cookie. The cookie contains a random string which uniquely identifies
a session on the server. The session_start() function handles all the
details of setting and maintaining that cookie and managing the
server-side data.

Cookies are transferred between client and server with every request
in the headers. If you don't have Firefox getfirefox.com. The google
for the livehttpheaders addon and install that. Turn it on and browse
your site. You will see the cookies in the headers of both requests
and responses. Cookies are not stored on the server side, they are
sent by the client with each request.

No additional HTTP requests are involved when using sessions.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Session variables

2009-02-07 Thread German Geek
Yeah i guess the cookie doesn't need to be stored on the server since it's
in the header anyway.

Thanks for clearing that up.

Tim-Hinnerk Heuer

http://www.ihostnz.com
Charles M. Schulz  - "I love mankind; it's people I can't stand."

2009/2/7 Stuart 

> 2009/2/7 Paul M Foster :
> > I'm not too clear on HTTP headers, cookies, and such. So here are
> > questions related to that. Let's say I generate a random number that I
> > want the user to enter in a form. When I generate the number, I store it
> > in a session variable ($_SESSION). When the user submits the form, I
> > check the number they enter with what I've stored in the session
> > variable.
> >
> > Since this session variable survives across page loads (assuming
> > session_start() is appropriately called), how is it stored and recalled?
> >
> > Is it automatically stored as a cookie on the user's system?
> >
> > Or is it stored on the server?
> >
> > And how does a server "get" a cookie?
> >
> > Is it a separate request made by the server to the client?
> >
> > If the value I've asked the user for is *not* stored as a cookie, then
> > is it passed as part of the HTTP submission or what?
> >
> > Thanks for any enlightenment on this.
>
> Session data is stored on the server and tied to a browser using a
> cookie. The cookie contains a random string which uniquely identifies
> a session on the server. The session_start() function handles all the
> details of setting and maintaining that cookie and managing the
> server-side data.
>
> Cookies are transferred between client and server with every request
> in the headers. If you don't have Firefox getfirefox.com. The google
> for the livehttpheaders addon and install that. Turn it on and browse
> your site. You will see the cookies in the headers of both requests
> and responses. Cookies are not stored on the server side, they are
> sent by the client with each request.
>
> No additional HTTP requests are involved when using sessions.
>
> -Stuart
>
> --
> http://stut.net/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


[PHP] move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
Hi,

I'm having problem with function move_uploaded_file() under Linux
(Slackware 12.2). It  simply want execute only that function in php
file. So maybe I should add something to http.config file or  ? I
tried to execute that php file under Windows and it's working just
fine (I've copied whole project to xampp's htdocs folder and run it
normally).

And also I have question, does anyone knows how to configure apache
(also under same Linux) so that in future I wouldn't have to write
http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
Hi,

I'm having problem with function move_uploaded_file() under Linux
(Slackware 12.2). It  simply won't execute only that function in php
file. So maybe I should add something to http.config file or  ? I
tried to execute that php file under Windows and it's working just
fine (I've copied whole project to xampp's htdocs folder and run it
normally).

And also I have question, does anyone knows how to configure apache
(also under same Linux) so that in future I wouldn't have to write
 wrote:
> Hi,
>
> I'm having problem with function move_uploaded_file() under Linux
> (Slackware 12.2). It  simply want execute only that function in php
> file. So maybe I should add something to http.config file or  ? I
> tried to execute that php file under Windows and it's working just
> fine (I've copied whole project to xampp's htdocs folder and run it
> normally).
>
> And also I have question, does anyone knows how to configure apache
> (also under same Linux) so that in future I wouldn't have to write
> 
> Thnx, Dusan
>
> --
> made by Dusan
>



-- 
made by Dusan

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



Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Alpár Török
2009/2/7 Dušan Novaković 

> Hi,
>
> I'm having problem with function move_uploaded_file() under Linux
> (Slackware 12.2). It  simply won't execute only that function in php
> file. So maybe I should add something to http.config file or  ? I
> tried to execute that php file under Windows and it's working just
> fine (I've copied whole project to xampp's htdocs folder and run it
> normally).
>
Can you show some code?

>
>
> And also I have question, does anyone knows how to configure apache
> (also under same Linux) so that in future I woul
>
dn't have to write
> 
You need to change the enable_short_tags  directive. It is probably more
simple to do it in the php.ini configuration file and not in the apache
configuration file, but you should know that short tags are off by default
because they conflict with xml.

>
> Thnx, Dusan
>
> On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković  wrote:
> > Hi,
> >
> > I'm having problem with function move_uploaded_file() under Linux
> > (Slackware 12.2). It  simply want execute only that function in php
> > file. So maybe I should add something to http.config file or  ? I
> > tried to execute that php file under Windows and it's working just
> > fine (I've copied whole project to xampp's htdocs folder and run it
> > normally).
> >
> > And also I have question, does anyone knows how to configure apache
> > (also under same Linux) so that in future I wouldn't have to write
> >  >
> > Thnx, Dusan
> >
> > --
> > made by Dusan
> >
>
>
>
> --
> made by Dusan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alpar Torok


Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Dušan Novaković
On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török  wrote:
>
>
> 2009/2/7 Dušan Novaković 
>>
>> Hi,
>>
>> I'm having problem with function move_uploaded_file() under Linux
>> (Slackware 12.2). It  simply won't execute only that function in php
>> file. So maybe I should add something to http.config file or  ? I
>> tried to execute that php file under Windows and it's working just
>> fine (I've copied whole project to xampp's htdocs folder and run it
>> normally).
>
> Can you show some code?

This is part where I use function move_uploaded_file()

if($_FILES['file']['name'] && $_FILES['file']['size']<55){

$file_name = 
"news_".$_FILES['file']['name'];

$image="../_img/news/".$file_name;  
//Upload file

move_uploaded_file($_FILES['file']['tmp_name'], $image);


}


And normaly HTML code:





...


  Slika [max 500kB; formati: gif, jpg, jpeg]:

  
.

>>
>>
>> And also I have question, does anyone knows how to configure apache
>> (also under same Linux) so that in future I woul
>>
>> dn't have to write
>> 
> You need to change the enable_short_tags  directive. It is probably more
> simple to do it in the php.ini configuration file and not in the apache
> configuration file, but you should know that short tags are off by default
> because they conflict with xml.
>>
>> Thnx, Dusan
>>
>> On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković  wrote:
>> > Hi,
>> >
>> > I'm having problem with function move_uploaded_file() under Linux
>> > (Slackware 12.2). It  simply want execute only that function in php
>> > file. So maybe I should add something to http.config file or  ? I
>> > tried to execute that php file under Windows and it's working just
>> > fine (I've copied whole project to xampp's htdocs folder and run it
>> > normally).
>> >
>> > And also I have question, does anyone knows how to configure apache
>> > (also under same Linux) so that in future I wouldn't have to write
>> > > >
>> > Thnx, Dusan
>> >
>> > --
>> > made by Dusan
>> >
>>
>>
>>
>> --
>> made by Dusan
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
>
> --
> Alpar Torok
>



-- 
made by Dusan

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



[PHP] Re: Session variables

2009-02-07 Thread Nathan Rixham

Paul M Foster wrote:

I'm not too clear on HTTP headers, cookies, and such. So here are
questions related to that. Let's say I generate a random number that I
want the user to enter in a form. When I generate the number, I store it
in a session variable ($_SESSION). When the user submits the form, I
check the number they enter with what I've stored in the session
variable.

Since this session variable survives across page loads (assuming
session_start() is appropriately called), how is it stored and recalled?

Is it automatically stored as a cookie on the user's system? 

Or is it stored on the server? 

And how does a server "get" a cookie? 

Is it a separate request made by the server to the client? 


If the value I've asked the user for is *not* stored as a cookie, then
is it passed as part of the HTTP submission or what?

Thanks for any enlightenment on this.

Paul



seeing as you're a voomer here's a very mini explanation

session has an id

a:
session id is passed to a user in the http headers
users client gets sessionid and stores it in a cookie
users client sends cookie with sessionid in it back to website every 
page load



b:
on the server a small file is stored in a temp directory containing all 
the stuff you've stored in session

the file is named with the session id
when php recieves a request, with a cookie, with a session id in it, 
then it grabs the related server side session files, pulls the variables 
from it an makes them available to you in $_SESSION.


v simple :p

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



Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Chris



if($_FILES['file']['name'] && $_FILES['file']['size']<55){

$file_name = 
"news_".$_FILES['file']['name'];

$image="../_img/news/".$file_name;
//Upload file

move_uploaded_file($_FILES['file']['tmp_name'], $image);


error_reporting(E_ALL);
ini_set('display_errors', true);

what does it show?

does it get this far in the code? Add an error_log or echo "line is " . 
__LINE__ or something so you know for certain this is the problem.


--
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] Re: move_uploaded_file() problem

2009-02-07 Thread Carlos Medina

Chris schrieb:



if($_FILES['file']['name'] && $_FILES['file']['size']<55){
   
$file_name = "news_".$_FILES['file']['name'];
$image="../_img/news/".$file_name;   
//Upload file

move_uploaded_file($_FILES['file']['tmp_name'], $image);


error_reporting(E_ALL);
ini_set('display_errors', true);

what does it show?

does it get this far in the code? Add an error_log or echo "line is " . 
__LINE__ or something so you know for certain this is the problem.



Hallo,
please show in the php.net site the Method is

bool move_uploaded_file  ( string $filename  , string $destination  )

String filename and destination are not right...

Carlos Medina

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



Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 14:03 +0100, Carlos Medina wrote:
> Chris schrieb:
> > 
> >> if($_FILES['file']['name'] && $_FILES['file']['size']<55){
> >>
> >> $file_name = "news_".$_FILES['file']['name'];
> >> $image="../_img/news/".$file_name;   
> >> //Upload file
> >> 
> >> move_uploaded_file($_FILES['file']['tmp_name'], $image);
> > 
> > error_reporting(E_ALL);
> > ini_set('display_errors', true);
> > 
> > what does it show?
> > 
> > does it get this far in the code? Add an error_log or echo "line is " . 
> > __LINE__ or something so you know for certain this is the problem.
> > 
> Hallo,
> please show in the php.net site the Method is
> 
> bool move_uploaded_file  ( string $filename  , string $destination  )
> 
> String filename and destination are not right...
> 
> Carlos Medina
> 
I've been using this function for years, it's definitely right. Are you
sure your strings are right? The should be absolute or relative paths to
the file. Usually you'd do something like this Chris showed you. Also,
as you're on a Linux system, make sure that the directory into which you
are trying to put the file has got the right permissions to allow Apache
to do this.




Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Email configuration

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 01:58 +, Nathan Rixham wrote:
> Shawn McKenzie wrote:
> > Nathan Rixham wrote:
> >> Shawn McKenzie wrote:
> >>> Ever heard of RBL or DNSBL?  I use it on my email server and so do many
> >> lol snap, just sent same message at same time - tis so easy to jump on
> >> ash's back cos he's always so sure he's right lolol
> > 
> > Hmmm...  So Ashley is a "him"?
> > 
> 
> yeah quot:
> "Actually I'm a guy, but we can't all be perfect ;)"
> http://www.mail-archive.com/php-general@lists.php.net/msg235765.html
> 
> dunno why I insist on winding him up either, he's pretty sound lol
> 
Thanks!

And yes, I just checked this morning, and I am still a guy! Bloody
Americans cannibalising the spelling of it for their girls!


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread Alpár Török
2009/2/7 Dušan Novaković 

> On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török  wrote:
> >
> >
> > 2009/2/7 Dušan Novaković 
> >>
> >> Hi,
> >>
> >> I'm having problem with function move_uploaded_file() under Linux
> >> (Slackware 12.2). It  simply won't execute only that function in php
> >> file. So maybe I should add something to http.config file or  ? I
> >> tried to execute that php file under Windows and it's working just
> >> fine (I've copied whole project to xampp's htdocs folder and run it
> >> normally).
> >
> > Can you show some code?
>
> This is part where I use function move_uploaded_file()
>
> if($_FILES['file']['name'] && $_FILES['file']['size']<55){
>
>$file_name =
> "news_".$_FILES['file']['name'];
>
>  $image="../_img/news/".$file_name;
>//Upload file
>
>  move_uploaded_file($_FILES['file']['tmp_name'], $image);
>
>
> }
>
>
> And normaly HTML code:
>
Make sure that the relative path resolves to what you think it does. Try to
make a test with a hard coded absolute path, and do an echo
realpath("../_img/news/$file_name"); to see the absolute path that it
resolves to. It might be that the function does indeed work, but places
files in annother folder than you expect it to.

>
>
> 
>  enctype="multipart/form-data" name="form" id="form">
>
> ...
>
> 
>  Slika [max 500kB; formati: gif, jpg, jpeg]:
>
>  
> .
>
> >>
> >>
> >> And also I have question, does anyone knows how to configure apache
> >> (also under same Linux) so that in future I woul
> >>
> >> dn't have to write
> >>  >
> > You need to change the enable_short_tags  directive. It is probably more
> > simple to do it in the php.ini configuration file and not in the apache
> > configuration file, but you should know that short tags are off by
> default
> > because they conflict with xml.
> >>
> >> Thnx, Dusan
> >>
> >> On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković 
> wrote:
> >> > Hi,
> >> >
> >> > I'm having problem with function move_uploaded_file() under Linux
> >> > (Slackware 12.2). It  simply want execute only that function in php
> >> > file. So maybe I should add something to http.config file or  ? I
> >> > tried to execute that php file under Windows and it's working just
> >> > fine (I've copied whole project to xampp's htdocs folder and run it
> >> > normally).
> >> >
> >> > And also I have question, does anyone knows how to configure apache
> >> > (also under same Linux) so that in future I wouldn't have to write
> >> >  >> >
> >> > Thnx, Dusan
> >> >
> >> > --
> >> > made by Dusan
> >> >
> >>
> >>
> >>
> >> --
> >> made by Dusan
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >
> >
> >
> > --
> > Alpar Torok
> >
>
>
>
> --
> made by Dusan
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alpar Torok


Re: [PHP] Re: move_uploaded_file() problem

2009-02-07 Thread German Geek
make sure the permissions on the folders are right, so at least read for the
httpd in the tmp folder and write in the destination folder. since its
moving i would make them both writeable to the webserver daemon user.
permissions can be annoying are necessary though...
They caught me quite a few times now, so its one of the first things i would
check.

Tim-Hinnerk Heuer

http://www.ihostnz.com
Charles M. Schulz  - "I love mankind; it's people I can't stand."

2009/2/8 Alpár Török 

> 2009/2/7 Dušan Novaković 
>
> > On Sat, Feb 7, 2009 at 12:29 PM, Alpár Török 
> wrote:
> > >
> > >
> > > 2009/2/7 Dušan Novaković 
> > >>
> > >> Hi,
> > >>
> > >> I'm having problem with function move_uploaded_file() under Linux
> > >> (Slackware 12.2). It  simply won't execute only that function in php
> > >> file. So maybe I should add something to http.config file or  ? I
> > >> tried to execute that php file under Windows and it's working just
> > >> fine (I've copied whole project to xampp's htdocs folder and run it
> > >> normally).
> > >
> > > Can you show some code?
> >
> > This is part where I use function move_uploaded_file()
> >
> > if($_FILES['file']['name'] && $_FILES['file']['size']<55){
> >
> >$file_name =
> > "news_".$_FILES['file']['name'];
> >
> >  $image="../_img/news/".$file_name;
> >//Upload file
> >
> >  move_uploaded_file($_FILES['file']['tmp_name'], $image);
> >
> >
> > }
> >
> >
> > And normaly HTML code:
> >
> Make sure that the relative path resolves to what you think it does. Try to
> make a test with a hard coded absolute path, and do an echo
> realpath("../_img/news/$file_name"); to see the absolute path that it
> resolves to. It might be that the function does indeed work, but places
> files in annother folder than you expect it to.
>
> >
> >
> > 
> >  > enctype="multipart/form-data" name="form" id="form">
> >
> > ...
> >
> > 
> >  Slika [max 500kB; formati: gif, jpg, jpeg]:
> >
> >  
> > .
> >
> > >>
> > >>
> > >> And also I have question, does anyone knows how to configure apache
> > >> (also under same Linux) so that in future I woul
> > >>
> > >> dn't have to write
> > >>  > >
> > > You need to change the enable_short_tags  directive. It is probably
> more
> > > simple to do it in the php.ini configuration file and not in the apache
> > > configuration file, but you should know that short tags are off by
> > default
> > > because they conflict with xml.
> > >>
> > >> Thnx, Dusan
> > >>
> > >> On Sat, Feb 7, 2009 at 11:53 AM, Dušan Novaković 
> > wrote:
> > >> > Hi,
> > >> >
> > >> > I'm having problem with function move_uploaded_file() under Linux
> > >> > (Slackware 12.2). It  simply want execute only that function in php
> > >> > file. So maybe I should add something to http.config file or  ?
> I
> > >> > tried to execute that php file under Windows and it's working just
> > >> > fine (I've copied whole project to xampp's htdocs folder and run it
> > >> > normally).
> > >> >
> > >> > And also I have question, does anyone knows how to configure apache
> > >> > (also under same Linux) so that in future I wouldn't have to write
> > >> >  > >> >
> > >> > Thnx, Dusan
> > >> >
> > >> > --
> > >> > made by Dusan
> > >> >
> > >>
> > >>
> > >>
> > >> --
> > >> made by Dusan
> > >>
> > >> --
> > >> PHP General Mailing List (http://www.php.net/)
> > >> To unsubscribe, visit: http://www.php.net/unsub.php
> > >>
> > >
> > >
> > >
> > > --
> > > Alpar Torok
> > >
> >
> >
> >
> > --
> > made by Dusan
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Alpar Torok
>


Re: [PHP] Re: Some kind of Popup

2009-02-07 Thread Patrick Moloney

Ashley Sheridan wrote:

On Sat, 2008-11-22 at 12:32 -0500, Patrick Moloney wrote:

Yeti wrote:

Another JavaScript method would be to load the content in a hidden div
with position: absolute.
I think that's what I was considering doing with CSS except it would be 
labels only in the content. I only wanted to retrieve the data record 
from mysql if the user asked for the specs.


One issue is I don't want to leave the space available on my regular web 
page and would like to try not to overwrite something there - I'd rather 
have a separate window of some sort that sort of floats over the web page.



The best way to have the popup work, even with popup blockers is to have
a link like this:

More Details

The onclick handler is called before the link is actioned, and it opens
a new window with your settings, called 'details'. When that is
finished, the browser continues actioning the link, looks to find the
window/frame called 'details', finds one, and uses it. This way, even if
a user has scripting turned off, the link still works and opens in a new
window.


Ash
www.ashleysheridan.co.uk



Ashley,
Thanks, I finally worked on the popup you suggested. That is the closest 
to what I am looking for. I'm sure there are some other settings that 
could be useful. For example, the popup window gets hidden behind the 
primary web page if the user goes back there, and does not come back if 
he clicks again.


But, my bigger question is this: Is this solution specific to MS 
Windows. What would happen if someone were viewing the website using 
Apple or Linus etc?


Here's hoping you see this.

Thanks,
Patrick

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



Re: [PHP] Re: Some kind of Popup

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 09:06 -0500, Patrick Moloney wrote:
> Ashley Sheridan wrote:
> > On Sat, 2008-11-22 at 12:32 -0500, Patrick Moloney wrote:
> >> Yeti wrote:
> >>> Another JavaScript method would be to load the content in a hidden div
> >>> with position: absolute.
> >> I think that's what I was considering doing with CSS except it would be 
> >> labels only in the content. I only wanted to retrieve the data record 
> >> from mysql if the user asked for the specs.
> >>
> >> One issue is I don't want to leave the space available on my regular web 
> >> page and would like to try not to overwrite something there - I'd rather 
> >> have a separate window of some sort that sort of floats over the web page.
> >>
> > The best way to have the popup work, even with popup blockers is to have
> > a link like this:
> > 
> > More Details
> > 
> > The onclick handler is called before the link is actioned, and it opens
> > a new window with your settings, called 'details'. When that is
> > finished, the browser continues actioning the link, looks to find the
> > window/frame called 'details', finds one, and uses it. This way, even if
> > a user has scripting turned off, the link still works and opens in a new
> > window.
> > 
> > 
> > Ash
> > www.ashleysheridan.co.uk
> > 
> 
> Ashley,
> Thanks, I finally worked on the popup you suggested. That is the closest 
> to what I am looking for. I'm sure there are some other settings that 
> could be useful. For example, the popup window gets hidden behind the 
> primary web page if the user goes back there, and does not come back if 
> he clicks again.
> 
> But, my bigger question is this: Is this solution specific to MS 
> Windows. What would happen if someone were viewing the website using 
> Apple or Linus etc?
> 
> Here's hoping you see this.
> 
> Thanks,
> Patrick
> 
I use Linux myself, and the Window does stay in the background if it's
already open. You could fix this by changing the onclick a bit:


function details_popup()
{
detailsWin = window.open('about: blank',
'details','width=300,height=200');
detailsWin.focus();
}




More Details

I've not tested this, but it should allow your link to bring the window
to focus even if it is already open and in the background.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Re: Some kind of Popup

2009-02-07 Thread Phpster
No, it's a generic solution, should be pretty much the same across  
browsers. Why not download more browsers and test?


I would also add a window.focus() to the body tag in the popup to  
bring the window back on top when the user reclocks the link




Bastien

Sent from my iPod

On Feb 7, 2009, at 9:06, Patrick Moloney  wrote:


Ashley Sheridan wrote:

On Sat, 2008-11-22 at 12:32 -0500, Patrick Moloney wrote:

Yeti wrote:
Another JavaScript method would be to load the content in a  
hidden div

with position: absolute.
I think that's what I was considering doing with CSS except it  
would be labels only in the content. I only wanted to retrieve the  
data record from mysql if the user asked for the specs.


One issue is I don't want to leave the space available on my  
regular web page and would like to try not to overwrite something  
there - I'd rather have a separate window of some sort that sort  
of floats over the web page.


The best way to have the popup work, even with popup blockers is to  
have

a link like this:
onclick="window.open('about:

blank', 'details','width=300,height=200');">More Details
The onclick handler is called before the link is actioned, and it  
opens

a new window with your settings, called 'details'. When that is
finished, the browser continues actioning the link, looks to find the
window/frame called 'details', finds one, and uses it. This way,  
even if
a user has scripting turned off, the link still works and opens in  
a new

window.
Ash
www.ashleysheridan.co.uk


Ashley,
Thanks, I finally worked on the popup you suggested. That is the  
closest to what I am looking for. I'm sure there are some other  
settings that could be useful. For example, the popup window gets  
hidden behind the primary web page if the user goes back there, and  
does not come back if he clicks again.


But, my bigger question is this: Is this solution specific to MS  
Windows. What would happen if someone were viewing the website using  
Apple or Linus etc?


Here's hoping you see this.

Thanks,
Patrick

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



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



Re: [PHP] Re: Some kind of Popup

2009-02-07 Thread Patrick Moloney

Phpster wrote:
No, it's a generic solution, should be pretty much the same across 
browsers. Why not download more browsers and test?




Thanks all, I thought this might get lost in history here.
It's not just different browsers, it's different operating systems - 
Apple, Linux, more. I can't download those. Although I have thought 
about setting up one dedicated machine just to test Linux on such things.


I thought the Window function(?) is probably part of MS Windows. Maybe 
it's also implemented in Linux, possibly others just to be compatible.

I'll keep working on this with a little CSS and other options.
Thanks

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



Re: [PHP] Re: Some kind of Popup

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 09:43 -0500, Patrick Moloney wrote:
> Phpster wrote:
> > No, it's a generic solution, should be pretty much the same across 
> > browsers. Why not download more browsers and test?
> > 
> 
> Thanks all, I thought this might get lost in history here.
> It's not just different browsers, it's different operating systems - 
> Apple, Linux, more. I can't download those. Although I have thought 
> about setting up one dedicated machine just to test Linux on such things.
> 
> I thought the Window function(?) is probably part of MS Windows. Maybe 
> it's also implemented in Linux, possibly others just to be compatible.
> I'll keep working on this with a little CSS and other options.
> Thanks
> 
Window doesn't refer to MS Windows, it's just the generic object for the
browser window, so anything that supports Javascript will support it!
There are a lot of browser-specific additions to Javascript, but the
code we've all shown here is all pretty generic.


Ash
www.ashleysheridan.co.uk


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



[PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread revDAVE
Newbie question...

Hi folks, 

Adding records & capture the new record ID:

In the past, if I added a new record from a form in a phonebook file as an
example,  I would use a web form to fill out the info,  and then add and
invisible text item that stored a random number in one of the unused
database fields.

Then, after I inserted the record -  I would do a quick query that would
retrieve the record ID by searching for the random number

Q: is there a better way to retrieve the record ID from the newly added
record?





--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread Stuart
2009/2/7 revDAVE :
> Adding records & capture the new record ID:
>
> In the past, if I added a new record from a form in a phonebook file as an
> example,  I would use a web form to fill out the info,  and then add and
> invisible text item that stored a random number in one of the unused
> database fields.
>
> Then, after I inserted the record -  I would do a quick query that would
> retrieve the record ID by searching for the random number

Ouch that's nasty!!

> Q: is there a better way to retrieve the record ID from the newly added
> record?

Use an auto_increment field then, assuming MySQL you can use
mysql_insert_id to get the ID of the last record inserted on a given
connection.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread revDAVE
On 2/7/2009 11:41 AM, "Stuart"  wrote:

>> Then, after I inserted the record -  I would do a quick query that would
>> retrieve the record ID by searching for the random number
> 
> Ouch that's nasty!!
> 
>> Q: is there a better way to retrieve the record ID from the newly added
>> record?
> 
> Use an auto_increment field then, assuming MySQL you can use
> mysql_insert_id to get the ID of the last record inserted on a given
> connection.
> 
> -Stuart

Thanks Stuart - it works great - so much Less Nasty!

BTW: as long as - mysql_insert_id is right after the insert statement - is
it 100% accurate - (in that no other insert from another user could get in
the middle of this)?



--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists 09]




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



Re: [PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread Stuart
2009/2/7 revDAVE :
> On 2/7/2009 11:41 AM, "Stuart"  wrote:
>
>>> Then, after I inserted the record -  I would do a quick query that would
>>> retrieve the record ID by searching for the random number
>>
>> Ouch that's nasty!!
>>
>>> Q: is there a better way to retrieve the record ID from the newly added
>>> record?
>>
>> Use an auto_increment field then, assuming MySQL you can use
>> mysql_insert_id to get the ID of the last record inserted on a given
>> connection.
>>
>> -Stuart
>
> Thanks Stuart - it works great - so much Less Nasty!
>
> BTW: as long as - mysql_insert_id is right after the insert statement - is
> it 100% accurate - (in that no other insert from another user could get in
> the middle of this)?

Yes. As I stated, it returns the ID of the last record inserted on a
given connection.

-Stuart

-- 
http://stut.net/

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



Re: [PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread tedd

At 12:12 PM -0800 2/7/09, revDAVE wrote:

On 2/7/2009 11:41 AM, "Stuart"  wrote:


 Then, after I inserted the record -  I would do a quick query that would
 retrieve the record ID by searching for the random number


 Ouch that's nasty!!


 Q: is there a better way to retrieve the record ID from the newly added
 record?


 Use an auto_increment field then, assuming MySQL you can use

 > mysql_insert_id to get the ID of the last record inserted on a given

 connection.

 -Stuart


Thanks Stuart - it works great - so much Less Nasty!

BTW: as long as - mysql_insert_id is right after the insert statement - is
it 100% accurate - (in that no other insert from another user could get in
the middle of this)?



That's one way, to use "mysql_insert_id" (probably the best).

But another is simply to read back in the record you just created and 
check the $row['id']. That's the way I do it sometimes.


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] Sending XML requests as raw post data

2009-02-07 Thread Alpár Török
2009/2/7 Marc Steinert 

> Hi there!
>
> The software I'm maintaining uses $HTTP_RAW_POST_DATA to receive XML
> requests, posted by some client  written in C#.
> Now I need to write a PHP client that posts XML requests the same way as
> the C# client, so that the posted data is stored in $HTTP_RAW_POST_DATA,
> too.
>
> I tried to use curl to match my needs, but failed to establish a connection
> with the following code:
>
> $header[] = "Host: ".$host;
> $header[] = "MIME-Version: 1.0";
> $header[] = "Accept: text/xml";
> $header[] = "Content-length: ".strlen($xmlRequest);
> $header[] = "Cache-Control: no-cache";
> $header[] = "Connection: close \r\n";
> $header[] = $xmlRequest; // Contains the XML request
>
> curl_setopt($curl, CURLOPT_URL,self::BASE_URL);
> curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
> curl_setopt($curl, CURLOPT_TIMEOUT, 4);
> curl_setopt($curl, CURLOPT_CUSTOMREQUEST,'POST');
> curl_setopt($curl, CURLOPT_HTTPHEADER, $header);
>
> // Dispatch request and read answer
> $response = curl_exec($curl); // returns false
>
>
> Thanks for your help.
>
> Greetings from Germany
>
> Marc
>
> --
> http://bithub.net/
> Synchronize and share your files over the web for free
>
>
> My Twitter feed
> http://twitter.com/MarcSteinert
>
> Take a look at the free, open source php JSON-RPC  at *jsonrpcphp*.org ,
in the client you will find a very good example of what you need. (Sorry no
time to provide it directly)

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


-- 
Alpar Torok


Re: [PHP] Adding Records & Capture The New Record ID

2009-02-07 Thread Ashley Sheridan
On Sat, 2009-02-07 at 15:26 -0500, tedd wrote:
> At 12:12 PM -0800 2/7/09, revDAVE wrote:
> >On 2/7/2009 11:41 AM, "Stuart"  wrote:
> >
> >>>  Then, after I inserted the record -  I would do a quick query that would
> >>>  retrieve the record ID by searching for the random number
> >>
> >>  Ouch that's nasty!!
> >>
> >>>  Q: is there a better way to retrieve the record ID from the newly added
> >>>  record?
> >>
> >>  Use an auto_increment field then, assuming MySQL you can use
> >  > mysql_insert_id to get the ID of the last record inserted on a given
> >>  connection.
> >>
> >>  -Stuart
> >
> >Thanks Stuart - it works great - so much Less Nasty!
> >
> >BTW: as long as - mysql_insert_id is right after the insert statement - is
> >it 100% accurate - (in that no other insert from another user could get in
> >the middle of this)?
> 
> 
> That's one way, to use "mysql_insert_id" (probably the best).
> 
> But another is simply to read back in the record you just created and 
> check the $row['id']. That's the way I do it sometimes.
> 
> Cheers,
> 
> tedd
> -- 
> ---
> http://sperling.com  http://ancientstones.com  http://earthstones.com
> 
How do you plan on reading back the row if you don't use the
mysql_insert_id value? For most cases, it's not enough to read back the
values you just put in as they may be the same for some people.


Ash
www.ashleysheridan.co.uk


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



[PHP] Re: Sending XML requests as raw post data

2009-02-07 Thread Nathan Rixham

Marc Steinert wrote:

Hi there!

The software I'm maintaining uses $HTTP_RAW_POST_DATA to receive XML 
requests, posted by some client  written in C#.
Now I need to write a PHP client that posts XML requests the same way as 
the C# client, so that the posted data is stored in $HTTP_RAW_POST_DATA, 
too.


I tried to use curl to match my needs, but failed to establish a 
connection with the following code:


$header[] = "Host: ".$host;
$header[] = "MIME-Version: 1.0";
$header[] = "Accept: text/xml";
$header[] = "Content-length: ".strlen($xmlRequest);
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close \r\n";
$header[] = $xmlRequest; // Contains the XML request

curl_setopt($curl, CURLOPT_URL,self::BASE_URL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 4);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

// Dispatch request and read answer
$response = curl_exec($curl); // returns false


Thanks for your help.

Greetings from Germany

Marc



i think..
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlhere );

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



[PHP] Re: Sending XML requests as raw post data

2009-02-07 Thread Nathan Rixham

Marc Steinert wrote:

Hi there!

The software I'm maintaining uses $HTTP_RAW_POST_DATA to receive XML 
requests, posted by some client  written in C#.
Now I need to write a PHP client that posts XML requests the same way as 
the C# client, so that the posted data is stored in $HTTP_RAW_POST_DATA, 
too.


I tried to use curl to match my needs, but failed to establish a 
connection with the following code:


$header[] = "Host: ".$host;
$header[] = "MIME-Version: 1.0";
$header[] = "Accept: text/xml";
$header[] = "Content-length: ".strlen($xmlRequest);
$header[] = "Cache-Control: no-cache";
$header[] = "Connection: close \r\n";
$header[] = $xmlRequest; // Contains the XML request

curl_setopt($curl, CURLOPT_URL,self::BASE_URL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 4);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST,'POST');
curl_setopt($curl, CURLOPT_HTTPHEADER, $header);

// Dispatch request and read answer
$response = curl_exec($curl); // returns false


Thanks for your help.

Greetings from Germany

Marc



and nearly forgot, you can loose all of those headers, half the ones you 
specified are for responses not requests anyways :p


$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, self::BASE_URL);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $xmlRequest);
curl_setopt($curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
curl_setopt($curl, CURLINFO_HEADER_OUT, 1);
$response = curl_exec($curl);


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



Re: [PHP] Reg-ex help

2009-02-07 Thread Craige Leeder

Thanks!

That's a big help.

- Craige

Jim Lucas wrote:

Craige Leeder wrote:

Hey guys,

I'm trying to write a regular expression to match a tag for my 
frameworks template engine.  I seem to be having some trouble.  The 
expression should match:


{:seg 'segname':}
{:seg 'segname' cache:}

What I have is...

$fSegRegEx = "#\{:seg \'[a-z0-9\-\_]{3,}\'( cache)?:\}#i";

Which when run against my test data, seems to match:

"{:seg 'segname' cache:}"
" cache"


Thanks guys.  This has been bugging me for a couple days.
- Craige




I used some of your code, but try this variant on for size.




{:seg 'title':}
{:seg 'title' cache:}



DATA;

# For arguments sake, I'll provide the whole code snippet...

$fSegRegEx = "|\{:(seg) \'([a-z0-9\-\_]{3,})\'\s?(cache)?:\}|i";

preg_match_all($fSegRegEx, $dummyData, $faSegMatches, PREG_SET_ORDER);
print_r($faSegMatches);

?>

Not sure what your input is going to be (HTML, XML, etc...) so I used 
HTML


Anyways, output from the above code is this:



Array
(
[0] => Array
(
[0] => {:seg 'title':}
[1] => seg
[2] => title
)

[1] => Array
(
[0] => {:seg 'title' cache:}
[1] => seg
[2] => title
[3] => cache
)

)

Hope this starts you down the right path.



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



[PHP] Seeking PHP Work in Chicago or Telecommute

2009-02-07 Thread Richard Lynch
I figure if job postings are okay, then so are job requests, right? :-)

I'm looking for PHP work in Chicago or telecommuting.

My resume is here:
http://l-i-e.com/resume.htm

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



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