OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 16 Dec 2005 23:03:28 -0000 Issue 3854

php-general-digest-helplists.php.net
Date: Fri Dec 16 2005 - 17:03:28 CST


php-general Digest 16 Dec 2005 23:03:28 -0000 Issue 3854

Topics (messages 227526 through 227563):

Re: simple-ish question but something i never knew
        227526 by: Karlos Zafra
        227551 by: Robert Cummings

PHP/MySQL noob rides again.. into trouble
        227527 by: Paul Jinks
        227528 by: David Grant
        227529 by: Richard Davey
        227531 by: Paul Jinks
        227532 by: Paul Jinks
        227533 by: David Grant
        227534 by: Kilbride, James

Re: Random Images with no duplicates?
        227530 by: Kilbride, James
        227538 by: Jared Williams

upload path
        227535 by: Adrian Bruce
        227539 by: Jay Blanchard
        227540 by: Adrian Bruce
        227541 by: Jay Blanchard
        227542 by: Oli Howson
        227543 by: Adrian Bruce
        227549 by: Weber Sites LTD

Re: Is it possible to use header() to POST form data?
        227536 by: Jay Blanchard

PHP 4.4.1 "array_set_current" bug?
        227537 by: Eric Butera

mysql select statement in php having three conditions
        227544 by: sunaram patir
        227546 by: Jay Blanchard

Re: i18n maybe?
        227545 by: Al

Re: One big file or many includes?
        227547 by: John Nichel

PHP and Apache 2.2.0
        227548 by: Kevin McBride
        227552 by: Kevin McBride

Fatal error 'Unable to read from thread kernel pipe' when using mail() function
        227550 by: Stut

Re: php file upload permission query
        227553 by: Burhan

Can anyone recommend a hosting company
        227554 by: Marty
        227555 by: Dan Harrington
        227556 by: Oli Howson
        227557 by: loveneesh.bansal.csipl.net

Blocking Values From an External Source
        227558 by: Shaun
        227559 by: Michael Hulse
        227560 by: Jason Gerfen
        227561 by: Michael Hulse

Re: Help with the copy command...
        227562 by: Tim Meader

Weird html - No "real" <cr>
        227563 by: Gustav Wiberg

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


2005/12/10, Robert Cummings <robertinterjinn.com>:
>
> On Sat, 2005-12-10 at 10:45, Zareef Ahmed wrote:
> > ----- Original Message -----
> > From: "Robert Cummings" <robertinterjinn.com>
> > To: "Aaron Koning" <aaronkoninggmail.com>
> > Cc: "PHP-General" <php-generallists.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.

attached mail follows:


On Fri, 2005-12-16 at 06:59, Karlos Zafra wrote:
> 2005/12/10, Robert Cummings <robertinterjinn.com>:
>
> 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. |
`------------------------------------------------------------'

attached mail follows:


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

attached mail follows:


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/

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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
>

attached mail follows:


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/

attached mail follows:


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:paulpauljinks.co.uk]
> Sent: Friday, December 16, 2005 8:21 AM
> Cc: php-generallists.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
>
>

attached mail follows:


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:czirzowgmail.com]
> Sent: Friday, December 16, 2005 2:47 AM
> To: php-generallists.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()*1000000);
> > #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
>
>

attached mail follows:


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()*1000000);
#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

attached mail follows:


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

attached mail follows:


[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()

attached mail follows:


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

attached mail follows:


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

attached mail follows:


Allow them to browse the server (up to a limited level), saving the
current selected path within the $_GET string.

attached mail follows:


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

attached mail follows:


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:abrucestvincent.ac.uk]
Sent: Friday, December 16, 2005 3:55 PM
To: php-generallists.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

attached mail follows:


[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

attached mail follows:


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!

attached mail follows:


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.

attached mail follows:


[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=''";

attached mail follows:


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:
>>
>> 3&Atilde;&cent;&Acirc;&Acirc;&cent;16
>
>
> this looks borked; should it not be:
>
> 3&tilde;&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
>>>
>>>
>>
>>
>>

attached mail follows:


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
jnicheldotcomholdingsofbuffalo.com

attached mail follows:


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

attached mail follows:


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.

attached mail follows:


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

stutbrian:~$ 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

attached mail follows:


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.

attached mail follows:


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

attached mail follows:


I'd recommend www.xiolink.com

Thanks
Dan

-----Original Message-----
From: Marty [mailto:vpelginc.com]
Sent: Friday, December 16, 2005 9:10 AM
To: php-generallists.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

attached mail follows:


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:

attached mail follows:


Hi,

Please use www.veryfasthosting.net

Regards,

Love

----- Original Message -----
From: "Oli Howson" <olilondonis.co.uk>
To: <php-generallists.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
>
>

attached mail follows:


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.

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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

attached mail follows:


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 <tmeaderpobox.com> 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
tmeaderpobox.com

attached mail follows:


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>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<b>PCB</b><br><b>AUTOMATISK</B> INFOGNING AV PRODUKTER SOM INTE FINNS I VP's
databas!<br><hr>Loggfil=logfiles/pcb_autoinsert.txt<br>Rader i
databas=354<br><hr>Kontroll rad i textfil:1 av 1881<br><hr>Kontroll rad i
textfil:2 av 1881<br><b>.</b><hr>Kontroll rad i textfil:3 av
1881<br><b>.</b><hr>Kontroll rad i textfil:4 av 1881<br><b>.</b><hr>Kontroll
rad i textfil:5 av 1881<br><b>.</b><hr>Kontroll rad i textfil:6 av
1881<br><b>.</b><hr>Kontroll rad i textfil:7 av 1881<br><b>.</b><hr>Kontroll
rad i textfil:8 av 1881<br><b>.</b><hr>Kontroll rad i textfil:9 av
1881<br><b>.</b><hr>Kontroll rad i textfil:10 av
1881<br><b>.</b><hr>Kontroll rad i textfil:11 av
1881<br><b>.</b><hr>Kontroll rad i textfil:12 av
1881<br><b>.</b><hr>Kontroll rad i textfil:13 av
1881<br><b>.</b><hr>Kontroll rad i textfil:14 av
1881<br><b>.</b><hr>Kontroll rad i textfil:15 av
1881<br><b>.</b><hr>Kontroll rad i textfil:16 av
1881<br><b>.</b><hr>Kontroll rad i textfil:17 av
1881<br><b>.</b><hr>Kontroll rad i textfil:18 av
1881<br><b>.</b><hr>Kontroll rad i textfil:19 av
1881<br><b>.</b><hr>Kontroll rad i textfil:20 av
1881<br><b>.</b><hr>Kontroll rad i textfil:21 av
1881<br><b>.</b><hr>Kontroll rad i textfil:22 av
1881<br><b>.</b><hr>Kontroll rad i textfil:23 av
1881<br><b>.</b><hr>Kontroll rad i textfil:24 av
1881<br><b>.</b><hr>Kontroll rad i textfil:25 av
1881<br><b>.</b><hr>Kontroll rad i textfil:26 av
1881<br><b>.</b><hr>Kontroll rad i textfil:27 av
1881<br><b>.</b><hr>Kontroll rad i textfil:28 av
1881<br><b>.</b><hr>Kontroll rad i textfil:29 av
1881<br><b>.</b><hr>Kontroll rad i textfil:30 av
1881<br><b>.</b><hr>Kontroll rad i textfil:31 av
1881<br><b>.</b><hr>Kontroll rad i textfil:32 av
1881<br><b>.</b><hr>Kontroll rad i textfil:33 av
1881<br><b>.</b><hr>Kontroll rad i textfil:34 av
1881<br><b>.</b><hr>Kontroll rad i textfil:35 av
1881<br><b>.</b><hr>Kontroll rad i textfil:36 av
1881<br><b>.</b><hr>Kontroll rad i textfil:37 av
1881<br><b>.</b><hr>Kontroll rad i textfil:38 av
1881<br><b>.</b><hr>Kontroll rad i textfil:39 av
1881<br><b>.</b><hr>Kontroll rad i textfil:40 av
1881<br><b>.</b><hr>Kontroll rad i textfil:41 av
1881<br><b>.</b><hr>Kontroll rad i textfil:42 av
1881<br><b>.</b><hr>Kontroll rad i textfil:43 av
1881<br><b>.</b><hr>Kontroll rad i textfil:44 av
1881<br><b>.</b><hr>Kontroll rad i textfil:45 av
1881<br><b>.</b><hr>Kontroll rad i textfil:46 av
1881<br><b>.</b><hr>Kontroll rad i textfil:47 av
1881<br><b>.</b><hr>Kontroll rad i textfil:48 av
1881<br><b>.</b><hr>Kontroll rad i textfil:49 av
1881<br><b>.</b><hr>Kontroll rad i textfil:50 av
1881<br><b>.</b><hr>Kontroll rad i textfil:51 av
1881<br><b>.</b><hr>Kontroll rad i textfil:52 av
1881<br><b>.</b><hr>Kontroll rad i textfil:53 av
1881<br><b>.</b><hr>Kontroll rad i textfil:54 av
1881<br><b>.</b><hr>Kontroll rad i textfil:55 av
1881<br><b>.</b><hr>Kontroll rad i textfil:56 av
1881<br><b>.</b><hr>Kontroll rad i textfil:57 av
1881<br><b>.</b><hr>Kontroll rad i textfil:58 av
1881<br><b>.</b><hr>Kontroll rad i textfil:59 av
1881<br><b>.</b><hr>Kontroll rad i textfil:60 av
1881<br><b>.</b><hr>Kontroll rad i textfil:61 av
1881<br><b>.</b><hr>Kontroll rad i textfil:62 av
1881<br><b>.</b><hr>Kontroll rad i textfil:63 av
1881<br><b>.</b><hr>Kontroll rad i textfil:64 av
1881<br><b>.</b><hr>Kontroll rad i textfil:65 av
1881<br><b>.</b><hr>Kontroll rad i textfil:66 av
1881<br><b>.</b><hr>Kontroll rad i textfil:67 av
1881<br><b>.</b><hr>Kontroll rad i textfil:68 av
1881<br><b>.</b><hr>Kontroll rad i textfil:69 av
1881<br><b>.</b><hr>Kontroll rad i textfil:70 av
1881<br><b>.</b><hr>Kontroll rad i textfil:71 av
1881<br><b>.</b><hr>Kontroll rad i textfil:72 av
1881<br><b>.</b><hr>Kontroll rad i textfil:73 av
1881<br><b>.</b><hr>Kontroll rad i textfil:74 av
1881<br><b>.</b><hr>Kontroll rad i textfil:75 av
1881<br><b>.</b><hr>Kontroll rad i textfil:76 av
1881<br><b>.</b><hr>Kontroll rad i textfil:77 av
1881<br><b>.</b><hr>Kontroll rad i textfil:78 av
1881<br><b>.</b><hr>Kontroll rad i textfil:79 av
1881<br><b>.</b><hr>Kontroll rad i textfil:80 av
1881<br><b>.</b><hr>Kontroll rad i textfil:81 av
1881<br><b>.</b><hr>Kontroll rad i textfil:82 av
1881<br><b>.</b><hr>Kontroll rad i textfil:83 av
1881<br><b>.</b><hr>Kontroll rad i textfil:84 av
1881<br><b>.</b><hr>Kontroll rad i textfil:85 av
1881<br><b>.</b><hr>Kontroll rad i textfil:86 av
1881<br><b>.</b><hr>Kontroll rad i textfil:87 av
1881<br><b>.</b><hr>Kontroll rad i textfil:88 av
1881<br><b>.</b><hr>Kontroll rad i textfil:89 av
1881<br><b>.</b><hr>Kontroll rad i textfil:90 av
1881<br><b>.</b><hr>Kontroll rad i textfil:91 av
1881<br><b>.</b><hr>Kontroll rad i textfil:92 av
1881<br><b>.</b><hr>Kontroll rad i textfil:93 av
1881<br><b>.</b><hr>Kontroll rad i textfil:94 av
1881<br><b>.</b><hr>Kontroll rad i textfil:95 av
1881<br><b>.</b><hr>Kontroll rad i textfil:96 av
1881<br><b>.</b><hr>Kontroll rad i textfil:97 av
1881<br><b>.</b><hr>Kontroll rad i textfil:98 av
1881<br><b>.</b><hr>Kontroll rad i textfil:99 av
1881<br><b>.</b><hr>Kontroll rad i textfil:100 av
1881<br><b>.</b><hr>Kontroll rad i textfil:101 av
1881<br><b>.</b><hr>Kontroll rad i textfil:102 av
1881<br><b>.</b><hr>Kontroll rad i textfil:103 av
1881<br><b>.</b><hr>Kontroll rad i textfil:104 av
1881<br><b>.</b><hr>Kontroll rad i textfil:105 av
1881<br><b>.</b><hr>Kontroll rad i textfil:106 av
1881<br><b>.</b><hr>Kontroll rad i textfil:107 av
1881<br><b>.</b><hr>Kontroll rad i textfil:108 av
1881<br><b>.</b><hr>Kontroll rad i textfil:109 av
1881<br><b>.</b><hr>Kontroll rad i textfil:110 av
1881<br><b>.</b><hr>Kontroll rad i textfil:111 av
1881<br><b>.</b><hr>Kontroll rad i textfil:112 av
1881<br><b>.</b><hr>Kontroll rad i textfil:113 av
1881<br><b>.</b><hr>Kontroll rad i textfil:114 av
1881<br><b>.</b><hr>Kontroll rad i textfil:115 av
1881<br><b>.</b><hr>Kontroll rad i textfil:116 av
1881<br><b>.</b><hr>Kontroll rad i textfil:117 av
1881<br><b>.</b><hr>Kontroll rad i textfil:118 av
1881<br><b>.</b><hr>Kontroll rad i textfil:119 av
1881<br><b>.</b><hr>Kontroll rad i textfil:120 av
1881<br><b>.</b><hr>Kontroll rad i textfil:121 av
1881<br><b>.</b><hr>Kontroll rad i textfil:122 av
1881<br><b>.</b><hr>Kontroll rad i textfil:123 av
1881<br><b>.</b><hr>Kontroll rad i textfil:124 av
1881<br><b>.</b><hr>Kontroll rad i textfil:125 av
1881<br><b>.</b><hr>Kontroll rad i textfil:126 av
1881<br><b>.</b><hr>Kontroll rad i textfil:127 av
1881<br><b>.</b><hr>Kontroll rad i textfil:128 av
1881<br><b>.</b><hr>Kontroll rad i textfil:129 av
1881<br><b>.</b><hr>Kontroll rad i textfil:130 av
1881<br><b>.</b><hr>Kontroll rad i textfil:131 av
1881<br><b>.</b><hr>Kontroll rad i textfil:132 av
1881<br><b>.</b><hr>Kontroll rad i textfil:133 av
1881<br><b>.</b><hr>Kontroll rad i textfil:134 av
1881<br><b>.</b><hr>Kontroll rad i textfil:135 av
1881<br><b>.</b><hr>Kontroll rad i textfil:136 av
1881<br><b>.</b><hr>Kontroll rad i textfil:137 av
1881<br><b>.</b><hr>Kontroll rad i textfil:138 av
1881<br><b>.</b><hr>Kontroll rad i textfil:139 av
1881<br><b>.</b><hr>Kontroll rad i textfil:140 av
1881<br><b>.</b><hr>Kontroll rad i textfil:141 av
1881<br><b>.</b><hr>Kontroll rad i textfil:142 av
1881<br><b>.</b><hr>Kontroll rad i textfil:143 av
1881<br><b>.</b><hr>Kontroll rad i textfil:144 av
1881<br><b>.</b><hr>Kontroll rad i textfil:145 av
1881<br><b>.</b><hr>Kontroll rad i textfil:146 av
1881<br><b>.</b><hr>Kontroll rad i textfil:147 av
1881<br><b>.</b><hr>Kontroll rad i textfil:148 av
1881<br><b>.</b><hr>Kontroll rad i textfil:149 av
1881<br><b>.</b><hr>Kontroll rad i textfil:150 av
1881<br><b>.</b><hr>Kontroll rad i textfil:151 av
1881<br><b>.</b><hr>Kontroll rad i textfil:152 av
1881<br><b>.</b><hr>Kontroll rad i textfil:153 av
1881<br><b>.</b><hr>Kontroll rad i textfil:154 av
1881<br><b>.</b><hr>Kontroll rad i textfil:155 av
1881<br><b>.</b><hr>Kontroll rad i textfil:156 av
1881<br><b>.</b><hr>Kontroll rad i textfil:157 av
1881<br><b>.</b><hr>Kontroll rad i textfil:158 av
1881<br><b>.</b><hr>Kontroll rad i textfil:159 av
1881<br><b>.</b><hr>Kontroll rad i textfil:160 av
1881<br><b>.</b><hr>Kontroll rad i textfil:161 av
1881<br><b>.</b><hr>Kontroll rad i textfil:162 av
1881<br><b>.</b><hr>Kontroll rad i textfil:163 av
1881<br><b>.</b><hr>Kontroll rad i textfil:164 av
1881<br><b>.</b><hr>Kontroll rad i textfil:165 av
1881<br><b>.</b><hr>Kontroll rad i textfil:166 av
1881<br><b>.</b><hr>Kontroll rad i textfil:167 av
1881<br><b>.</b><hr>Kontroll rad i textfil:168 av
1881<br><b>.</b><hr>Kontroll rad i textfil:169 av
1881<br><b>.</b><hr>Kontroll rad i textfil:170 av
1881<br><b>.</b><hr>Kontroll rad i textfil:171 av
1881<br><b>.</b><hr>Kontroll rad i textfil:172 av
1881<br><b>.</b><hr>Kontroll rad i textfil:173 av
1881<br><b>.</b><hr>Kontroll rad i textfil:174 av
1881<br><b>.</b><hr>Kontroll rad i textfil:175 av
1881<br><b>.</b><hr>Kontroll rad i textfil:176 av
1881<br><b>.</b><hr>Kontroll rad i textfil:177 av
1881<br><b>.</b><hr>Kontroll rad i textfil:178 av
1881<br><b>.</b><hr>Kontroll rad i textfil:179 av
1881<br><b>.</b><hr>Kontroll rad i textfil:180 av
1881<br><b>.</b><hr>Kontroll rad i textfil:181 av
1881<br><b>.</b><hr>Kontroll rad i textfil:182 av
1881<br><b>.</b><hr>Kontroll rad i textfil:183 av
1881<br><b>.</b><hr>Kontroll rad i textfil:184 av
1881<br><b>.</b><hr>Kontroll rad i textfil:185 av
1881<br><b>.</b><hr>Kontroll rad i textfil:186 av
1881<br><b>.</b><hr>Kontroll rad i textfil:187 av
1881<br><b>.</b><hr>Kontroll rad i textfil:188 av
1881<br><b>.</b><hr>Kontroll rad i textfil:189 av
1881<br><b>.</b><hr>Kontroll rad i textfil:190 av
1881<br><b>.</b><hr>Kontroll rad i textfil:191 av
1881<br><b>.</b><hr>Kontroll rad i textfil:192 av
1881<br><b>.</b><hr>Kontroll rad i textfil:193 av
1881<br><b>.</b><hr>Kontroll rad i textfil:194 av
1881<br><b>.</b><hr>Kontroll rad i textfil:195 av
1881<br><b>.</b><hr>Kontroll rad i textfil:196 av
1881<br><b>.</b><hr>Kontroll rad i textfil:197 av
1881<br><b>.</b><hr>Kontroll rad i textfil:198 av
1881<br><b>.</b><hr>Kontroll rad i textfil:199 av
1881<br><b>.</b><hr>Kontroll rad i textfil:200 av
1881<br><b>.</b><hr>Kontroll rad i textfil:201 av
1881<br><b>.</b><hr>Kontroll rad i textfil:202 av
1881<br><b>.</b><hr>Kontroll rad i textfil:203 av
1881<br><b>.</b><hr>Kontroll rad i textfil:204 av
1881<br><b>.</b><hr>Kontroll rad i textfil:205 av
1881<br><b>.</b><hr>Kontroll rad i textfil:206 av
1881<br><b>.</b><hr>Kontroll rad i textfil:207 av
1881<br><b>.</b><hr>Kontroll rad i textfil:208 av
1881<br><b>.</b><hr>Kontroll rad i textfil:209 av
1881<br><b>.</b><hr>Kontroll rad i textfil:210 av
1881<br><b>.</b><hr>Kontroll rad i textfil:211 av
1881<br><b>.</b><hr>Kontroll rad i textfil:212 av
1881<br><b>.</b><hr>Kontroll rad i textfil:213 av
1881<br><b>.</b><hr>Kontroll rad i textfil:214 av
1881<br><b>.</b><hr>Kontroll rad i textfil:215 av
1881<br><b>.</b><hr>Kontroll rad i textfil:216 av
1881<br><b>.</b><hr>Kontroll rad i textfil:217 av
1881<br><b>.</b><hr>Kontroll rad i textfil:218 av
1881<br><b>.</b><hr>Kontroll rad i textfil:219 av
1881<br><b>.</b><hr>Kontroll rad i textfil:220 av
1881<br><b>.</b><hr>Kontroll rad i textfil:221 av
1881<br><b>.</b><hr>Kontroll rad i textfil:222 av
1881<br><b>.</b><hr>Kontroll rad i textfil:223 av
1881<br><b>.</b><hr>Kontroll rad i textfil:224 av
1881<br><b>.</b><hr>Kontroll rad i textfil:225 av
1881<br><b>.</b><hr>Kontroll rad i textfil:226 av
1881<br><b>.</b><hr>Kontroll rad i textfil:227 av
1881<br><b>.</b><hr>Kontroll rad i textfil:228 av
1881<br><b>.</b><hr>Kontroll rad i textfil:229 av
1881<br><b>.</b><hr>Kontroll rad i textfil:230 av
1881<br><b>.</b><hr>Kontroll rad i textfil:231 av
1881<br><b>.</b><hr>Kontroll rad i textfil:232 av
1881<br><b>.</b><hr>Kontroll rad i textfil:233 av
1881<br><b>.</b><hr>Kontroll rad i textfil:234 av
1881<br><b>.</b><hr>Kontroll rad i textfil:235 av
1881<br><b>.</b><hr>Kontroll rad i textfil:236 av
1881<br><b>.</b><hr>Kontroll rad i textfil:237 av
1881<br><b>.</b><hr>Kontroll rad i textfil:238 av
1881<br><b>.</b><hr>Kontroll rad i textfil:239 av
1881<br><b>.</b><hr>Kontroll rad i textfil:240 av
1881<br><b>.</b><hr>Kontroll rad i textfil:241 av
1881<br><b>.</b><hr>Kontroll rad i textfil:242 av
1881<br><b>.</b><hr>Kontroll rad i textfil:243 av
1881<br><b>.</b><hr>Kontroll rad i textfil:244 av
1881<br><b>.</b><hr>Kontroll rad i textfil:245 av
1881<br><b>.</b><hr>Kontroll rad i textfil:246 av
1881<br><b>.</b><hr>Kontroll rad i textfil:247 av
1881<br><b>.</b><hr>Kontroll rad i textfil:248 av
1881<br><b>.</b><hr>Kontroll rad i textfil:249 av
1881<br><b>.</b><hr>Kontroll rad i textfil:250 av
1881<br><b>.</b><hr>Kontroll rad i textfil:251 av 1881<br><b>.</b><hr

>Kontroll rad i textfil:252 av 1881<br><b>.</b><hr>Kontroll rad i
>textfil:253 av 1881<br><b>.</b><hr>Kontroll rad i textfil:254 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:255 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:256 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:257 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:258 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:259 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:260 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:261 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:262 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:263 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:264 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:265 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:266 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:267 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:268 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:269 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:270 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:271 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:272 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:273 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:274 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:275 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:276 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:277 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:278 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:279 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:280 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:281 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:282 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:283 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:284 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:285 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:286 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:287 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:288 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:289 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:290 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:291 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:292 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:293 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:294 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:295 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:296 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:297 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:298 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:299 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:300 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:301 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:302 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:303 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:304 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:305 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:306 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:307 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:308 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:309 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:310 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:311 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:312 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:313 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:314 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:315 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:316 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:317 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:318 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:319 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:320 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:321 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:322 av
>1881<br><b>.</b><hr>Kontroll rad i textfil:323 av 1881<br><b>.</b><hr

<?php
//Parameters for specific vendor taken from db depending on ID sent to URL
//
if (isset($_GET["IDImport"])) {

    $IDImport = $_GET["IDImport"];

}

//echo "IMPORT=$IDImport";
//exit;
//This is when testing...
//
if (intval($IDImport) !== 5) {

  HEADER("Location:vendor_update.php?IDImport=$IDImport");
  exit;
}

?>
<html>
<head>
<title>main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>

<?php
//This script was updated 2005-12-16
//by Gustav Wiberg / gustavvarupiraten.se
//Please visit www.varupiraten.se for more scripts
//
require("phpfunctions/datefunctions.php");
$todayDate = dateOfCurrentTime();

require("phpfunctions/dbsafety.php");

require("phpfunctions/opendb.php");

//Delete unessary products (products without pictures)
//
$sql = "DELETE FROM tbvara WHERE bildlank = 'empty.jpg'";
$querys = mysql_query($sql);
//echo "TILLFÄLLIG PRODUKTER BORTTAGNA!";

//Start here...
//
$sql = "SELECT IDImport, importFile, vendorName, saldoColumn, artNrColumn,
priceColumn, checkLev, separator FROM tbimport WHERE IDImport = " .
safeQuote($IDImport) . " LIMIT 1";

$querys = mysql_query($sql);
$importDbArray = mysql_fetch_array($querys);

//No specific vendor is chosen
//Therefore, show all vendors for user to choose
//
if (strlen($importDbArray["importFile"]) == 0) {

    //Show a list of vendors
     //
     $sql = "SELECT IDImport, vendorName FROM tbimport ORDER BY vendorName";

     $querys = mysql_query($sql);
     while ($dbArray = mysql_fetch_array($querys)) {

        $IDImport = $dbArray["IDImport"];
        $vendorName = $dbArray["vendorName"];
        $logFileName = strtolower("logfiles/$vendorName.txt"); //Example:
captech.txt
        ?>
        <b><?php echo $vendorName;?></b><br><hr>
        <a href="vendor_insert.php?IDImport=<?php echo $IDImport;?>">Lägg
till produkter</a><br>
        <a href="<?php echo $logFileName;?>">Visa
loggfil</a><br><br><hr><br>
        <?php

     }

    mysql_close();
    exit;
}

//Parameters that sets the rules for importing
//
$fileName = $importDbArray["importFile"]; //Example: import/CapTech_pris.txt
$vendorName = $importDbArray["vendorName"]; //Example: Captech
$saldoColumn = $importDbArray["saldoColumn"]; //Example: 2 (third column)
$artNrColumn = $importDbArray["artNrColumn"]; //Example: 0 (First column)
$priceColumn = $importDbArray["priceColumn"]; //Example: 7 (Eigth column)
$checkLev = $importDbArray["checkLev"]; //Example: CA-
$separator = $importDbArray["separator"]; //Example: ;
$vendorName = $importDbArray["vendorName"]; //Example: ;

$logFileName = strtolower("logfiles/" . $vendorName. "_autoinsert.txt");
//Example: captech.txt

if (strlen($checkLev) == 0 || strlen($vendorName) == 0 ||
strlen($saldoColumn) == 0 || strlen($artNrColumn) == 0 ||
strlen($priceColumn) == 0 || strlen($checkLev) == 0) {

  echo "DOESN'T WORK WITHOUT all fields";
  mysql_close();
  exit;

}
static $row = 1;

//echo $fileName . "<br>"; // = $importDbArray["importFile"]; //Example:
import/CapTech_pris.txt
echo "<b>$vendorName</b><br>"; // = $importDbArray["vendorName"]; //Example:
Captech
//echo $saldoColumn . "<br>"; // = $importDbArray["saldoColumn"]; //Example:
2 (third column)
//echo $artNrColumn . "<br>"; // = $importDbArray["artNrColumn"]; //Example:
0 (First column)
//echo $priceColumn . "<br>"; // = $importDbArray["priceColumn"]; //Example:
7 (Eigth column)
//echo $checkLev . "<br>"; // = $importDbArray["checkLev"]; //Example: CA-
//echo "SEP:$separator";

//Function for creating a logfile
//and writing to screen
//
function writeNow($str, $logFileName) {

//Create a handle for writing (appending)
//
$logHandle = fopen($logFileName,"a");

  fwrite($logHandle, "$str\r\n");
  //echo $str . "<br>";

//Close file for writing to logfile
//
fclose($logHandle);

}

    //Check if the filename exists first!
    //If not, then exit script

    if (substr($fileName, 0, 4) != 'http') {

        if (!file_exists($fileName)) {

        echo "Filen $fileName finns inte!<br>Avslutar scriptet nu!";
        exit;

        }

    }

$rowsInTextFile = 0;

$insertActions = 0;

        $sql = "SELECT tbvara.Varunamn, tbvara.Saldo FROM tbvara";
        $sql .= " WHERE Varunamn LIKE '$checkLev%' AND tbvara.Saldo>0 ORDER
BY IDVara";
        $querys = mysql_query($sql);
        $rowsInDb = mysql_num_rows($querys);

        echo "<b>AUTOMATISK</B> INFOGNING AV PRODUKTER SOM INTE FINNS I VP's
databas!<br><hr>";
        echo "Loggfil=$logFileName<br>";
        echo "Rader i databas=$rowsInDb<br>";

    //Go through textfile and search for artnr. If not found, then add
information
    //
    $handle = fopen("$fileName", "r");

    //Go through textfile to $startRow
    //

    if (isset($_GET["startrow"])) {
        $startRow = $_GET["startrow"];
    }
    else {
        $startRow = 0;
    }

    $totalRowsInTextFile = 0;

     while (($data = fgetcsv($handle, 1000, "$separator")) !== FALSE) {

        //echo "STARTROW=$startRow";
        $totalRowsInTextFile++;
        //if (intval($startRow) > intval($totalRowsInTextFile)) {break;}

    }
    fclose($handle);

    $handle2 = fopen("$fileName", "r");

    $rowsInTextFile = 0;

     while (($data = fgetcsv($handle2, 1000, "$separator")) !== FALSE) {

        $textArtNr = $data[$artNrColumn];
        $textBeskrivandeVarunamn = $data[4];
        $textDetaljText = $data[8];

        //Go through database with products from vendor
        //
        $sql = "SELECT tbvara.Varunamn, tbvara.Saldo FROM tbvara";
        $sql .= " WHERE Varunamn LIKE '$checkLev%' ORDER BY IDVara";

        $querys = mysql_query($sql);

        //Does article exist in database already?
        //
        $foundProductInDb = 'N';

        while ($toarray = mysql_fetch_array($querys)) {

            $dbArtNr = substr($toarray["Varunamn"],3); //Start after PC-
            //echo "Comparing $textArtNr with $dbArtNr<br>";

            if ($textArtNr == $dbArtNr) {$foundProductInDb = 'Y';}

        }

        //Product existed in textfile, but not in db.
        //Therefore, insert into db
        //
        if ($foundProductInDb == 'N') {

            $intoDb = "PC-" . $textArtNr;
            $intoDbDetaljText = str_replace("br","<br>",$textDetaljText);

            //Go through rows in table tbreplacetextvendor for current
vendor
            //
            //Replace texts from field searchFor and replace from field
replaceWith
            //If nothing is written in field replaceWith, then do the
searchFor-field bold
            //
            $sql2 = "SELECT searchFor, ForIDVendor FROM
tbreplacetextvendor";
            $querys2 = mysql_query($sql2);

            while ($dbArray2 = mysql_fetch_array($querys2)) {

                $searchFor = $dbArray2["searchFor"];

                //Should the text be replaced by something specific?
                //
                    $explodeDetalj = explode("<br>",$intoDbDetaljText);

                    for ($nr=0;$nr<count($explodeDetalj);$nr++) {

                        if (substr($explodeDetalj[$nr],0,1) == "-") {
                        $explodeDetalj[$nr] = str_replace("- ", "<li> ",
$explodeDetalj[$nr]);
                        }

                    }

                    //Make text bold where it should be bold
                    //
                    for ($nr=0;$nr<count($explodeDetalj);$nr++) {

                    $detail = strtolower($explodeDetalj[$nr]);
                    $sf = strtolower($searchFor);

    if (substr($detail,0) == substr($sf,0)) {

                            $explodeDetalj[$nr] = str_replace($searchFor,
"<b>$searchFor</b>", $explodeDetalj[$nr]);
     }

                    }

                    $intoDbDetaljText = implode("<br>",$explodeDetalj);

            }

//$intoDbDetaljText = "testar";
$intoDbBildLank = "empty.jpg";
$intoDbBildLankStor = "empty_big.jpg";

            $sqlTest = "SELECT Varunamn FROM tbvara WHERE Varunamn=" .
safeQuote($intoDb);
            $querysTest = mysql_query($sqlTest);
            $prodCount = mysql_num_rows($querysTest);

            //Add only if the same product does not exist
            //
            if ($prodCount == 0) {

            $sql3 = "INSERT INTO tbvara (Varunamn,
ForIDAnvandare_Leverantor, beskrivandeVarunamn, detaljTextMer, inlagdDatum,
bildLank, bildlankStor)";
            $sql3 .= " VALUES (" . safeQuote($intoDb);
            $sql3 .= ", " . safeQuote(7); //Seven is VP-vendor.
            $sql3 .= ", " . safeQuote($textBeskrivandeVarunamn);
            $sql3 .= ", " . safeQuote($intoDbDetaljText);
            $sql3 .= ", " . safeQuote($todayDate);
            $sql3 .= ", " . safeQuote($intoDbBildLank);
            $sql3 .= ", " . safeQuote($intoDbBildLankStor);
            $sql3 .= ")";
            $querys3 = mysql_query($sql3) or die("DEAD sql3");

            $sql4 = "SELECT IDVara FROM tbvara ORDER BY IDVara DESC";
            $querys4 = mysql_query($sql4) or die("DEAD sql4");
            $dbArray4 = mysql_fetch_array($querys4);
            $dbID = $dbArray4["IDVara"];

            $sql5 = "SELECT ForIDVara, ForIDUnderKategori FROM
tbunderkategorivara WHERE ForIDVara=" . safeQuote($dbID) . " AND
ForIDUnderKategori=15";
            $querys5 = mysql_query($sql5) or die("DEAD sql5");
            $dbArray5 = mysql_fetch_array($querys5);

            //If connection not found, then insert...
            //
            if ($dbArray5["ForIDVara"] OR strlen($dbArray["ForIDVara"])==0)
{

                $sql6 = "INSERT INTO tbunderkategorivara (ForIDVara,
ForIDUnderKategori)";
                $sql6 .= " VALUES(" . safeQuote($dbID);
                $sql6 .= ", " . safeQuote(15); //This undercategory sets
product to not defined category
                $sql6 .= ")";
                $querys6 = mysql_query($sql6) or die ("DEAD sql6");

            }

            //writeNow($sql6,$logFileName);
            }

         }

$rowsInTextFile++;
$startRow++;
echo "<hr>Kontroll rad i textfil:$rowsInTextFile av
$totalRowsInTextFile<br>";
if (isset($sql3)) {
echo "<b>.</b>";
}
/*
if ($rowsInTextFile>100) {
  mysql_close();
  ?>
  <script language="Javascript" type="text/Javascript">
  window.document.location = 'vendor_insert.php?IDImport=<?php echo
$IDImport;?>&startrow=<?php echo $startRow++;?>';
  </script>
  <?php
}
  */

    //Next row in textfile
    //
    }

fclose($handle2);
mysql_close();

echo "<br><br><br>************************************<br>";
echo "<b>Automatisk infogning av produkter slutfört.</b><br>Dessa produkter
hamnar i kategorin Ej tilldelade";
?>
<br><br>
<a href="vendor_update?IDImport=<?php echo $IDImport;?>">Fortsätt med
uppdatering</a>
</body>
</html>

/G
http://www.varupiraten.se/