Re: [PHP] 4 Digit ID with Leading Zeros

2005-12-16 Thread Curt Zirzow

I got lost in the mix of threads, so here is my input on the
situation.

On Thu, Dec 15, 2005 at 09:53:46AM -0500, Rahul S. Johari wrote:
 I want to assign a 4 Digit ID with leading zeros to each record added using
 a form I have created.
 
 The PHP scripts does two things:
 (a) It adds the data to a mySQL table
 (b) it generates a CSV file with the data
 
 The 4 Digit ID (beginning from 0001) will be used in two places:
 (a) It will be the ID for the record in the mySQL table, instead of the
 usual ID that we create in mySQL. It will be a Primary Key, Not Null,
 Auto_Increment
 (b) It will also be the filename for the CSV file.
 
 So basically it has to match the record adding in the mySQL table and the
 filename for the CSV.

There seems to be a design flaw with this. As mentioned, well you
dont expect to have over  entries, you simply cant rely on the
auto_increment to deal with this as it easily can get over the
number with only one record. If 4 chars is an issue then i would
avoid using the auto_increment as the Primary key.

As Far as making sure that the file is written as the current
specifications call for the leading zero's is a virtual concept.

Consider:

  The query to get the record with and ID of 0001:

 select * from table where id = 0001

  This since 0001 is the same as 1 there really isn't any meaning
  behind the textual 0001.

  A result from an auto_increment that is just '1' can easily be
  formated to output as 0001:

$file = sprintf('%04s', 1);

At this point the only limiting factor is the output of the
filename.

As far as not expecting the auto_increment value never reaching
1, when I was 10 years old I thought anyone that was 30 was an
old person.

HTH,

Curt.
-- 
cat .signature: No such file or directory

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



Re: [PHP] Questions from a ColdFusion Developer

2005-12-16 Thread Robert Cummings
On Thu, 2005-12-15 at 22:24, Christopher Jordan wrote:

 I think you've hit the nail on the head there, but I'm sorta glad the
 subject's come up since I'm learning about a concept that I've not
 used before. Is it mostly used for purposes of scalability? It seems
 like it might be that way.

There's a decent article here that goes on about the shared nothing
philosphy. It's a bit of a PHP vs. Java blog, but it does make many
references to shared nothing.

http://www.sitepoint.com/blogs/2004/07/01/the-j2ee-guy-still-doesnt-get-php/

 Thanks so much Rob for sharing your knowledge with me. :) It's
 very nice to see that folks on the list seem to be patient and
 responsive.

No problem... you got us on a good day ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] One big file or many includes?

2005-12-16 Thread Martin Leduc
Hi everyones,

I coding PHP since 2002 and this is the first time I have to take this 
decision.

My group and I have to build a VERY, VERY BIG website for a callcenter 
users.  Understand I have to create (or use ;)) several code for access, 
transactions and management.

The customer had buy MSSQL server, so we have to use it and it's working 
very fine.  NO MYSQL (is not my personal choice ;))

Currently it's already hard to program and now we have many file.  We have 
only 20% done and the code are a real mess!!!

Creating Class, functions, splitting code in several php files using 
include, see the files sitemap??

So for the optimisation topic, what is THE BEST for the PHP compiler.  One 
big file or many included files?

Regards

Martin

PS:  If some one know somes related links about the subject, please dont 
hesitate. ;)

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



Re: [PHP] One big file or many includes?

2005-12-16 Thread Aaron Koning
I don't know about whats best for the compiler (rather interpreter), but if
it is a really big site with a lot of access, transaction and management
functionality I recommend you start breaking the code into classes and
separating each class into a file and documenting... A LOT! It will be
clearer to understand and maintain. IMHO.

There are lots of sites out there that describe how to separate web code
into layers such as: display, logic/rules, database interactivity, etc.

Aaron

On 12/15/05, Martin Leduc [EMAIL PROTECTED] wrote:

 Hi everyones,

 I coding PHP since 2002 and this is the first time I have to take this
 decision.

 My group and I have to build a VERY, VERY BIG website for a callcenter
 users.  Understand I have to create (or use ;)) several code for access,
 transactions and management.

 The customer had buy MSSQL server, so we have to use it and it's working
 very fine.  NO MYSQL (is not my personal choice ;))

 Currently it's already hard to program and now we have many file.  We have
 only 20% done and the code are a real mess!!!

 Creating Class, functions, splitting code in several php files using
 include, see the files sitemap??

 So for the optimisation topic, what is THE BEST for the PHP compiler.  One
 big file or many included files?

 Regards

 Martin

 PS:  If some one know somes related links about the subject, please dont
 hesitate. ;)

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




Re: [PHP] One big file or many includes?

2005-12-16 Thread Adrian Bruce
Definitely sounds as if you should be employing the object-orientated 
methodology, If the project is as big as you say it is then really you 
should be looking to use some UML planning tool so that you can keep all 
you code organised. 

It is ok on smaller projects to bash out some rough plans and get into 
the coding but with  more complex requirements its a recipe for 
disaster, wait until you client asks for a few seemingly simple changes 
and then you realize just how important a good design and plan is.


good luck
Adrian

Aaron Koning wrote:


I don't know about whats best for the compiler (rather interpreter), but if
it is a really big site with a lot of access, transaction and management
functionality I recommend you start breaking the code into classes and
separating each class into a file and documenting... A LOT! It will be
clearer to understand and maintain. IMHO.

There are lots of sites out there that describe how to separate web code
into layers such as: display, logic/rules, database interactivity, etc.

Aaron

On 12/15/05, Martin Leduc [EMAIL PROTECTED] wrote:
 


Hi everyones,

I coding PHP since 2002 and this is the first time I have to take this
decision.

My group and I have to build a VERY, VERY BIG website for a callcenter
users.  Understand I have to create (or use ;)) several code for access,
transactions and management.

The customer had buy MSSQL server, so we have to use it and it's working
very fine.  NO MYSQL (is not my personal choice ;))

Currently it's already hard to program and now we have many file.  We have
only 20% done and the code are a real mess!!!

Creating Class, functions, splitting code in several php files using
include, see the files sitemap??

So for the optimisation topic, what is THE BEST for the PHP compiler.  One
big file or many included files?

Regards

Martin

PS:  If some one know somes related links about the subject, please dont
hesitate. ;)

--
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] Help with the copy command...

2005-12-16 Thread Robin Vickery
On 12/15/05, Tim Meader [EMAIL PROTECTED] wrote:
 Okay, this seems like a ridiculously easy question which shouldn't even
 need asking, but I'm having trouble getting the builtin copy command to
 work properly. It seems to work fine as long as I feed it a full
 constant string path for each argument (ie - in the form
 /the/path/to/the/file). However, if I try to feed it two variables as
 the arguments, it craps out somewhere along the line. Here are the two
 different sets of calls I'm making:

 These two work perfectly:

 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline,
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline.bak)
 ;
 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp,
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp.bak);

 These two fail:

 $l_stLastRun =
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp;
 $l_stSnapshotBase =
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline;

 copy($l_stSnapshotBase, $l_stSnapshotBase..bak);
 copy($l_stLastRun, $l_stLastRun..bak);

 Can anyone offer any insight on what the problem might be with this? The
 unlink function seems to accept the variable inputs with absolutely no
 problem, so I can't understand the discrepancy between the two.

There's no problem with variable names as parameters to copy() - you
can test that in a few seconds.

   $ touch foo
   $ php -a
   Interactive mode enabled

   ?php
   $a = 'foo';
   copy($a, $a . '.bak');
   ?

   $ ls
   foo   foo.bak

So the problem is elsewhere.

99 times in 100 you've either messed up the filenames or you've not
got appropriate file permissions to do the copy.

  -robin


Re: [PHP] simple-ish question but something i never knew

2005-12-16 Thread Karlos Zafra
2005/12/10, Robert Cummings [EMAIL PROTECTED]:

 On Sat, 2005-12-10 at 10:45, Zareef Ahmed wrote:
  - Original Message -
  From: Robert Cummings [EMAIL PROTECTED]
  To: Aaron Koning [EMAIL PROTECTED]
  Cc: PHP-General php-general@lists.php.net
  Sent: Saturday, December 10, 2005 3:07 AM
  Subject: Re: [PHP] simple-ish question but something i never knew
 
 
   On Sat, 2005-12-10 at 03:01, Aaron Koning wrote:
My experience was with the Location keyword, it might work better
 with
  the
Redirect keyword in the header function. I stopped using header and
  Location
after a few problems and meta has never failed for me. MHO.
  
 
   What kind of problems did you have? I've never experience a problem
 with
   the location header, but would be interested to know of any gotchas
 that
   I've just been fortunate enough to miss over the years.
 
  I do not think that using meta is better than header but  header has one
  problem ( but in my view it is  feature) normally.
  for eaxample:
 
  ?php
  session_start();
 
  $_SESSION['somevar']=anything;
  header(location:url);
  ?

 Shouldn't be a problem if you change it to:

 ?php
 session_start();

 $_SESSION['somevar']=anything;
 session_write_close();

 header(location:url);

 ?

 I generally wrap redirection in a function, that way any shutdown
 routines can be performed transparently -- and also the URL can be
 reworked from relative to absolute.

 Cheers,
 Rob.
 --
 ..
 | InterJinn Application Framework - http://www.interjinn.com |
 ::
 | An application and templating framework for PHP. Boasting  |
 | a powerful, scalable system for accessing system services  |
 | such as forms, properties, sessions, and caches. InterJinn |
 | also provides an extremely flexible architecture for   |
 | creating re-usable components quickly and easily.  |
 `'

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


I've tried this in my server and had no problem.

 ?php
session_start();

$_SESSION['string']=foobar;
header(location:print_string.php);
?

?php

 session_start();

 echo String = {$_SESSION['string']};
?

This page prints:

String = foobar

I can't see the wrong behaviour.


[PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread Paul Jinks

Hi all,

I have a site where users can search study projects. I'd like to be able 
to clicks on a project title which passes a variable to this page, which 
then displays all the data on that project in a table. Cool - and to a 
noob like me, actually pretty exciting. Except it doesn't work.


I get a couldn't set value of result message - see end of code. The 
page displayed all the projects fine when I messed up passing them from 
the previous page, so the problem is presumably in the first SQL query. 
Any suggestions?


?
$connect = mysql_connect(, , )
or die(could not connect);
$db = mysql_select_db()
or die(could not select db);
if (isset($HTTP_GET_VARS['projTitle']))
{
$SQLQuery = SELECT * FROM project WHERE
projTitle = .$HTTP_GET_VARS['projTitle']
or die(SQLQuery 1 failed);
}
else
{
$SQLQuery = SELECT*FROM project ORDER BY projTitle
or die(SQLQuery 2 failed);
}
$result = mysql_query($SQLQuery,$connect)
or die(couldn't set value of result);

?

TIA

Paul

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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread David Grant
Paul Jinks wrote:
 $SQLQuery = SELECT * FROM project WHERE
 projTitle = .$HTTP_GET_VARS['projTitle']
 or die(SQLQuery 1 failed);

$SQLQuery = SELECT * FROM project WHERE projTitle = ' .
$HTTP_GET_VARS['projTitle'] . ';

Not sure why you've got the or die() there.

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread Richard Davey

On 16 Dec 2005, at 12:30, Paul Jinks wrote:

I have a site where users can search study projects. I'd like to be  
able to clicks on a project title which passes a variable to this  
page, which then displays all the data on that project in a table.  
Cool - and to a noob like me, actually pretty exciting. Except it  
doesn't work.


I get a couldn't set value of result message - see end of code.  
The page displayed all the projects fine when I messed up passing  
them from the previous page, so the problem is presumably in the  
first SQL query. Any suggestions?


?
$connect = mysql_connect(, , )
or die(could not connect);
$db = mysql_select_db()
or die(could not select db);
if (isset($HTTP_GET_VARS['projTitle']))
{
$SQLQuery = SELECT * FROM project WHERE
projTitle = .$HTTP_GET_VARS['projTitle']
or die(SQLQuery 1 failed);
}
else
{
$SQLQuery = SELECT*FROM project ORDER BY projTitle
or die(SQLQuery 2 failed);
}
$result = mysql_query($SQLQuery,$connect)
or die(couldn't set value of result);

?


Well you've got 5 die statements in there - which one does it die on?  
Also check that your web host allows the long array names  
($HTTP_GET_VARS), because lots do not. I would suggest replacing  
$HTTP_GET_VARS with $_GET (in all instances), because the long format  
will eventually vanish and your script will cease to work.


There are various issues re: SQL injection and lack of filtering  
going on here, but perhaps not best to dwell on those -just yet-, as  
long as you are aware that your script is lacking in all forms of  
security? Then you can address that once you've got it working.


I assume you removed the MySQL details to post to the mailing list,  
otherwise that won't help too much ;)


Cheers,

Rich
--
http://www.corephp.co.uk
PHP Development Services

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



RE: [PHP] Random Images with no duplicates?

2005-12-16 Thread Kilbride, James
Actually with this idea all you do is reduce $max after each successful
pull and 'increment' over pictures you already have. That way you never
have to pull another random number. You just may have to increment
through the entire set of pulled images if you pulled a high enough
number. 

for($i = 0; $i  $want; $i++) {
$random = mt_rand(0,$max);
for($j = 0; $j  $i; $j++) {
if ($retrieved[$j]  $random) {
$random++;
}
}
$retrieved[] = $random;
sort($retrieved);
$max--;
}

Guarentees unique choices.

 -Original Message-
 From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 16, 2005 2:47 AM
 To: php-general@lists.php.net
 Subject: Re: [PHP] Random Images with no duplicates?
 
 On Thu, Dec 15, 2005 at 08:45:33PM -0800, Mike Rondeau wrote:
  Hi,
  
  I'm still very green with PHP, but am working to fix that.
  
  I've searched high and low for an answer to this question 
 and so far 
  no solution has presented itself. I have a script to 
 populate my web 
  page with random images:
  
  ?php
  #random images example
  #this is your file
  $file = images.txt;
  #open the file
  $openFile = file($file);
  #generate a random number
  srand((double)microtime()*100);
  #get one of the entries in the file
  $random_image = $openFile[array_rand($openFile)]; #display 
 the entry 
  echo img src='$random_image' height='170' width='100'/img; ?
  
  
  This works beautifully, but my problem is that sometimes, 
 the same image
  displays twice or more on the same page-load. My page 
 requires 10 different
  places where my images need to load, but I can't have any 
 duplicate images 
  show up.
 
 Depending on the complexity of the logic you want in selecting
 random images you can do something like:
 
 $files = file($file);
 
 $want = 10;// how many I want
 $max = count($files);  // the range, we might need -1
 
 // a simple range check, to avoid an infinate loop
 $can_have = $want  $max? $max: $want;
 
 // start off the loop with these values
 $have = 0; // aka have none
 $images = array(); // aka no random images
 
 do { 
   // generate a random number
   $random = mt_rand(0, $max);
 
   // if we dont have it..
   if(! isset($images[$random]) ) {
 $have++;
 $images[$random] = $files[$random];
   }
 
 // have we made it there yet?
 } while($have  $can_have)
 
 var_dump($images);
 
 foreach($images as $random_image) {
   echo img src='$random_image' height='170' width='100'/img;
 }
 
 Now, keep in mind that if you have 15 images and you want 10, this
 could potentially be very intensive on the cpu.
 
 On the other hand if you have 10,000 images and are looking for 10
 it wont be as intensive on the cpu, but will use a lot of memory
 that really shouldn't be used by loading the file into an array. At
 this point an index file should be used or a DB solution should be
 considered.
 
 
 Curt.
 -- 
 cat .signature: No such file or directory
 
 -- 
 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] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread Paul Jinks

David Grant wrote:


$SQLQuery = SELECT * FROM project WHERE projTitle = ' .
$HTTP_GET_VARS['projTitle'] . ';


Yep, that fixed it. Thanks. I had a feeling there was a mix up with the 
s and 's. What's with the .  s?



Not sure why you've got the or die() there.


I had the idea that you could put an or die() after any command and it 
would tell you that it had screwed up at that point. Bad idea?


Many thanks

Paul

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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread Paul Jinks

Richard Davey wrote:

($HTTP_GET_VARS), because lots do not. I would suggest replacing  
$HTTP_GET_VARS with $_GET (in all instances), because the long format  
will eventually vanish and your script will cease to work.


Cheers Rich, will sort this out.



I assume you removed the MySQL details to post to the mailing list,  
otherwise that won't help too much ;)


Erm, even I'm not that daft!  =)


Rich
--
http://www.corephp.co.uk
PHP Development Services



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



Re: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread David Grant
Paul,

Paul Jinks wrote:
 David Grant wrote:
 $SQLQuery = SELECT * FROM project WHERE projTitle = ' .
 $HTTP_GET_VARS['projTitle'] . ';
 
 Yep, that fixed it. Thanks. I had a feeling there was a mix up with the
 s and 's. What's with the .  s?

The . is a concatenation operator, i.e. it joins two strings together.

 Not sure why you've got the or die() there.
 
 I had the idea that you could put an or die() after any command and it
 would tell you that it had screwed up at that point. Bad idea?

Bit hard to maintain I should think.  It's unlikely you're going to
screw up a string concatenation and it still be able to call the die().

Cheers,

David
-- 
David Grant
http://www.grant.org.uk/

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



RE: [PHP] PHP/MySQL noob rides again.. into trouble

2005-12-16 Thread Kilbride, James
periods are used to do string concatenation. So if you want to break a
statement up you can do:

$string = First part. .  And this is the second part;

I often do it when inserting variables:

$sql = select * from The_Other_Guy;
if(case 1) {
$sql .=  where The_Other_Guy.Is = .$something;
} else {
$sql .= , Women W where The_Other_Guy.WifeId = W.Id and W.Age 
. $age;
}

$sql .= order by The_Other_Guy.Pay_Grade;

or something like that.

 -Original Message-
 From: Paul Jinks [mailto:[EMAIL PROTECTED] 
 Sent: Friday, December 16, 2005 8:21 AM
 Cc: php-general@lists.php.net
 Subject: Re: [PHP] PHP/MySQL noob rides again.. into trouble
 
 David Grant wrote:
 
  $SQLQuery = SELECT * FROM project WHERE projTitle = ' .
  $HTTP_GET_VARS['projTitle'] . ';
 
 Yep, that fixed it. Thanks. I had a feeling there was a mix 
 up with the s and 's. What's with the .  s?
 
  Not sure why you've got the or die() there.
 
 I had the idea that you could put an or die() after any 
 command and it would tell you that it had screwed up at that 
 point. Bad idea?
 
 Many thanks
 
 Paul
 
 --
 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



[PHP] upload path

2005-12-16 Thread Adrian Bruce

hi all

a quick one i hope! i am trying to allow users to save a set of data as 
a csv file when clicking on a link on our intranet.  i can do all the 
formatting and output to file but i would like the user to be able to 
specify where the file is saved in the same way as they would choose a 
file to upload.  Any ideas how this can be done?


thanks
Ade

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



RE: [PHP] Is it possible to use header() to POST form data?

2005-12-16 Thread Jay Blanchard
[snip]
Does anyone know if it's possible to use the
header() function to POST form data to a URL?

If so what syntax needs to be used?
[/snip]

You will want to check out http://www.php.net/curl

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



[PHP] PHP 4.4.1 array_set_current bug?

2005-12-16 Thread Eric Butera
Hello all,

I have an image gallery script I created and I seem to be having some
difficulties with it.  I am using this script on many different platforms
and different PHP versions.  I have tried it on 4.4.0 (linux) and
4.3.11(entrophy osx).  The problem is with PHP version
4.4.1 from what I can tell.  That is what I am emailing for, to verify. =)

The problem is this function:
function array_set_current($array, $key) {

reset($array);

while(current($array)) {

if (key($array) == $key) {
break;
} // if

next($array);
} // while

} // function


On 4.4.0 and 4.3.11 I can pass an array and key and it will match the key
and break perfectly.  Recently one of our servers upgraded to 4.4.1.  This
script was working previously and now does not.  I ended up echoing out the
value of key().  On 4.4.1 the key is always 0. Next() does not goto the next
key.  On 4.4.0 and 4.3.11 the next() works fine.

We ended up just scrapping that and using a foreach key = value loop to set
the current key and breaking after that.

Has anybody else experienced this?  Am I doing something wrong that I am not
seeing?  I'm just curious.

Thanks in advance for any replies!


RE: [PHP] Random Images with no duplicates?

2005-12-16 Thread Jared Williams
Hi,
Just unset the ones you've picked
 
?php
#random images example
#this is your file
$file = images.txt;
#open the file
$openFile = file($file);
#generate a random number
srand((double)microtime()*100);
#get one of the entries in the file
for ($i = 0; $i  10; ++$i)
{
   $r = array_rand($openFile);
   $random_image = $openFile[$r]; 
   echo img src='$random_image' height='170'  width='100'/img;
   unset($openFile[$r]);
}
?

Jared

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



RE: [PHP] upload path

2005-12-16 Thread Jay Blanchard
[snip]
a quick one i hope! i am trying to allow users to save a set of data as 
a csv file when clicking on a link on our intranet.  i can do all the 
formatting and output to file but i would like the user to be able to 
specify where the file is saved in the same way as they would choose a 
file to upload.  Any ideas how this can be done?
[/snip]

You could have a drop down list of the available directories for storage on
the server and use that with move_uploaded_file()

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



Re: [PHP] upload path

2005-12-16 Thread Adrian Bruce
i see what you mean but i dont think that will work for me, ideally  
just want them to choose a location after which i will create the file 
in this location.  the only option i can think of the moment is to 
default to the users home directory.


Ive just realised that the subject of my email is rather misleading, 
sorry i am a numpty at times.


Ade

Jay Blanchard wrote:


[snip]
a quick one i hope! i am trying to allow users to save a set of data as 
a csv file when clicking on a link on our intranet.  i can do all the 
formatting and output to file but i would like the user to be able to 
specify where the file is saved in the same way as they would choose a 
file to upload.  Any ideas how this can be done?

[/snip]

You could have a drop down list of the available directories for storage on
the server and use that with move_uploaded_file()
 



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



RE: [PHP] upload path

2005-12-16 Thread Jay Blanchard
[snip]
i see what you mean but i dont think that will work for me, ideally  
just want them to choose a location after which i will create the file 
in this location.  the only option i can think of the moment is to 
default to the users home directory.

Ive just realised that the subject of my email is rather misleading, 
sorry i am a numpty at times.
[/snip]

Are you wanting to create a directory for them, that they name?

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



Re: [PHP] upload path

2005-12-16 Thread Oli Howson
Allow them to browse the server (up to a limited level), saving the 
current selected path within the $_GET string.


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



Re: [PHP] upload path

2005-12-16 Thread Adrian Bruce

aaah, scrap that, i think i have solved my own problem,

thanks for your time anyway,



Jay Blanchard wrote:


[snip]
i see what you mean but i dont think that will work for me, ideally  
just want them to choose a location after which i will create the file 
in this location.  the only option i can think of the moment is to 
default to the users home directory.


Ive just realised that the subject of my email is rather misleading, 
sorry i am a numpty at times.

[/snip]

Are you wanting to create a directory for them, that they name?

 



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



[PHP] mysql select statement in php having three conditions

2005-12-16 Thread sunaram patir
hi,
  can someone tell me how to do this:
  i have to retrive data from a mysql table let's sayTABLE . i have to
check that the rows i retrive meet this condition:
field1='$variable',field2 is false and field3 is also false. as you
can see field2 and field3 are bool type. field1 is varchar. i did this
query SELECT * FROM TABLE WHERE field1='$variable' AND field2='0' AND
field3='0'; another one tried is SELECT * FROM TABLE WHERE
field1='$variable' AND field2=false AND field3=false; But none was a
success. it didn't matter whether i used '0' or 0 and false or
'false'.
  thanks in advance.

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



Re: [PHP] i18n maybe?

2005-12-16 Thread Al

Jochem's right about this.  I've just encountered problems trying to 
utf-8_decode strings.

I now just make certain everying is set for utf-8, from webpage on. So far, no 
problems with this approach.

Al...


Jochem Maas wrote:

hi Richard,

what charset is your DB set to use?
what charset are your output pages set to?
what charset is used for the file which contains the
data you want to import?
what [exactly] do you see for the band name in the import file for
the '3-16' band?

whatever is happening now I think you need to totally
'fix' any relevant strings (artist names) that are extracted
from the 'import file' before inserting anything into the DB...

I don't have a real answer going on here but I certainly feel the
problem  and I know that you might have a situation currently
were the strings you are trying to transform/'fix' are not
fixable because they are completely borked (for instance trying
to stick certain UTF8 chars into a ISO8859_1 charset field can 'break'
the string)


Richard Lynch wrote:


UPDATE:

What's actually in the database is:

3Atilde;cent;Acirc;Acirc;cent;16



this looks borked; should it not be:

3tilde;cent;circ;circ;cent;16





Would 'middot;' output by a browser turn into 'âÂ#65533;¢' ???



thaqt seems unlikely but I'm not going to say no.



If so, what can I do about it?



start from the beginning again ;-)



--
Like Music?
http://l-i-e.com/artists.htm

--
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] mysql select statement in php having three conditions

2005-12-16 Thread Jay Blanchard
[snip]
  can someone tell me how to do this:
  i have to retrive data from a mysql table let's sayTABLE . i have to
check that the rows i retrive meet this condition:
field1='$variable',field2 is false and field3 is also false. as you
can see field2 and field3 are bool type. field1 is varchar. i did this
query SELECT * FROM TABLE WHERE field1='$variable' AND field2='0' AND
field3='0'; another one tried is SELECT * FROM TABLE WHERE
field1='$variable' AND field2=false AND field3=false; But none was a
success. it didn't matter whether i used '0' or 0 and false or
'false'.
  thanks in advance.
[/snip]

That is likely because the data is either blank or NULL , try;

SELECT * FROM TABLE WHERE field1='$variable' AND field2 IS NULL AND field3=
IS NULL ; 

or

SELECT * FROM TABLE WHERE field1='$variable' AND field2='' AND field3=''; 

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



Re: [PHP] One big file or many includes?

2005-12-16 Thread John Nichel

Martin Leduc wrote:

Hi everyones,

I coding PHP since 2002 and this is the first time I have to take this 
decision.


My group and I have to build a VERY, VERY BIG website for a callcenter 
users.  Understand I have to create (or use ;)) several code for access, 
transactions and management.


The customer had buy MSSQL server, so we have to use it and it's working 
very fine.  NO MYSQL (is not my personal choice ;))


Currently it's already hard to program and now we have many file.  We have 
only 20% done and the code are a real mess!!!


Creating Class, functions, splitting code in several php files using 
include, see the files sitemap??


So for the optimisation topic, what is THE BEST for the PHP compiler.  One 
big file or many included files?


My personal preference is many includes.  My reasoning behind this is 
there will be portions of the site which will not need all the functions 
and/or classes.  Say I have a site which contains many aspects of a 
company.  The pages which display web stats don't need the code that 
manages the email lists, so on and so forth.  I also divide up some 
include files that are used on every page (session management, database, 
error control, etc.), because I find it easier to maintain the scripts 
that way.


YMMV

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



[PHP] PHP and Apache 2.2.0

2005-12-16 Thread Kevin McBride

Hello,

I hope I am not repeating something that was discussed on this list before.

I am curious to know if there are plans to make a module for Apache
2.2.0.  I couldn't find it in the anonymous CVS, but if it's already
there, can someone point to me where it is?

- KJM

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



RE: [PHP] upload path

2005-12-16 Thread Weber Sites LTD
Something like this?

http://www.weberdev.com/get_example-3701.html

Sincerely 
 
berber 
 
Visit the Weber Sites Today, 
To see where PHP might take you tomorrow. 
PHP code examples : http://www.weberdev.com 
PHP Web Logs : http://www.weberblog.com/ 
PHP  MySQL Forums : http://www.weberforums.com/ 
Learn PHP Playing Trivia http://www.webertrivia.com 
Web Development Index http://www.weberindex.com 
Web Templates http://www.webertemplates.com
Search for PHP Code from your browser http://toolbar.weberdev.com  

-Original Message-
From: Adrian Bruce [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 3:55 PM
To: php-general@lists.php.net
Subject: [PHP] upload path

hi all

a quick one i hope! i am trying to allow users to save a set of data as a
csv file when clicking on a link on our intranet.  i can do all the
formatting and output to file but i would like the user to be able to
specify where the file is saved in the same way as they would choose a file
to upload.  Any ideas how this can be done?

thanks
Ade

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



[PHP] Fatal error 'Unable to read from thread kernel pipe' when using mail() function

2005-12-16 Thread Stut

Hi All,

I've just upgraded the PHP port installation on my server to v4.4.1 and 
the mail function has stopped working. I created a script that simply 
calls the mail function to send a test email ad this is what I get when 
I run it...


[EMAIL PROTECTED]:~$ php test.php
Fatal error 'Unable to read from thread kernel pipe' at line 1100 in 
file /usr/src/lib/libc_r/uthread/uthread_kern.c (errno = 0)

Abort trap (core dumped)

The email gets sent successfully on the CLI despite crashing. When the 
mail function is called from a web page it never gets sent and the 
script never finishes.


I've googled for this error and all references I found that related to 
PHP basically say that it's due to Apache and PHP being compiled in 
different threading modes. This cannot be the case in this instance 
since Apache is using the preform MPM and even if it wasn't it's 
happening on the CLI where Apache is not involved.


Any clues people might have as to the cause of this problem would be 
gratefully received.


FYI: OS is FreeBSD v5.2 and Apache if v2.0.55

Cheers.

-Stut

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



Re: [PHP] simple-ish question but something i never knew

2005-12-16 Thread Robert Cummings
On Fri, 2005-12-16 at 06:59, Karlos Zafra wrote:
 2005/12/10, Robert Cummings [EMAIL PROTECTED]:

 I've tried this in my server and had no problem.
 
  ?php
 session_start();
 
 $_SESSION['string']=foobar;
 header(location:print_string.php);
 ?
 
 ?php
 
  session_start();
 
  echo String = {$_SESSION['string']};
 ?
 
 This page prints:
 
 String = foobar
 
 I can't see the wrong behaviour.

Are you referring you your use of a local path when using the location
header?? If so, I clearly stated in a previous post in this thread that
many browsers tolerate it, but that it isn't standards compliant.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



[PHP] Re: PHP and Apache 2.2.0

2005-12-16 Thread Kevin McBride

belia wrote:

Hi,

You can download at http://www.apachelounge.com/download/


I am using Linux, not Windows, so the content there will not work.

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



Re: [PHP] php file upload permission query

2005-12-16 Thread Burhan

Angelo Zanetti wrote:
thanks, but Im sure there is something that is messing up the file 
permissions that I can change before the upload, instead of trying to 
cure the problem by setting the chmod of the file after its uplaoded


Check the following things:

1. umask settings on the directory
2. Apache's default mask

Also, please don't top post.

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



[PHP] Can anyone recommend a hosting company

2005-12-16 Thread Marty
Can anyone recommend a fair priced, reliable hosting company that would best
meet my needs as follows:


Shared plan with
PHP
Windows server
Mssql
Need to host multiple domains under one account.

thanks in advance

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



RE: [PHP] Can anyone recommend a hosting company

2005-12-16 Thread Dan Harrington
I'd recommend www.xiolink.com

Thanks
Dan


-Original Message-
From: Marty [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 16, 2005 9:10 AM
To: php-general@lists.php.net
Subject: [PHP] Can anyone recommend a hosting company 

Can anyone recommend a fair priced, reliable hosting company that would best
meet my needs as follows:


Shared plan with
PHP
Windows server
Mssql
Need to host multiple domains under one account.

thanks in advance

--
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] Can anyone recommend a hosting company

2005-12-16 Thread Oli Howson

I've been using www.wehostwebpages.com for about 4 years, been good to me :)


Can anyone recommend a fair priced, reliable hosting company that would best
meet my needs as follows:


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



Re: [PHP] Can anyone recommend a hosting company

2005-12-16 Thread loveneesh.bansal
Hi,

Please use www.veryfasthosting.net

Regards,

Love

- Original Message - 
From: Oli Howson [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: 16 December 2005 10:21
Subject: Re: [PHP] Can anyone recommend a hosting company


 I've been using www.wehostwebpages.com for about 4 years, been good to me
:)

  Can anyone recommend a fair priced, reliable hosting company that would
best
  meet my needs as follows:

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



[PHP] Blocking Values From an External Source

2005-12-16 Thread Shaun
Hi,

I have a script on my site for processing values sent from a contact form 
and emailing them to the webmaster. The script has been abused by spammers 
and my hosting company has recommended that I change the script to only 
accept information posted from my own URL. Could someone tell me how this 
can be done please?

Thanks for your advice. 

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



Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Michael Hulse


On Dec 16, 2005, at 11:50 AM, Shaun wrote:
I have a script on my site for processing values sent from a contact 
form
and emailing them to the webmaster. The script has been abused by 
spammers

and my hosting company has recommended that I change the script to only
accept information posted from my own URL. Could someone tell me how 
this

can be done please?


Hello,

Maybe try using:

$_SERVER['DOCUMENT_ROOT']

Or, something similar.

http://us2.php.net/reserved.variables

Hth,
Cheers,
Micky

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



Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Jason Gerfen

Or try

$defined['hostname'] = ALLOWED_DOMAIN_NAME;

if ($_SERVER['SERVER_NAME'] != $defined['hostname']) {
 echo Not from my domain pal;
}

Michael Hulse wrote:



On Dec 16, 2005, at 11:50 AM, Shaun wrote:

I have a script on my site for processing values sent from a contact 
form
and emailing them to the webmaster. The script has been abused by 
spammers

and my hosting company has recommended that I change the script to only
accept information posted from my own URL. Could someone tell me how 
this

can be done please?



Hello,

Maybe try using:

$_SERVER['DOCUMENT_ROOT']

Or, something similar.

http://us2.php.net/reserved.variables

Hth,
Cheers,
Micky




--
Jason Gerfen

Oh I have seen alot of what
the world can do, and its
breaking my heart in two...
~ Wild World, Cat Stevens

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



Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Michael Hulse


On Dec 16, 2005, at 12:05 PM, Michael Hulse wrote:

http://us2.php.net/reserved.variables


Check this post in the comment section of above url:

Zoic
20-Sep-2005 11:39
I just wrote up this function to secure forms on my site so that you 
can't submit a form from anywhere but your site. This is extremely 
effective in securing your forms from hacking attempts.


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



Re: [PHP] Help with the copy command...

2005-12-16 Thread Tim Meader
What difference are you seeing in the files I give in the example? Are
they not identical paths?

Thanks.

Hristo Yankov wrote:
 The two examples you give are not the same? I see
 different files. Please, doublecheck.
 
 --- Tim Meader [EMAIL PROTECTED] wrote:
 
 Okay, this seems like a ridiculously easy question
 which shouldn't even
 need asking, but I'm having trouble getting the
 builtin copy command to
 work properly. It seems to work fine as long as I
 feed it a full
 constant string path for each argument (ie - in the
 form
 /the/path/to/the/file). However, if I try to feed
 it two variables as
 the arguments, it craps out somewhere along the
 line. Here are the two
 different sets of calls I'm making:

 These two work perfectly:


 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline,
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline.bak)
 ;

 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp,
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp.bak);
 These two fail:

 $l_stLastRun =

 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp;
 $l_stSnapshotBase =

 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline;
 copy($l_stSnapshotBase, $l_stSnapshotBase..bak);
 copy($l_stLastRun, $l_stLastRun..bak);

 Can anyone offer any insight on what the problem
 might be with this? The
 unlink function seems to accept the variable
 inputs with absolutely no
 problem, so I can't understand the discrepancy
 between the two.

 Thanks in advance.

 Tim

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


 
 
 ===
 Hristo Yankov, Developer at Portellus, Inc.
 ICQ - 191445567
 Yahoo! - yankov_hristo
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

-- 
Tim
[EMAIL PROTECTED]

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



[PHP] Weird html - No real cr

2005-12-16 Thread Gustav Wiberg

Hi there!

Why do I get this kind of ... why don't cr work? There is now newline as 
when you view source in an ordinary html-file... I hope you guys understand 
what I mean...



DOWN BELOW IS THE PHP CODE! :-)



html
head
titlemain/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
body


bPCB/bbrbAUTOMATISK/B INFOGNING AV PRODUKTER SOM INTE FINNS I VP's 
databas!brhrLoggfil=logfiles/pcb_autoinsert.txtbrRader i 
databas=354brhrKontroll rad i textfil:1 av 1881brhrKontroll rad i 
textfil:2 av 1881brb./bhrKontroll rad i textfil:3 av 
1881brb./bhrKontroll rad i textfil:4 av 1881brb./bhrKontroll 
rad i textfil:5 av 1881brb./bhrKontroll rad i textfil:6 av 
1881brb./bhrKontroll rad i textfil:7 av 1881brb./bhrKontroll 
rad i textfil:8 av 1881brb./bhrKontroll rad i textfil:9 av 
1881brb./bhrKontroll rad i textfil:10 av 
1881brb./bhrKontroll rad i textfil:11 av 
1881brb./bhrKontroll rad i textfil:12 av 
1881brb./bhrKontroll rad i textfil:13 av 
1881brb./bhrKontroll rad i textfil:14 av 
1881brb./bhrKontroll rad i textfil:15 av 
1881brb./bhrKontroll rad i textfil:16 av 
1881brb./bhrKontroll rad i textfil:17 av 
1881brb./bhrKontroll rad i textfil:18 av 
1881brb./bhrKontroll rad i textfil:19 av 
1881brb./bhrKontroll rad i textfil:20 av 
1881brb./bhrKontroll rad i textfil:21 av 
1881brb./bhrKontroll rad i textfil:22 av 
1881brb./bhrKontroll rad i textfil:23 av 
1881brb./bhrKontroll rad i textfil:24 av 
1881brb./bhrKontroll rad i textfil:25 av 
1881brb./bhrKontroll rad i textfil:26 av 
1881brb./bhrKontroll rad i textfil:27 av 
1881brb./bhrKontroll rad i textfil:28 av 
1881brb./bhrKontroll rad i textfil:29 av 
1881brb./bhrKontroll rad i textfil:30 av 
1881brb./bhrKontroll rad i textfil:31 av 
1881brb./bhrKontroll rad i textfil:32 av 
1881brb./bhrKontroll rad i textfil:33 av 
1881brb./bhrKontroll rad i textfil:34 av 
1881brb./bhrKontroll rad i textfil:35 av 
1881brb./bhrKontroll rad i textfil:36 av 
1881brb./bhrKontroll rad i textfil:37 av 
1881brb./bhrKontroll rad i textfil:38 av 
1881brb./bhrKontroll rad i textfil:39 av 
1881brb./bhrKontroll rad i textfil:40 av 
1881brb./bhrKontroll rad i textfil:41 av 
1881brb./bhrKontroll rad i textfil:42 av 
1881brb./bhrKontroll rad i textfil:43 av 
1881brb./bhrKontroll rad i textfil:44 av 
1881brb./bhrKontroll rad i textfil:45 av 
1881brb./bhrKontroll rad i textfil:46 av 
1881brb./bhrKontroll rad i textfil:47 av 
1881brb./bhrKontroll rad i textfil:48 av 
1881brb./bhrKontroll rad i textfil:49 av 
1881brb./bhrKontroll rad i textfil:50 av 
1881brb./bhrKontroll rad i textfil:51 av 
1881brb./bhrKontroll rad i textfil:52 av 
1881brb./bhrKontroll rad i textfil:53 av 
1881brb./bhrKontroll rad i textfil:54 av 
1881brb./bhrKontroll rad i textfil:55 av 
1881brb./bhrKontroll rad i textfil:56 av 
1881brb./bhrKontroll rad i textfil:57 av 
1881brb./bhrKontroll rad i textfil:58 av 
1881brb./bhrKontroll rad i textfil:59 av 
1881brb./bhrKontroll rad i textfil:60 av 
1881brb./bhrKontroll rad i textfil:61 av 
1881brb./bhrKontroll rad i textfil:62 av 
1881brb./bhrKontroll rad i textfil:63 av 
1881brb./bhrKontroll rad i textfil:64 av 
1881brb./bhrKontroll rad i textfil:65 av 
1881brb./bhrKontroll rad i textfil:66 av 
1881brb./bhrKontroll rad i textfil:67 av 
1881brb./bhrKontroll rad i textfil:68 av 
1881brb./bhrKontroll rad i textfil:69 av 
1881brb./bhrKontroll rad i textfil:70 av 
1881brb./bhrKontroll rad i textfil:71 av 
1881brb./bhrKontroll rad i textfil:72 av 
1881brb./bhrKontroll rad i textfil:73 av 
1881brb./bhrKontroll rad i textfil:74 av 
1881brb./bhrKontroll rad i textfil:75 av 
1881brb./bhrKontroll rad i textfil:76 av 
1881brb./bhrKontroll rad i textfil:77 av 
1881brb./bhrKontroll rad i textfil:78 av 
1881brb./bhrKontroll rad i textfil:79 av 
1881brb./bhrKontroll rad i textfil:80 av 
1881brb./bhrKontroll rad i textfil:81 av 
1881brb./bhrKontroll rad i textfil:82 av 
1881brb./bhrKontroll rad i textfil:83 av 
1881brb./bhrKontroll rad i textfil:84 av 
1881brb./bhrKontroll rad i textfil:85 av 
1881brb./bhrKontroll rad i textfil:86 av 
1881brb./bhrKontroll rad i textfil:87 av 
1881brb./bhrKontroll rad i textfil:88 av 
1881brb./bhrKontroll rad i textfil:89 av 
1881brb./bhrKontroll rad i textfil:90 av 
1881brb./bhrKontroll rad i textfil:91 av 
1881brb./bhrKontroll rad i textfil:92 av 
1881brb./bhrKontroll rad i textfil:93 av 
1881brb./bhrKontroll rad i textfil:94 av 
1881brb./bhrKontroll rad i textfil:95 av 
1881brb./bhrKontroll rad i textfil:96 av 
1881brb./bhrKontroll rad i textfil:97 av 
1881brb./bhrKontroll rad i textfil:98 av 
1881brb./bhrKontroll rad i textfil:99 av 
1881brb./bhrKontroll rad i textfil:100 av 
1881brb./bhrKontroll rad i textfil:101 av 
1881brb./bhrKontroll rad i textfil:102 av 
1881brb./bhrKontroll rad i textfil:103 av 
1881brb./bhrKontroll rad i textfil:104 av 
1881brb./bhrKontroll rad i textfil:105 av 
1881brb./bhrKontroll rad i textfil:106 av 
1881brb./bhrKontroll rad i textfil:107 av 
1881brb./bhrKontroll rad i textfil:108 av 

Re: [PHP] Weird html - No real cr

2005-12-16 Thread Gustav Wiberg

Hi

Yes, but I assume that

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr;


would render a newline ?

/G

- Original Message - 
From: [EMAIL PROTECTED]

To: Gustav Wiberg [EMAIL PROTECTED]
Sent: Saturday, December 17, 2005 12:15 AM
Subject: Re: [PHP] Weird html - No real cr


[assuming i understand your question correctly] a cr or other type
of (operating system) newline is not a rendered value in html. you
need to use an html BR, or P (or put the text within an html
PRE block) to get the rendered html to have new lines.




 Original Message 

Date: Saturday, December 17, 2005 12:03:02 AM +0100
From: Gustav Wiberg [EMAIL PROTECTED]
To: PHP General php-general@lists.php.net
Subject: [PHP] Weird html - No real cr

Hi there!

Why do I get this kind of ... why don't cr work? There is now
newline as when you view source in an ordinary html-file... I
hope you guys understand what I mean...


DOWN BELOW IS THE PHP CODE! :-)



html
head
titlemain/title
meta http-equiv=Content-Type content=text/html;
charset=iso-8859-1
/head
body


bPCB/bbrbAUTOMATISK/B INFOGNING AV PRODUKTER SOM INTE
FINNS I VP's
databas!brhrLoggfil=logfiles/pcb_autoinsert.txtbrRader i
databas=354brhrKontroll rad i textfil:1 av 1881brhrKontroll
rad i textfil:2 av 1881brb./bhrKontroll rad i textfil:3 av
1881brb./bhrKontroll rad i textfil:4 av
1881brb./bhrKontroll rad i textfil:5 av
1881brb./bhrKontroll rad i textfil:6 av
1881brb./bhrKontroll rad i textfil:7 av
1881brb./bhrKontroll rad i textfil:8 av
1881brb./bhrKontroll rad i textfil:9 av
1881brb./bhrKontroll rad i textfil:10 av
1881brb./bhrKontroll rad i textfil:11 av
1881brb./bhrKontroll rad i textfil:12 av
1881brb./bhrKontroll rad i textfil:13 av
1881brb./bhrKontroll rad i textfil:14 av
1881brb./bhrKontroll rad i textfil:15 av
1881brb./bhrKontroll rad i textfil:16 av
1881brb./bhrKontroll rad i textfil:17 av
1881brb./bhrKontroll rad i textfil:18 av
1881brb./bhrKontroll rad i textfil:19 av
1881brb./bhrKontroll rad i textfil:20 av
1881brb./bhrKontroll rad i textfil:21 av
1881brb./bhrKontroll rad i textfil:22 av
1881brb./bhrKontroll rad i textfil:23 av
1881brb./bhrKontroll rad i textfil:24 av
1881brb./bhrKontroll rad i textfil:25 av
1881brb./bhrKontroll rad i textfil:26 av
1881brb./bhrKontroll rad i textfil:27 av
1881brb./bhrKontroll rad i textfil:28 av
1881brb./bhrKontroll rad i textfil:29 av
1881brb./bhrKontroll rad i textfil:30 av
1881brb./bhrKontroll rad i textfil:31 av
1881brb./bhrKontroll rad i textfil:32 av
1881brb./bhrKontroll rad i textfil:33 av
1881brb./bhrKontroll rad i textfil:34 av
1881brb./bhrKontroll rad i textfil:35 av
1881brb./bhrKontroll rad i textfil:36 av
1881brb./bhrKontroll rad i textfil:37 av
1881brb./bhrKontroll rad i textfil:38 av
1881brb./bhrKontroll rad i textfil:39 av
1881brb./bhrKontroll rad i textfil:40 av
1881brb./bhrKontroll rad i textfil:41 av
1881brb./bhrKontroll rad i textfil:42 av
1881brb./bhrKontroll rad i textfil:43 av
1881brb./bhrKontroll rad i textfil:44 av
1881brb./bhrKontroll rad i textfil:45 av
1881brb./bhrKontroll rad i textfil:46 av
1881brb./bhrKontroll rad i textfil:47 av
1881brb./bhrKontroll rad i textfil:48 av
1881brb./bhrKontroll rad i textfil:49 av
1881brb./bhrKontroll rad i textfil:50 av
1881brb./bhrKontroll rad i textfil:51 av
1881brb./bhrKontroll rad i textfil:52 av
1881brb./bhrKontroll rad i textfil:53 av
1881brb./bhrKontroll rad i textfil:54 av
1881brb./bhrKontroll rad i textfil:55 av
1881brb./bhrKontroll rad i textfil:56 av
1881brb./bhrKontroll rad i textfil:57 av
1881brb./bhrKontroll rad i textfil:58 av
1881brb./bhrKontroll rad i textfil:59 av
1881brb./bhrKontroll rad i textfil:60 av
1881brb./bhrKontroll rad i textfil:61 av
1881brb./bhrKontroll rad i textfil:62 av
1881brb./bhrKontroll rad i textfil:63 av
1881brb./bhrKontroll rad i textfil:64 av
1881brb./bhrKontroll rad i textfil:65 av
1881brb./bhrKontroll rad i textfil:66 av
1881brb./bhrKontroll rad i textfil:67 av
1881brb./bhrKontroll rad i textfil:68 av
1881brb./bhrKontroll rad i textfil:69 av
1881brb./bhrKontroll rad i textfil:70 av
1881brb./bhrKontroll rad i textfil:71 av
1881brb./bhrKontroll rad i textfil:72 av
1881brb./bhrKontroll rad i textfil:73 av
1881brb./bhrKontroll rad i textfil:74 av
1881brb./bhrKontroll rad i textfil:75 av
1881brb./bhrKontroll rad i textfil:76 av
1881brb./bhrKontroll rad i textfil:77 av
1881brb./bhrKontroll rad i textfil:78 av
1881brb./bhrKontroll rad i textfil:79 av
1881brb./bhrKontroll rad i textfil:80 av
1881brb./bhrKontroll rad i textfil:81 av
1881brb./bhrKontroll rad i textfil:82 av
1881brb./bhrKontroll rad i textfil:83 av
1881brb./bhrKontroll rad i textfil:84 av
1881brb./bhrKontroll rad i textfil:85 av
1881brb./bhrKontroll rad i textfil:86 av
1881brb./bhrKontroll rad i textfil:87 av
1881brb./bhrKontroll rad i textfil:88 av
1881brb./bhrKontroll rad i textfil:89 av
1881brb./bhrKontroll rad i textfil:90 av
1881brb./bhrKontroll rad i textfil:91 av
1881brb./bhrKontroll rad i textfil:92 av

RE: [PHP] Weird html - No real cr

2005-12-16 Thread Brady Mitchell
 Hi
 
 Yes, but I assume that
 
 echo hrKontroll rad i textfil:$rowsInTextFile av 
 $totalRowsInTextFilebr;
 
 would render a newline ?
 
 /G

Echo does not automatically add a newline, you would have to use \n to
get newlines with the echo statement:

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr;

Will display the line break in the webpage as expected, but to get the
source code displayed to have the line break you would need to use:

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr\n;

Brady

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



Re: [PHP] Help with the copy command...

2005-12-16 Thread adriano ghezzi
just put the wrong lines in a file and run it from the shell
with php -f
you should get more info about what's going wrong

hyh
ciao!


2005/12/16, Tim Meader [EMAIL PROTECTED]:

 What difference are you seeing in the files I give in the example? Are
 they not identical paths?

 Thanks.

 Hristo Yankov wrote:
  The two examples you give are not the same? I see
  different files. Please, doublecheck.
 
  --- Tim Meader [EMAIL PROTECTED] wrote:
 
  Okay, this seems like a ridiculously easy question
  which shouldn't even
  need asking, but I'm having trouble getting the
  builtin copy command to
  work properly. It seems to work fine as long as I
  feed it a full
  constant string path for each argument (ie - in the
  form
  /the/path/to/the/file). However, if I try to feed
  it two variables as
  the arguments, it craps out somewhere along the
  line. Here are the two
  different sets of calls I'm making:
 
  These two work perfectly:
 
 
 
 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline,
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline.bak)
  ;
 
 
 copy(/usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp,
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp.bak);
  These two fail:
 
  $l_stLastRun =
 
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/lastrun.timestamp;
  $l_stSnapshotBase =
 
 
 /usr/local/apache/htdocs/ipreg2/crons/regservice_rep/snapshot.baseline;
  copy($l_stSnapshotBase, $l_stSnapshotBase..bak);
  copy($l_stLastRun, $l_stLastRun..bak);
 
  Can anyone offer any insight on what the problem
  might be with this? The
  unlink function seems to accept the variable
  inputs with absolutely no
  problem, so I can't understand the discrepancy
  between the two.
 
  Thanks in advance.
 
  Tim
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
  ===
  Hristo Yankov, Developer at Portellus, Inc.
  ICQ - 191445567
  Yahoo! - yankov_hristo
 
  __
  Do You Yahoo!?
  Tired of spam?  Yahoo! Mail has the best spam protection around
  http://mail.yahoo.com
 

 --
 Tim
 [EMAIL PROTECTED]

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




Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Matt Stone

- Original Message - 
From: Shaun [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Friday, December 16, 2005 7:50 PM
Subject: [PHP] Blocking Values From an External Source


 Hi,

 I have a script on my site for processing values sent from a contact form
 and emailing them to the webmaster. The script has been abused by spammers
 and my hosting company has recommended that I change the script to only
 accept information posted from my own URL. Could someone tell me how this
 can be done please?


If your script is being abused through mail headers injection, making it
only accept information being posted from your own url won't work.
First set a max length in your from e  mail address text box and validate
that. For example:

if (strlen($_POST['email'])  SOME_NUMBER ){
die (E Mail Address Too Long);
}

Next, validate your e mail address to the rfc standard, there's a good
tutorial here: http://www.iamcal.com/publish/articles/php/parsing_email/

If you validate it using the function in the article your form will be
bulletproof as far as headers injection goes as the rfc standard does not
allow a '\' or ':' in the address. If you follow your isp's advice and still
allow invalid input from your form you're leaving yourself wide open to
header injection. For example someone can still input

[EMAIL PROTECTED]: [EMAIL PROTECTED]

into the from address field. Who needs a bot to post that info when a single
click on a form can see your script used to spam a stack of recipients? To
put it another way, is it worth validating the source of your input if
you're not going to validate the input itself?

HTH

Cheers
Matt

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



Re: [PHP] Can anyone recommend a hosting company

2005-12-16 Thread Jose Miguel
Try browsing the forums webhostingtalk.com, they have some pretty good
reviews about several hosting companys.

On 12/16/05, Marty [EMAIL PROTECTED] wrote:

 Can anyone recommend a fair priced, reliable hosting company that would
 best
 meet my needs as follows:


 Shared plan with
 PHP
 Windows server
 Mssql
 Need to host multiple domains under one account.

 thanks in advance

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




--
Jose Arce
http://sinexion.com - http://josearce.com


Re: [PHP] Can anyone recommend a hosting company

2005-12-16 Thread Ray Hauge

I use SiteFlip.  Their prices are really low, and they offer quite a bit.

www.siteflip.com

Affiliates have some special discount prices as low as $11.40/yr for 250 
MB space, 5GB transfer, 1 domain (you register it), PHP, MySQL, and more 
(no setup fees).


http://affiliates.siteflip.com

Jose Miguel wrote:


Try browsing the forums webhostingtalk.com, they have some pretty good
reviews about several hosting companys.

On 12/16/05, Marty [EMAIL PROTECTED] wrote:
 


Can anyone recommend a fair priced, reliable hosting company that would
best
meet my needs as follows:


Shared plan with
PHP
Windows server
Mssql
Need to host multiple domains under one account.

thanks in advance

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


   




--
Jose Arce
http://sinexion.com - http://josearce.com

 



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



[PHP] setcookie doesn't save session properly

2005-12-16 Thread nhiemenz
I'm using
setcookie($sessionName, $sessionid, time()+60*60*24*1,
$sessionCookie['path'], $sessionCookie['domain'],
$sessionCookie['secure']);

to, obviously, store a session. The problem is that this always times out
after 24 hours, and I can't figure out why.
Is there something I'm missing? ie, perhaps this doesn't save a session
itself, so the session still gets deleted. But then why does the session
stick around for 24 hours even if the browser is closed? Sessions used to
time out when the browser was closed before adding this.

Also, I only use session_start() so perhaps I'm supposed to call
session_id()?

Thanks,
Realm

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



Re: [PHP] setcookie doesn't save session properly

2005-12-16 Thread comex
 I'm using
 setcookie($sessionName, $sessionid, time()+60*60*24*1,
 $sessionCookie['path'], $sessionCookie['domain'],
 $sessionCookie['secure']);

 to, obviously, store a session.
 Also, I only use session_start() so perhaps I'm supposed to call
 session_id()?

I'm not sure why the cookie is being mis-saved, but sessions ARE
supposed to save the cookies automatically.

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



Re: [PHP] Binary Config file: Protect script(s): Powered-by logo: How to?

2005-12-16 Thread Michael Hulse


On Dec 15, 2005, at 10:15 PM, Michael Hulse wrote:

On Dec 15, 2005, at 10:09 PM, Michael Hulse wrote:
So, if you buy the gallery script, which I did (I think I spent like 
20$), the Powered by Company Name disappears.


I forgot to add:

When you buy the script, the company will send you a new replacement 
config.dat file that magically removes the Powered by Company Name 
from the bottom of the template pages.


Hello,

Wow, I did not expect to get 0 responses to my original post... Now I 
feel kinda bad for even asking.   :(


Anyway, Let me re-phrase my question: How do you protect your code?

I have heard about commercial options of obfuscating code... But I 
would love to learn about ways to do the same without paying the 
big-bucks.


If one were to read my original post, that gallery script has a great 
system of adding a Powered By link to bottom of the template pages... 
I would love to learn how to do something similar. Anyone feel like 
sharing? Links? Thoughts? Comments? Suggestions? Should I go bugger 
off?


Feel free to contact me off-list.

:)

Thanks in advance!
Cheers,
Micky

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



Re: [PHP] Weird html - No real cr

2005-12-16 Thread Gustav Wiberg

Ok, thanx!:-)

/G

- Original Message - 
From: Brady Mitchell [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Saturday, December 17, 2005 12:35 AM
Subject: RE: [PHP] Weird html - No real cr



Hi

Yes, but I assume that

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr;


would render a newline ?

/G


Echo does not automatically add a newline, you would have to use \n to
get newlines with the echo statement:

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr;

Will display the line break in the webpage as expected, but to get the
source code displayed to have the line break you would need to use:

echo hrKontroll rad i textfil:$rowsInTextFile av 
$totalRowsInTextFilebr\n;

Brady

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