[PHP] Re: Using Header() to pass information...

2006-04-22 Thread Tim Van Wassenhove
On 2006-04-22, Todd Cary [EMAIL PROTECTED] wrote:
 If I use

if ($send)
  header(location: mypage.php?message= . $message);

 the data ($message) is passed in the URL.  Is there a way to pass 
 the data as though it was a POST method i.e. not in the URL?

It's impossible to change the HTTP method. So if your user-agent is
performing a GET request, a location header would result in another GET
request. Thus, unless you are using a POST method (which is odd since
you wrote that the variables are in the URL) it's not possible.

What you could do is write it into $_SESSION (and call
session_write_close before you redirect)
Or you could stuff it yourself in $_POST and include/require mypage.php

Btw, there are browsers that don't handle a relative URL for redirection
very well. I suggest that you use an absolute URL (as written in
RFC2616 section 14.30)

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



[PHP] Re: http protocols defining what gets sent between web server and browser

2005-11-25 Thread Tim Van Wassenhove
On 2005-11-24, bruce [EMAIL PROTECTED] wrote:
 I'm working on a project, and need to know if there's anyone who's a guru
 with Web Server/Client interactions. Basically, I'm trying to get a much
 better/deeper understanding of the HTTP protocols defining the information
 that is sent/transfered between the web server/client browser apps.

There is an article about HTTP on Wikipedia.org and from there you find
a link to RFC2616.

 So, if you have the skills/expertise in this area, and you're willing to
 talk to me for a few minutes, I'd appreciate it. As stated, the underlying
 reason for the questions is to get a better understanding of 'man in the
 middle attacks' as this applies to web server apps.

In that case you might want to look at tcp/ip and http over ssl too.

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



Re: [PHP] OT - database and indexes... but anyone please?

2005-09-26 Thread Tim Van Wassenhove
On 2005-09-26, Rory McKinley [EMAIL PROTECTED] wrote:
 If the index in question happens to be a unique index or a primary key
 (really just a special case of index) 

I thought a primary key is something defined at the logical, where an
index is defined at the implementation level.. Therefore, a primary key
can't be a special case of an index.


-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



[PHP] Re: headers .vs javascript location.href

2005-09-18 Thread Tim Van Wassenhove
On 2005-09-17, bruce [EMAIL PROTECTED] wrote:
 need to talk to someone to figure out how/what i need to do to use the php
 'headers' function, as opposed to the javascript 'location.href'.

 i've tried to implement the buffering functions, but still get the same
 error...

Now, if you read the documentation of output buffering you will see that
it does *not* buffer headers..

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



[PHP] Re: [php]: monthly statistics

2005-09-18 Thread Tim Van Wassenhove
On 2005-09-18, John Taylor-Johnston [EMAIL PROTECTED] wrote:
 Hi,
 Where could I find a monthly statistic plugin that can take my 
 `StampDate` field and generate monthy graphs of my primary key `id`?
 I'm sure I,m not the first to ask? ;-)

 CREATE TABLE `counter` (
   `id` int(10) NOT NULL auto_increment,
   `StampDate` date NOT NULL default '1999-12-31',
   PRIMARY KEY  (`id`)
 ) TYPE=MyISAM AUTO_INCREMENT=26050 ;


All you need to do is SELECT .. GROUP BY YEARMONTH(StampDate) and you're
ready to go..

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



[PHP] Re: Way for script to discover it's path?

2005-09-18 Thread Tim Van Wassenhove
On 2005-09-18, Ken Tozier [EMAIL PROTECTED] wrote:
 I'm working on an auto-include mechanism for some complex scripts and  
 rather than have all the paths to the various components hard coded,  
 I'd like to have the script walk up the hierarchy looking for it's  
 specified includes. Is it possible to do this? I looked at the  
 various file related php functions but didn't see anything resembling  
 'my_path()'

You might also want to check out the __FILE__ constant..

http://be.php.net/manual/en/language.constants.predefined.php 

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



Re: [PHP] LAN IP address

2005-08-29 Thread Tim Van Wassenhove
On 2005-08-29, Philippe Reynolds [EMAIL PROTECTED] wrote:
 Yes, I would hard code my IP address but when the computer crashs the server 
 assigns it a different IP address, so I have to make my code a tad more 
 dynamic...

Have you had a look at tools that you get at dynip etc?

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://timvw.madoka.be

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



Re: [PHP] Need help with a string

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Greg Donald wrote:
 On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
[EMAIL PROTECTED] wrote:
 Given the following string:
 
 $textString = Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 11:00 
 Wishes? nighttime spectacular 10:00
 
 I need to break the string up into pieces where as
 
 $string[1] = Share A Dream Come True Parade 3:00
 $string[2] = SpectroMagic Parade 9:00, 11:00
 $string[3] = Wishes? nighttime spectacular 10:00
 
 Granted this is pretty easy because I could just search for this stuff and break it 
 up, but the string above can actually be different each time, for instance, next 
 time it could be:
 
 $textString = Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade 9:00, 
 11:00 Wishes? nighttime spectacular 10:00
 
 I think my main issue is that I don't know how to keep the , XX:XX part combined 
 with the previous part of the string.
 
 preg_match_all() is what you want to use.  You can easily match
 everything up to the time since it's formed with a :00 at the end
 each time.

If i'm not mistaken, preg_split on \d{0,2}:\d{2}

-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Re: move_uploaded_file() problem

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Daniel Lahey wrote:
 I'm seeing a very strange problem with move_uploaded_file(...).  I'm
 uploading jpegs and the transfer appears to go a little too quickly,
 and when I look at the directory listing, the files are about twice the
 size that they should be.  When we view the file in the browser, the
 images are either mangled or appear incomplete.  Sometimes the bits
 seem to be scrambled and other times it appears that only the first 1/4
 or so of the image is complete.  

Meaby the maximum execution time is exceeded, and the script dies?


Another odd thing is that
 the permissions on the files are set to -rw--- and owned by apache.
 I can do a chmod on them to get them readable, but chown doesn't
 appear to work to change ownership.

I believe you have to be root to perform chown.

If you really want another user to be the owner of the files, you could
extend your upload script so that it uploads all the files with ftp to
localhost. This way they will be owned by the ftp-user.



-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Re: Creating a Sequence from Array

2004-10-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Nick Wilson wrote:
 array (
 1 = array(123, 345, 454), 
 2 = array(8854, 393, 4947, 77, 3343), 
 3 = array(393, 33)
   );
 
 I need to create an array sequence from that that would look like this:
 array (
 '1:123', 
 '2:8854', 
 '3:393', 
 '1:345', 
 '2:393', 
 '3:33', 
 '1:454', 
 '2:4947', 
 '3:393',// notice this has started from the start again...
 '1:123',// as has this..
 '2:77', 
 etc etc 
   );
 
 untill the last number of the largest array (number 2 in
 the original array) have been used.
 
 I do have some code to show you but im afraid ive been going at it all
 the wrong way so im not sure it's of any use. 

Do you have a clue what your code is doing? Or did you just come up with
it? What is the use of writing code that you don't understand?

Not going to do your homework, but will give you some hints:

it seems your function accepts an array as parameter, and returns a new
array. 

to find the largest number, you could say the first number in the array
is the current biggest. And then you loop through all the values, and remember
the array number when you meet a value that is greater than the current
biggest.

Now it's only a matter of building the new array, and resetting your
index to 0 when it's as big as the biggest found earlier.

http://www.php.net/functions
http://www.php.net/foreach


-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



Re: [PHP] Session handlers

2004-10-02 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Ewout De Boer wrote:
 
 - Original Message - 
 From: Shawn McKenzie [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Saturday, October 02, 2004 2:11 AM
 Subject: [PHP] Session handlers
 
 
 Just curious, what is the advantage of using a custom session handler,
 such as saving session data in MySQL?
 
 security !
 
 The default location for php to store session data is the tmp directory of
 the host os (like /tmp), and in most cases these files are readable by the
 webserver... and by all other scripts it's running. So if you're hosting
 your site on a shared server other users can read your session data, that's
 fine as long as you don't use it to store critical information like
 username, password

If others can read from your session.save_path, i'm pretty sure
they'll be able to read the credentials you use in the scripts to connect the database 
too. Which makes the security argument in this case invalid.


-- 
Met vriendelijke groeten,
Tim Van Wassenhove http://www.timvw.info

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



[PHP] Re: htmlArea look-a-like

2004-07-21 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Robb Kerr wrote:
 I am developing an app in which my visitors must be able to enter text and
 do some minimal HTML formatting including making some of the text
 hyperlinks. I like the looks of htmlArea, but can't get either available
 version to work in any Mac browsers. I've also found EditLive! and am
 intrigued by it. Does anyone know of anthing else like these availlable on
 the market?


You can try http://home.mysth.be/~timvw/test/ (user/pass webmaster/webmaster)

Source at http://home.mysth.be/~timvw/programming/php/easyform.zip

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: convert degrees to heading

2004-07-16 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], René fournier wrote:
 I have to write a little function to convert a direction from degrees 
 to a compass -type heading. 0 = West. 90 = North. E.g.:
 
 from:
 135 degrees
 
 to:
 NW
 
 Now, I was planning to write a series of if statements to evaluate e.g.,
 
 if ($heading_degrees  112.5  $heading_degrees  67.5) {
   $heading_compass = N;
   }
 
 The works, but it will require
 
 N, NNW, NNE, NE, NW, ENE, NWW... many IF statements.
 
 Can anyone think of a programatically more elegant and efficient way of 
 converting this type of data? (I suppose this is not really a problem, 
 just a curiosity.)

Might need some corrections, but the idea should be clear: 

function degrees2compass($degrees)
{ 
$compass = array('N', 'NNW', 'NNE', 'NE', ...);
$index = $heading_degrees / sizeof($compass);
return $compass[$index];
}

Or you could use a switch

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



Re: [PHP] Re: convert degrees to heading

2004-07-16 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Warren Vail wrote:
 Well, isn't north really about 340 to 020 degrees?  Looks like if you threw
 in a factor.

Well, modulo is a nice function. But i'm not the homework service :)

 
 Warren Vail
 
 -Original Message-
 From: René Fournier [mailto:[EMAIL PROTECTED] 
 Sent: Friday, July 16, 2004 3:59 PM
 To: Tim Van Wassenhove
 Cc: php
 Subject: Re: [PHP] Re: convert degrees to heading
 
 
 Works beautifully. Thanks!
 
 .Rene
 
 On Friday, July 16, 2004, at 04:36 PM, Tim Van Wassenhove wrote:
 
 function degrees2compass($degrees)
 {
 $compass = array('N', 'NNW', 'NNE', 'NE', ...);
 $index = $heading_degrees / sizeof($compass);
 return $compass[$index];
 }
 


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: Regular Expressions

2004-07-15 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Arik Raffael Funke wrote:
 implement following pattern Last Name:\s*(.*)\n.

 I get just 'Jason'. But what I currently get is:
 Jason
 Street: abc

This is behaviour because (.*) is greedy.
As you noticed, it matched Jason \nStreet:abc

/Last Name:\s+(.*?)\n/


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: ereg question/prob...

2004-07-15 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Bruce wrote:
 $file = .txt;
 
 ereg((\.)([a-z0-9]{3,5})$, $file, $regs);
 echo  ww = .$regs. brbr;
 
 
 i'm trying to figure out how to get the portion of the regex that's the
 extension of the file. my understanding of the docs, says that the
 extension should be in the $reg array
 
 any ideas/comments on where my mistake is would be appreciated...

Will it work with 123.123.txt ?

If you have a look at the file functions in the manual, you'll find much
better solutions like pathinfo();


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: Regular Expressions

2004-07-15 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Red Wingate wrote:
 Oh guess it would be even better and faster to only use:
 
 /Last Name:([^\n]*)/

In most environments is strpos and substr even faster ;)

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: PHP and HTML Conventions

2004-07-13 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Torsten Roehr wrote:
 Harlequin [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 is there a HTML equivalent of the PHP include statement then...?
 
 No, but you can include pure HTML with include()/include_once(). Just give
 the file a php extension:
 
 include_once 'pureHTML.php';

readfile is in this case more appropriate imho

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: mail problem

2004-07-11 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Joao Gomes wrote:
 [mail function]
 ; For Win32 only.
 SMTP = [EMAIL PROTECTED]

I don't think [EMAIL PROTECTED] is a valid hostname.

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: Passing Variables

2004-07-11 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Harlequin wrote:
 I'm just working on my syntax for passing a variable UserID from one page
 to the next and it works a little like this so far:
 
?php echo for example: ['$UserID']; ?

As you seem to have _many_ problems, i can only advise you to read the
manual.. and read it again.. and again... http://www.php.net/manual.

You can find the answer in the section on variables, predefined
variables to be more precise.

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



Re: [PHP] Login Verification

2004-07-10 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Harlequin wrote:
 I did Jason but am reworking all the pages and tidying the syntax up and one
 of the things I never sorted out was the fact that users logging in would be
 taken to the logged in page although their user data was not displayed and
 an error told them they logged in incorrectly.

Meaby you can have a look at pear::auth ?

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: problem with downloading some pdf's

2004-07-09 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Scott Taylor wrote:
 I have tried twice, both times its starts to download but stops about 
 half way or three-quarters the way complete. I get a error message that 
 the download was not completed. When I go to look at the message there 
 is just numbers. I have tried to download again but the numbers show 
 up and it won't let me try again.

Perhaps the execution time has been exceeded? 

 if (file_exists($file))
 {
 // a switch would be perfect here,
 // but it just didn't work last time...it was always
 // taking the 'default:' case

Probably because you forgot to put a break.
Also this is discussed in the manual. 

And a lazy programmer would lookup the extension - content-type
relationship in a file like /etc/mime.types :)


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: breadcrumb app...

2004-07-09 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Bruce wrote:
 has anybody seen a reasonably good/basic breadcrumb app that works... new
 pages are displayed to the user based upon the user's menu selection...

The best approach i've seen untill now is to keep a stack with pages
that have been visited. And each time another script is expected to be
loaded/unloaded the calling script would have to call scriptNext or
scriptPrevious to keep the stack up to date. This way you do not only
have an easy way to build a path with breadcrumbs but also a way to
handle things like ppl that hit the back button after posting a form... 


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



Re: [PHP] Malicious SQL

2004-07-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Philip Olson wrote:
 One thing to remember is mysql_query() will execute just one (the first)
 query so use of ; won't do anything in the above except break the
 query.  

If i'm not mistaken, newer versions of mysql do allow multiple queries. 

 (once) and put single quotes around the criteria ($name) and life will be
 grand.  Quotes around numerical values won't hurt (such as id = '$id')
 although it's not required.  If you choose not to do that then be sure
 it's numerical before use (like cast it as an int, or check 
 is_numeric(), etc. ...).  Some people check for ';' in the request
 variable and if found yell at the user, that can be fun.  bugs.php.net
 does this.

Or use prepared statements with mysqli


-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



Re: [PHP] Client IP

2004-07-08 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Rosen wrote:
:)
 Ok - then how linux server communicate with client - the server must have IP
 adress to whitch to send data.

 Rosen wrote:

  IP adress not send ?!? And how server communicate with client ?

For example people on a lan (with let's say ip addresses in the
192.168.X.Y range) that use a proxy. You'll see the address of the
proxy in $_SERVER['REMOTE_ADDR']. And i doubt that is what you were
looking for :)

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: PEAR::DB is great but is sooooo SLOW !

2004-05-16 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Greg wrote:
 If I compare a script using PEAR::DB with a script using
 standard functions (and which supports mysql, pgsql and
 sqlite databases), the script using PEAR::DB is 10 times
 slower than the other.
 
 Conclusion : if you want to use PEAR::DB package, you'll
 probably will have to use cache systems for scripts that
 may be request often.

I don't understand your logic. 

Imho, you can only compare:
- A without caching VS B without caching
- A with caching VS B with caching

 Am I the only one annoying by this loss of performance ?
 Because this is a huge loss in that case !

I understand there might be a significant difference in performance, and
i understand nobody likes that.

But imho the real questions are these:
- What are the advantages of a Database Abstraction API?
- What are the disadvantages of a Database Abstraction API?
- Can we live with the lesser performance if we know we'll safe a lot of time
when we switch to another DBMS product? 
- How likely is it that we are going to switch to another DBMS? 

-- 
http://home.mysth.be/~timvw

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



[PHP] Re: create if table not exists

2004-05-16 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], John Taylor-Johnston wrote:
 How can I check if a table exists in a mysql db. 

$query = 'IF NOT EXISTS table CREATE TABLE table (..)';
mysql_query($query);

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw/contact.php

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