[PHP] Sessions GET vs. Cookies

2003-07-27 Thread Nicholas Robinson
Hi

First time on the list and this may be a silly question. I'm developing a site 
that uses sessions. I have enabled cookies and checked that a valid cookie 
with the appropriate session id is being set. However, I've noticed that 
links in my pages are getting the sessionid added as a GET parameter. Can 
anything be done to stop this as, presumably, they aren't necessary in this 
situation.

TIA

Nick

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



Re: [PHP] Sessions GET vs. Cookies

2003-07-27 Thread Nicholas Robinson
Many thanks, that's fixed it!

On Sunday 27 Jul 2003 10:42 pm, Chris Shiflett wrote:
> --- Nicholas Robinson <[EMAIL PROTECTED]> wrote:
> > I've noticed that links in my pages are getting the sessionid
> > added as a GET parameter.
>
> The session.use_trans_sid directive is enabled in your php.ini. Disable it
> if you do not want this behavior.
>
> Hope that helps.
>
> Chris
>
> =
> Become a better Web developer with the HTTP Developer's Handbook
> http://httphandbook.org/


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



Re: [PHP] $_GET['sort'] & argument separator

2003-07-28 Thread Nicholas Robinson
What happens if you use a non-breaking html space instead? I.e EvalĀ #

HTH

Nick
On Monday 28 Jul 2003 9:06 am, Ow Mun Heng wrote:
> Hi,
>
>   I have this problem, which could easily be solved through a name
> change but I would like to learn more.
>
> There's a table set up from a MySQL query like this
>
> row1) Eval #  Title   # Heads My Findings
> row2) P1000   Title16 This is my findings
> row3) P1223   Eg 2  3 2nd findings
>
> row1 is the header columns, the title names are derived from sql statement
> executed as SELECT eval_no as "Eval #" etc..
>
> row1 is also set up such that if the user clicks the link, it will trigger
> a SQL comand to sort it.
>
> The problem here is the '#' sign/key. spaces are no problem. the
> $_GET['sort'] is not able to get the whole field, as such "Eval #" can only
> be recognised as "Eval" and thus sql is not able to sort it.
>
> I've looked at the php.ini file and tried setting these 2 configs
>
> 
> arg_separator.output string
> The separator used in PHP generated URLs to separate arguments.
>
> arg_separator.input string
> List of separator(s) used by PHP to parse input URLs into variables.
> Note: Every character in this directive is considered as separator!
> 
>
> but it still does not work..
>
> 
> This is how the link looks like
> http://10.0.0.1/trackit/trackit-2003-07-28/view_set_tracker.php?sort=Eval%2
>0 #&dir=ASC
>
>
> Help... Please...
>
> ==view_tracker.php==
> $l_column_header = nl2br(mysql_field_name($l_results,$k));
>
> echo nl2br(sql_sort_by_header($l_column_header, $l_column_header,
> sql_sort_cat, $sql_sort_dir) );
>
> =sql_functions===
> function sql_sort_by_header( $p_string, $p_sort_field, $p_sort, $p_dir ) {
> if ( $p_sort_field == $p_sort ) {
> # we toggle between ASC and DESC if the user clicks the same
> sort order
> if ( 'ASC' == $p_dir ) {
> $p_dir = 'DESC';
> } else {
> $p_dir = 'ASC';
> }
> }
> echo ''. $p_string .'';
> }
> =view_set_tracker.php
>   $_SESSION['sql_sort_cat']   = '';
>   $_SESSION['sql_sort_dir']   =
> $GLOBALS['g_default_sql_sort_dir'];
>   $_SESSION['sql_sort_cat']   = $_GET['sort'];
>
>   if (!empty( $_GET['dir'] ))
>   {
>   $sql_sort_dir = $_GET['dir'];
>   }
>
>   header_redirect_html("view_tracker.php");
> }
>
> ?>
>
> =
>
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia
> DID : 03-7870 5168


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



Re: [PHP] List Problems

2003-07-28 Thread Nicholas Robinson
I've been getting them too. The really annoying bit is that the most likely 
reason for it is that  the lucky devil hanmir is probably on holiday!

On Monday 28 Jul 2003 6:26 pm, Curt Zirzow wrote:
> Any body else getting a message back with subject like:
>  [ERR] Re: [PHP] subject of message.
>
> With contents:
>
> Transmit Report:
>
>  To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED])
>
>
> I tried contacting the list admin and posted a message here ealier
> this weekend about fixing this (ie unsubing him.)
>
> Or am I the only one getting these bounced mail messages, meanwhile
> I'll just filter all the mail to /dev/null
>
> Curt


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



Re: [PHP] Parsing MySQL query return

2003-07-28 Thread Nicholas Robinson
If you assume either \n or \n\n as the para delimiters then you could use 
strpos (see function.strpos.html)  to work out where to split the text. If the 
text field contents are huge, you might consider limiting the query results 
by using left( field, size ) in the query.

KR

N
On Monday 28 Jul 2003 7:57 pm, Ewout de Boer wrote:
> - Original Message -
> From: "John" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 8:22 PM
> Subject: [PHP] Parsing MySQL query return
>
> > Hey All,
> >
> > I have a question regarding parsing text from a MySQL query. Basically, I
> > have several paragraphs of text in a field in MySQL. I run a query, get
>
> the
>
> > results, no problem. However, I would like to only display the first
> > paragraph of the data returned.
> >
> > What is the best way to do this?
>
> That depends on te format of the text/paragraphs in the mysql field.
> How are the paragraphs separated ?
>
>
>
> regards,
> Ewout


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



Re: [PHP] Parsing MySQL query return

2003-07-28 Thread Nicholas Robinson
It occurred to me after my first reply that you might be able to do something 
in mysql.

This works (given my earlier assumptions):

select left( paras, if ( locate( '\n', paras ) = 0, length( paras ), locate( 
'\n', paras ))) ...

It will work with \n\n as well.

N
On Monday 28 Jul 2003 7:57 pm, Ewout de Boer wrote:
> - Original Message -
> From: "John" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, July 28, 2003 8:22 PM
> Subject: [PHP] Parsing MySQL query return
>
> > Hey All,
> >
> > I have a question regarding parsing text from a MySQL query. Basically, I
> > have several paragraphs of text in a field in MySQL. I run a query, get
>
> the
>
> > results, no problem. However, I would like to only display the first
> > paragraph of the data returned.
> >
> > What is the best way to do this?
>
> That depends on te format of the text/paragraphs in the mysql field.
> How are the paragraphs separated ?
>
>
>
> regards,
> Ewout


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



Re: [PHP] Apache logs to keep $_POST values

2003-07-29 Thread Nicholas Robinson
Probably better to shell a command to write to the system log - I don't think 
PHP can do it directly. This would nott be subject to the contention problems 
you cite in writing to either an apache log or a dedicated log.

HTH

Nick
On Tuesday 29 Jul 2003 8:36 pm, Jay Blanchard wrote:
> [snip]
> I wanted to know if Apache has a feature that could log the $_POST
> values.
> [/snip]
>
> I don't think so, you would probably have to consult an Apache list or
> the Apache manual.
>
> [snip]
> By the way, fopening the log file and write the $_POST variables won't
> work on a server with high activity because other requests could be
> processed by apache and logged before I can write my $_POST variables in
> it's access log so I would just mess up my logs. I could just keep my
> own log written by my application if Apache doesn't have such a feature.
> This helps a lot tracking bugs because people just don't remember what
> they've done when something went wrong.
> [/snip]
>
> True, I was just offering a solution to your situation. I like your idea
> better, but you are likely to have the same problem with a seperate log
> on a high traffic site, no?


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



Re: [PHP] MySQL query/PHP logic?

2003-07-29 Thread Nicholas Robinson
Don't know whether it's just because it's late at night here in the UK or 
whether I'm being a bit dim, but wouldn't it be much, much easier to store 
all the data in your non-main tables in a single table and distinguish the 
type of data (i.e. fof, pub, gov, etc) by a field. This would simplify 
your query and no doubt improve performance.


On Tuesday 29 Jul 2003 10:13 pm, Petre Agenbag wrote:
> Hi List
>  OK, I've posted this on the MySQL list as well, but it seems a bit quiet
> there, and arguably it could definately be a PHP rather than mysql question
> depending on whether it can be done with one query (then it was/is a mysql
> query), or whether it should be done with some structures and multiple
> queries ( then it's arguably PHP).
>
> So, here goes.
>
>
> I'm trying to return from multiple tables, the records that have field
> "information_sent" between two dates.
> The tables are all related by means of the id of the entry in the main
> table, ie..
>
> main
> identity_name ...
>
> fof
> id_fofid  information_sent ...
>
> pub
> id_pubid  information_sent ...
>
> etc.
>
> So, I tried the following join
>
> select * from main
>   left join fof on main.id = fof.id
>   left join pub on main.id = pub.id
>   left join gov on main.id = gov.id
>   left join med on main.id = med.id
>   left join ngo on main.id = ngo.id
>   left join own on main.id = own.id
>   left join sup on main.id = sup.id
>   left join tra on main.id = tra.id
>   where (
>   (fof.information_sent > '$date1' and fof.information_sent < '$date2')
>   OR
>   (pub.information_sent > '$date1' and pub.information_sent < '$date2')
>   OR
>   (gov.information_sent > '$date1' and gov.information_sent < '$date2')
>   OR
>   (med.information_sent > '$date1' and med.information_sent < '$date2')
>   OR
>   (ngo.information_sent > '$date1' and ngo.information_sent < '$date2')
>   OR
>   (own.information_sent > '$date1' and own.information_sent < '$date2')
>   OR
>   (sup.information_sent > '$date1' and sup.information_sent < '$date2')
>   OR
>   (tra.information_sent > '$date1' and tra.information_sent < '$date2')
>   )
>   order by entity_name
>
>
> BUT, although it seems to be "joining" the tables correctly AND only
> returning the ones with the correct date criteria, it does NOT return
> the "id" or the "information_sent" fields correctly ( due to duplication
> in the result )
>
> Can this be done in one query without sub-selects, or should it be broken
> up (in which case I would still need help with the logic and to minimize
> the amount of queries inside loops)
>
>
> Thanks


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



Re: [PHP] Search in PhP

2003-07-30 Thread Nicholas Robinson
 Try running a exec() running a grep command on your DocumentRoot.

something like 'grep -ril fred * would just produce the filenames containing 
fred or -ri would display the context.

You could then produce links to the files from the resulting output.

HTH

On Wednesday 30 Jul 2003 10:51 am, khuram noman wrote:
> Hello
>
> i have a site in php but not using database i want to
> add the search facilty in that site means user can
> search into the contents of the site .so how can i do
> that in php without using database.waiting for ur soon
> reply
>
> thanks
> khuram noman
>
> __
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com


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



Re: [PHP] Location header - slow redirect

2003-07-30 Thread Nicholas Robinson
try putting this after the header:

echo "";

It forces the redirect to take place immediately (in most cases!).

HTH

On Wednesday 30 Jul 2003 11:53 am, admin wrote:
> I'm using the following short script to redirect users to another page
> on my site (php 4.3.2, Apache 2.0.47).
>
>  $goLang='en';
> header("Location: http://"; . $_SERVER['HTTP_HOST'] . "/" . $goLang . "/");
> exit;
> ?>
>
> I'm having a problem where it takes up to 15 seconds for the redirect
> page to load, but for other redirects on the site programmed in a
> similar way using php and the location header the page loads straight away.
>
> I'm a bit perplexed and would appreciate some suggestions.
> Thanks
> Phil


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



Re: [PHP] Mysql query and PHP loops

2003-07-31 Thread Nicholas Robinson
I think this does what you want. You can probably extend it to do the final 
check for val3 vs. val2 

select distinct t1.val1, max( t1.id ), t1.val2 from table as t1, table as t2 
where t1.val2 <= t2.val2 group by t1.val1;

HTH

On Thursday 31 Jul 2003 3:22 pm, Petre Agenbag wrote:
> Hi List
>
> I've been trying to do something with one MySQL query, but I don't think
> it is possible, so, I would need to probably do multiple queries, and
> possibly have queries inside loops, but I am rather weary of that so,
> I'd like your views/possible solutions to doing the following:
>
>
> Consider this:
>
> idval1val2val3
> 1 a   1   1
> 2 b   2   3
> 3 a   1   2
> 4 b   2   1
> 5 c   3   3
> 6 c   2   1
>
> I need to query this table to return this:
>
> idval1val2val3
> 3 a   1   2
> 4 b   2   1
> 6 c   2   1
>
> Thus, I need to firstly only return ONE row for each val1, and that row
> MUST be that last row (ie, the row with the highest id, OR, should val3
> for instance be a date, then with the highest date).
>
>
> if I do a
>
> select distinct val1, MAX(id) from table order by val1, then it returns
>
> idval1
> 3 a
> 4 b
> 6 c
>
> which is correct, BUT
> select distinct val1, MAX(id), val2 from table order by val1
>
> it returns
>
> idval1val2
> 3 a   1
> 4 b   2
> 6 c   3   <--- incorrect
>
> it then returns the FIRST "hit" for val2 in the db, and NOT the one in
> the row with the max id...
>
> Can I do this with one query? ( PS, I cannot use MAX on val2 or val3,
> they are text)
>
>
> Thanks


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



Re: [PHP] Mysql query and PHP loops

2003-08-01 Thread Nicholas Robinson
On further reflection, my first attempt works for the specific example but may 
not in the general case. Try using a combination of max( ...id ) and min( 
...val2 ) and add t1.val2 to the group by clause. This might work, but I've 
deleted my test files now!

On Friday 01 Aug 2003 7:04 am, Nicholas Robinson wrote:
> I think this does what you want. You can probably extend it to do the final
> check for val3 vs. val2 
>
> select distinct t1.val1, max( t1.id ), t1.val2 from table as t1, table as
> t2 where t1.val2 <= t2.val2 group by t1.val1;
>
> HTH
>
> On Thursday 31 Jul 2003 3:22 pm, Petre Agenbag wrote:
> > Hi List
> >
> > I've been trying to do something with one MySQL query, but I don't think
> > it is possible, so, I would need to probably do multiple queries, and
> > possibly have queries inside loops, but I am rather weary of that so,
> > I'd like your views/possible solutions to doing the following:
> >
> >
> > Consider this:
> >
> > id  val1val2val3
> > 1   a   1   1
> > 2   b   2   3
> > 3   a   1   2
> > 4   b   2   1
> > 5   c   3   3
> > 6   c   2   1
> >
> > I need to query this table to return this:
> >
> > id  val1val2val3
> > 3   a   1   2
> > 4   b   2   1
> > 6   c   2   1
> >
> > Thus, I need to firstly only return ONE row for each val1, and that row
> > MUST be that last row (ie, the row with the highest id, OR, should val3
> > for instance be a date, then with the highest date).
> >
> >
> > if I do a
> >
> > select distinct val1, MAX(id) from table order by val1, then it returns
> >
> > id  val1
> > 3   a
> > 4   b
> > 6   c
> >
> > which is correct, BUT
> > select distinct val1, MAX(id), val2 from table order by val1
> >
> > it returns
> >
> > id  val1val2
> > 3   a   1
> > 4   b   2
> > 6   c   3   <--- incorrect
> >
> > it then returns the FIRST "hit" for val2 in the db, and NOT the one in
> > the row with the max id...
> >
> > Can I do this with one query? ( PS, I cannot use MAX on val2 or val3,
> > they are text)
> >
> >
> > Thanks


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



Re: [PHP] Redirect to HTTPS

2003-08-01 Thread Nicholas Robinson
It might also be worth making sure that your web server is configured to force 
https on this page if this is what you want. Otherwise a user could type the 
URL in without the HTTPS and still get the page.


On Friday 01 Aug 2003 9:20 am, [EMAIL PROTECTED] wrote:
> I have a stupid question.
>
> I need if i be in a http make a redirect to https.
> Http is a 80 port and ssl is a 443 port
>
> if ($HTTP_SERVER_VARS['SERVER_PORT']==80)
> {
>
>  header("Location: https://mynet.com/pay.php";);
>  exit;
>  }
>
> Is the correct way to do this ??? Exist any function to make this ???
>
>
>
> Excuse my broken English, Regards from Spain
>
> Un saludo, Danny


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



Re: [PHP] Insidious!

2003-08-07 Thread Nicholas Robinson
Could this have anything to do with our being registered as spammers?

On Wednesday 06 Aug 2003 9:59 am, [EMAIL PROTECTED] wrote:
> Do you recall during the height of the War in March?
> I posted a simple joke - got one (positive) reply before getting kicked off
> the list by Mr Lerdorf himself.
>
> Now all of a sudden my inbox is FILLED with JUNK!  How many of you flamers
> are getting kicked off the (*&%^$^%&% list?
>
> At least I made a few people laugh!
>
> Oh - Apache vs. IIS, in case you forgot.
>
> Go ahead and kick me off the list again, moron


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



Re: [PHP] easier than switch

2003-08-09 Thread Nicholas Robinson
As, in this case, only one of the variables is non-null, then you could use 
the string concatenation operator and this would return what you want.

i.e. type = $_POST['news'] . $_POST['dreams'] . $_POST['storys']...

I think I've used the same variable name in different forms on the same page, 
as only one form submission occurs at any one time there can't be a conflict 
and PHP doesn't care where the POST'ed variable came from.. So, you could 
rename news, dreams, etc. to be type and extract the result directly without 
having to fiddle around.

HTH

Nick

On Monday 04 Aug 2003 11:19 pm, skate wrote:
> okay, so i know there's an easy way to do this, and i've seen it done, sure
> of it. so please forgive the stupidity of my question, i don't even know
> where to begin to look in the archives either...
>
> i have several forms on one page, they all submit a different variable, i
> then want to set one variable depending on that... okay, now i'm confusing
> myself, lets try explain it with some code...
>
> 
> if(isset($_POST))
> {
>  $type = $_POST['news'] || $_POST['dreams'] || $_POST['storys'] ||
> $_POST['words'] || $_POST['chat']; }
>
> ?>
>
> obviously this doesn't work. but i wanna set $type depending on which
> $_POST variable was sent. only one of these will ever be sent. rather than
> doing a big ass switch statement, is there no way i can get this into one
> line?
>
> i hope this isn't too confusing...


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



Re: [PHP] Problem occurs when included file includes anther file.

2003-08-09 Thread Nicholas Robinson
You can set the path(s) in php.ini

Edit the file and search on 'include'

HTH

Nick

On Friday 08 Aug 2003 6:38 am, CaiYongzhou wrote:
> The directory structure is as follows:
> /
>
> |-- demo.php
> |-- inc/
> |
> |-- inc1.php
> |-- inc2.php
>
> === file demo.php ==
>  require 'inc/inc1.php';
> ?>
>
> === file inc/inc1.php ==
>  require 'inc2.php';
> ?>
>
> == file inc/inc2.php ==
> this is a test
>
> The above inc/inc1.php is ok for testing.And this would be ok too:
>  //file inc/inc1.php
> require 'inc/inc2.php';
> ?>
>
> Problem occurs when the code is like this
>  //file inc/inc1.php
> require './inc2.php';
> ?>
> Fatal error: main(): Failed opening required './inc2.php'
> (include_path='.:/usr/local/lib/php')
>
> It seems that there's no explanation about this in php manual.Could
> someone give some?
>
> Btw,I am using redhat 7.2 / Apache 2.0.47 / PHP 4.3.3RC1 as my testing
> server.
> Thank you for reading my post:)


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



Re: [PHP] Stop neurotic posting

2003-08-10 Thread Nicholas Robinson
Andu's right. I've left several lists in the past, not because of people 
listing questions where they should have read the manual first, but because I 
couldn't stand the sad b**ds who get their kicks by belittling people 
with less knowledge but more manners than themselves.

I've actually learned quite a few useful things from questions in the past 
couple of weeks since I joined this list that have obviously reappeared 
several times. Now, I could spend hours trawling the archives to see if 
there's anything of interest, but I don't really have the time - and in any 
event they're often things I wouldn't have thought about looking up anyway.

So, keep the questions coming.

Nick

On Wednesday 06 Aug 2003 5:31 am, andu wrote:
> This is a very busy list, over 100 message in a quiet day and most people
> are helpful and decent, don't mind reading and learning. Unfortunately
> there are some who mostly post stuff like 'read the manual' and other shit
> like that. Stuffing e-mailboxes with such garbage day after day doesn't do
> anybody any good even if the manual is  not being read as much as it should
> be. Is it too difficult to not answer the post at all if you disagree with
> the content?
>
>
> Andu


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



Re: [PHP] Stop neurotic posting

2003-08-11 Thread Nicholas Robinson
I don't have time for speculative research and I'm not going to apologise for 
it.

By answering a few queries of a technical nature, helpfully and constructively 
without recourse to rude TLA's and FL:A's  (and not having to defend my modus 
operandi), I feel I earn the odd tasty morsel lobbed in my direction.

On Wednesday 06 Aug 2003 7:27 pm, Jennifer Goodie wrote:
> Not to beat a dead horse, but...
>
> From two separate responses:
> > And as for Google, I don't feel like I have time to wade through pages
> > and pages of irrelevant links until I find what I'm looking for when I
> > have a better resource right here.
> >
> >
> >
> > I've actually learned quite a few useful things from questions in
> > the past
> > couple of weeks since I joined this list that have obviously reappeared
> > several times. Now, I could spend hours trawling the archives to see if
> > there's anything of interest, but I don't really have the time -
> > and in any
> > event they're often things I wouldn't have thought about looking
> > up anyway.
>
> I love how the argument for not doing research is not having the time/not
> wanting to waste time.  That is just lazy and selfish.  Since you don't
> want to waste your time looking, it is perfectly acceptable for everyone
> else to waste time reading a question that's been posted 80 times in the
> last month, and possibly waste more time typing up the same answer that has
> probably been posted 80+ times.  How is your time more important or
> valuable than everyone else's?
>
> This is not a personal attack on the two posters quoted, just my feelings
> on that general attitude.


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



Re: [PHP] Problem occurs when included file includes anther file.

2003-08-11 Thread Nicholas Robinson
ooops, sorry, ignore my last post, I must get larger text on my screen! Missed 
the .: element of your path!

Can you confirm that this file is a replacement for demo.php?

"Problem occurs when the code is like this
"

If so, then it won't find it because you haven't include ./inc in your include 
path.

Otherwise your example works fine on my machine.

HTH

Nick

On Friday 08 Aug 2003 6:38 am, CaiYongzhou wrote:
> The directory structure is as follows:
> /
>
> |-- demo.php
> |-- inc/
> |
> |-- inc1.php
> |-- inc2.php
>
> === file demo.php ==
>  require 'inc/inc1.php';
> ?>
>
> === file inc/inc1.php ==
>  require 'inc2.php';
> ?>
>
> == file inc/inc2.php ==
> this is a test
>
> The above inc/inc1.php is ok for testing.And this would be ok too:
>  //file inc/inc1.php
> require 'inc/inc2.php';
> ?>
>
> Problem occurs when the code is like this
>  //file inc/inc1.php
> require './inc2.php';
> ?>
> Fatal error: main(): Failed opening required './inc2.php'
> (include_path='.:/usr/local/lib/php')
>
> It seems that there's noxplanation about this in php manual.Could
> someone give some?
>
> Btw,I am using redhat 7.2 / Apache 2.0.47 / PHP 4.3.3RC1 as my testing
> server.
> Thank you for reading my post:)


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



Re: [PHP] logging of mail() function?

2003-08-14 Thread Nicholas Robinson
I use a bcc to a specific email account. Not pretty but it works.

Here's a snippet:

/* To send HTML mail, you can set the Content-type header. */
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-15\r\n";

/* additional headers */
$headers .= "From: $COMPANY_INFORMAL_NAME <$COMPANY_SALES_EMAIL>\r\n";

// Keep a copy";
$headers .= "Bcc: $COMPANY_SALES_EMAIL\r\n";

/* and now mail it */
return ( mail($to, $subject, $message, $headers) );

HTH

Nick

On Sunday 03 Aug 2003 9:46 pm, RiGe wrote:
> Is there possible to log outgoing mails sent via mail() function? I need to
> know, when, which script (can be path to php file on server) and receipt of
> mail that was sent.
>
> Is there possible?
>
> Thanx.
>
> RiGe


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



Re: [PHP] Validate The Last Day of Month with server's clock????

2003-08-14 Thread Nicholas Robinson
The 'usual' trick is to set the date to the first day of the month after the 
one you want and then subtract one day.

HTH

Nick

On Wednesday 13 Aug 2003 8:00 pm, Scott Fletcher wrote:
> Hi!
>
> Here's a trick script.  We know that some months have the last day
> which is 30 while other is 31.  As for February, it can be either 28 or 29.
>  So, what's the trick in using the php to find out what is the last day of
> the month if you want to checked it against the server's clock to find out
> the last day of the month.  Suppose it is this month or 3 months ago or 3
> months from now.  Anyone know?
>
> Thanks!


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



Re: [PHP] Background process

2003-08-14 Thread Nicholas Robinson
Are you sending a  after the re-direct to ensure your browser 
loads the page as soon as possible rather than delaying? If not, this could 
appear that it isn't re-directing until the script  starts.

On Wednesday 13 Aug 2003 8:21 pm, Jackson Miller wrote:
> I have a script that starts a background process and redirects.  The
> background process is a PHP script that is started with an exec() call.
>
> The problem is that it is taking a while for the background process to
> start. The redirect starts working in the browser, but doesn't seem to go
> until the process starts.
>
> Is there a faster way to start a background process?
>
> -Jackson


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



Re: [PHP] Validate The Last Day of Month with server's clock????

2003-08-17 Thread Nicholas Robinson
And the reason I quoted 'usual' is that my suggestion is more portable.

On Thursday 14 Aug 2003 11:54 am, Ford, Mike [LSS] wrote:
> On 13 August 2003 20:05, Nicholas Robinson wrote:
> > On Wednesday 13 Aug 2003 8:00 pm, Scott Fletcher wrote:
> > > Hi!
> > >
> > > Here's a trick script.  We know that some months have the last
> > > day which is 30 while other is 31.  As for February, it can be
> > >  either 28 or 29. So, what's the trick in using the php to find out
> > > what is the last day of the month if you want to checked it against
> > > the server's clock to find out the last day of the month.  Suppose
> > > it is this month or 3 months ago or 3 months from now.  Anyone know?
> >
> > The 'usual' trick is to set the date to the first day of the month
> > after the one you want and then subtract one day.
>
> Actually, the "usual" trick is to ask mktime() for the 0th day of the
> following month.  One of the examples on the mktime() page of the manual
> (http://www.php.net/mktime) even illustrates exactly this.
>
> Cheers!
>
> Mike
>
> -
> Mike Ford,  Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
> Email: [EMAIL PROTECTED]
> Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211


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



Re: [PHP] File upload + permissions + .htaccess in php

2003-08-22 Thread Nicholas Robinson
I've had this problem twice recently.

Once it was because I'd foolishly moved a script that used relative pathnames. 
The result was that I was trying to access a file outside the DocumentRoot 
and it didn't matter what the permissions on the file were, it wasn't trying 
to open that one at all!

The other time is more confusing. I'd gone through all directory and file 
ownerships and they were okay. In the end, in desperation, I chgrp'd the file 
to be mine (leaving ownership alone) and it worked. This is on my list of 
things to come back to!

HTH

Nick

On Thursday 21 Aug 2003 10:30 am, Ryan A wrote:
> Hi,
> I am trying to upload something into a directory on my server but always i
> am getting a permission denied ONLY from this server...i have tried it on 2
> other servers and they seem to be working fine but i have to get it working
> on this server as this server is the fastest and our production server.
>
> I have looked at the folder permissions and CHMODED/changed them from 644
> to 766 and finally 777 but am getting the same error, i then had a look at
> the php info file (http://jumac.com/phpinfo.php) and i see file_uploading
> is set to 1 and 1, safe mode is off, i am not too familier with file
> uploading so is this right? if not, how can i change it? hopefully via a
> .htaccess as I dont have access to the php.ini file directly.
>
> Let me again point out that this problem only seems to be on this server,
> the scripts including the upload is working perfectly on the other test
> servers/sites.
>
> Kindly reply,
> -Ryan A.
>
>
> We will slaughter you all! - The Iraqi (Dis)information ministers site
> http://MrSahaf.com


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



Re: [PHP] Clean Up the sand box time

2003-08-23 Thread Nicholas Robinson
On Friday 22 Aug 2003 10:26 pm, John Taylor-Johnston wrote:
> This is my favourite question. Can I clean up my 'if then' statements a
> tad? Must be a cleaner way?
> Still learning, still having fun :)
> Thanks,
> John
>
>  $news = mysql_query($sql) or die(print
> "document.write(\"".mysql_error()."\");");
>
>  $found = 0;
>  while ($mydata = mysql_fetch_object($news))
>  {
>   if($getaddr == $mydata->IPAddress)
>   {
>   $found = 1;
>   }
>  }
>
>   if ($found > 0)
>   {
>   echo "document.write(\"$getaddr already visited. \");";
>   }else{
>   echo "document.write(\"insert $getaddr into $table. \");";
>   }

Not sure at exactly what level you're looking to improve it!

Could you improve the query so you didn't have to search through all the 
records? i. e. add in '..where IPAddress = $getaddr" That way you could do 
away with the while loop altogether.

If you can't then why not break out of the while as soon as you've found the 
IPaddress you're looking for - i.e.

if ( $found = $getaddr == $mydata->IPAddress ) break;

And finally, if you were really having a downer on if statements you could use 
the ternary operator form as in:

document.write( ( $found ) ? "...already vistied" : "insert..." );

Whatever you use, I think Robert's layout not only shows elegance and panache 
but also makes it much easier to read.

HTH

Nick

PS: IP addresses are a notoriously bad way of checking to see if someone's 
visited your site.



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



Re: [PHP] Gripe^2 [was Gripe]

2003-08-30 Thread Nicholas Robinson
You could equally ask why we get plagued with silly strap lines like

"I used to think I was indecisive, but now I'm not so sure."

HTH


On Saturday 30 Aug 2003 3:54 am, Curt Zirzow wrote:
> Why do people insist on using their work address so we are plagued
> with privacy notices and autorespond's letting us know that he will
> be gone one extra day over the weekend
>
>
> p.s. you'll know why I'm griping if you reply to this 
> p.s.s. at least till i get him booted off the list 
>
> cheers!
>
> Curt

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



Re: [PHP] MySQL Left Join Question

2003-09-02 Thread Nicholas Robinson
I'm not clear whether you are saying you get the records where there is a 
match and no non-matching records, or simply no records at all!

What happens if you take out the WHERE clause, do you get all the records from 
p being displayed with NULLs for c.projectid where no match exists? 

Nick

On Monday 01 Sep 2003 11:00 pm, Van Andel, Robbert wrote:
> This may not be the best place to ask this question, but I'm running into a
> problem when I perform a left join sql statement in PHP.  The sql statement
> is as follows:
>
> SELECT p.id
> pid,p.designID,p.project_name,p.node,p.received,p.lots,p.ugfootage,p.aerial
>f ootage,p.node,c.* FROM projects as p LEFT JOIN proSub as c on
> p.id=c.projectID WHERE p.id=$id
>
> I have verified that $id has a value.  What I'm finding is that when there
> is no corresponding entry in proSub, the query returns nothing even though
> LEFT JOIN is supposed to return the contents of the left table even if the
> right table has no data.  The left data does have data and I am asking for
> the correct value for p.id.  I've run into some other scripts on my site
> where left join does not behave the way it's supposed to.
>
> Any thoughts??
>
> Robbert van Andel

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



Re: [PHP] TIME

2003-09-02 Thread Nicholas Robinson
Not directly as far as I know. Try using chronyd or similar (google will point 
you in the right direction). This works well with one of my machines that has 
a wayward clock and chronyd is happy to work with networks not permanently 
connected to the internet.

On Tuesday 02 Sep 2003 1:11 am, Dale Hersh wrote:
> The battery on my server keeps on dieing, so the clock is not keeping time
> correctly. I was wondering is there any way to query some type of global
> time source in php?
>
> Thanks,
> Dale

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



Re: [PHP] mysql query

2003-10-03 Thread Nicholas Robinson
DESC is a reserved word (used to indicate a DESCending ORDER bY).

N

On Friday 03 Oct 2003 11:17 am, Cameron Metzke wrote:
> ok im stumped lol i have used this code in the past to insert data into
> mysql (im relitively new though)
> --code
> mysql_query("INSERT INTO Images (Image, desc) VALUES ('$name',
> '$description')") or die (mysql_error());
> --end code-
> but i get this error]
> -error-
> You have an error in your SQL syntax. Check the manual that corresponds to
> your MySQL server version for the right syntax to use near ''Image',
> 'desc') VALUES ('2419091.jpg', 'stone')' at line 1
> --- end error--
> I found if i just try and record the name value it works fine but if i try
> to add the description i get the error.
> Any clues?
>
> :)

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



Re: [PHP] SQL Query OT question for the experts :)

2003-10-17 Thread Nicholas Robinson
The following works in MySQL, but obviously (and unlike your client!) you'll 
want to do this on a copy of the table first...

update londonhotelsallphotos set Number = ( if (@hi != HotelID, @line := 1, 
@line := @line + 1)), HotelID = (@hi := HotelID)

Note that if you run this query more than once, you'll need to reset @line 
manually in between otherwise the first hotelid will have not have numbers 
running from 1, but from n+1 where n was the maximum number of the last hotel 
id.

Nick

On Friday 17 Oct 2003 9:09 pm, Andrew Brampton wrote:
> Hi,
> I have a client with a database of around 17k entries. Now due to powers
> out of my control the table structure looks like:
>
> CREATE TABLE londonhotelsallphotos (
>   HotelID double default NULL,
>   active_hotel_photo_Name varchar(255) default NULL,
>   URL varchar(255) default NULL,
>   Number varchar(50) default NULL,
>   Name varchar(255) default NULL
> ) TYPE=MyISAM;
>
> and a few example rows look like:
> (105304,NULL,'http://blah/photos/105304/BAB105304.jpg','1','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/CAB105304.jpg','2','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/DAB105304.jpg','3','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/EAB105304.jpg','4','Cairn Hotel');
>
> However the client has recently updated the database and now all entries
> look something like:
> (105304,NULL,'http://blah/photos/105304/AAB105304.jpg',NULL,NULL);
> (105304,NULL,'http://blah/photos/105304/DAB105304.jpg',NULL,NULL);
> (105304,NULL,'http://blah/photos/105304/BAB105304_2.jpg',NULL,NULL);
> (105304,NULL,'http://blah/photos/105304/BAB105304_3.jpg',NULL,NULL);
>
> Now you will notice that the last 3 fields have changed... The client
> wanted to change the URL field, but also changed the Number & Name
> fields With the current coding it appears they require the Number field
> to be set to 1, 2, 3, 4 etc... However as you can see the number field are
> all NULL now, this is meaning the rows aren't being shown on the PHP page
> due to the way the page was coded..
>
> Now what I'm asking is for a SQL Query I can use to re-number all the rows
> (17,000 ish). The table has many different HotelIDs in it, with at most 5
> rows with the same ID meaning that the Number field won't be higher than 5.
> The URL field I think is always unique for all the rows Also I don't
> mind that the Name field is left NULL.
>
> A few example rows would be:
> (105304,NULL,'http://blah/photos/105304/BAB105304.jpg','1','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/CAB105304.jpg','2','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/DAB105304.jpg','3','Cairn Hotel');
> (105304,NULL,'http://blah/photos/105304/EAB105304.jpg','4','Cairn Hotel');
> (105356,NULL,'http://blah/photos/105356/EAB105356.jpg','1','Ramada Jarvis
> Bolton');
> (105356,NULL,'http://blah/photos/105356/CAB105498.jpg','2','Ramada Jarvis
> Bolton');
>
> If I can't do this with some quick and dirty SQL, I'll write some PHP to do
> the process, but since I'm not being paid to fix this problem, and the
> client caused it himself I thought I'll take the easier option of using SQL
> before I wrote some code out of kindness...
>
> Thanks very much
> Andrew

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



Re: [PHP] Is anybody else getting these??

2003-10-20 Thread Nicholas Robinson
I'm feeling left out, I'm not getting any of these. Haven't done since I 
blocked Hanmir.

On Monday 20 Oct 2003 4:11 pm, John Nichel wrote:
> Does [EMAIL PROTECTED] need to be removed from the list, or is it
> just me?
>
>  Original Message 
> Subject: Returned mail: see transcript for details (Re: [PHP] PHP manual
> - multiple HTML pages)
> Date: 20 Oct 03 1459 GMT
> From: Mailer Daemon <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
>
>
>
> - The following addresses had permanent fatal errors -
> 
>  (reason: 550 Recipient  is no user here)
>
>
> - Transcript of session follows -
>
> .. while talking to smtp.:
> >>> RCPT To:
>
> <<< 550 Recipient  is no user here
> 550 5.1.1 ... User unknown
>
>
> - Transcript of mail follows -
> Received: from pb1.pair.com (pb1.pair.com [216.92.131.4])
>   by digtechinc.com (8.9.3/8.9.3) with SMTP id KAA20908
>   for <[EMAIL PROTECTED]>; Mon, 20 Oct 2003 10:58:47 -0400 (EDT)
> Received: (qmail 61526 invoked by uid 1010); 20 Oct 2003 14:58:11 -
> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Precedence: bulk
> list-help: 
> list-unsubscribe: 
> list-post: 
> Delivered-To: mailing list [EMAIL PROTECTED]
> Received: (qmail 61513 invoked by uid 1010); 20 Oct 2003 14:58:11 -
> Delivered-To: [EMAIL PROTECTED]
> Delivered-To: [EMAIL PROTECTED]
> Message-ID: <[EMAIL PROTECTED]>
> Date: Mon, 20 Oct 2003 10:00:35 -0500
> From: John Nichel <[EMAIL PROTECTED]>
> Organization: By-Tor.com
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4)
> Gecko/20030624 Netscape/7.1 (ax)
> X-Accept-Language: en-us, en
> MIME-Version: 1.0
> To: wim <[EMAIL PROTECTED]>
> CC: [EMAIL PROTECTED]
> References: <[EMAIL PROTECTED]>
> In-Reply-To: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=us-ascii; format=flowed
> Content-Transfer-Encoding: 7bit
> Subject: Re: [PHP] PHP manual - multiple HTML pages
> X-UIDL: 9622b9dae1c0a3c1401061ad550b17bb
>
>
> X-Bounce: msd
>
> wim wrote:
> > Does anyone still have the tarfile for the manual. On the website they
> > announce that these manuals will be redeployed shortly but this message
> > is already three weeks there and I need this (as always ) urgently.
> > Thanx in advance for sending it .
> >
> > Wim
>
> Best I have is a copy that was last updated on Dec 10, 2002...
>
> http://www.by-tor.com/php_manual.tar.bz2

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



Re: [PHP] Using cookies

2003-10-21 Thread Nicholas Robinson

If we're into analogies, how about a cookie containing username/password being 
much the same as leaving the keys to the house under your doormat? If someone 
knows that this is a common practice, they can find them and gain access to 
your house.

As I understand it (and I am not a lawyer) the laws in the UK (esp. Data 
Protection Act 1998 and the Computer Misuse Act) would place the 
responsibility with the site provider if cookies or 
authorisation/authentication mechanisms enable unauthorised access to 
information directly or indirectly - rather than the end user. In the case of 
personal data, the provider would be deemed to have failed to take adequate 
steps to protect the data from unauthorised disclosure. In other cases, it 
would probably render a successful prosecution of hacking more difficult.

Nick

On Tuesday 21 Oct 2003 11:10 pm, Chris Shiflett wrote:
> --- Marco Tabini <[EMAIL PROTECTED]> wrote:
> > IMHO, by storing the user's name and password in a cookie, you may be
> > exposing that information to unnecessary risks by letting it go back
> > and  forth continuously on the Net (assuming, of course, that you're
> > not under SSL and/or are using some encryption mechanism) and possibly
> > someone could argue that you did not take the necessary steps to protect
> > the user's data in an efficient way.
>
> I agree completely with this. If you are exposing someone's access
> credentials over the Internet for every single transaction (potentially
> many times for every page), your neglect would probably outweigh the fact
> that you didn't intentionally hand a third party any information. That's
> just my perspective, of course.
>
> In the case of cookies in general, I don't think it's as clear as any of
> the analogies used so far. The typical user probably doesn't realize you
> are setting or reading cookies. And, since the developer understands this
> while the user doesn't, it seems risky that the developer can know about
> potential vulnerabilities without alerting the user. I always assumed those
> legal disclaimers said stuff like, "You could die from using this site.
> Your death is not our responsibility. Browse at your own risk." Well, maybe
> not that extreme, but you get the idea. :-)
>
> Of course, if you don't store sensitive data in the cookies, there's not a
> big concern anyway.
>
> I should mention that the law doesn't always agree with me, so it's never
> safe to assume it does. I'm just saying what makes sense to me. :-)
>
> Chris
>
> =
> My Blog
>  http://shiflett.org/
> HTTP Developer's Handbook
>  http://httphandbook.org/
> RAMP Training Courses
>  http://www.nyphp.org/ramp

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



Re: [PHP] Age from birthdate?

2003-10-23 Thread Nicholas Robinson
Yes, but think about all the presents, hangovers, etc. they miss.


On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> >> >celebrate they're birthday before or after it on non leap years?
> >>
> >>Neither.  They celebrate it on Feb 29th.  So while we age every
> >> year, they only age once every four.  Make sense?
> >
> >So their life expectancy is only ~19 years? I'd hate to be born on that
> >day :)
>
> I dunno, a housemate of mine is thrilled to be turning just 9 years old
> this year. :D
>
> -
> michal migurski- contact info and pgp key:
> sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Age from birthdate?

2003-10-23 Thread Nicholas Robinson
Oh, you're such a pedant.

On Thursday 23 Oct 2003 9:08 pm, Ryan A wrote:
> Now HERES a good PHP related thread thats been going on for around 2
> days...:-D
>
> >Yes, but think about all the presents, hangovers, etc. they miss.
>
> On Thursday 23 Oct 2003 2:12 am, Mike Migurski wrote:
> > >> >I do wonder what the rule for those born on Feb 29'th.  Do they
> > >> >celebrate they're birthday before or after it on non leap years?
> > >>
> > >>Neither.  They celebrate it on Feb 29th.  So while we age every
> > >> year, they only age once every four.  Make sense?
> > >
> > >So their life expectancy is only ~19 years? I'd hate to be born on that
> > >day :)
> >
> > I dunno, a housemate of mine is thrilled to be turning just 9 years old
> > this year. :D
> >
> > -
> > michal migurski- contact info and pgp key:
> > sf/cahttp://mike.teczno.com/contact.html

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