[PHP] Re: Open Source Classifides

2008-08-15 Thread Lupus Michaelis

Joey a écrit :


Does anyone know of a good php based classified system?


  What do you mean by classified system ?

--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Re: Conditional compilation

2008-08-15 Thread Robert Cummings
On Fri, 2008-08-15 at 22:56 -0500, Shawn McKenzie wrote:
> Robert Cummings wrote:
> > On Fri, 2008-08-15 at 18:34 -0500, Shawn McKenzie wrote:
> >> Herman Gomez wrote:
> >>> Hi,
> >>>
> >>> Here is something I used to do in C/C++ to include/exclude automaticaly 
> >>> all debugging code at compiling time:
> >>>
> >>> #define debug TRUE
> >>> #ifdef(debug)
> >>> //debugging code
> >>> #endif
> >>>
> >>> That way I can include/exclude easily all debugging code in the final 
> >>> compiled code. In PHP I have not been able to find anything like that.
> >>> The only solution I've found is having this kind of code in every debug 
> >>> code block:
> >>>
> >>> if ($debug) {
> >>> //debugging code
> >>> }
> >>>
> >>> But this means that the debugging code is in the final compiled 
> >>> (interpreted) code, wasting cpu cycles even if there won't be any 
> >>> debugging in production.
> >>>
> >>> Does somebody know if there is something like conditional compilation in 
> >>> PHP that I can use?
> >>>
> >>> Regards,
> >>> Herman Gomez
> >>> Madrid, Spain.
> >> Well PHP isn't compiled it's interpreted.  Still I don't see much diff 
> >> and no overhead between the following:
> >>
> >> #ifdef(debug)
> >>//debugging code
> >> #endif
> >>
> >> ---and---
> >>
> >> if (defined('DEBUG')) {
> >>//debugging code
> >> }
> >>
> >> I don't think checking a define is cpu intensive or even measurable. 
> >> You could "assume" that it's defined as true or false and:
> >>
> >> if (DEBUG === true)) {
> >>//debugging code
> >> }
> >>
> >> Still, I don't think that even checking $debug is measurable.
> > 
> > That depends on where the conditional exists. In C you can place it
> > anywhere, including wihtin a tight loop. In PHP you end up having to
> > either take an overhead penalty or duplicate code to force the
> > conditional outside of a tight loop.
> > 
> > Contrast the following:
> > 
> >  > 
> > if( DEBUG === true )
> > {
> > for( $i = 0; $i < 100; $i++ )
> > {
> > // Do something common between DEBUG and !DEBUG modes.
> > // Do something dependent on debug mode.
> > }
> > }
> > else
> > {
> > for( $i = 0; $i < 100; $i++ )
> > {
> > // Do something common between DEBUG and !DEBUG modes.
> > }
> > }
> > 
> > ?>
> > 
> > Versus:
> > 
> >  > 
> > for( $i = 0; $i < 100; $i++ )
> > {
> > // Do something common between DEBUG and !DEBUG modes.
> > 
> > if( DEBUG === true )
> > {
> > // Do something dependent on debug mode.
> > }
> > }
> > 
> > ?>
> > 
> > Now depending on what "Do something common between DEBUG and !DEBUG
> > modes" does, it can be a real PITA to do code duplication to optimize
> > debug mode handling, but on the other hand, you really don't want to
> > check if DEBUG is enabled 1 million times.
> > 
> > If I recall though... a few years ago the answer to this question was
> > that there's no reason why you can't use the C pre-processor to
> > accomplish the same thing with PHP. The down side though is that then
> > you lose debugging information such as the real line number on which an
> > error occurs.
> > 
> > Cheers,
> > Rob.
> 
> Great!  Then the answer is:   wait,   wait,
> 
> write it in C!

Well PHP does have a great extension system so you can plug in your own
C code ;)

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



Re: [PHP] Re: Conditional compilation

2008-08-15 Thread Shawn McKenzie

Robert Cummings wrote:

On Fri, 2008-08-15 at 18:34 -0500, Shawn McKenzie wrote:

Herman Gomez wrote:

Hi,

Here is something I used to do in C/C++ to include/exclude automaticaly 
all debugging code at compiling time:


#define debug TRUE
#ifdef(debug)
//debugging code
#endif

That way I can include/exclude easily all debugging code in the final 
compiled code. In PHP I have not been able to find anything like that.
The only solution I've found is having this kind of code in every debug 
code block:


if ($debug) {
//debugging code
}

But this means that the debugging code is in the final compiled 
(interpreted) code, wasting cpu cycles even if there won't be any 
debugging in production.


Does somebody know if there is something like conditional compilation in 
PHP that I can use?


Regards,
Herman Gomez
Madrid, Spain.
Well PHP isn't compiled it's interpreted.  Still I don't see much diff 
and no overhead between the following:


#ifdef(debug)
//debugging code
#endif

---and---

if (defined('DEBUG')) {
//debugging code
}

I don't think checking a define is cpu intensive or even measurable. 
You could "assume" that it's defined as true or false and:


if (DEBUG === true)) {
//debugging code
}

Still, I don't think that even checking $debug is measurable.


That depends on where the conditional exists. In C you can place it
anywhere, including wihtin a tight loop. In PHP you end up having to
either take an overhead penalty or duplicate code to force the
conditional outside of a tight loop.

Contrast the following:



Versus:



Now depending on what "Do something common between DEBUG and !DEBUG
modes" does, it can be a real PITA to do code duplication to optimize
debug mode handling, but on the other hand, you really don't want to
check if DEBUG is enabled 1 million times.

If I recall though... a few years ago the answer to this question was
that there's no reason why you can't use the C pre-processor to
accomplish the same thing with PHP. The down side though is that then
you lose debugging information such as the real line number on which an
error occurs.

Cheers,
Rob.


Great!  Then the answer is:   wait,   wait,

write it in C!

-Shawn

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



Re: [PHP] SESSION problem

2008-08-15 Thread VamVan
Tedd,

I think according to PHP manual. Session_start() must be the first line in
the code. Dont worry it will remember your session until you close the
browser and also it wont duplicate it.

Thanks

On Fri, Aug 15, 2008 at 4:39 PM, tedd <[EMAIL PROTECTED]> wrote:

> At 1:47 PM -0500 8/15/08, Boyd, Todd M. wrote:
>
>> Have you tried:
>>
>>echo SID;
>>
>> ...? I'm wondering if you're going to get different values on the two
>> pages. What that means beyond two different sessions is beyond me, but
>> it's a start.
>>
>>
>> Todd Boyd
>> Web Programmer
>>
>
> Todd:
>
> I added code to show the SID and it's the same, but still nothing happens.
>
> http://www.webbytedd.com/b2/session-test/index.php
>
> I know what the problem is, but don't know how to fix it.
>
> If you will look at the code, I am using a variable within the SESSION
> declaration:
>
> $_SESSION[$i] = $i;
>
> If I comment that out, the $_SESSION['test'] will be passed.
>
> Thanks,
>
> 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] Re: Conditional compilation

2008-08-15 Thread Robert Cummings
On Fri, 2008-08-15 at 18:34 -0500, Shawn McKenzie wrote:
> Herman Gomez wrote:
> > Hi,
> > 
> > Here is something I used to do in C/C++ to include/exclude automaticaly 
> > all debugging code at compiling time:
> > 
> > #define debug TRUE
> > #ifdef(debug)
> > //debugging code
> > #endif
> > 
> > That way I can include/exclude easily all debugging code in the final 
> > compiled code. In PHP I have not been able to find anything like that.
> > The only solution I've found is having this kind of code in every debug 
> > code block:
> > 
> > if ($debug) {
> > //debugging code
> > }
> > 
> > But this means that the debugging code is in the final compiled 
> > (interpreted) code, wasting cpu cycles even if there won't be any 
> > debugging in production.
> > 
> > Does somebody know if there is something like conditional compilation in 
> > PHP that I can use?
> > 
> > Regards,
> > Herman Gomez
> > Madrid, Spain.
> 
> Well PHP isn't compiled it's interpreted.  Still I don't see much diff 
> and no overhead between the following:
> 
> #ifdef(debug)
>   //debugging code
> #endif
> 
> ---and---
> 
> if (defined('DEBUG')) {
>   //debugging code
> }
> 
> I don't think checking a define is cpu intensive or even measurable. 
> You could "assume" that it's defined as true or false and:
> 
> if (DEBUG === true)) {
>   //debugging code
> }
> 
> Still, I don't think that even checking $debug is measurable.

That depends on where the conditional exists. In C you can place it
anywhere, including wihtin a tight loop. In PHP you end up having to
either take an overhead penalty or duplicate code to force the
conditional outside of a tight loop.

Contrast the following:



Versus:



Now depending on what "Do something common between DEBUG and !DEBUG
modes" does, it can be a real PITA to do code duplication to optimize
debug mode handling, but on the other hand, you really don't want to
check if DEBUG is enabled 1 million times.

If I recall though... a few years ago the answer to this question was
that there's no reason why you can't use the C pre-processor to
accomplish the same thing with PHP. The down side though is that then
you lose debugging information such as the real line number on which an
error occurs.

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



RE: [PHP] SESSION problem

2008-08-15 Thread tedd

At 1:47 PM -0500 8/15/08, Boyd, Todd M. wrote:

Have you tried:

echo SID;

...? I'm wondering if you're going to get different values on the two
pages. What that means beyond two different sessions is beyond me, but
it's a start.


Todd Boyd
Web Programmer


Todd:

I added code to show the SID and it's the same, but still nothing happens.

http://www.webbytedd.com/b2/session-test/index.php

I know what the problem is, but don't know how to fix it.

If you will look at the code, I am using a variable within the 
SESSION declaration:


$_SESSION[$i] = $i;

If I comment that out, the $_SESSION['test'] will be passed.

Thanks,

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



[PHP] Re: Conditional compilation

2008-08-15 Thread Shawn McKenzie

Herman Gomez wrote:

Hi,

Here is something I used to do in C/C++ to include/exclude automaticaly 
all debugging code at compiling time:


#define debug TRUE
#ifdef(debug)
//debugging code
#endif

That way I can include/exclude easily all debugging code in the final 
compiled code. In PHP I have not been able to find anything like that.
The only solution I've found is having this kind of code in every debug 
code block:


if ($debug) {
//debugging code
}

But this means that the debugging code is in the final compiled 
(interpreted) code, wasting cpu cycles even if there won't be any 
debugging in production.


Does somebody know if there is something like conditional compilation in 
PHP that I can use?


Regards,
Herman Gomez
Madrid, Spain.


Well PHP isn't compiled it's interpreted.  Still I don't see much diff 
and no overhead between the following:


#ifdef(debug)
//debugging code
#endif

---and---

if (defined('DEBUG')) {
//debugging code
}

I don't think checking a define is cpu intensive or even measurable. 
You could "assume" that it's defined as true or false and:


if (DEBUG === true)) {
//debugging code
}

Still, I don't think that even checking $debug is measurable.

-Shawn

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



Re: [PHP] Sessions - Failed to initialize storage...

2008-08-15 Thread Bojan Tesanovic

Hm , this issue has been reported
http://bugs.php.net/bug.php?id=25876 and http://bugs.php.net/bug.php? 
id=32330


and it occurs sporadically for some users
though most of them said that setting
ini_set("session.save_handler", "files");  solved the problem and / 
tmp dir must be writable by server


so 2 steps
1. make sure that on prod server .htaccess is actually read , as you  
set "php_value session.save_handler files" in it

2. /tmp is writable





On Aug 15, 2008, at 8:20 PM, Chris Ditty wrote:

Fatal error: session_start(): Failed to initialize storage module.  
in /home/webroot/www/service/payarrange/index.php on line 4


Line 4 is the session_start();


Bojan Tesanovic <[EMAIL PROTECTED]> 8/15/2008 1:10 PM >>>
Can you give us the exact error that you got, that can help to  
debug ...



On Aug 15, 2008, at 7:53 PM, Chris Ditty wrote:


Can someone tell me what I am missing here?  This is working fine
on my development machine(5.2.6), but on the production box(4.3.2),
it doesn't want to work.  I am getting that error on my
session_start() function.

Is the difference in versions what is causing the problems?

I've googled and none of the results fit my problem.  Below is
my .htaccess file.
php_value session.save_handler files
php_value session.save_path /tmp
php_value session.name PHPSESSID
php_flag session.auto_start off
php_value session.cookie_path /
php_flag session.use_cookies on
php_value session.cache_expire 180
php_flag session.use_trans_sid on



MLGW now offers ONLINE BILLING!
To view your bills, receive paperless bills,
check payment status and pay online,
go to www.mlgw.com and click on the My Account link.
Enroll today!


This e-mail and any attachments represent the views and opinions
of only the sender and are not necessarily those of
Memphis Light, Gas & Water Division, and no such inference should
be made.


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



Bojan Tesanovic
http://classiccars.carster.us/







MLGW now offers ONLINE BILLING!
To view your bills, receive paperless bills,
check payment status and pay online,
go to www.mlgw.com and click on the My Account link.
Enroll today!


This e-mail and any attachments represent the views and opinions
of only the sender and are not necessarily those of
Memphis Light, Gas & Water Division, and no such inference should  
be made.




Bojan Tesanovic
http://www.classicio.com/
http://www.real-estates-sale.com/





Re: [PHP] PHP Script/Thread ID thingie

2008-08-15 Thread Stut

On 15 Aug 2008, at 23:30, Richard Lynch wrote:

On Fri, August 15, 2008 10:52 am, Stut wrote:

On 15 Aug 2008, at 16:37, [EMAIL PROTECTED] wrote:

I'm logging things with error_log, and would like to be able to sort
out one script run from another.

So I'm looking for some kind of "script id" or "thread id" or "PHP
script run execution ID" type of function.

getmypid() just returns the same apache child process ID all the
time, so that's not what I want.

zend_thread_id() looks useful, but I suspect it's not quite what I'm
looking for.  But I'd have to re-compile with ZTS and --debug-mode
and I don't think the function I'm looking for should require
that...

Perhaps I've just missed the right function name?

Or perhaps this should be a "Feature Request"?


Don't think there is such a thing, but you could generate one by
combining the pid, timestamp and the script filename, maybe into an
md5 hash value or similar. Thinking about it, "ip.pid" would be
enough, i.e. 127.0.0.1.12345.


The IP and pid will not actually change...

It's just me surfing to my own app (or one I inherited) on my own
desktop.

Apache isn't getting nearly exercised enough to need a second child,
so the pid is the same all the time...

Guess I'll have to create one as Eric Butera suggested...

Seems kind of odd that there isn't some kind of
script/thread/M_INIT/R_INIT id hanging around and exposed that
developers could use.
[shrug]


I don't find that odd since there's on external context to such an ID  
other than that which you create within the script so you can just use  
something randomly unique.


-Stut

--
http://stut.net/

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



Re: [PHP] PHP Script/Thread ID thingie

2008-08-15 Thread Richard Lynch
On Fri, August 15, 2008 10:52 am, Stut wrote:
> On 15 Aug 2008, at 16:37, [EMAIL PROTECTED] wrote:
>> I'm logging things with error_log, and would like to be able to sort
>> out one script run from another.
>>
>> So I'm looking for some kind of "script id" or "thread id" or "PHP
>> script run execution ID" type of function.
>>
>> getmypid() just returns the same apache child process ID all the
>> time, so that's not what I want.
>>
>> zend_thread_id() looks useful, but I suspect it's not quite what I'm
>> looking for.  But I'd have to re-compile with ZTS and --debug-mode
>> and I don't think the function I'm looking for should require
>> that...
>>
>> Perhaps I've just missed the right function name?
>>
>> Or perhaps this should be a "Feature Request"?
>
> Don't think there is such a thing, but you could generate one by
> combining the pid, timestamp and the script filename, maybe into an
> md5 hash value or similar. Thinking about it, "ip.pid" would be
> enough, i.e. 127.0.0.1.12345.

The IP and pid will not actually change...

It's just me surfing to my own app (or one I inherited) on my own
desktop.

Apache isn't getting nearly exercised enough to need a second child,
so the pid is the same all the time...

Guess I'll have to create one as Eric Butera suggested...

Seems kind of odd that there isn't some kind of
script/thread/M_INIT/R_INIT id hanging around and exposed that
developers could use.
[shrug]

-- 
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



[PHP] Open Source Classifides

2008-08-15 Thread Joey
Hello All,

 

Does anyone know of a good php based classified system?

 

Thanks!

 

 



RE: [PHP] How to submit form via PHP

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 2:54 PM
> To: php-general@lists.php.net
> Subject: RE: [PHP] How to submit form via PHP
> 
> Thanks, that was what I needed. Also I found this:
> http://curl.haxx.se/libcurl/php/examples/./simplepost.html. Is it
> somehow possible to retrieve result of that operation?
> 
> Thanks in advance.
> 
> Matěj "czech_d3v3l0pr" Grabovský

I believe:

curl_setopt(CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);

...will send the output from cURL to the variable rather than the web 
browser/screen.


Todd Boyd
Web Programmer




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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 2:58 PM, Dan Shirah wrote:



There you go!

Entering in the search criteria pulls up the search in a new window  
and automatically pulls results based on your search.  Then I can  
just close the window to return to where I was on your site.


I think that is simple and easy to use.  And I'm sure not much of a  
headache for you!


It wasn't exactly what I had wanted, but it works and was very easy.

Thanks again for taking the time to help me.

- jody


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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
There you go!

Entering in the search criteria pulls up the search in a new window and
automatically pulls results based on your search.  Then I can just close the
window to return to where I was on your site.

I think that is simple and easy to use.  And I'm sure not much of a headache
for you!


RE: [PHP] How to submit form via PHP

2008-08-15 Thread pe . ve . ce
Thanks, that was what I needed. Also I found this: 
http://curl.haxx.se/libcurl/php/examples/./simplepost.html. Is it somehow 
possible to retrieve result of that operation?

Thanks in advance.

Matěj "czech_d3v3l0pr" Grabovský


>  Původní zpráva 
> Od: Warren Vail <[EMAIL PROTECTED]>
> Předmět: RE: [PHP] How to submit form via PHP
> Datum: 15.8.2008 21:04:12
> 
> Key to this one may be understanding what is being asked.  I think pe.ve.ce
> performed a file read (file_get_contents) on the form from another website
> and wants to be able to simulate a browser submit from his code.
>
> If this is correct, I would recommend you take a look at CURL.  There are
> probably several approaches that work, but as I understand that CURL is an
> implementation of the C libraries used by early browsers.  If that is not
> correct, someone here will set us straight.  Many ISP's won't support CURL,
> because it is often used for questionable activities and considered a
> security exposure, but I believe CURL is what you want.
>
> Hth,
>
> Warren Vail
>
> > -Original Message-
> > From: Jay Blanchard [mailto:[EMAIL PROTECTED]
> > Sent: Friday, August 15, 2008 11:31 AM
> > To: [EMAIL PROTECTED]; php-general@lists.php.net
> > Subject: RE: [PHP] How to submit form via PHP
> >
> > [snip]
> > Hello. I'm pretty noob in PHP and would like to know how can
> > I submit some HTML form got via file_get_contents(URL). For example:
> >
> > 
> > 
> > 
> >
> > so how can I submit 'someform' form.
> >
> > Thanks in advance for any suggestions.
> > [/snip]
> >
> > Click 'Submit'
> >
> >
> >
> > Your form tag needs an action statement
> >
> > 
> >
> > All of the form's variables will be available in the $_POST array
> >
> > --
> > 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: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
On 8/15/08, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
>  GET should work too. Do you know of any examples anywhere online for
>>> this? My brain shuts off at the thought of how I'd do that.
>>>
>>> - jody
>>
>>
> When you GET a value you are retrieving a passed value that appears in the
> address bar:
> Example
>
> http://www.mysite.com?name=joe 
>
> www.mysite.com is the website
>
> ?name=joe is the value being passed by GET
>
> To put this value into a PHP variable you would simply do:
>  $name = $_GET['name'];
> ?>
>

Although, since you have no control over the actual search page to edit the
code and have it pull in the $_GET[''] values you will probably have to
disect the search page to get its form elements so you can feed them to it
and force a submit.

I just looked at your site, and after I input my search criteria and click
submit I have to again enter in the search criteria and submit to actually
get some results.


Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> GET should work too. Do you know of any examples anywhere online for this?
>> My brain shuts off at the thought of how I'd do that.
>>
>> - jody
>
>
When you GET a value you are retrieving a passed value that appears in the
address bar:
Example

http://www.mysite.com?name=joe

www.mysite.com is the website

?name=joe is the value being passed by GET

To put this value into a PHP variable you would simply do:
 


Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Stut

On 15 Aug 2008, at 20:34, Jody Cleveland wrote:


On Aug 15, 2008, at 2:27 PM, Stut wrote:


On 15 Aug 2008, at 20:21, Jody Cleveland wrote:

I work for a consortium of 30 libraries. Each library has their  
own website, but they all share the same web catalog. On each  
library's website there is a search box to search the catalog,  
which is on a completely different server from the websites. We've  
been finding that once people use that search box, they get  
distracted with the catalog and have no easy way to get back to  
the library's website. The problem I was tasked with is, coming up  
with a way to search the catalog with an easy way to return to  
where the user was before they initiated the search.


The only way I thought to do this was to use a frameset for the  
search results. Which, you can see here:

http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html


Is POST the only way to get the search results, or will it work  
with a GET?


If GET will work then you need to set the search form to post to a  
script on your site which then outputs a frameset with a URL on  
your server that shows the header, and the URL for the shared  
search server with all the POSTed variables as GET parameters as  
the second frame. Job done.


GET should work too. Do you know of any examples anywhere online for  
this? My brain shuts off at the thought of how I'd do that.


Off the top of my head and very untested...

 $v)
  {
$vars[] = urlencode($k).'='.urlencode($v);
  }
  $searchurl = 'http://search.server.com/search.php?'.implode('&',  
$vars);

?>

  
  


Modify to your own frameset/url requirements but that's the basic idea.

-Stut

--
http://stut.net/

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> I work for a consortium of 30 libraries. Each library has their own
> website, but they all share the same web catalog. On each library's website
> there is a search box to search the catalog, which is on a completely
> different server from the websites. We've been finding that once people use
> that search box, they get distracted with the catalog and have no easy way
> to get back to the library's website. The problem I was tasked with is,
> coming up with a way to search the catalog with an easy way to return to
> where the user was before they initiated the search.
>
> The only way I thought to do this was to use a frameset for the search
> results. Which, you can see here:
>
> http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html
>
> If anyone has any ideas, other than using frames for the results, I'd love
> to hear them. The problem is, there's nothing I can do on the web catalog
> end.
>
> - jody



Easiest solution - Open the search page in a new window. Then they can just
close it to get back to the previous window...

I now understand what you're trying to say in regards to the frames.

The top frame resides completely on your server so you can place a "Go back
to homepage" link to direct people back to YOUR libraries homepage. And the
bottom frame contains the search results page that you have no control over
and cannot alter to simply place a "Home" link on it. And that should remain
since the global search results page is accessed by multiple libraries.

Like I said above, the easiest thing to do is just open it in a seperate
window so they can close it at any time and still be at the same place on
your libraries website.


Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 2:27 PM, Stut wrote:


On 15 Aug 2008, at 20:21, Jody Cleveland wrote:

I work for a consortium of 30 libraries. Each library has their own  
website, but they all share the same web catalog. On each library's  
website there is a search box to search the catalog, which is on a  
completely different server from the websites. We've been finding  
that once people use that search box, they get distracted with the  
catalog and have no easy way to get back to the library's website.  
The problem I was tasked with is, coming up with a way to search  
the catalog with an easy way to return to where the user was before  
they initiated the search.


The only way I thought to do this was to use a frameset for the  
search results. Which, you can see here:

http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html


Is POST the only way to get the search results, or will it work with  
a GET?


If GET will work then you need to set the search form to post to a  
script on your site which then outputs a frameset with a URL on your  
server that shows the header, and the URL for the shared search  
server with all the POSTed variables as GET parameters as the second  
frame. Job done.


GET should work too. Do you know of any examples anywhere online for  
this? My brain shuts off at the thought of how I'd do that.


- jody

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Stut

On 15 Aug 2008, at 20:21, Jody Cleveland wrote:

I work for a consortium of 30 libraries. Each library has their own  
website, but they all share the same web catalog. On each library's  
website there is a search box to search the catalog, which is on a  
completely different server from the websites. We've been finding  
that once people use that search box, they get distracted with the  
catalog and have no easy way to get back to the library's website.  
The problem I was tasked with is, coming up with a way to search the  
catalog with an easy way to return to where the user was before they  
initiated the search.


The only way I thought to do this was to use a frameset for the  
search results. Which, you can see here:

http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html


Is POST the only way to get the search results, or will it work with a  
GET?


If GET will work then you need to set the search form to post to a  
script on your site which then outputs a frameset with a URL on your  
server that shows the header, and the URL for the shared search server  
with all the POSTed variables as GET parameters as the second frame.  
Job done.


If not then you're going to need to play silly wotsits with a hidden  
form in the top frame which reposts the search to the bottom form. Not  
pretty and would require JS but it should work.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 2:05 PM, Stut wrote:


On 15 Aug 2008, at 19:50, Jody Cleveland wrote:

On Aug 15, 2008, at 1:46 PM, Stut wrote:

On 15 Aug 2008, at 19:39, Jody Cleveland wrote:

On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:

Actually you may want to check back with basic html at the  
"target"

parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]


Target won't work for me because the originating page with the  
search box is not part of any frameset. I'm trying to get the  
search results from that page to go to a page that is part of a  
frameset.


Are you saying that the frame you want to have the search results  
shown in doesn't exist when the search form is submitted? If it  
does then it doesn't matter where the form is, just specify the  
target as the name of the frame and it will almost certainly work.


If however you want the search to create the frameset when it runs  
then you have a completely different problem which is best solved  
using some sort of session. The script that handles the POST will  
need to store the details of the search somewhere and output the  
frameset. The frame that needs to contain the results would then  
grab the details and run the search outputting the results.


That is exactly what I want. I apologize for the confusion. I was  
having a hard time trying to put what I was trying to do in words.  
But, yes, your second paragraph is exactly what I want to do. My  
knowledge of PHP is very limited, and I've tried to search for  
something that will do this, but couldn't find anything.


Ok, then I have to ask the question... why frames?

If you really need frames then you need to come up with a way to  
pass the search from the script the search form loads to the  
specific frame in the frameset it outputs. You could do this through  
a GET parameter, or via a session or in several other ways. In any  
case you'd be far better off not using frames if possible, so why  
frames?


I work for a consortium of 30 libraries. Each library has their own  
website, but they all share the same web catalog. On each library's  
website there is a search box to search the catalog, which is on a  
completely different server from the websites. We've been finding that  
once people use that search box, they get distracted with the catalog  
and have no easy way to get back to the library's website. The problem  
I was tasked with is, coming up with a way to search the catalog with  
an easy way to return to where the user was before they initiated the  
search.


The only way I thought to do this was to use a frameset for the search  
results. Which, you can see here:

http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html

If anyone has any ideas, other than using frames for the results, I'd  
love to hear them. The problem is, there's nothing I can do on the web  
catalog end.


- jody

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



Re: [PHP] preg_replace strange behaviour, duplicates

2008-08-15 Thread Micah Gersten
Take a look at the negative assertions on this page:
http://us2.php.net/manual/en/regexp.reference.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Adz07 wrote:
> I am trying to nail down a bit of code for changing processor names depending
> on matches.
> Problem i am having is the replacement takes place then it seems to do it
> again replacing the text just replaced as there are similar matches
> afterwards. example (easier)
>
> $string = "The new Intel Core 2 Duo T8300";
>
> $patterns = array("/Intel Core 2 Duo/","/Intel Core 2/");
>
> $replacements = array("/Intel Core 2 Duo Processor Technology/","/Intel Core
> 2 Processor Technology/");
>
> I would expect to get the following:
>
> The new Intel Core 2 Duo Processor Technology T8300
>
> but i get 
>
> The new Intel Core 2 Processor Technology Duo Processor Technology T8300
>
> I can see why its doing it, reading the string in and making the replacement
> but then reading the string in for the next pattern, but i don't want it to
> do this. How do i stop preg_replace from reading in the same part of the
> string that has been replaced already?
>
> (it's a bad day! :( )
>   

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> That is exactly what I want. I apologize for the confusion. I was having a
> hard time trying to put what I was trying to do in words. But, yes, your
> second paragraph is exactly what I want to do. My knowledge of PHP is very
> limited, and I've tried to search for something that will do this, but
> couldn't find anything.
>
> - jody


In that case, I would not use frames at all.  I believe in the top frame all
you wanted to store was the search text, right?

Just have your search link do something like this:










SEARCH




And then on
http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html
just
assign your posted search value and make a hidden form field.
















Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Stut

On 15 Aug 2008, at 19:50, Jody Cleveland wrote:

On Aug 15, 2008, at 1:46 PM, Stut wrote:

On 15 Aug 2008, at 19:39, Jody Cleveland wrote:

On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:


Actually you may want to check back with basic html at the "target"
parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]


Target won't work for me because the originating page with the  
search box is not part of any frameset. I'm trying to get the  
search results from that page to go to a page that is part of a  
frameset.


Are you saying that the frame you want to have the search results  
shown in doesn't exist when the search form is submitted? If it  
does then it doesn't matter where the form is, just specify the  
target as the name of the frame and it will almost certainly work.


If however you want the search to create the frameset when it runs  
then you have a completely different problem which is best solved  
using some sort of session. The script that handles the POST will  
need to store the details of the search somewhere and output the  
frameset. The frame that needs to contain the results would then  
grab the details and run the search outputting the results.


That is exactly what I want. I apologize for the confusion. I was  
having a hard time trying to put what I was trying to do in words.  
But, yes, your second paragraph is exactly what I want to do. My  
knowledge of PHP is very limited, and I've tried to search for  
something that will do this, but couldn't find anything.


Ok, then I have to ask the question... why frames?

If you really need frames then you need to come up with a way to pass  
the search from the script the search form loads to the specific frame  
in the frameset it outputs. You could do this through a GET parameter,  
or via a session or in several other ways. In any case you'd be far  
better off not using frames if possible, so why frames?


-Stut

--
http://stut.net/

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



RE: [PHP] How to submit form via PHP

2008-08-15 Thread Jay Blanchard
[snip]
On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can I submit
> some HTML form got via file_get_contents(URL). For example:
> 
> 
> 
> 
> 
> so how can I submit 'someform' form.
> 
> Thanks in advance for any suggestions.
> [/snip]
> 
> Click 'Submit'
> 
> 
> 
> Your form tag needs an action statement

No it doesn't... without an action statement it will submit to the same
URL in which it was presented.
[/snip]

True, I was just eyeballs deep in coding something and answered much too
quickly.

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



RE: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Warren Vail
Probably something I don't understand about your implementation, but the
form parameter will allow a target parameter, and if the frameset contains a
frame that is named (even one different from the one that contains the
search form), the results should be placed in the "target" frame.  Without a
target, if the form is outside the frameset, it will replace the entire
frameset, exactly what you describe.

Warren 

> -Original Message-
> From: Jody Cleveland [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 15, 2008 11:40 AM
> To: php-general@lists.php.net
> Subject: Re: [PHP] Re: Passing variable to a page in a frameset
> 
> 
> On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:
> 
> > Actually you may want to check back with basic html at the "target"
> > parameter on your search "form" statement.
> >
> > HTH,
> >
> > Warren Vail
> > Vail Systems Technology
> > [EMAIL PROTECTED]
> 
> Target won't work for me because the originating page with 
> the search box is not part of any frameset. I'm trying to get 
> the search results from that page to go to a page that is 
> part of a frameset.
> 
> - jody
> 
> --
> 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: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 1:46 PM, Stut wrote:


On 15 Aug 2008, at 19:39, Jody Cleveland wrote:

On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:


Actually you may want to check back with basic html at the "target"
parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]


Target won't work for me because the originating page with the  
search box is not part of any frameset. I'm trying to get the  
search results from that page to go to a page that is part of a  
frameset.


Are you saying that the frame you want to have the search results  
shown in doesn't exist when the search form is submitted? If it does  
then it doesn't matter where the form is, just specify the target as  
the name of the frame and it will almost certainly work.


If however you want the search to create the frameset when it runs  
then you have a completely different problem which is best solved  
using some sort of session. The script that handles the POST will  
need to store the details of the search somewhere and output the  
frameset. The frame that needs to contain the results would then  
grab the details and run the search outputting the results.


That is exactly what I want. I apologize for the confusion. I was  
having a hard time trying to put what I was trying to do in words.  
But, yes, your second paragraph is exactly what I want to do. My  
knowledge of PHP is very limited, and I've tried to search for  
something that will do this, but couldn't find anything.


- jody


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



RE: [PHP] SESSION problem

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: tedd [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 12:10 PM
> To: php-general@lists.php.net
> Subject: [PHP] SESSION problem
> 
> Hi gang:
> 
> Arrggg -- what the heck is going on?
> 
> I can't get anything to pass via SESSION -- what's wrong?
> 
> Here's the example -- (all the code is there):
> 
> I populate the $_SESSIONs here.
> 
> http://www.webbytedd.com/b2/session-test/index.php
> 
> If you click "Proceed to Step 2", you'll see that nothing is passed.
> 
> Now, where did I go wrong?
> 
> Cheers,
> 
> tedd
> 
> PS: I've tried this on two different servers and get the same results.

Have you tried:

echo SID;

...? I'm wondering if you're going to get different values on the two
pages. What that means beyond two different sessions is beyond me, but
it's a start.


Todd Boyd
Web Programmer




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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Stut

On 15 Aug 2008, at 19:39, Jody Cleveland wrote:

On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:


Actually you may want to check back with basic html at the "target"
parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]


Target won't work for me because the originating page with the  
search box is not part of any frameset. I'm trying to get the search  
results from that page to go to a page that is part of a frameset.


Are you saying that the frame you want to have the search results  
shown in doesn't exist when the search form is submitted? If it does  
then it doesn't matter where the form is, just specify the target as  
the name of the frame and it will almost certainly work.


If however you want the search to create the frameset when it runs  
then you have a completely different problem which is best solved  
using some sort of session. The script that handles the POST will need  
to store the details of the search somewhere and output the frameset.  
The frame that needs to contain the results would then grab the  
details and run the search outputting the results.


If I'm completely misunderstanding you please feel free to elaborate.

-Stut

--
http://stut.net/

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



RE: [PHP] How to submit form via PHP

2008-08-15 Thread Warren Vail
Key to this one may be understanding what is being asked.  I think pe.ve.ce
performed a file read (file_get_contents) on the form from another website
and wants to be able to simulate a browser submit from his code.

If this is correct, I would recommend you take a look at CURL.  There are
probably several approaches that work, but as I understand that CURL is an
implementation of the C libraries used by early browsers.  If that is not
correct, someone here will set us straight.  Many ISP's won't support CURL,
because it is often used for questionable activities and considered a
security exposure, but I believe CURL is what you want.

Hth,

Warren Vail

> -Original Message-
> From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 15, 2008 11:31 AM
> To: [EMAIL PROTECTED]; php-general@lists.php.net
> Subject: RE: [PHP] How to submit form via PHP
> 
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can 
> I submit some HTML form got via file_get_contents(URL). For example:
> 
> 
> 
> 
> 
> so how can I submit 'someform' form.
> 
> Thanks in advance for any suggestions.
> [/snip]
> 
> Click 'Submit'
> 
> 
> 
> Your form tag needs an action statement
> 
> 
> 
> All of the form's variables will be available in the $_POST array
> 
> --
> 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] How to submit form via PHP

2008-08-15 Thread Dotan Cohen
2008/8/15 Jay Blanchard <[EMAIL PROTECTED]>:
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can I submit
> some HTML form got via file_get_contents(URL). For example:
>
> 
> 
> 
>
> so how can I submit 'someform' form.
>
> Thanks in advance for any suggestions.
> [/snip]
>
> Click 'Submit'
>
>
>
> Your form tag needs an action statement
>
> 
>
> All of the form's variables will be available in the $_POST array
>

I think he's asking how to make a POST request via
file_get_contents(URL), as opposed to a GET request.

-- 
Dotan Cohen

http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?


RE: [PHP] How to submit form via PHP

2008-08-15 Thread Robert Cummings
On Fri, 2008-08-15 at 13:30 -0500, Jay Blanchard wrote:
> [snip]
> Hello. I'm pretty noob in PHP and would like to know how can I submit
> some HTML form got via file_get_contents(URL). For example:
> 
> 
> 
> 
> 
> so how can I submit 'someform' form.
> 
> Thanks in advance for any suggestions.
> [/snip]
> 
> Click 'Submit'
> 
> 
> 
> Your form tag needs an action statement

No it doesn't... without an action statement it will submit to the same
URL in which it was presented.

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 1:22 PM, Warren Vail wrote:


Actually you may want to check back with basic html at the "target"
parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]


Target won't work for me because the originating page with the search  
box is not part of any frameset. I'm trying to get the search results  
from that page to go to a page that is part of a frameset.


- jody

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



RE: [PHP] How to submit form via PHP

2008-08-15 Thread Jay Blanchard
[snip]
Hello. I'm pretty noob in PHP and would like to know how can I submit
some HTML form got via file_get_contents(URL). For example:





so how can I submit 'someform' form.

Thanks in advance for any suggestions.
[/snip]

Click 'Submit'



Your form tag needs an action statement



All of the form's variables will be available in the $_POST array

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



[PHP] Re: Buffering problem

2008-08-15 Thread Lupus Michaelis

Anders Norrbring a écrit :

I'm running out of ideas to where to look for this, so can you please give
me some pointers?


  I guess it is that you're seeking for :




--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



[PHP] How to submit form via PHP

2008-08-15 Thread pe . ve . ce
Hello. I'm pretty noob in PHP and would like to know how can I submit some HTML 
form got via file_get_contents(URL). For example:





so how can I submit 'someform' form.

Thanks in advance for any suggestions.

Matěj "czech_d3v3l0p3r" Grabovský

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



Re: [PHP] Buffering problem

2008-08-15 Thread Dan Joseph
On Fri, Aug 15, 2008 at 2:18 PM, Anders Norrbring <[EMAIL PROTECTED]>wrote:

> I'm trying to make php output things sequentially as they're
> printed/echoed.. No luck. It's buffered to the end of the script, and then
> it comes on to screen.
> This is while running Apache2, in a cli session it works fine.
>
> The script does *not* have any buffering commands at all.
> The web server does not have mod_gzip installed.
>
> I'm running out of ideas to where to look for this, so can you please give
> me some pointers?
>
> Anders.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Take a look at http://us.php.net/manual/en/function.ob-flush.php -- There
are some examples at the bottom on how to do this.

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"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."


RE: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Warren Vail
Actually you may want to check back with basic html at the "target"
parameter on your search "form" statement.

HTH,

Warren Vail
Vail Systems Technology
[EMAIL PROTECTED]
 
 

> -Original Message-
> From: Jay Moore [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 15, 2008 7:03 AM
> To: php-general@lists.php.net
> Subject: [PHP] Re: Passing variable to a page in a frameset
> 
> Jody Cleveland wrote:
> > Hello,
> > 
> > I've got a website here: http://beta.menashalibrary.org/about
> > 
> > On every page, i've got a search box at the top. This search box 
> > searches the library's web catalog. The problem is, when someone 
> > searches, it takes them away from the site. What I'd like to do is 
> > take what a person searches for, and load it into the 
> bottom frame of this page:
> > 
> http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/sa
> > lamander/searchframe.html
> > 
> > 
> > Is there a way, with php, to take what someone puts in the 
> search box 
> > and put the results into the bottom frame of a frameset when the 
> > originating page does not contain frames?
> > 
> > - jody
> 
> Frames?!
> 
> As a fellow Wisconsinite and a web developer, I'm going to 
> have to ask you to leave the state.  Minnesota can have you.
> 
> :P
> 
> 
> Jay
> 
> 
> PS -  No, but seriously, frames?!?!
> 
> --
> 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] Sessions - Failed to initialize storage...

2008-08-15 Thread Chris Ditty
Fatal error: session_start(): Failed to initialize storage module. in 
/home/webroot/www/service/payarrange/index.php on line 4

Line 4 is the session_start();

>>> Bojan Tesanovic <[EMAIL PROTECTED]> 8/15/2008 1:10 PM >>>
Can you give us the exact error that you got, that can help to debug ...


On Aug 15, 2008, at 7:53 PM, Chris Ditty wrote:

> Can someone tell me what I am missing here?  This is working fine  
> on my development machine(5.2.6), but on the production box(4.3.2),  
> it doesn't want to work.  I am getting that error on my  
> session_start() function.
>
> Is the difference in versions what is causing the problems?
>
> I've googled and none of the results fit my problem.  Below is  
> my .htaccess file.
> php_value session.save_handler files
> php_value session.save_path /tmp
> php_value session.name PHPSESSID
> php_flag session.auto_start off
> php_value session.cookie_path /
> php_flag session.use_cookies on
> php_value session.cache_expire 180
> php_flag session.use_trans_sid on
>
>
>
> MLGW now offers ONLINE BILLING!
> To view your bills, receive paperless bills,
> check payment status and pay online,
> go to www.mlgw.com and click on the My Account link.
> Enroll today!
>
>
> This e-mail and any attachments represent the views and opinions
> of only the sender and are not necessarily those of
> Memphis Light, Gas & Water Division, and no such inference should  
> be made.
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php 
>

Bojan Tesanovic
http://classiccars.carster.us/ 







MLGW now offers ONLINE BILLING!
To view your bills, receive paperless bills, 
check payment status and pay online,
go to www.mlgw.com and click on the My Account link.
Enroll today!


This e-mail and any attachments represent the views and opinions
of only the sender and are not necessarily those of 
Memphis Light, Gas & Water Division, and no such inference should be made.


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



[PHP] Buffering problem

2008-08-15 Thread Anders Norrbring
I'm trying to make php output things sequentially as they're
printed/echoed.. No luck. It's buffered to the end of the script, and then
it comes on to screen.
This is while running Apache2, in a cli session it works fine.

The script does *not* have any buffering commands at all.
The web server does not have mod_gzip installed.

I'm running out of ideas to where to look for this, so can you please give
me some pointers?

Anders.


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



Re: [PHP] Displaying files

2008-08-15 Thread Philip Thompson

On Aug 14, 2008, at 3:29 PM, Dan Shirah wrote:



You need to know the mime type for the file you're serving. Call

header('Content-Type: x/y'); where x/y is the mime type. Then call
readfile('/path/to/file/on/server'); to output the file to the  
browser.


-Stut





Stut, trying that method gives me the following: PHP Warning:   
readfile(

\\server\folder\file.xls) [href='function.readfile'>function.readfile]: failed to open  
stream:

Invalid argument on line 44

Here's my code.  Line 44 is where it stated readfile()
This document is located on a seperate server.





This won't address the permissions issue, but I ran into a similar  
problem where IE wouldn't open the file unless 'exit;' was  present.  
You may want to add:




Cheers,
~Philip


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



Re: [PHP] Sessions - Failed to initialize storage...

2008-08-15 Thread Bojan Tesanovic

Can you give us the exact error that you got, that can help to debug ...


On Aug 15, 2008, at 7:53 PM, Chris Ditty wrote:

Can someone tell me what I am missing here?  This is working fine  
on my development machine(5.2.6), but on the production box(4.3.2),  
it doesn't want to work.  I am getting that error on my  
session_start() function.


Is the difference in versions what is causing the problems?

I've googled and none of the results fit my problem.  Below is  
my .htaccess file.

php_value session.save_handler files
php_value session.save_path /tmp
php_value session.name PHPSESSID
php_flag session.auto_start off
php_value session.cookie_path /
php_flag session.use_cookies on
php_value session.cache_expire 180
php_flag session.use_trans_sid on



MLGW now offers ONLINE BILLING!
To view your bills, receive paperless bills,
check payment status and pay online,
go to www.mlgw.com and click on the My Account link.
Enroll today!


This e-mail and any attachments represent the views and opinions
of only the sender and are not necessarily those of
Memphis Light, Gas & Water Division, and no such inference should  
be made.



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



Bojan Tesanovic
http://classiccars.carster.us/






RE: [PHP] Re: PHP editor for linux

2008-08-15 Thread Boyd, Todd M.
> -Original Message-

> From: Davi Vidal [mailto:[EMAIL PROTECTED]

> Sent: Friday, August 15, 2008 12:07 PM

> To: php-general@lists.php.net

> Subject: Re: [PHP] Re: PHP editor for linux

> 

> Em Friday 15 August 2008, Robert Cummings escreveu:

> > On Fri, 2008-08-15 at 10:43 -0600, Nathan Nobbe wrote:

> > > On Fri, Aug 15, 2008 at 10:40 AM, Richard Heyes <[EMAIL PROTECTED]>

> wrote:

> > > > >> What do you think is the best php editor for linux.

> > > >

> > > > pico :-)

> > >

> > > ed baby; its all about ed!

> >

> > hexedit /dev/sda1

> >

> > ;)

> >

> 

> Butterflies. :-)

> 

> http://xkcd.com/378/

 

Haha! Yes! That is one of my favorite XKCD strips. Kudos, my friend.

For those of you who are unfamiliar--give it a click. You won't be
sorry.

 

 

Todd Boyd

Web Programmer

 

 

 

 



[PHP] Sessions - Failed to initialize storage...

2008-08-15 Thread Chris Ditty
Can someone tell me what I am missing here?  This is working fine on my 
development machine(5.2.6), but on the production box(4.3.2), it doesn't want 
to work.  I am getting that error on my session_start() function. 

Is the difference in versions what is causing the problems?

I've googled and none of the results fit my problem.  Below is my .htaccess 
file.
php_value session.save_handler files
php_value session.save_path /tmp
php_value session.name PHPSESSID
php_flag session.auto_start off
php_value session.cookie_path /
php_flag session.use_cookies on
php_value session.cache_expire 180
php_flag session.use_trans_sid on



MLGW now offers ONLINE BILLING!
To view your bills, receive paperless bills, 
check payment status and pay online,
go to www.mlgw.com and click on the My Account link.
Enroll today!


This e-mail and any attachments represent the views and opinions
of only the sender and are not necessarily those of 
Memphis Light, Gas & Water Division, and no such inference should be made.


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



Re: [PHP] SESSION problem

2008-08-15 Thread Philip Thompson

On Aug 15, 2008, at 12:16 PM, Dan Joseph wrote:


On Fri, Aug 15, 2008 at 1:09 PM, tedd <[EMAIL PROTECTED]> wrote:


Hi gang:

Arrggg -- what the heck is going on?

I can't get anything to pass via SESSION -- what's wrong?

Here's the example -- (all the code is there):

I populate the $_SESSIONs here.

http://www.webbytedd.com/b2/session-test/index.php

If you click "Proceed to Step 2", you'll see that nothing is passed.

Now, where did I go wrong?

Cheers,

tedd

PS: I've tried this on two different servers and get the same  
results.




What's in your header.php?


It probably won't make a difference, but you may try:

");
}
?>

Throw the $_SESSION into {}.

~Philip

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



Re: [PHP] Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
>  So, I had this all wrong before. Basically, I need two forms, right? One
>> on my originating page, and one on the page within the frameset I want to
>> pass the values to. Correct?
>>
>> My form, which I named my_search has one input field, which I named query.
>> In the javascript, I put in this:
>>
>> 
>> function submitForm(var1,var2) {
>>  top.mainFrame.document.my_search.query.value = var1;
>>  top.mainFrame.document.my_search.submit();
>>  document.search_form.submit();
>> }
>> 
>>
>> In the framset named mainFrame, I have a page which matches the form on
>> the originating page.
>>
>> Am I on the right track? When I click on the search link, nothing happens.
>
>
mainFrame should not be the name of your frameset.  Say I have a frameset
with three sections. Top, Left, and Right...you will actually have 4 pages.

Frameset.php //The top level of the frameset that doesn't do much more than
assign the Frame names and pages associated with them
TopSection.php //Anything on this page will be displayed in your top frame
LeftSection.php // Anything on this page will be displayed in your left
frame
RightSection.php //Anything on this page will be displayed in your right
frame

In order to see the names assigned to your different frames you need to open
Frameset.php and look for them.

It will look something like this:


  
  
  


You should never need to reference Framset.php directly.

Say I wanted to pass a value from TopSection.php to a text field in
LeftSection.php I would do this:

TopSection.php

 //The default value will be
blank but will change if someone enters in text.


//Now the persons submits the form and you want the search name to populate
to your other frame.
SEARCH

//The Javascript function this calls will pass the
document.search_form.search_name.value to the new form
function submitForm(name) {
 top.leftFrame.document.my_search.search_name.value = name;
 document.search_form.submit();
}
//top goes to the highest level of your frameset, leftFrame is the frame
name specified for LeftSection.php on your Frameset.php page,
document.my_search is the name of your form in
//LeftSection.php, search_name is the name of your text field within the
form in LeftSection.php

//Your TopSection.php form has now passed the search_name value to the
LeftSection.php page

LeftSection.php




That should be enough to get you going.  If you have any further questions
lets take this "Off List" since it does not relate to PHP.

Dan


Re: [PHP] Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 11:32 AM, Dan Shirah wrote:


In the  of my page, I have this:


function submitForm(var1,var2) {
 top.mainFrame.document.my_search.text1.value = var1;
 top.mainFrame.document.my_search.text2.value = var2;
 top.mainFrame.document.my_search.submit();
 document.search_form.submit();
}


If I type in a word in the search box http://beta.menashalibrary.org/about 
 and hit enter, it searches the catalog just fine, but then just  
replaces the current page with the search results. If I click on the  
SEARCH link with the javascript, it does nothing.



It looks like you haven't adapted the example I gave you to conform  
to your page/form structure.


top.mainFrame.document.my_search.text1.value = var1;

The frame you are populating may not be named mainFrame
The form in your destination frame may not be named my_search
The input in you destination frame may not be text1

You have to modify these areas to suit your application and add or  
remove more as needed.


So, I had this all wrong before. Basically, I need two forms, right?  
One on my originating page, and one on the page within the frameset I  
want to pass the values to. Correct?


My form, which I named my_search has one input field, which I named  
query. In the javascript, I put in this:



function submitForm(var1,var2) {
 top.mainFrame.document.my_search.query.value = var1;
 top.mainFrame.document.my_search.submit();
 document.search_form.submit();
}


In the framset named mainFrame, I have a page which matches the form  
on the originating page.


Am I on the right track? When I click on the search link, nothing  
happens.


- jody

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



Re: [PHP] Re: PHP editor for linux

2008-08-15 Thread Robert Cummings
On Fri, 2008-08-15 at 14:06 -0300, Davi Vidal wrote:
> Em Friday 15 August 2008, Robert Cummings escreveu:
> > On Fri, 2008-08-15 at 10:43 -0600, Nathan Nobbe wrote:
> > > On Fri, Aug 15, 2008 at 10:40 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> > > > >> What do you think is the best php editor for linux.
> > > >
> > > > pico :-)
> > >
> > > ed baby; its all about ed!
> >
> > hexedit /dev/sda1
> >
> > ;)
> >
> 
> Butterflies. :-)
> 
> http://xkcd.com/378/


That's great... I love those cartoons.

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



Re: [PHP] SESSION problem

2008-08-15 Thread Dan Joseph
On Fri, Aug 15, 2008 at 1:09 PM, tedd <[EMAIL PROTECTED]> wrote:

> Hi gang:
>
> Arrggg -- what the heck is going on?
>
> I can't get anything to pass via SESSION -- what's wrong?
>
> Here's the example -- (all the code is there):
>
> I populate the $_SESSIONs here.
>
> http://www.webbytedd.com/b2/session-test/index.php
>
> If you click "Proceed to Step 2", you'll see that nothing is passed.
>
> Now, where did I go wrong?
>
> Cheers,
>
> tedd
>
> PS: I've tried this on two different servers and get the same results.
>
> --
> ---
> 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
>
>
What's in your header.php?

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"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] SESSION problem

2008-08-15 Thread tedd

Hi gang:

Arrggg -- what the heck is going on?

I can't get anything to pass via SESSION -- what's wrong?

Here's the example -- (all the code is there):

I populate the $_SESSIONs here.

http://www.webbytedd.com/b2/session-test/index.php

If you click "Proceed to Step 2", you'll see that nothing is passed.

Now, where did I go wrong?

Cheers,

tedd

PS: I've tried this on two different servers and get the same results.

--
---
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] Re: PHP editor for linux

2008-08-15 Thread Davi Vidal
Em Friday 15 August 2008, Robert Cummings escreveu:
> On Fri, 2008-08-15 at 10:43 -0600, Nathan Nobbe wrote:
> > On Fri, Aug 15, 2008 at 10:40 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> > > >> What do you think is the best php editor for linux.
> > >
> > > pico :-)
> >
> > ed baby; its all about ed!
>
> hexedit /dev/sda1
>
> ;)
>

Butterflies. :-)

http://xkcd.com/378/

-- 
Davi Vidal
--
E-mail: [EMAIL PROTECTED]
MSN   : [EMAIL PROTECTED]
GTalk : [EMAIL PROTECTED]
Skype : davi vidal
YIM   : davi_vidal
ICQ   : 138815296

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



Re: [PHP] Re: PHP editor for linux

2008-08-15 Thread Robert Cummings
On Fri, 2008-08-15 at 10:43 -0600, Nathan Nobbe wrote:
> On Fri, Aug 15, 2008 at 10:40 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:
> 
> > >> What do you think is the best php editor for linux.
> >
> > pico :-)
> 
> 
> ed baby; its all about ed!

hexedit /dev/sda1

;)

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



Re: [PHP] Re: PHP editor for linux

2008-08-15 Thread Nathan Nobbe
On Fri, Aug 15, 2008 at 10:40 AM, Richard Heyes <[EMAIL PROTECTED]> wrote:

> >> What do you think is the best php editor for linux.
>
> pico :-)


ed baby; its all about ed!

-nathan


Re: [PHP] Re: PHP editor for linux

2008-08-15 Thread Richard Heyes
>> What do you think is the best php editor for linux.

pico :-)

-- 
Richard Heyes
http://www.phpguru.org

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



Re: [PHP] Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> In the  of my page, I have this:
>
> 
> function submitForm(var1,var2) {
>  top.mainFrame.document.my_search.text1.value = var1;
>  top.mainFrame.document.my_search.text2.value = var2;
>  top.mainFrame.document.my_search.submit();
>  document.search_form.submit();
> }
> 
>
> If I type in a word in the search box http://beta.menashalibrary.org/about and
> hit enter, it searches the catalog just fine, but then just replaces the
> current page with the search results. If I click on the SEARCH link with the
> javascript, it does nothing.



It looks like you haven't adapted the example I gave you to conform to your
page/form structure.

top.mainFrame.document.my_search.text1.value = var1;

The frame you are populating may not be named mainFrame
The form in your destination frame may not be named my_search
The input in you destination frame may not be text1

You have to modify these areas to suit your application and add or remove
more as needed.


Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 9:20 AM, Dan Shirah wrote:



Frames?!


As a fellow Wisconsinite and a web developer, I'm going to have to  
ask you

to leave the state.  Minnesota can have you.

:P


Jay


PS -  No, but seriously, frames?!?!



There's nothing wrong with a Frame every once in a while!  Granted  
they

aren't used much anymore, but sometimes they can be useful!


I know, I know. I'm not a fan of frames either, and have never even  
thought of using them until now. The problem is, our library catalog  
is on a different server and provides results for a consortium of 30  
libraries. So, what we've been doing is including a search box for the  
catalog on web pages. Which works fine, but it's easy for people to  
get caught up in the catalog with no good way to get back to the site  
you came from. So, I created a frame page that has a small button in  
the top frame that takes you back to where you came from. So, the site  
itself isn't using frames, only when you search the catalog. Of  
course, that's if I can get it working...


- jody

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



Re: [PHP] Passing variable to a page in a frameset

2008-08-15 Thread Jody Cleveland


On Aug 15, 2008, at 7:33 AM, Dan Shirah wrote:


I apologize for my ignorance, I don't really know much about
javascript. When I add all that into my form page, when I submit the
form, it just replaces the page I was on with the form results, rather
than in the new frame page. I'm assuming I need to put the url for the
frameset page in that code somewhere. Where does it go? And, which
part do I replace with the frame name on that frameset page?

Thank you for taking the time to help me with this, I really  
appreciate it!



Let's look at the code:

//var1 and var2 are the search criteria the user entered in your  
search form(You may have more or less)

function submitForm(var1,var2) {

//top.leftFrame is how you set the focus to the frame you want.   
leftFrame could be different on your system...whatever you named the  
frame.


//top.leftFrame.document.my_search.text1.value=var1 assumes the form  
name in the frame you want data in is named
//my_search and it givs the text object text1 the value of var1 from  
your search form

top.leftFrame.document.my_search.text1.value = var1;

//top.leftFrame.document.my_search.text2.value=var2 assumes the form  
name in the frame you want data in is named
//my_search and it givs the text object text1 the value of var2 from  
your search form

 top.leftFrame.document.my_search.text2.value = var2;

//top.leftFrame.document.my_search.submit() will submit the form in  
your target frame then you can use the $_POST values throughout the  
frame

 top.leftFrame.document.my_search.submit();

//document.search_form.submit() will submit your search page. I use  
this so I can reuse the $_POST values to display the search criteria  
after submit.

 document.search_form.submit();
}




In the  of my page, I have this:


function submitForm(var1,var2) {
 top.mainFrame.document.my_search.text1.value = var1;
 top.mainFrame.document.my_search.text2.value = var2;
 top.mainFrame.document.my_search.submit();
 document.search_form.submit();
}


Then, for the form code I have this:

http://webcat.winnefox.org/web2/tramp2.exe/do_keyword_search/guest 
" id="qpl">







	Find library books, music, movies and more...class="searchbartextfield" id="query" name="query" type="text">  	href 
= 
"javascript:submitForm 
(document 
.search_form.var1.value,document.search_form.var2.value)">SEARCHa> Advanced  
Search



If I type in a word in the search box http://beta.menashalibrary.org/about 
 and hit enter, it searches the catalog just fine, but then just  
replaces the current page with the search results. If I click on the  
SEARCH link with the javascript, it does nothing.


I want the results to go to this url: 
http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html
in the frame name of mainFrame. I'm thinking that address needs to go  
in the javascript somewhere so it knows where to go, but where? Does  
the rest of the code look ok?


Thanks again for taking the time to help me with this.

- jody

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



[PHP] preg_replace strange behaviour, duplicates

2008-08-15 Thread Adz07

I am trying to nail down a bit of code for changing processor names depending
on matches.
Problem i am having is the replacement takes place then it seems to do it
again replacing the text just replaced as there are similar matches
afterwards. example (easier)

$string = "The new Intel Core 2 Duo T8300";

$patterns = array("/Intel Core 2 Duo/","/Intel Core 2/");

$replacements = array("/Intel Core 2 Duo Processor Technology/","/Intel Core
2 Processor Technology/");

I would expect to get the following:

The new Intel Core 2 Duo Processor Technology T8300

but i get 

The new Intel Core 2 Processor Technology Duo Processor Technology T8300

I can see why its doing it, reading the string in and making the replacement
but then reading the string in for the next pattern, but i don't want it to
do this. How do i stop preg_replace from reading in the same part of the
string that has been replaced already?

(it's a bad day! :( )
-- 
View this message in context: 
http://www.nabble.com/preg_replace-strange-behaviour%2C-duplicates-tp19001166p19001166.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] Re: Passing variable to a page in a frameset

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: Dan Shirah [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 9:20 AM
> To: Jay Moore
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Re: Passing variable to a page in a frameset
> 
> >
> > Frames?!
> >>
> >> As a fellow Wisconsinite and a web developer, I'm going to have to
> ask you
> >> to leave the state.  Minnesota can have you.
> >>
> >> :P
> >>
> >>
> >> Jay
> >>
> >>
> >> PS -  No, but seriously, frames?!?!
> >
> >
> There's nothing wrong with a Frame every once in a while!  Granted
they
> aren't used much anymore, but sometimes they can be useful!

I believe frames and framesets are being phased out of XHTML altogether.
It's all about DIVs nowadays. I think there's an XHTML specification for
something like frames, but it's just as ugly.


Todd Boyd
Web Programmer




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



Re: [PHP] PHP Script/Thread ID thingie

2008-08-15 Thread Eric Butera
On Fri, Aug 15, 2008 at 11:37 AM,  <[EMAIL PROTECTED]> wrote:
>
> I'm logging things with error_log, and would like to be able to sort out one 
> script run from another.
>
> So I'm looking for some kind of "script id" or "thread id" or "PHP script run 
> execution ID" type of function.
>
> getmypid() just returns the same apache child process ID all the time, so 
> that's not what I want.
>
> zend_thread_id() looks useful, but I suspect it's not quite what I'm looking 
> for.  But I'd have to re-compile with ZTS and --debug-mode and I don't think 
> the function I'm looking for should require that...
>
> Perhaps I've just missed the right function name?
>
> Or perhaps this should be a "Feature Request"?


I suppose if nobody else has better ideas you can fake it with setting
some sort of unique value and combining that with __FILE__ for your
instance run.



Not very glamorous though. ;)

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



RE: [PHP] import XLS sheet into DB

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: Alain R. [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 3:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] import XLS sheet into DB
> 
> Hi,
> 
> I would like to import content of an XLS sheet into a PostgreSQL DB
> (table).
> 
> How can i do that ?
> thanks a lot,

I fail to see how this has anything to do with PHP.

Regardless, I think you could just import it as a text field if you're
wanting to save the entire sheet. I'm not sure that I understand the
scope of your question.

Do you want the elements separated into table columns, or do you just
want to store the XLS for later retrieval as a whole?


Todd Boyd
Web Programmer




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



Re: [PHP] PHP Script/Thread ID thingie

2008-08-15 Thread Stut

On 15 Aug 2008, at 16:37, [EMAIL PROTECTED] wrote:
I'm logging things with error_log, and would like to be able to sort  
out one script run from another.


So I'm looking for some kind of "script id" or "thread id" or "PHP  
script run execution ID" type of function.


getmypid() just returns the same apache child process ID all the  
time, so that's not what I want.


zend_thread_id() looks useful, but I suspect it's not quite what I'm  
looking for.  But I'd have to re-compile with ZTS and --debug-mode  
and I don't think the function I'm looking for should require that...


Perhaps I've just missed the right function name?

Or perhaps this should be a "Feature Request"?


Don't think there is such a thing, but you could generate one by  
combining the pid, timestamp and the script filename, maybe into an  
md5 hash value or similar. Thinking about it, "ip.pid" would be  
enough, i.e. 127.0.0.1.12345.


-Stut

--
http://stut.net/

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



RE: [PHP] Removing an element from the middle of an mdlti-dimentsional array

2008-08-15 Thread Boyd, Todd M.
> -Original Message-
> From: Simcha Younger [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 2:49 AM
> To: 'Don'; php-general@lists.php.net
> Subject: RE: [PHP] Removing an element from the middle of an mdlti-
> dimentsional array
> 
> 
> array_splice($a, 1, 1);
> 
> This will remove the second element, and reset the keys.
> 
> 
> -Original Message-
> From: Don [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 4:30 AM
> To: php-general@lists.php.net
> Subject: [PHP] Removing an element from the middle of an mdlti-
> dimentsional
> array
> 
> Hi,
> 
> Let's say I have the following array:
> 
> $myArray = array(array('1','2','3'), array('4','5','6'),
> array('7','8','9'),
> 
> array('10','11','12'));
> 
> How do I remove say the second element?
> 
> I have tried: $myArray = array_splice($myArray, 1, 1);
> 
> But this seems to remove the second element as well as all the
> following
> elements and I am left with:
> 
> $myArray = array(array('1','2','3'));
> 
> when I really want:
> 
> $myArray = array(array('1','2','3'), array('7','8','9'),
> array('10','11','12'));

Yep. He had been using the return value of array_splice(), which is just
the spliced elements--not the resulting array post-splice.

http://www.php.net/array_splice


Todd Boyd
Web Programmer




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



[PHP] PHP Script/Thread ID thingie

2008-08-15 Thread ceo

I'm logging things with error_log, and would like to be able to sort out one 
script run from another.



So I'm looking for some kind of "script id" or "thread id" or "PHP script run 
execution ID" type of function.



getmypid() just returns the same apache child process ID all the time, so 
that's not what I want.



zend_thread_id() looks useful, but I suspect it's not quite what I'm looking 
for.  But I'd have to re-compile with ZTS and --debug-mode and I don't think 
the function I'm looking for should require that...



Perhaps I've just missed the right function name?



Or perhaps this should be a "Feature Request"?



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



[PHP] Re: PHP editor for linux

2008-08-15 Thread Shawn McKenzie

It flance wrote:

Hi,

What do you think is the best php editor for linux.

I'm using the Debian distribution.

Thanks


  



I use Aptana which is based on eclipse and has built-in HTML/JS/PHP?SVN 
stuff.  Also a cool plugin that lets you easily develop for the iPhone 
and preview it.


-Shawn

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



Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
>
> A scheduled task is messy. IIWY I'd use FTP to pull the file over, but
> that's still pretty messy.
>
> If this is an Intranet then the risks involved in giving that user access
> to the network is minimal and probably would be the best solution.
> Alternatively you could set up an HTTP server on the document server and
> proxy the documents through the IIS server (readfile should be happy to take
> an HTTP URL unless you've disabled it in php.ini, and the end user will
> never see the actual URL).


I agree, it is really messy to work with and prone to lots of complications.

This application will be used within our network, but will also be used by a
sister agency that is not in our network. Which is why we do not want the
document server complete path floating inbetween us and them where it could
be intercepted by an outside user.

Reading the documents through as a URL would be so nice and probably the
easiest method to accomplish this, but the "God's Above" want it to remain
strictly a file server.

I guess I will start looking into FTP'ing them between servers as that may
be the simplest solution at this point.


[PHP] Conditional compilation

2008-08-15 Thread Herman Gomez

Hi,

Here is something I used to do in C/C++ to include/exclude automaticaly 
all debugging code at compiling time:


#define debug TRUE
#ifdef(debug)
//debugging code
#endif

That way I can include/exclude easily all debugging code in the final 
compiled code. In PHP I have not been able to find anything like that.
The only solution I've found is having this kind of code in every debug 
code block:


if ($debug) {
//debugging code
}

But this means that the debugging code is in the final compiled 
(interpreted) code, wasting cpu cycles even if there won't be any 
debugging in production.


Does somebody know if there is something like conditional compilation in 
PHP that I can use?


Regards,
Herman Gomez
Madrid, Spain.

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



Re: [PHP] Displaying files

2008-08-15 Thread Stut

On 15 Aug 2008, at 15:41, Dan Shirah wrote:
Your best bet would be to run a periodic sync to copy the files  
across from the other server but it would have to run outside the  
IIS process. There are plenty of solutions around for doing this and  
they have nothing to do with PHP. You can then refer to the local  
copy of the file from PHP and it will then work.


This isn't very feasible because the server that contains the  
documents contains almost 1 terabyte worth of documents and  
continues to grow in size. No way I would want to mirror that amount  
of information just to hude the file path.


Instead of just making and executing a batch file, maybe there is a  
way for PHP to call a scheduled task?  Since within a scheduled task  
you specify what username/password is used to execute it I may be  
able to get it to work?


A scheduled task is messy. IIWY I'd use FTP to pull the file over, but  
that's still pretty messy.


If this is an Intranet then the risks involved in giving that user  
access to the network is minimal and probably would be the best  
solution. Alternatively you could set up an HTTP server on the  
document server and proxy the documents through the IIS server  
(readfile should be happy to take an HTTP URL unless you've disabled  
it in php.ini, and the end user will never see the actual URL).


-Stut

--
http://stut.net/

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



Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
>
>  Your best bet would be to run a periodic sync to copy the files across
>> from the other server but it would have to run outside the IIS process.
>> There are plenty of solutions around for doing this and they have nothing to
>> do with PHP. You can then refer to the local copy of the file from PHP and
>> it will then work.
>
>
This isn't very feasible because the server that contains the documents
contains almost 1 terabyte worth of documents and continues to grow in size.
No way I would want to mirror that amount of information just to hude the
file path.

Instead of just making and executing a batch file, maybe there is a way for
PHP to call a scheduled task?  Since within a scheduled task you specify
what username/password is used to execute it I may be able to get it to
work?


Re: [PHP] Displaying files

2008-08-15 Thread Stut

On 15 Aug 2008, at 15:17, Dan Shirah wrote:
What about using some type of a dispatch script? Locate all the  
files outside of the doc root and then just call: viewdocument.php? 
ID=12345678 ? Although now that I've typed that I realize that you  
would still be running the same issue.. Unless you used javascript  
in your PHP to call the file maybe?


Hmmm, what if I tried to use PHP to write a simple batch file?  Use  
the batch file to copy the selected file from one server to  
another.  And then open the copied file using any method I wanted  
since it's new location would be in a temp directory?


And then maybe use if_exists() to see if the new file is located in  
the temp directory and if it is, display it.


The only issue there might be when a file is really large or the  
network is sluggish and it could take 1-5 seconds for the file to  
copy over.  In which case if_exists() would be false since it is  
taking a while for the file to copy.  Hmmm.


PHP *cannot* access those files. Doesn't matter if you call a batch  
file from the PHP since that will still be running as PHP.


Your best bet would be to run a periodic sync to copy the files across  
from the other server but it would have to run outside the IIS  
process. There are plenty of solutions around for doing this and they  
have nothing to do with PHP. You can then refer to the local copy of  
the file from PHP and it will then work.


-Stut

--
http://stut.net/

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



Re: [PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> Frames?!
>>
>> As a fellow Wisconsinite and a web developer, I'm going to have to ask you
>> to leave the state.  Minnesota can have you.
>>
>> :P
>>
>>
>> Jay
>>
>>
>> PS -  No, but seriously, frames?!?!
>
>
There's nothing wrong with a Frame every once in a while!  Granted they
aren't used much anymore, but sometimes they can be useful!


Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
>  What about using some type of a dispatch script? Locate all the files
>> outside of the doc root and then just call: viewdocument.php?ID=12345678 ?
>> Although now that I've typed that I realize that you would still be running
>> the same issue.. Unless you used javascript in your PHP to call the file
>> maybe?
>
>
Hmmm, what if I tried to use PHP to write a simple batch file?  Use the
batch file to copy the selected file from one server to another.  And then
open the copied file using any method I wanted since it's new location would
be in a temp directory?

And then maybe use if_exists() to see if the new file is located in the temp
directory and if it is, display it.

The only issue there might be when a file is really large or the network is
sluggish and it could take 1-5 seconds for the file to copy over.  In which
case if_exists() would be false since it is taking a while for the file to
copy.  Hmmm.


Re: [PHP] Displaying files

2008-08-15 Thread Jason Pruim


On Aug 15, 2008, at 9:57 AM, Dan Shirah wrote:


Wow, I think it finally clicked.

Sorry that took so long.

The whole point behind using PHP was to try and copy or call the  
file from
the server side so the user does not see the path to the document.  
Using
HTML and Javascript it is extrememly easy to just view source and  
see the
path.  Whereas using PHP it would take the regular user a bit more  
work to
view the path which is why I wanted to go that route.  But having to  
grant
the anonymous internet account access to the server would be just as  
bad if

not worse.

My application retrieves a list of docments that the user can view  
based on
search criteria. When the user clicks on the document I wanted to  
somehow
mask the location the document is being pulled from.  HTML and  
Javascript
are so easy to circumvent, even to the everyday user that I wanted  
to do
something with PHP since it's code is not viewable when you view  
source

since it is run on the server.

Have any of you attempted something like this?


What about using some type of a dispatch script? Locate all the files  
outside of the doc root and then just call: viewdocument.php? 
ID=12345678 ? Although now that I've typed that I realize that you  
would still be running the same issue.. Unless you used javascript in  
your PHP to call the file maybe?




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
> Wow, I think it finally clicked.
>
> Sorry that took so long.
>

That's fine, sorry if I sounded rude or something. I didn't mean it.


The whole point behind using PHP was to try and copy or call the file from
> the server side so the user does not see the path to the document. Using
> HTML and Javascript it is extrememly easy to just view source and see the
> path.  Whereas using PHP it would take the regular user a bit more work to
> view the path which is why I wanted to go that route.  But having to grant
> the anonymous internet account access to the server would be just as bad if
> not worse.
>

My guess is worse. :)


My application retrieves a list of docments that the user can view based on
> search criteria. When the user clicks on the document I wanted to somehow
> mask the location the document is being pulled from.  HTML and Javascript
> are so easy to circumvent, even to the everyday user that I wanted to do
> something with PHP since it's code is not viewable when you view source
> since it is run on the server.
>
> Have any of you attempted something like this?
>

You can have a php file called something like getFile.php where you pass
parameters like getFile.php?file=123 and it returns the file (with proper
headers).

But that way you'd have to map all file paths to a database. Then you could
access them thru codes, but remember to check user permissions before
handling him the file as you'd have a serious problem.

Aside of that, at the moment I can't figure another way of serving files for
a user hiding them the path for it.

I'd be happy to see what others have in mind. :)

-- 
Thiago Henrique Pojda


[PHP] Re: Passing variable to a page in a frameset

2008-08-15 Thread Jay Moore

Jody Cleveland wrote:

Hello,

I've got a website here: http://beta.menashalibrary.org/about

On every page, i've got a search box at the top. This search box 
searches the library's web catalog. The problem is, when someone 
searches, it takes them away from the site. What I'd like to do is take 
what a person searches for, and load it into the bottom frame of this page:
http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html 



Is there a way, with php, to take what someone puts in the search box 
and put the results into the bottom frame of a frameset when the 
originating page does not contain frames?


- jody


Frames?!

As a fellow Wisconsinite and a web developer, I'm going to have to ask 
you to leave the state.  Minnesota can have you.


:P


Jay


PS -  No, but seriously, frames?!?!

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



Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Wow, I think it finally clicked.

Sorry that took so long.

The whole point behind using PHP was to try and copy or call the file from
the server side so the user does not see the path to the document. Using
HTML and Javascript it is extrememly easy to just view source and see the
path.  Whereas using PHP it would take the regular user a bit more work to
view the path which is why I wanted to go that route.  But having to grant
the anonymous internet account access to the server would be just as bad if
not worse.

My application retrieves a list of docments that the user can view based on
search criteria. When the user clicks on the document I wanted to somehow
mask the location the document is being pulled from.  HTML and Javascript
are so easy to circumvent, even to the everyday user that I wanted to do
something with PHP since it's code is not viewable when you view source
since it is run on the server.

Have any of you attempted something like this?


Re: [PHP] Displaying files

2008-08-15 Thread Stut

On 15 Aug 2008, at 14:26, Dan Shirah wrote:
Because as I mentioned before PHP runs as a different user to your  
browser.


-Stut

Stut,

Are you referring to this?

"If you're using IIS then it's the IUSR_machine user which doesn't  
have access to the network by default"


The IUSR_SERVERNAME account is what it should be connecting as  
whether I'm using PHP/Javascript/HTML, unless specifically set in a  
connection string such as the database connections.  But, the  
initial calls always come from IUSR_SERVERNAME.


You need to understand that there are 2 sides to a web-based  
application, the client and the server. When you link the browser to a  
file (as in your HTML and JS code below) it's the *client* that's  
accessing the file. Neither IIS nor PHP get involved in that. This  
works because the browser is running as you and has sufficient  
permissions to access that network location.


When you try to do the same with PHP it is running as the  
IUSR_SERVERNAME user which, by default and for good reason, cannot  
access network shares in that way. The link I gave you should give you  
enough information to enable the required access for that user, but  
you might want to think carefully before doing so since it's disabled  
by default for security reasons.


-Stut


Thiago,

HTML WORKS
Open

Javascript WORKS
function openWin(folder,file) {
 var LeftPosition = (this.screen.width) / 2;
 var TopPosition = (this.screen.height) - this.screen.height;
 var Height = (this.screen.height) - 90;
 var Width = (this.screen.width) /2 - 10;
 MyWin = window.open(server\\"+folder+"\\"+file 
+"\.xls","ViewImage","scrollbars=yes, status=yes,   
resizable=no,top="+TopPosition+",left="+LeftPosition+",width="+Width 
+",height="+Height+"");

 MyWin.focus();
}

PHP DOESN'T WORK
$filename = "server\\".$folder."\\".$file.".xls";
header("Content-Type: application/x-msdownload");
readfile($filename);

I put all three of these examples into the exact same page.  The  
HTML and Javascript open the file without any problems, but PHP  
cannot open it.





--
http://stut.net/

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



Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
>
> Thiago,
>
> HTML WORKS
> Open
>
> Javascript WORKS
> function openWin(folder,file) {
>   var LeftPosition = (this.screen.width) / 2;
>   var TopPosition = (this.screen.height) - this.screen.height;
>   var Height = (this.screen.height) - 90;
>   var Width = (this.screen.width) /2 - 10;
>   MyWin =
> window.open(server\\"+folder+"\\"+file+"\.xls","ViewImage","scrollbars=yes,
> status=yes,
>
> resizable=no,top="+TopPosition+",left="+LeftPosition+",width="+Width+",height="+Height+"");
>   MyWin.focus();
> }


You JavaScript works because it's opening a Window and pointing it's URL to
a directory your BROWSER has access, that's client-side.
If I run your JS (or your HTML) code, it will not work as I don't have
access to that \\server share.

PHP (and your HTTP server) are on server-side, and they're not having access
to your file.


PHP DOESN'T WORK
>
> $filename = "server\\".$folder."\\".$file.".xls";
> header("Content-Type: application/x-msdownload");
> readfile($filename);



I put all three of these examples into the exact same page.  The HTML and
> Javascript open the file without any problems, but PHP cannot open it.
>



-- 
Thiago Henrique Pojda


Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
>
>  Because as I mentioned before PHP runs as a different user to your
>> browser.
>>
>> -Stut
>
>
Stut,

Are you referring to this?

"If you're using IIS then it's the IUSR_machine user which doesn't have
access to the network by default"

The IUSR_SERVERNAME account is what it should be connecting as whether I'm
using PHP/Javascript/HTML, unless specifically set in a connection string
such as the database connections.  But, the initial calls always come from
IUSR_SERVERNAME.

Thiago,

HTML WORKS
Open

Javascript WORKS
function openWin(folder,file) {
 var LeftPosition = (this.screen.width) / 2;
 var TopPosition = (this.screen.height) - this.screen.height;
 var Height = (this.screen.height) - 90;
 var Width = (this.screen.width) /2 - 10;
 MyWin = 
window.open(server\\"+folder+"\\"+file+"\.xls","ViewImage","scrollbars=yes,
status=yes,
resizable=no,top="+TopPosition+",left="+LeftPosition+",width="+Width+",height="+Height+"");
 MyWin.focus();
}

PHP DOESN'T WORK
$filename = "server\\".$folder."\\".$file.".xls";
header("Content-Type: application/x-msdownload");
readfile($filename);

I put all three of these examples into the exact same page.  The HTML and
Javascript open the file without any problems, but PHP cannot open it.


Re: [PHP] Displaying files

2008-08-15 Thread Stut

On 15 Aug 2008, at 13:37, Dan Shirah wrote:
If the network resource is the only location where these files  
exist, what

do you suggest I do?

Use PHP to first copy() the file from the server to a temp directory  
on my

web server and then open the document from the temp dir?


PHP cannot access the file because the user it's running as has no  
network access. It has nothing to do with the method you use to access  
the file in PHP so copy will not work either.


If that other server is publicly accessible your best bet is to serve  
the file directly on that server - i.e. do an HTTP redirect to that  
file on the other server. If not then you're left with enabling  
network access for the PHP user. A quick Google got me this: http://support.microsoft.com/kb/207671 
 but there are other references out there.


-Stut


On 8/14/08, Boyd, Todd M. <[EMAIL PROTECTED]> wrote:



-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2008 4:34 PM
To: Boyd, Todd M.
Cc: php-general@lists.php.net
Subject: Re: [PHP] Displaying files

On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote:


-Original Message-
From: Stut [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 14, 2008 4:21 PM
To: Dan Shirah
Cc: PHP-General List
Subject: Re: [PHP] Displaying files

On 14 Aug 2008, at 21:57, Dan Shirah wrote:

That simply means it can't open the file. Make sure the machine

this
is running on has everything it needs to access that UNC  
filename.


-Stut


Stut,

If I copy the link from the error message and paste it into a
browser running from my PHP server, the file comes up just fine.

Should I try mkdir() or mkpath() to set the server and folder
location and then try it from there?


The user PHP runs as needs to be able to access it, not you. I'm
guessing you're on Windows...

If you're using IIS then it's the IUSR_machine user which doesn't
have
access to the network by default. You can enable it but I can't
recall
how off the top of my head and you may want to reconsider because

it

leaves the server a lot more open should IIS/PHP/else be

compromised.


If you're using Apache on Windows then you'll need to check the
service configuration to see what user it's running as.


It can be done somewhat securely by mapping a network drive and  
then

granting permissions to it specifically, rather than the network
itself.
(I believe...)


It's been a while since I've used Windows but IIRC you need to  
enable
network access for that user at the lowest layer (i.e. system  
policy)

and then normal access rules apply, but I could be wrong. Either way
I'd avoid doing it if at all possible.


I think after XP SP2 it got a bit more granular. However, I'm no  
MCSE,
so don't take my word for it. :) I do agree with you, anyway, that  
the

user a webserver is posing as should not have access to network
resources like this.

I digress.


Todd Boyd
Web Programmer




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




--
http://stut.net/

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



Re: [PHP] Displaying files

2008-08-15 Thread Thiago H. Pojda
On 8/15/08, Dan Shirah <[EMAIL PROTECTED]> wrote:
>
> Okay, I'm perplexed!
>
> If I put the exact same value into a javascript function and open a window
> the document comes up perfectly fine.
>
> But, when trying to readfile() copy() or fopen() in PHP I get the "failed
> to
> open stream:" error.
>
> Any idea why the exact same link would open fine using a HTML link or a
> javascript function, but will not work using PHP?
>

I'm not sure I understand this... Can you provide some new code? :)

-- 
Thiago Henrique Pojda


Re: [PHP] Displaying files

2008-08-15 Thread Stut

On 15 Aug 2008, at 14:07, Dan Shirah wrote:

Okay, I'm perplexed!

If I put the exact same value into a javascript function and open a  
window

the document comes up perfectly fine.

But, when trying to readfile() copy() or fopen() in PHP I get the  
"failed to

open stream:" error.

Any idea why the exact same link would open fine using a HTML link  
or a

javascript function, but will not work using PHP?


Because as I mentioned before PHP runs as a different user to your  
browser.


-Stut

--
http://stut.net/

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



Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
Okay, I'm perplexed!

If I put the exact same value into a javascript function and open a window
the document comes up perfectly fine.

But, when trying to readfile() copy() or fopen() in PHP I get the "failed to
open stream:" error.

Any idea why the exact same link would open fine using a HTML link or a
javascript function, but will not work using PHP?


Re: [PHP] Displaying files

2008-08-15 Thread Dan Shirah
If the network resource is the only location where these files exist, what
do you suggest I do?

Use PHP to first copy() the file from the server to a temp directory on my
web server and then open the document from the temp dir?


On 8/14/08, Boyd, Todd M. <[EMAIL PROTECTED]> wrote:
>
> > -Original Message-
> > From: Stut [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, August 14, 2008 4:34 PM
> > To: Boyd, Todd M.
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP] Displaying files
> >
> > On 14 Aug 2008, at 22:24, Boyd, Todd M. wrote:
> >
> > >> -Original Message-
> > >> From: Stut [mailto:[EMAIL PROTECTED]
> > >> Sent: Thursday, August 14, 2008 4:21 PM
> > >> To: Dan Shirah
> > >> Cc: PHP-General List
> > >> Subject: Re: [PHP] Displaying files
> > >>
> > >> On 14 Aug 2008, at 21:57, Dan Shirah wrote:
> > >>> That simply means it can't open the file. Make sure the machine
> > this
> > >>> is running on has everything it needs to access that UNC filename.
> > >>>
> > >>> -Stut
> > >>>
> > >>>
> > >>> Stut,
> > >>>
> > >>> If I copy the link from the error message and paste it into a
> > >>> browser running from my PHP server, the file comes up just fine.
> > >>>
> > >>> Should I try mkdir() or mkpath() to set the server and folder
> > >>> location and then try it from there?
> > >>
> > >> The user PHP runs as needs to be able to access it, not you. I'm
> > >> guessing you're on Windows...
> > >>
> > >> If you're using IIS then it's the IUSR_machine user which doesn't
> > >> have
> > >> access to the network by default. You can enable it but I can't
> > >> recall
> > >> how off the top of my head and you may want to reconsider because
> it
> > >> leaves the server a lot more open should IIS/PHP/else be
> > compromised.
> > >>
> > >> If you're using Apache on Windows then you'll need to check the
> > >> service configuration to see what user it's running as.
> > >
> > > It can be done somewhat securely by mapping a network drive and then
> > > granting permissions to it specifically, rather than the network
> > > itself.
> > > (I believe...)
> >
> > It's been a while since I've used Windows but IIRC you need to enable
> > network access for that user at the lowest layer (i.e. system policy)
> > and then normal access rules apply, but I could be wrong. Either way
> > I'd avoid doing it if at all possible.
>
> I think after XP SP2 it got a bit more granular. However, I'm no MCSE,
> so don't take my word for it. :) I do agree with you, anyway, that the
> user a webserver is posing as should not have access to network
> resources like this.
>
> I digress.
>
>
> Todd Boyd
> Web Programmer
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


Re: [PHP] Passing variable to a page in a frameset

2008-08-15 Thread Dan Shirah
>
> I apologize for my ignorance, I don't really know much about
> javascript. When I add all that into my form page, when I submit the
> form, it just replaces the page I was on with the form results, rather
> than in the new frame page. I'm assuming I need to put the url for the
> frameset page in that code somewhere. Where does it go? And, which
> part do I replace with the frame name on that frameset page?
>
> Thank you for taking the time to help me with this, I really appreciate it!



Let's look at the code:

//var1 and var2 are the search criteria the user entered in your search
form(You may have more or less)
function submitForm(var1,var2) {

//top.leftFrame is how you set the focus to the frame you want.  leftFrame
could be different on your system...whatever you named the frame.

//top.leftFrame.document.my_search.text1.value=var1 assumes the form name in
the frame you want data in is named
//my_search and it givs the text object text1 the value of var1 from your
search form
top.leftFrame.document.my_search.text1.value = var1;

//top.leftFrame.document.my_search.text2.value=var2 assumes the form name in
the frame you want data in is named
//my_search and it givs the text object text1 the value of var2 from your
search form
 top.leftFrame.document.my_search.text2.value = var2;

//top.leftFrame.document.my_search.submit() will submit the form in your
target frame then you can use the $_POST values throughout the frame
 top.leftFrame.document.my_search.submit();

//document.search_form.submit() will submit your search page. I use this so
I can reuse the $_POST values to display the search criteria after submit.
 document.search_form.submit();
}


Re: [PHP] import XLS sheet into DB

2008-08-15 Thread Jason Pruim


On Aug 15, 2008, at 4:29 AM, Alain R. wrote:


Hi,

I would like to import content of an XLS sheet into a PostgreSQL DB  
(table).


How can i do that ?
thanks a lot,

A.


Alain,

I haven't done it with PostgreSQL... But assuming it's not far from  
MySQL just save the excel file as a csv, or a tab separated file and  
import that. If you find away to import a strict xls file let me know,  
I have a project that could really benefit from that :)



--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





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



Re: [PHP] import XLS sheet into DB

2008-08-15 Thread Mario Guenterberg
On Fri, Aug 15, 2008 at 10:29:40AM +0200, Alain R. wrote:
> Hi,
>
> I would like to import content of an XLS sheet into a PostgreSQL DB (table).
>
> How can i do that ?

Your question is not php related ;-)

Maybe, export the sheet as comma separated csv file and import it to postgresql.

Happy coding
Mario

-- 
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS/CM d- s++: a+ C>$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D  G++ e* h
r+++ y
--END GEEK CODE BLOCK--


signature.asc
Description: Digital signature


[PHP] import XLS sheet into DB

2008-08-15 Thread Alain R.

Hi,

I would like to import content of an XLS sheet into a PostgreSQL DB (table).

How can i do that ?
thanks a lot,

A.

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



Re: [PHP] PHP editor for linux

2008-08-15 Thread Mario Guenterberg
On Thu, Aug 14, 2008 at 07:32:13PM -0400, Eric Butera wrote:
> What sort of plugins do you use with vim?  For a while I was
> interested with it after seeing some presentations on it.  I never
> could figure out how to get it to do code completion based on methods
> of a class, it sort of jumbled all of them from a project together.  I
> also felt like it was a bit clunky jumping between files.  Using MVC
> means at least 3 files per uri so that got to be very tedious for me
> jumping between so many different files.  Any tips there?
> 
> One of my favorite parts of pdt is the fact that I can code complete
> any class in my current project or anything that I specify in my
> include path.  Also you can jump to the exact class/method by control
> clicking on it too which is a huge time saver.  Is there anything like
> this?

Hi

I use vim + some plugins and a custom configuration. It works fine
in cli and as vim-gtk under debian/ubuntu.

The Plugins are NERDTree, PDV and debugger. This and a little own
vimrc makes we wonder how powerfull vim is.

The vim installation is a standard apt-get install way installation.

You can open mutliple files with NERDTree if you use the the tab-key. 
It is easy to handle more than 3 files recently, but a bigger 
resolution on your desktop is needed ;-)

So i can coding some lines or files, press CTRL-L for syntax
checking and have a wonderfull customizable syntax highlightning.

The autocomplete function works also very well. I have downloaded
the php5 funclist from rasmus and extend it if needed. Variables and
contants defined in the file that i edit are also autocompleted.

Happy coding
Mario

-- 
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS/CM d- s++: a+ C>$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D  G++ e* h
r+++ y
--END GEEK CODE BLOCK--

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