[PHP] Weight function.

2002-10-17 Thread Steve Jackson

Hi all.
Wondering if anyone can shed some light!

I have a problem whereby I need to define the weight of a selection of
items in a shopping cart in order to calculate a shipping cost.
Basically I have 5 products (at the moment) which are of set weights.
What I want to do is add up the amount of items in the cart and multiply
by weight then determine what the shipping weight is. Once that is
determined I can calculate the shipping cost. My problem is arrays. I
dunno what I'm doing with them! I can return the weight of one item and
multiply that by the amount of items in the cart but need to figure out
how do then do it again for any more items and add them to the first
calculation. Here is my code:

function calculate_weight($items)
{
global $weight;
$conn = db_connect();
$query = select weight from products 
where catid = $catid;
$result = @mysql_query($query);
$weight = ($result*$items);
return $weight;
}

Where $items is the number of items in the cart. $catid is the category
the products are in but maybe I need to use a different identifier. I
have another identifier called $itemCode which defines the actual item
which would probably be more reasonable?

Thoughts?
Regards,  

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159


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




[PHP] how to setup mysql logging from php scripts

2002-10-17 Thread Petre Agenbag

Hi
I need to be able to see logs of all mysql queries from php scripts on
my server.
I have a multitude of virtual hosts on my RedHat server, with many mysql
db's, and would like to be able to see what queries are done against the
db's from which scripts. The reason being is that I suspect that some of
the scripts on some domains are causing problems, for example infinite
loop db queries etc. Yesterday again I had mysql freeze up completely on
the server, and the only interaction with mysql are from php scripts
on the various domains, so looking at the mysql.log file gives no help.

Ideally I would like to see something like the following logged:

time || path/to/script.php || sql_query || mysql_error

or ANYthing that will help me to determine what went wrong.
At the moment I can merely blame the gremlins, and I don't know if it is
a poorly written script causing this or not, so I can't do anything
about the situation...
ANY suggestions or methods being used by ppl out there are also welcome.

Thanks alot.

 




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




Re: [PHP] Blank PHP pages...

2002-10-17 Thread René Moonen

I had the same thing just two days ago. This is what happend:

I have some code using include files in this way:

1 ?php
2
3 // some php code
4 include(xlib.inc);
5 // some php code
6
7 ?

The include file looks like

1 ?php
2 // some code
3 ?

The problem was in line 3 of the include file. If there is a line feed 
behind ? , the code does not work - gives a blank page just like yours.
Removing that linefeed solved my problem.

I did not yet figure out why this happend. It has someting to do with 
html headers being send. The line feed behind ? is considered HTML 
output, so headers are send at that point. Somehow the rest of the 
PHP-code gets lost.

Anyway... with a little luck this could be of any help to you.

Good luck

René





Angel Gabriel wrote:

... I've got PHP working, on my server, I know this because I used that
small PHP script that shows all the variables, and that worked fine. The
problem seems to be that every other script shows me a blank pages. I'm
using redhat 7.3,  and I installed PHP, MySQL and Apache from RPM's and they
are all up2date - I have no idea what I could have missed. Has anyone else
encountered a similar problem, and if so, how did you remedy it? I have
followed the install instructions to the letter, and I can't seem to find
what the problem is. Any suggestions, hints or tips, greatfully recieved!
Thanks in advance.

***
Not everyone is touched by an Angel..and those that are, never forget
the experience.
***
If you want guest list for bare club
nights.http://raw-talent.hopto.org/mailman/clubnights
***
Can you sing, dance, MC, DJ, do you have talent?Send an email to
[EMAIL PROTECTED]
***


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.404 / Virus Database: 228 - Release Date: 10/15/2002



  





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




Re: [PHP] Problem with setcookie and IE6.0.2800.1106

2002-10-17 Thread John Nichel

It seems that the problem is with IE, and characters in the domain name. 
  This is a beta site (of one of my existing sites), and I have the 
virtual host name set as by-tor_v70.  I tried setting the cookie on 
another virtual host running on the same box, and it worked.  So, I 
removed the underscore from the name, and the cookie worked fine.  Live 
and learn, eh?  IE6 != underscores.  Thanks for the help guys.

Timothy Hitchens wrote:
 This will work for you I use this for tracking activity and is set to last
 for 3 months.
 
 
 setcookie(cookieName, $value, mktime() + 7725000,'/', 
 '.yourdomain.com.au',0);
 
 
 
 
 Timothy Hitchens (HiTCHO)
 [EMAIL PROTECTED]
 
 
 
 
 John Nichel wrote:
 
 Timothy,

   The headers are coming across fine.  I looked in the privacy report, 
 and told IE to accept all cookies from my domain, but it still isn't 
 registering them. If it wasn't for the fact that I've had over 100,000 
 page views by IE6 this month, I wouldn't give it a second glance. 
 Catering to MS products is really getting old. :)

 Timothy Hitchens wrote:

 As per my earlier commments about seeing the privacy report this will 
 answer all your questions regarding cookies.. also you can allways 
 telnet to the host eg..

 telnet {host} 80
 get /{page.html} http/1.0
 host: {yourdomain.com.au}
 {enter}
 {ctrl d}

 You should then see the header information as well that should 
 include your cookie informaiton if not you have even a bigger problem.


 Timothy Hitchens (HiTCHO)
 [EMAIL PROTECTED]



 Chris Shiflett wrote:

 John,

 Can you see if this works:

 header(Set-Cookie: foo=bar);

 If not, then check the configuration for IE6. I seem to recall 
 hearing that cookies are disabled by default for sites that are not 
 P3P compliant? Or, perhaps that was for third-party cookies only. At 
 any rate, I seem to recall some significant change with IE6 in 
 regards to cookies, so maybe you're experiencing that. My example 
 above will give you the simplest test case for setting a cookie.

 Good luck, and happy hacking.

 Chris

 John Nichel wrote:

 Hi guys and gals.  I'm having a problem with setting a cookie on IE 
 6. I'm running RedHat 7, Apache 1.3.26 and php 4.2.3.  The cookie 
 sets fine in all other browsers (IE5, Netscape 4 and up, Opera, 
 Mozilla, etc.) but on IE 6, not even my session cookie sets.  I've 
 tried all of these

 setcookie ( $name, $cookie_data, $date, /, by-tor_v70, 0 );
 setcookie ( $name, $cookie_data, $date, /, by-tor_v70 );
 setcookie ( $name, $cookie_data, $date, / );
 setcookie ( $name, $cookie_data, $date );
 setcookie ( $name, $cookie_data );

 I've also replaced $date with time() and time()+3600.
 $date is set to the standard set forth on Netscape's site.











 



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




Re: [PHP] Weight function.

2002-10-17 Thread Jason Wong

On Thursday 17 October 2002 14:34, Steve Jackson wrote:
 Hi all.
 Wondering if anyone can shed some light!

 I have a problem whereby I need to define the weight of a selection of
 items in a shopping cart in order to calculate a shipping cost.
 Basically I have 5 products (at the moment) which are of set weights.
 What I want to do is add up the amount of items in the cart and multiply
 by weight then determine what the shipping weight is. Once that is
 determined I can calculate the shipping cost. My problem is arrays. I
 dunno what I'm doing with them! I can return the weight of one item and
 multiply that by the amount of items in the cart but need to figure out
 how do then do it again for any more items and add them to the first
 calculation. Here is my code:

 function calculate_weight($items)
 {
   global $weight;
   $conn = db_connect();
   $query = select weight from products
   where catid = $catid;
   $result = mysql_query($query);
   $weight = ($result*$items);
   return $weight;
 }

 Where $items is the number of items in the cart. $catid is the category
 the products are in but maybe I need to use a different identifier. I
 have another identifier called $itemCode which defines the actual item
 which would probably be more reasonable?

Your code as it stands does not do anything meaningful.

1) mysql_query() returns a resource_id -- which you assigned to $result.

2) You need to pass $result into one of these functions to actually get the 
data resulting from your query -- mysql_fetch_row(), mysql_fetch_array(), 
mysql_fetch_object(), mysql_result().

Try to get this part working then post your question again!

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Absence makes the heart grow fonder.
-- Sextus Aurelius
*/


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




RE: [PHP] Weight function.

2002-10-17 Thread Steve Jackson

Thanks.
I have just this minute got it working.
Basically the same function I used for determining price of the cart
items could be used for determining weight. All I needed to do was
assign my DB with a field called weight and call that instead of price
from the DB so my calculate weight function looks like this. 

function calculate_weight($cart)
{
  // sum total weight for all items in shopping cart
  global $weight;
  $weight = 0.0;
  if(is_array($cart))
  {
$conn = db_connect();
foreach($cart as $ItemCode = $qty)
{  
  $query = select weight from products where ItemCode='$ItemCode';
  $result = mysql_query($query);
  if ($result)
  {
$item_weight = mysql_result($result, 0, weight);
$weight +=$item_weight*$qty;
  }
}
  }
  return $weight;
}

By making $weight a global variable I then call that in my shipping
function and set it's parameters:

function calculate_shipping_cost($weight)
{
  //shipping costs calc. less than 10KG is 15 more than 10KG currently
20.
  
global $shipping;
if ($weight = 1)
$shipping = 15;
else
$shipping = 20;
return $shipping;

}

I still don't fully understand why this works but am happy it does!


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




Re: [PHP] People who searched this also searched this!

2002-10-17 Thread Krzysztof Dziekiewicz

 Hi guys,

 Does anybody have a working example of doing the lists of 'People who
 searched this also searched this!' that I see on Amazon and other
 websites.

That  is  a very complex problem. It is not for PHP. PHP may only insert queries
and  get  results and another system computers all data. Such system is based on
statistic  or  artificial neuron nets. For example the company Net Perceptions
makes such systems as NetP based on statistic but they are not very fast. If you
would like to buy their system you would have to sell some good cars.

-- 
Krzysztof Dziekiewicz


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




Re: [PHP] weird IE cookie problem

2002-10-17 Thread Krzysztof Dziekiewicz

 Is the time set properly on your machine? Double check both the time AND
 the timezone. I went nuts trying to fix a similar problem once just to
 find out that someone had changed the timezone on the PC for a test and
 then forgot to put it back.

It is very easy to check. Set
   $expires = 0;
It makes a session cookie independed from time set. If you set a session cookie
you will know you have problem with time set.


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




[PHP] xml parsing

2002-10-17 Thread Michael Ransburg

Hi!

I understand that it's easily possible to parse xml documents with php.
But what about changing them? With other xml parsers, I have the xml
document in a structure (usually a tree or an array) and when I change
something in the structure I can later write out the structure again
into a xml file and get a changed xml file that way. Is this possible
easily with PHP too?

Thanks
Mike

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002
 


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




Re: [PHP] Weight function.

2002-10-17 Thread Jason Wong

On Thursday 17 October 2002 15:52, Steve Jackson wrote:
 Thanks.
 I have just this minute got it working.
 Basically the same function I used for determining price of the cart
 items could be used for determining weight. All I needed to do was
 assign my DB with a field called weight and call that instead of price
 from the DB so my calculate weight function looks like this.

 function calculate_weight($cart)
 {
   // sum total weight for all items in shopping cart
   global $weight;
   $weight = 0.0;
   if(is_array($cart))
   {
 $conn = db_connect();
 foreach($cart as $ItemCode = $qty)
 {
   $query = select weight from products where ItemCode='$ItemCode';
   $result = mysql_query($query);
   if ($result)
   {
 $item_weight = mysql_result($result, 0, weight);
 $weight +=$item_weight*$qty;
   }
 }
   }
   return $weight;

See below

 }

 By making $weight a global variable I then call that in my shipping
 function and set it's parameters:

By making $weight a global variable there is no need for return $weight; 
inside your function. And same for return $shipping; below.


 function calculate_shipping_cost($weight)
 {
   //shipping costs calc. less than 10KG is 15 more than 10KG currently
 20.

   global $shipping;
   if ($weight = 1)
   $shipping = 15;
   else
   $shipping = 20;
   return $shipping;

 }

 I still don't fully understand why this works but am happy it does!

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
The solution of problems is the most characteristic and peculiar sort
of voluntary thinking.
-- William James
*/


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




[PHP] Is this a bad thing to do? (Unix permissions)

2002-10-17 Thread Gwydion Elderwyn

As part of my new site I have created a php-driven guestbook.  The guestbook
entries are stored in a file called guestbook.txt.

I found that in order to get the script to write to the file, I had to set
the directory permissions for the guestbook directory and the guestbook.txt
file to -rw-rw-rw-   ... is that a bad thing to do?  Does it expose me to
any hacking problems?  If so, what should I have done?

Bear in mind I'm using a 3rd-party host and I work in Windows, so please
don't blind me with science ;)

Thanks,
Gwydion



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




[PHP] Re: how to setup mysql logging from php scripts

2002-10-17 Thread David Robley

In article 1034836283.1253.23.camel@dell, [EMAIL PROTECTED] says...
 Hi
 I need to be able to see logs of all mysql queries from php scripts on
 my server.
 I have a multitude of virtual hosts on my RedHat server, with many mysql
 db's, and would like to be able to see what queries are done against the
 db's from which scripts. The reason being is that I suspect that some of
 the scripts on some domains are causing problems, for example infinite
 loop db queries etc. Yesterday again I had mysql freeze up completely on
 the server, and the only interaction with mysql are from php scripts
 on the various domains, so looking at the mysql.log file gives no help.
 
 Ideally I would like to see something like the following logged:
 
 time || path/to/script.php || sql_query || mysql_error
 
 or ANYthing that will help me to determine what went wrong.
 At the moment I can merely blame the gremlins, and I don't know if it is
 a poorly written script causing this or not, so I can't do anything
 about the situation...
 ANY suggestions or methods being used by ppl out there are also welcome.
 
 Thanks alot.

Mysql has its own logging procedure - search the mysql site for any of the 
following topics:

The MySQL Log Files

MySQL has several different log files that can help you find out what's 
going on inside mysqld:


Log fileDescription
The error log   Problems encountering starting, running or stopping mysqld.
The isam logLogs all changes to the ISAM tables. Used only for debugging 
the isam code.
The query log   Established connections and executed queries.
The update log  Deprecated: Stores all statements that changes data
The binary log  Stores all statements that changes something. Used 
also for replication
The slow logStores all queries that took more than long_query_time to 
execute or didn't use indexes.
All logs can be found in the mysqld data directory.  You can force mysqld 
to reopen the log files (or in some cases switch to a new log) by 
executing FLUSH LOGS. See FLUSH.



Error log   The Error Log
Query log   The General Query Log
Update log  The Update Log
Binary log  The Binary Update Log
Slow query log  The Slow Query Log
Log file maintenanceLog File Maintenance

Sorry about the crappy copy/paste, but that's what comes out of the .hlp 
file.

-- 
David Robley
Temporary Kiwi!

Quod subigo farinam

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




Re: [PHP] fopen error

2002-10-17 Thread Marek Kilimajer

if allow_url_fopen is not on, you can still use fsockopen(), and no it 
doesn't affect security, if you don't open files based on unchecked user 
input.

Alfonso Ballesteros wrote:

Hello

I'm a newcomer to PHP and I wish to know how to get the contents of a file
located in an URL if the parameter allow_url_fopen is no value in the
php.ini file.

Does this parameter, if is on, affect the security of the server?

Thanks in advance

Alfonso



  



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




RE: [PHP] Weight function.

2002-10-17 Thread Steve Jackson

I'm using both variables called in another page.
Taking globals off causes weight not to be calculated in the shipping
cost?

Steve Jackson
Web Developer
Viola Systems Ltd.
http://www.violasystems.com
[EMAIL PROTECTED]
Mobile +358 50 343 5159



 -Original Message-
 From: Jason Wong [mailto:[EMAIL PROTECTED]] 
 Sent: 17. lokakuuta 2002 12:39
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Weight function.
 
 
 On Thursday 17 October 2002 15:52, Steve Jackson wrote:
  Thanks.
  I have just this minute got it working.
  Basically the same function I used for determining price of 
 the cart 
  items could be used for determining weight. All I needed to do was 
  assign my DB with a field called weight and call that 
 instead of price 
  from the DB so my calculate weight function looks like this.
 
  function calculate_weight($cart)
  {
// sum total weight for all items in shopping cart
global $weight;
$weight = 0.0;
if(is_array($cart))
{
  $conn = db_connect();
  foreach($cart as $ItemCode = $qty)
  {
$query = select weight from products where 
 ItemCode='$ItemCode';
$result = mysql_query($query);
if ($result)
{
  $item_weight = mysql_result($result, 0, weight);
  $weight +=$item_weight*$qty;
}
  }
}
return $weight;
 
 See below
 
  }
 
  By making $weight a global variable I then call that in my shipping 
  function and set it's parameters:
 
 By making $weight a global variable there is no need for 
 return $weight; 
 inside your function. And same for return $shipping; below.
 
 
  function calculate_shipping_cost($weight)
  {
//shipping costs calc. less than 10KG is 15 more than 
 10KG currently 
  20.
 
  global $shipping;
  if ($weight = 1)
  $shipping = 15;
  else
  $shipping = 20;
  return $shipping;
 
  }
 
  I still don't fully understand why this works but am happy it does!
 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications 
 Development *
 
 /*
 The solution of problems is the most characteristic and 
 peculiar sort of voluntary thinking.
   -- William James
 */
 
 
 -- 
 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/frontpage

2002-10-17 Thread John Nichel

I'm not 100% sure, but I think the answer you seek lies in the server, 
and not php.  You may have to set your webserver to reconize *.php as FP 
files that it needs to parse, or set it to where it parses *.htm for 
php.  Is this running on IIS, Apache, or something else?

Shaun wrote:
 Hi ,
 
 I used ms frontpage 2000 to make a website. When
 i comepleted the site , i had to study php to enable database
 capabilities. When i changed my login.htm file into login.php,
 ms frontpage did not recognize the .php file. All the navigational
 links/views were removed from the login.php file. Can i enable frontpage
 to work with php.
 
 if not , what program would you use ?
 
 Thanks ,Shaun
 
 
 



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




[PHP] Re: Get the string in between two other strings

2002-10-17 Thread Noodle Snacks


Cameron Cooke [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]...
 Hi,

 I need a function to get a string in between two other strings. So you
would
 give the function the string to search and then you pass the first string
 and last string, and the function will return the string in between.

 Does anyone have this, or know how to do it. I tried but could not get it
to
 work.

will substr() - http://au.php.net/manual/en/function.substr.php suit your
needs?

if not check out:

http://au.php.net/manual/en/ref.regex.php

and

http://au.php.net/manual/en/ref.pcre.php



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




[PHP] shopping cart, inventory control, point of sale system

2002-10-17 Thread Daniel Negron/KBE

can anyone point me in the direction of a good system that will cover all 3
of these points (Shopping Cart, Inventory Control, and Point of Sale) ?


Thank you,

**DAN**


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




RE: [PHP] php/frontpage

2002-10-17 Thread Rankin, Randy

Yes. Frontpage can edit php files ( albeit not very gracfully ). So, if you
must ...

Open Front Page
Select Tools | Options
Select the Configure Editors tab and add the .php extension.

HTH,

Randy

-Original Message-
From: Shaun [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 17, 2002 8:50 AM
To: [EMAIL PROTECTED]
Subject: [PHP] php/frontpage


Hi ,

I used ms frontpage 2000 to make a website. When
i comepleted the site , i had to study php to enable database
capabilities. When i changed my login.htm file into login.php,
ms frontpage did not recognize the .php file. All the navigational
links/views were removed from the login.php file. Can i enable frontpage
to work with php.

if not , what program would you use ?

Thanks ,Shaun



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



Re: [PHP] MySQL GMT -- Local time

2002-10-17 Thread 1LT John W. Holmes

 My logging application is feeding a MySQL database with data records
 that are time stamped with GMT time.  I would like to query the database
 for records matching local time(eg. all records created on oct
 17,2002 local time).  I would prefer if the records could be formated
 in local time when returned from MySQL.  What is the best way to do this.

I don't know if there is an automatic way to do it, but if you know you are
5 hours ahead of GMT for example, and you want all records for Oct 17, 2002
GMT+5, then you could do this:

SELECT * FROM  your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) =
TO_DAYS(20021017)

You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or
use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in
PHP. With the above query, the 5 and actual date 20021017 can be PHP
variables, to make it more flexible.

---John Holmes...


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




Re: [PHP] shopping cart, inventory control, point of sale system

2002-10-17 Thread Justin French

A web based interface is pretty slow for POS isn't it???

phpshop.org might be a good start on the other two...

justin

on 17/10/02 11:56 PM, Daniel Negron/KBE ([EMAIL PROTECTED]) wrote:

 can anyone point me in the direction of a good system that will cover all 3
 of these points (Shopping Cart, Inventory Control, and Point of Sale) ?
 
 
 Thank you,
 
 **DAN**
 


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




RE: [PHP] Which one? Firebird or mysql for php

2002-10-17 Thread John W. Holmes

 I am working on a project which has plenty Gigabytes of data.
 I heard something about firebird.
 Is it much better than mysql?
 Can anybody compare the odds of both of them?
 Is it easy to use firebird from php?
 Thanx...

What kind of data are you storing? Is it going to be mostly reads or
writes or a mix? What are you going to do with the data? Each database
is good at different things...

---John Holmes...



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




RE: [PHP] Downloads

2002-10-17 Thread John W. Holmes

 I know that php allows uploading , but does it support downloading.
 
 I want users to be able to download from my site , how do i go to
work.
 
 Please send me sample of code if possible.

Yes, it does.

a href=mydocument.docClick here to download/a

---John Holmes...



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




[PHP] Re: Get the string in between two other strings

2002-10-17 Thread Cameron Cooke

I have looked at these, and they make no sense to me. I tried the substr
function, but it all went a bit pear shaped.

Cameron


Noodle Snacks [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...

 Cameron Cooke [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]...
  Hi,
 
  I need a function to get a string in between two other strings. So you
 would
  give the function the string to search and then you pass the first
string
  and last string, and the function will return the string in between.
 
  Does anyone have this, or know how to do it. I tried but could not get
it
 to
  work.

 will substr() - http://au.php.net/manual/en/function.substr.php suit your
 needs?

 if not check out:

 http://au.php.net/manual/en/ref.regex.php

 and

 http://au.php.net/manual/en/ref.pcre.php





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




Re: [PHP] Re: Get the string in between two other strings

2002-10-17 Thread Tom Rogers

Hi,

Thursday, October 17, 2002, 10:33:43 PM, you wrote:
CC I have looked at these, and they make no sense to me. I tried the substr
CC function, but it all went a bit pear shaped.

Here is a way that will handle line breaks which tend to stuff up the
string functions:

?
function find_string($string,$str1,$str2){
$x = $y = 0;
$state = 'S';
$r = '';
$p = '';
$len_str = strlen($string);
$len_x = strlen($str1);
$len_y = strlen($str2);
for($i=0;$i$len_str;$i++){
switch($state){
case 'S':   //try to find first string
if($string[$i] == $str1[$x]){
$state = 'P'; //possibly the start
$x++;
}
break;
case 'P':
if($string[$i] == $str1[$x]){
if($x == ($len_x -1)){
$state = 'R'; //found the first string 
switch to result
}
else $x++; //keep looking
}
else{
$state = 'S'; // bummer .. back to search for 
first string again
$x = 0;
}
break;
case 'R':
if($string[$i] == $str2[$y]){
$state = 'Q'; //quietly confident we have the 
start of string 2
$y++;
$p .= $string[$i]; //save it in a temp var for 
now
}
else{
$r .= $string[$i]; // still in result mode
$y = 0;
}
break;
case 'Q':
if($string[$i] == $str2[$y]){
if($y == ($len_y -1)){ // yippee found the 
second string
return $r; //all done
}
else{
$p .= $string[$i]; //keep going
$y ++;
}
}
else{
$r .= $p; // add temp to result
$r .= $string[$i]; // don't forget this one
$p = '';
$y = 0;
$state = 'R'; // oops back to finding string 2
}
break;
}
}
return ''; //didn't find anything
}

$string = 'I need a function to get a string in between two other strings.';
$str1 = 'function to get';
$str2 = 'two other ';
echo String: '$string' br;
echo Str1: '$str1' br;
echo Str2: '$str2' br;
echo Extracted: '.find_string($string,$str1,$str2).'br;





-- 
regards,
Tom


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




[PHP] Re:[PHP] fopen error

2002-10-17 Thread Alfonso Ballesteros

First of all... thanks for trying to help...

I'll show the full piece of code I made :
$file = http://www.ivan.ivao.org/whazzup.txt;;

$fp = fsockopen($file, 80);



if (!$fp) {
echo does not open;
} else {
echo $fp;   - Here is what I say it does't return anything. This
line is just to figure out what fsockopen() returns.
while (!feof($fp)) {
echo fgets ($fp,500);
}
fclose ($fp);
}

Thanks again
Alfonso

==

What do you mean it returns nothing?

fsockopen() returns a file handle.  Was the file handle valid, i.e., not 0?
If true, then you must READ from the opened file handle.

Please, be more specific in your error discussion.

 Original Message -
From: Alfonso Ballesteros [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 17, 2002 6:58 AM
Subject: Re: [PHP] fopen error


I'm still stuck with this...

Using fsockopen() I'm not able to open the remote file.

I use

$file = http://www.xxx.xxx/file.txt;;
$fp = fsockopen($file, 80);

and $fp returns nothing...

Any idea?

Alfonso

Marek Kilimajer [EMAIL PROTECTED] escribió en el mensaje
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 if allow_url_fopen is not on, you can still use fsockopen(), and no it
 doesn't affect security, if you don't open files based on unchecked user
 input.

 Alfonso Ballesteros wrote:

 Hello
 
 I'm a newcomer to PHP and I wish to know how to get the contents of a
file
 located in an URL if the parameter allow_url_fopen is no value in the
 php.ini file.
 
 Does this parameter, if is on, affect the security of the server?
 
 Thanks in advance
 
 Alfonso
 
 
 
 
 




--
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] php/frontpage

2002-10-17 Thread Shaun

Hi ,

I used ms frontpage 2000 to make a website. When
i comepleted the site , i had to study php to enable database
capabilities. When i changed my login.htm file into login.php,
ms frontpage did not recognize the .php file. All the navigational
links/views were removed from the login.php file. Can i enable frontpage
to work with php.

if not , what program would you use ?

Thanks ,Shaun



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




Re: [PHP] Calendar System

2002-10-17 Thread Rick Emery

http://myphpcalendar.sourceforge.net/



[PHP] Re: shopping cart, inventory control, point of sale system

2002-10-17 Thread Tjoumaidis

You may find something in www.oscommerce.com

Daniel Negron/Kbe wrote:
 can anyone point me in the direction of a good system that will cover all 3
 of these points (Shopping Cart, Inventory Control, and Point of Sale) ?
 
 
 Thank you,
 
 **DAN**
 



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




Re: [PHP] xml parsing

2002-10-17 Thread Geoff Hankerson

Change xml into a different type of xml sounds like a job for the xslt 
functions. Works like a charm

Michael Ransburg wrote:

Hi!

I understand that it's easily possible to parse xml documents with php.
But what about changing them? With other xml parsers, I have the xml
document in a structure (usually a tree or an array) and when I change
something in the structure I can later write out the structure again
into a xml file and get a changed xml file that way. Is this possible
easily with PHP too?

Thanks
Mike

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.394 / Virus Database: 224 - Release Date: 03.10.2002
 

  





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




[PHP] E-Commerce interfacing...

2002-10-17 Thread Noodle Snacks

What is a good service to process credit card numbers for an E-Commerce
site?

To be specific I mean an easy interface with a PHP based system (maybe even
sample code)  eg works well with curl... and second any personal
recommendations...


--
JJ Harrison
[EMAIL PROTECTED]





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




Re: [PHP] MySQL GMT -- Local time

2002-10-17 Thread Jason


On Thu, 17 Oct 2002, 1LT John W. Holmes wrote:

  My logging application is feeding a MySQL database with data records
  that are time stamped with GMT time.  I would like to query the database
  for records matching local time(eg. all records created on oct
  17,2002 local time).  I would prefer if the records could be formated
  in local time when returned from MySQL.  What is the best way to do this.
 
 I don't know if there is an automatic way to do it, but if you know you are
 5 hours ahead of GMT for example, and you want all records for Oct 17, 2002
 GMT+5, then you could do this:
 
 SELECT * FROM  your_table WHERE TO_DAYS(datetime_column + INTERVAL 5 HOUR) =
 TO_DAYS(20021017)
 
 You can use DATE_FORMAT() in your query to reformat the MySQL timestamp, or
 use UNIX_TIMESTAMP() to retrieve a unix timestamp instead and format it in
 PHP. With the above query, the 5 and actual date 20021017 can be PHP
 variables, to make it more flexible.
 
 ---John Holmes...
 

Where it gets messy is when daylight saving kicks in.  Knowing what
dates are included with standard or daylight savings time offsets is a
problem.  It gets more complicated when I want to return a distinct date
record set from the timestamp column.

Jason



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




[PHP] Alt tags in rollover buttons

2002-10-17 Thread Brad Harriger

Is there any way to create ALT tags in secondary nav bars with rollover 
images?  (NOF 7)

Thanks in advance,

Brad


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