RE: [PHP] remote files to servers

2002-09-26 Thread David Buerer

Of Course!  

You can use the fopen functions or curl functions depending on what and how
you want to manage the data once you get it.

Look at the manual in both of these sections and it will show you how to do
it.

BTW: What you are talking about doing is building a caching webserver.
Apache can do this by default, so can many other web server so check
documentaiton there as well.

David


-Original Message-
From: Simon Angell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 8:12 AM
To: [EMAIL PROTECTED]
Subject: [PHP] remote files to servers


Hi all.
i was wondering if it is possible to use PHP to retrieve a remote file and
then write a copy to my own server for quicker access?

--
Cheers
-
Simon Angell
Canberra ACT
www.canberra-wx.com
-
Member of:
Australian Severe Weather Association.
www.severeweather.asn.au
-
This email is virus free.
Scanned before leaving my mailbox
using Norton Antivirus 2002 for Win2k
Scanned with the latest definition File.




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




RE: [PHP] Looking for some help on web header coding.

2002-09-26 Thread David Buerer

go look at the tutorial for using php with flash to retrieve variables from
a database. it's pretty self explanatory and clear in how/what to do.

-Original Message-
From: Joshua Patterson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 10:35 AM
To: 'PHP'
Subject: [PHP] Looking for some help on web header coding.


I have been working to try and have flash MX use PHP to access a database
but have been having issues with retrieving the post values in php.

http://127.43.1.1/learning/checkpassword.php?password=somepasswordusername=
MyUserName

html

body

?php


//store header values to internal defined values.
 $username = $HTTP_POST_VARS['username'];
 $password = $HTTP_POST_VARS['password'];
//db_connect has been removed for security purposes.

 mysql_select_db(test,$db);

 $result = mysql_query(SELECT * FROM users WHERE username =
$username,$db);
 $myrow = mysql_fetch_array($result);

 if( md5($password) == $myrow['user_password'] )
   echo 1;
 else
  echo 0;

//Trying to get some visibility on what is actually retrieved.
 echo $password;
 echo \n\n\n;
 echo $username;
 echo \n\n\n;
 echo end of the line;


?



/body



/html

---
 Initiative is what separates a genius from the rest of the pack...
---
This Quote has been brought to you in part by the Letter C.
For C is for cookie.




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




RE: [PHP] I don't want multiple form submitted

2002-09-26 Thread David Buerer

There is a header you can send which has a page expires time which will
prevent the posting page from being reposted.  Do some research on this and
see what you can come up with.

-Original Message-
From: Clemson Chan [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 1:57 PM
To: Php
Subject: [PHP] I don't want multiple form submitted


I have a message board written in PHP w/MySQL.
So when a person submitting a post, it goes to a list_view.
If this person refresh the list_view.
The message he submitted will get submitted again.
How can I avoid this problem?
Please let me know if you know the answer. Thanks

--Clemson

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




RE: [PHP] Keeping your published script safe?

2002-09-26 Thread David Buerer

www.zend.com


-Original Message-
From: Stephen Craton [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 26, 2002 2:09 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Keeping your published script safe?


Hello,

I have many scripts published at various script sites and I just got a
report of an incident where the user has removed my copyright at the
bottom of the script. We have reached an agreement thank heavens,
they're going to go search for a script that doesn't require the
copyright.

Anyway, I was just wondering if there was any program or script that can
keep your script safe from people removing the copyright. Please help!
I'd really like to keep my scripts safe from those hacker people.

Thanks,
Stephen
http://www.melchior.us
http://php.melchior.us



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




RE: [PHP] authenticating and redirecting with special access

2002-09-24 Thread David Buerer

make the directory outside of the web server root path and create some PHP
routines to display the directory data as you see fit.  PHP can see the
entire file store, whereas the webserver can only see data below it's root.
That way you keep security and can also display the data.

-Original Message-
From: Bryan Koschmann - GKT [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 24, 2002 10:56 AM
To: PHP General
Subject: [PHP] authenticating and redirecting with special access


Hello,

I'm fairly new to PHP, but I am studying (ORA's Programming PHP). I am
trying to do something but can't quite figure out how.

Here is what I need to do:

User goes to an address. They login with say jsmith and their password.
the PHP script gets authenticates against a MySQL database. I have this
working.

After being authenticated, user is redirected to a directory to which only
they have access to (say www.mydomain.com/jsmith). I have this working to
the redirect part.

Where I am stuck is how to make it so someone can ONLY get to that
directory if they are authenticated, and cannot access it directly.

Now, I was thinking that there could be something php-based in that
directory that checks if they are already authenticated, but the problem
is that the files are generated by another program that I cannot modify.

I'm also having a problem where I have to close my browser to be able to
re-login, but I'm guessing this is a session problem and I just haven't
gotten that far yet.

Does anyone have any ideas here? I did a lot of searching and didn't find
much of anything.

Thanks in advance!

Bryan


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




RE: [PHP] MySQL vs. basic text file

2002-09-23 Thread David Buerer

Speed
Accessability
Features
Security
Performance
Simplicity
Reusability
Indexing
Record-Locking

To name a few.

however, in your situation, it's an existing application which is working
great and which no one has any complaints over.  If it ain't broke, don't
fix it.

For your next application, use a database. When it's time for a major
upgrade to this one, convert, until then, just leave things the way they
are.

Let me illustrate a point on the performance/simplicity front.  let's say
that you need to change the title of an item in a catalog.  

With a text file:
1.) Open the file
2.) Read the contents of the file until you find the item you're looking for
(got help us if it's the last item!)
3.) Parse the line 
4.) rewrite the line with the new information
5.) rewrite the file
6.) Close the file
ellapsed time: depending on the speed of the computer, typically between 1-5
seconds


With a database
1.) Open the database 
2.) UPDATE catalog SET title='new title' WHERE item=123
ellapsed time:  1 second, my benchmarks show usually in the .26-.33 second
range




-Original Message-
From: Doug Parker [mailto:[EMAIL PROTECTED]]
Sent: Saturday, September 21, 2002 4:26 PM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL vs. basic text file


often i use text files at my data sources, delimted by the | symbol. 
i simply delimit the fields of each line, then when i need to open them, 
i open the text file, populate an array with each line, then explode the 
fields for each to get the corresponding values.   i use this method for 
catalogs - and even backend interfaces, for which the client can 
add/edit/delete products.  everything seems to be working fine, and 
there doesn't seem to be a need for MySQL or anything.  i was wondering 
if there is anything i'm not thinking of that perhaps would push me to 
favor using php and mysql instead of the plain old text file.



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




RE: [PHP] Is php even right for this design?

2002-09-19 Thread David Buerer

1) Large Includes
200K of includes? Piece of cake!  Remember, it is the server that is doing
all of the work, not your clients.  The issue is how many requests can your
server simultaneously process and is there enough overhead to do it.  With
respect to speed, your server will cache the files after their first and
repeated use, so you won't have to pull them from disk every single time.


2)Long Processes.
3)Reporting.

Neither one of these things is a problem with PHP.  The pdf library
suggestion is a great one for reports. However, if it were me I would write
a secondary app in my language of choice, like VB, foxpro, java, (but not
access) which would still give me direct access to my data but would allow
for some of the advanced admin/reporting tasks that PHP just didn't do well.

Now, if everything must be web based, than you are limited to java or php or
vbscript or other web langauges.

4)Loosely Typed Variables.

mysql CAN BE very specific in it's typing requirements. PHP is a bit loose,
but frankly html is looser.  As the developer you have control to be as
stricht as possible and validate/format all data any way you want.  PHP has
the tools to do this.

me.

5.) But If there's a better framework for developing such an app, please let
me
know.


Maybe there is, maybe there isn't.  PHP will certainly drop the development
time significantly.  Give your requirements, I see no reason why you
shouldn't move forward.



[PHP] Sessions /Cross Domain

2002-09-18 Thread David Buerer

Are sessions domain specific?
 
What I mean is this.
 
Suppose I have two websites:
secure.web.com
www.web.com http://www.web.com 
and both web sites point to the same set of data.
 
If I looking at web page http://www.web.com/index.html
http://www.web.com/index.html  and have a set of session variables defined
and then I call the page https://secure.web.com/index.html
https://secure.web.com/index.html  do I still have access to the same
session variables?



RE: [PHP] Sessions /Cross Domain

2002-09-18 Thread David Buerer

I do have control over the content of both domains...in fact right now it's
the identical contenteven the same physical data store on the disk, I
just seem to be losing session variables for one reason or another.

DAvid

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 18, 2002 11:06 AM
To: David Buerer
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP] Sessions /Cross Domain


Domains are specific, and so you do not get the same sesion variables.
here's are
ways around this, but you need control of the content of both servers.

Cheers,
Rob.

David Buerer wrote:
 
 Are sessions domain specific?
 
 What I mean is this.
 
 Suppose I have two websites:
 secure.web.com
 www.web.com http://www.web.com
 and both web sites point to the same set of data.
 
 If I looking at web page http://www.web.com/index.html
 http://www.web.com/index.html  and have a set of session variables
defined
 and then I call the page https://secure.web.com/index.html
 https://secure.web.com/index.html  do I still have access to the same
 session variables?

-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'



RE: [PHP] Extracting Numbers from a string.

2002-09-12 Thread David Buerer

OK y'all, go ahead and shoot me, but this is what I'd do:

$mystring=enters $56.55 for example;
$mynumber=$mystring+1-1;

$mynumber now equals 56.55  If you want the . to go to, use the other
methods.

-Original Message-
From: Jason Caldwell [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 3:31 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Extracting Numbers from a string.


I need to extract the numbers only from a field.

For example:  I have an AMOUNT field and so that I can filter out any user
typo's I would like to extract the numbers only.

If the user enters $56.55 for example or just $56 then I would like to be
able to remove the $ and the . keeping just the 56 or 5655.

Can I use eregi_replace() to do this -- I've been trying but it doesn't seem
to work right.

Thanks.
Jason



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




RE: [PHP] Re: unless something...

2002-09-12 Thread David Buerer

True, but isn't unless just a negated while?


q.e.d.

while ($c==$a OR $c==$b) 
{
  blabla
  exit 0
}


-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 12, 2002 10:28 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Re: unless something...


There is no 'unless' in PHP, so you just have to grind it out. If you are
searching for known strings, rather than string *patterns*, use the strstr()
function here: http://www.php.net/manual/en/function.strstr.php.

So, something like:

if(!strstr($c,$a)  !strstr($c,$b)) {
  bla;
  exit;
}

Completely untested ;) If you are looking for patterns, see preg_match(),
linked to from the link above.

Kirk

 Magnus Solvang [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  I'm used to the unless-statement in perl... How do I do this:
 
if string A or B are NOT in string C, then do something and quit.
 
  In perl, I would do this:
 
  unless ($c =~ /$a|$b/) {
blabla
exit 0
  }

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




RE: [PHP] Re: mysql query

2002-09-11 Thread David Buerer

Look into the LIMIT command, it will limit the number of rows in the result
set to the number you specify

-Original Message-
From: bill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:10 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: mysql query


function mysql_one_element($query, $element) {
  // quickly returns just one element from a query
  $one=mysql_query($query);
  // add error checking here if you wish
  $r=mysql_fetch_array($one);
  $thisvalue=$r[$element];
  return($thisvalue);
}

$row=mysql_one_element(select euro from brandstofprijzen where id=2,
euro);

Chris Schoeman wrote:

 I use the script below to get one value out of a database:

 $result = mysql_query(select euro from brandstofprijzen where id=2)
 or die (mysql_error());
 while ($row = mysql_fetch_array($result))
 {
 $euro = $row[euro];
 }
 mysql_free_result($result);

 This is working fine, but is there an easier (less code) way to do
 this?

 Thankx


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




RE: [PHP] basic voting

2002-09-11 Thread David Buerer

Justin, you've just asked for a way to restrict the possible number of votes
from any one person to 1, however, you don't want to find out anything about
that person!

Although I certainly understand your position, you either have to get from
them some information specific to the person, like, name, email, DL, SSN,
and only allow one vote entry per id, or you have track based on cookie, ip
address, etc.  A simple non-obtrusive way would be to track by IP, but then
you've got the problem of users behind proxies, or multiple users at one
computer, or 

You pretty much have to ask for something like email or name, or be willing
to accept multiple votes from the same person.

Sorry.


-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:34 AM
To: php
Subject: [PHP] basic voting


Hi,

I'm looking to implement very basic like it | hate it voting for a product
on a site, but I'd like to implement some simple (or not so simple) ways of
ensuring people don't vote over and over and over.

1. I could set a cookie.  Sure, they could delete the cookie and re-vote
though, and those without cookies will be able to repeat vote.

2. To prevent automated voting, I can make sure that the votes are POSTed,
not done through GET, but if people really wanted, they could still get
around it.

3. I can restrict voting to logged in members, but I don't think I want to
be that restrictive.


Am I missing something obvious?  Or do you just use a combo of 1 + 2???


Justin French


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




RE: [PHP] Re: mysql query

2002-09-11 Thread David Buerer

sorry bill, i misunderstood your question.  I thought you wanted to only
return one row, not just get one value. Given my new understanding, I would
do something like this which is only a slight variant on what you did
 
 $result = mysql_query(select euro from brandstofprijzen where id=2) or
die (mysql_error()); 
$row=mysql_fetch_array($result);
$euro =$row[0]; 

 -Original Message-
From: bill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 7:50 AM
To: David Buerer
Subject: Re: [PHP] Re: mysql query



Maybe I wasn't clear.  The value returned should be called euro not row 

I didn't think I needed LIMIT because the query should be written to only
get one row; at least the function only returns the first row. 


kind regards, 


bill 


David Buerer wrote: 


  

Look into the LIMIT command, it will limit the number of rows in the result
set to the number you specify 


-Original Message- 
From: bill [ mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] 
Sent: Wednesday, September 11, 2002 7:10 AM 
To: [EMAIL PROTECTED] 
Subject: [PHP] Re: mysql query 


function mysql_one_element($query, $element) { 
  // quickly returns just one element from a query 
  $one=mysql_query($query); 
  // add error checking here if you wish 
  $r=mysql_fetch_array($one); 
  $thisvalue=$r[$element]; 
  return($thisvalue); 
} 


$row=mysql_one_element(select euro from brandstofprijzen where id=2,
euro); 


Chris Schoeman wrote: 


 I use the script below to get one value out of a database: 
 
 $result = mysql_query(select euro from brandstofprijzen where id=2) 
 or die (mysql_error()); 
 while ($row = mysql_fetch_array($result)) 
 { 
 $euro = $row[euro]; 
 } 
 mysql_free_result($result); 
 
 This is working fine, but is there an easier (less code) way to do 
 this? 
 
 Thankx 


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




RE: [PHP] basic voting

2002-09-11 Thread David Buerer

Since you haven't divulged your task, I'm guessing from comments that
receving 24 votes from faked emails is a really bad thing. In that case you
have no choice but to thoroughly authenticate your users!  Hey, at least
it's not a complicated thing to do, just kind of pain on everyones end.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 8:10 AM
To: David Buerer; '[EMAIL PROTECTED]'
Subject: Re: [PHP] basic voting


on 12/09/02 12:12 AM, David Buerer ([EMAIL PROTECTED]) wrote:

 Justin, you've just asked for a way to restrict the possible number of
votes
 from any one person to 1, however, you don't want to find out anything
about
 that person!

I'd consider that a restriction to getting lots of votes in a quick
manner... :)


 Although I certainly understand your position, you either have to get from
 them some information specific to the person, like, name, email, DL, SSN,
 and only allow one vote entry per id, or you have track based on cookie,
ip
 address, etc.  A simple non-obtrusive way would be to track by IP, but
then
 you've got the problem of users behind proxies, or multiple users at one
 computer, or 

IP address' aren't an option.

 You pretty much have to ask for something like email or name, or be
willing
 to accept multiple votes from the same person.

There's NOTHING to stop me from entering 24 different names or email
address', so I don't consider these options either.


 Sorry.

It's not your fault :)


Justin French




RE: [PHP] Will return break loop?

2002-09-11 Thread David Buerer

really quik answer...

yes.

really long answer...
from php manual:

the return() statement immediately ends execution of the current function,
and returns its argument as the value of the function call.


-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 11, 2002 2:57 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Will return break loop?


Really quick question.  Will return break a loop inside a function?

Example..
myfunc()
{
while($val=0)
{
if ($i=128)
{
return true;  //-break or no?
}
}
}

I know I could easily figure this out my own but I do not have the means to
test it right now.  :)

Much thanks!
Kevin


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




RE: [PHP] Help getting count to show up.

2002-09-10 Thread David Buerer

SELECT feild1, field2, COUNT([insert field name here]) FROM tables GROUP BY
category,format

--or--

SELECT feild1, field2, COUNT([insert field name here]) as mycount FROM
tables GROUP BY category,format

-Original Message-
From: Chuck Payne [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 3:25 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Help getting count to show up.


Hi,

Last night I asked for help doing counts. One of the answers I got was
really great but I can't make it work. The answer I more or less show me a
great way to create a stats page,

ex. SELECT feild1, field2, COUNT(*) FROM tables GROUP BY category, format.

But my problem is I can't get count to show. I can get two of the fields.

Below is the PHP program that I am wanting to run. How can I get count to
show? Thanks.

Chuck Payne
Magi Design and Support




?

$db = mysql_connect('localhost','user','passwd');
mysql_select_db('media',$db);

$result =mysql_query(SELECT category, format, COUNT(*) FROM library GROUP
BY category, format,$db);

if ($myrow = mysql_fetch_array($result)) {

// display list if there are no records to display

do  {



printf(%s %s %sbr, $myrow[category], $myrow[format],
$myrow[count]);

} while ($myrow = mysql_fetch_array($result));

} else {

// no record to display

echo 'Sorry no records were found!';

}


?



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




RE: [PHP] Upload Progress

2002-09-09 Thread David Buerer

Ya' know guys i'm sitting here thinking about this problem because I have
the same problem on one of my sites.  A bunch of inpatient stupid users whom
are click happy when they get impatient. Event a 100K upload can take to
long!

I don't like the ASP idea.  It's really not a good solution.  I'm almost
wondering if a JAVA solution which can do FTP directly or maybe a direct
socket connection/transfer with Macromedia Flash would work. Both of these
ways you could better monitor what's going on at the packet level and
therefore giving a lot of control over something like a progress bar.  Who
knows.  It's got to be something other than PHP though because PHP is after
all only a server side language.

-Original Message-
From: Jed Verity [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 11:08 AM
To: Jay Blanchard; [EMAIL PROTECTED]
Subject: Re: [PHP] Upload Progress


You're right about it costing more money. But we had one server handling a
bunch of uploads, most of them over 25 MB, and 99% being instigated by very
impatient, not very technical, people. People who kept canceling and
canceling, despite our directions, because they thought it was stuck or
frozen or taking too long. It was worth $150 for us to buy the ASP component
(I think we used ABCUpload, maybe?). The development time required for a
creative PHP solution -- and one that might not have worked as well -- would
have been dramatically more expensive than the almost out-of-the-box
solution with ASP's components. (And much of the site was already written in
ASP.)

Other than that, you'll get know argument from me about ASP vs. PHP. I'm
head over heels for PHP and, in any context other than the one stated above
(and maybe one or two others), I would choose to use God Blessed PHP over
anything else.

Cheers!
Jed

P.S. I knew I'd get some fighters with that comment. Haven't learned my
lesson yet... ;-)

On the threshold of genius, Jay Blanchard wrote:

 [snip]
 There really isn't a great solution for this, that I know of. It's one of
 the few things that makes an argument for ASP over PHP, as far as I'm
 concerned (if you have the luxury of choosing). Below is what I did once
to
 try to get around the problem. It worked *okay*.
 [/snip]
 
 How does this argue for ASP over PHP? I don't see how. File upload on PHP
is
 built in and therefore free. ASP file upload mechs cost more money. And,
 having used ASP for a while, and having looked for this feature, no upload
 progress bar exists there either. And PHP is a language, where ASP is a
 service ... please do not confuse the two. If you want to argue VBScript
vs.
 PHP , well ,come on ... let's go. :^] PHP can beat VBScript with one
 curly-brace tied behind its back.
 
 I mentioned a while back, when this came up before (see the archives) that
 this could probably be done with an IFRAME in the upload dialog box. Now I
 haven't given this much thought, but maybe it could be done. The largest
 problem that I see is the communication back and forth between client and
 server. The server would have to know the original size of the file at the
 point the upload is started, then it would be checked for original_size
 minus bits_uploaded, flush the reults to the IFRAME drawing a GD graph,
and
 continue to do this as it went on.
 
 Another method is to start the upload with a non-progressive animation
that
 quits when is_upload_file() returns true.
 
 Jay
 
 


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




RE: [PHP] RE: Session seams to be clearing randomly

2002-09-09 Thread David Buerer

I would bet money on the fact that one of your pages doesn't have a session
start in it. Or there is a link which which requires resets the browser and
initiates the creation of  new session. I've had some problems before with
javascript and top.window.location redirections that when set to
http://site/file.php instead of just  /file.php it resets the session.

-Original Message-
From: David Cramblett [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 09, 2002 11:38 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] RE: Session seams to be clearing randomly


Additionally,

I forgot to mention that the session file is still viewable in the tmp 
directory after the session clears.

David

David Cramblett wrote:

   Hello,

 I am having trouble with my session clearing after a few clicks around 
 the application.  The session is started in a header which is loaded 
 first on every page in my application and I can not isolate the 
 clearing to one page or link, it seams to be random.  I can click 
 maybe 10 - 20 links, even back and forth between the same two links 
 and then the session clears for no apparent reason.  I use almost 
 identical session handling and startup on many other applications on 
 different servers, I only seem to have this problem on this particular 
 server.

 PHP is running as an Apache module on a Linux/Intel server and my 
 application uses a Postgres DB Back End.  PHP is version 4.1.2. (Yes I 
 would like to be using the most current version but this is not my 
 server, so please don't suggest an update, unless you know that there 
 was a problem with this in older versions of PHP that can be worked 
 around.)

 Session Lifetime is set to 0  and Session Garbage Collection is set to 
 24 minutes in the php.ini file.

 Thanks,

 David





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




RE: [PHP] Web based FTP client

2002-09-06 Thread David Buerer

Reading the users hard drive is impossible from php, but it's really easy
with Java.

-Original Message-
From: Jon Haworth [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 7:49 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Web based FTP client


Hi Mark,

 I am trying to build or find a web FTP client.
 I want it to look like a windows based FTP client a list box on one
 site for the user's file system and a list box on the other for the 
 ftp server.

A couple of iframes side by side should let you do that.

The biggest problem I can see you hitting is reading the contents of the
user's hard drive... usually this is impossible, for good reasons.


Cheers
Jon

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




IRE: [PHP] Web based FTP client

2002-09-06 Thread David Buerer

That's been one of the major problems i've encoutered as well because PHP is
a server based language (what you've got,) not a client based language (what
you need.)  If i had to write a web based ftp client.  I would do some
exploring with Java, or flash, activeX, or ? all languages which can
open up direct socket connections and maybe you can even find some libraries
with pre-built in ftp functions.  Do some searching on the web and see what
shows up.

David

-Original Message-
From: Mark McCulligh [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 9:17 AM
To: David Buerer
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Web based FTP client


Do you mean use a Java Applet or JavaScript.

I know how to browse the user's file system using JavaScript or VBScript if
I use the ActiveX object FileSystemObject but then the site will only work
on IE. I don't like build sites that only work for one browser.

But even if I create a page that lets the user browse their own computer and
the FTP Server using a combo of JavaScript, PHP and HTML frames.  I still
don't know how to ftp right from the client side browser without using the
INPUT tag file and upload, not ftp.

Mark.
_
Mark McCulligh, Application Developer / Analyst
Sykes Canada Corporation www.SykesCanada.com
(888)225-6824 ex. 3262
[EMAIL PROTECTED]
- Original Message -
From: David Buerer [EMAIL PROTECTED]
Newsgroups: php.general
To: [EMAIL PROTECTED]
Sent: Friday, September 06, 2002 11:24 AM
Subject: RE: [PHP] Web based FTP client


 Reading the users hard drive is impossible from php, but it's really easy
 with Java.

 -Original Message-
 From: Jon Haworth [mailto:[EMAIL PROTECTED]]
 Sent: Friday, September 06, 2002 7:49 AM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] Web based FTP client


 Hi Mark,

  I am trying to build or find a web FTP client.
  I want it to look like a windows based FTP client a list box on one
  site for the user's file system and a list box on the other for the
  ftp server.

 A couple of iframes side by side should let you do that.

 The biggest problem I can see you hitting is reading the contents of the
 user's hard drive... usually this is impossible, for good reasons.


 Cheers
 Jon

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






RE: [PHP] Web based FTP client

2002-09-06 Thread David Buerer

no more of a security breach than any other ftp client a user would make the
CHOICE to use.  Hey, it's our responsibility as developers to make things as
secure as possible...but only to the point that we continue to help meet the
needs of our clients.  When we stop meeting the needs because of our
obsession with security we've failed.

-Original Message-
From: Chris Hewitt [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 06, 2002 11:11 AM
To: Mark McCulligh
Cc: David Buerer; [EMAIL PROTECTED]
Subject: Re: [PHP] Web based FTP client


Mark McCulligh wrote:


I know how to browse the user's file system using JavaScript or VBScript if
I use the ActiveX object FileSystemObject but then the site will only
work

Sounds like a massive security breach.

Chris




[PHP] file download/open and ie bug

2002-09-05 Thread David Buerer

I'm using version 6 of IE and Netscape

I'm allowing the user to open/dowload a file from a secure locaiton on our
server.  Under Netscape it works great!  Under IE, it doesn't work at all.
IE complains about not being able to read from the server.

Anyone know of any workarounds?

here's the command I send:

header(Content-type: {$mimetype[PDF]} \n);
header(Content-transfer-encoding: binary\n); 
header(Content-length:  . filesize($fname) . \n);
readfile($fname);



RE: [PHP] sort dinamic generated table

2002-09-05 Thread David Buerer

stick the values in an array and use asort() to sort it.

-Original Message-
From: Rodrigo Peres [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 05, 2002 8:30 AM
To: PHP
Subject: [PHP] sort dinamic generated table


Hi,

I have a resume system that put a rank in it resume at runtime. example: If
you do a serach for each match that it finds it atribute 1 point, now I need
to sort the generated list based in this rank, how can i do this, since this
rank is dinamic and isn't in database??

Thank's


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




RE: [PHP] question

2002-09-04 Thread David Buerer

while($a) { [statments]  }
while($b) { [statments]  }
while($c) { [statments]  }

or 

while(isset($a)) { [statments] }
while(isset($b)) { [statments] }
while(isset($c)) { [statments] }

would both work well depending on your particular situation


-Original Message-
From: Richard Black [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, September 04, 2002 7:32 AM
To: [EMAIL PROTECTED]; Php-General
Subject: RE: [PHP] question


Can you provide a bit more info??? Maybe a real life example of what
you're trying to accomplish???

Richy

==
Richard Black
Senior Developer, DataVisibility Ltd - http://www.datavisibility.com
Tel: 0141 951 3481
Email: [EMAIL PROTECTED] 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
Sent: 04 September 2002 15:26
To: [EMAIL PROTECTED]
Subject: [PHP] question


I have a php question.

I would like to enter a while loop, but:
I want it to be like this:

when $a has a value, while $a...
when $b has a value, while $b... (same statements as with $a) when $a
has a value, and $b has a value, while $a and $b

this is based on a search system in which the user can enter a, b or a
and b. 

Can you help me with my problem, or help me find someone who can?!

Thanks.

Dore van Hoorn.


-- 
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] Fun with Binary Numbers

2002-08-28 Thread David Buerer

Here's a question,

Say I have a binary number like this

1101 0100 0110 0110

And I want to pull out of the binary number the third quartet (is that the
right word)

I want to know how to apply the mask

   

to the number above so that the result would be
0100

Likewise, given
the number: 1101 0100 0110 0110
and the mask   
the result  0110

I suppose this is the same algorithm used to separate the host from the node
address given an IP address and a subnet mask.  I just need to know what the
algorithm is.

Thanks
David




[PHP] unable to lookup host [1001] error

2002-08-21 Thread David Buerer

Anyone ever seen this error before?  What causes it?  It happens on a call
to socket_bind after a successful call to socket_listen.

Any ideas would be appreciated.

Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
stack overflowed. in
f:\public\www\josiah\josiah2\consultation\chat\test_server.php on line 31
AIEE -- Couldn't bind! 



RE: [PHP] unable to lookup host [1001] error

2002-08-21 Thread David Buerer

Here is the code per your request

?php

//includes
include('common.phpi');
include('constants.phpi');

// defaults...
define('MAXLINE', 1024);// how much to read from a socket at a time
define('LISTENQ', 10);  // listening queue
$PORT = 1482;  // the default port to run on
$FD_SETSIZE = 5;   // file descriptor set size (max number of
concurrent clients)...

set_time_limit(240);

$db_master=dbconnect($database_consultation);
mysql_query(DELETE FROM livechat);  //delete all old records left over
from a possible server crash or other anomoly

// set up the file descriptors and sockets...

// $listenfd only listens for a connection, it doesn't handle anything
// but initial connections, after which the $client array takes over...

$allset = socket_fd_alloc();
$listenfd = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($listenfd)
{ print Listening on port $PORT\n; }
else
{ die(AIEE -- socket died!\n); }

socket_setopt($listenfd, SOL_SOCKET, SO_REUSEADDR, 1);
if (!socket_bind($listenfd, '172.25.190.4', $PORT))
{
socket_close($listenfd);
die(AIEE -- Couldn't bind!\n);
}
socket_listen($listenfd, LISTENQ);
.
.
.
.
.

// set up our clients. After listenfd receives a connection,
// the connection is handed off to a $client[].

-Original Message-
From: Andrew Brampton [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 21, 2002 9:42 AM
To: David Buerer
Subject: Re: [PHP] unable to lookup host [1001] error


Show the code and we might be able to help better...
maybe line 20-35 ish, or anything you feel useful

thx
Andrew
- Original Message -
From: David Buerer [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, August 21, 2002 3:39 PM
Subject: [PHP] unable to lookup host [1001] error


 Anyone ever seen this error before?  What causes it?  It happens on a call
 to socket_bind after a successful call to socket_listen.

 Any ideas would be appreciated.

 Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
 stack overflowed. in
 f:\public\www\josiah\josiah2\consultation\chat\test_server.php on line 31
 AIEE -- Couldn't bind!





[PHP] Unexplained Socket Error

2002-08-20 Thread David Buerer

Anyone know why I might get this error?

I was working on development of a socket server several weeks ago and it was
working fine.  When I returned to it this morning, I am getting this error:

Listening on port 1482 (sucess message from socket_create)
Warning: socket_bind() unable to lookup host [1001]: Recursion too deep,
stack overflowed. in test_server.php on line 31
AIEE -- Couldn't bind! (failure message from socket_bind)

Line 31 says : 
if (!socket_bind($listenfd, 172.25.190.4, $PORT))
{
socket_close($listenfd);
die(AIEE -- Couldn't bind!\n);
}




[PHP] HTML - iframe

2002-08-19 Thread David Buerer

Yes I know it's a PHP list, but I thought someone might have an idea on how
to fixt this problem anyway.

I have a page with (2) iframes.  While the source file for the iframes is
being loaded, the iframe shows up as a big white area, similar to a
textarea.  How do I make it so this doesn't happen?



[PHP] secure files acess

2002-08-16 Thread David Buerer

I have a bunch of files which need to be kept secure. I need to allow a user
access to them them based on a criteria which I can programmatically
determine.

My question, is how can I allow the user to download or view only one file
on my computer without allowthem to just enter the URL into their browser of
the file and view it?



RE: [PHP] secure files acess

2002-08-16 Thread David Buerer

Thankyou Robert, THat is a great and easy way to do it.

What if I need to initiate a download to the user?

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 2:06 PM
To: David Buerer
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP] secure files acess


David Buerer wrote:
 
 I have a bunch of files which need to be kept secure. I need to allow a
user
 access to them them based on a criteria which I can programmatically
 determine.
 
 My question, is how can I allow the user to download or view only one file
 on my computer without allowthem to just enter the URL into their browser
of
 the file and view it?

Have a php script authenticate the user, then if authenticated, use the
reafile() function to output it to the user directly. Since PHP can see
more than just the web space the files just need to reside outside of
the websapce.

Cheers,
Rob.
-- 
.-.
| Robert Cummings |
:-`.
| Webdeployer - Chief PHP and Java Programmer  |
:--:
| Mail  : mailto:[EMAIL PROTECTED] |
| Phone : (613) 731-4046 x.109 |
:--:
| Website : http://www.webmotion.com   |
| Fax : (613) 260-9545 |
`--'



Re: [PHP] Automatically send email on special day

2002-08-15 Thread David Buerer

Hey guys, you're all making this too dificult.

Windows NT, Windows 2000, Windows XP, and even Window 98 all have a built in
schedule utility.  On NT, it's accessed via the AT command. In order to use
it, the Scheduler system service must be installed.

Once it's installed, tell it to call the PHP executable with the script
which sends the emails as the first paramter.  For example, on widnow NT you
could schedule the following:

AT 06:00 /every:M,T,W,Th,F,Sa,Su c:\myscripts\gobirthday.bat

The contents of gobirthday.bat would be only one line,
c:\php\php.exe c:\myscripts\gobirthday.php

then every day at 6:00am the batch file gobirthday.bat would be ran which
executes the gobirthday.php script.  now it doesn't matter whehter you have
visitors at all to your site. Every morning the birthday emails will get
sent.

David


- Original Message -
From: Liam MacKenzie [EMAIL PROTECTED]
To: NoWhErEMan [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, August 14, 2002 10:11 PM
Subject: Re: [PHP] Automatically send email on special day


 when the function excecutes, it checks the current date, then looks in a
 little textfile, if it's a match, it stops the script, but if the text
file
 says a different date, it processes the scripts then updates the text
file.

 Follow me?
 You could also use a MySQL database.




 - Original Message -
 From: NoWhErEMan [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Thursday, August 15, 2002 3:08 PM
 Subject: Re: [PHP] Automatically send email on special day


 I can ensure ar least one visitor per day, that;s me!!
 Since my server in on my local windows mechine, i can load the page at
start
 up.
 But i have a question, how can i ensure the script only runs once though,
 per day?
 I think it is related to coding
 Say, my index.php have a script to check current day and send the email if
 birthday.
 However, when more than one visitor on index.php, it will send duplicated
 email

 Nowhereman
 César aracena [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D
 :001e01c24414$789a5490$[EMAIL PROTECTED]
 Not ignored Lian. That idea is great but only if you are 100% sure that
 your site is going to have at least one visitor per day. If you want to
 setup a script like that in your pet's dedicated page, which maybe will
 not have that many visitors at first, you will probably miss a lot of
 appointments. In the other hand, if Hotmail or Yahoo want to do that...
 fine... I think they WILL have at least ONE visitor per day for sure.

 C.

  -Original Message-
  From: Liam MacKenzie [mailto:[EMAIL PROTECTED]]
  Sent: Thursday, August 15, 2002 1:22 AM
  To: 'NoWhErEMan'; [EMAIL PROTECTED]
  Subject: Re: [PHP] Automatically send email on special day
 
  Hey, if you don't have access to CRON, you could try and include the
 page
  in
  your index.php.
  Set it so it only runs once though, per day.  That means that as soon
 as
  someone visits your site they activate it for that day.  It'd only
 work if
  you had the traffic though.
 
  Just an idea.
 
  Then again, I'm having one of those days
 
  Ignore me...
 
 
  - Original Message -
  From: César Aracena [EMAIL PROTECTED]
  To: 'NoWhErEMan' [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Thursday, August 15, 2002 2:17 PM
  Subject: RE: [PHP] Automatically send email on special day
 
 
  This have been very much discussed in this list, and the only logical
  way of doing this through PHP would be to have a script that reads the
  actual date of the server's system once a day, but that would be just
  impossible without having that script (page) reloaded at least once a
  day.
 
  I think there are two way of doing this. First, would be to setup a
 cron
  job under unix (which I don't know so I'm guessing here) and second,
  which is the easiest, would be to have that script in a page with
  refreshing META tags, so it would refresh itself every 24 or 12 hours.
 
  Does this make any sense? C.
 
   -Original Message-
   From: NoWhErEMan [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, August 15, 2002 1:03 AM
   To: [EMAIL PROTECTED]
   Subject: [PHP] Automatically send email on special day
  
   Hi all,
   My site maintain a list of members, which i knew their birthday, and
 i
   want
   to send a email greeting to them on their birthday, of course,
   automatically.
  
   How can i do that?
  
   Thanks in advance
   Nowhereman
  
  
  
   --
   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 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 General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP General 

RE: [PHP] Automatically send email on special day

2002-08-15 Thread David Buerer

Sorry if my reply set you off. It was late. I might have said something
stupid.  I was tired. I should have gone to bed and ignored it.  You're
right though, it's pretty important to say I don't have full access to my
web server in your message when you don't.  I guess I was keying off of
NoWhErMan's statment Since my server in on my local windows machine which
I interpreted to mean that he had control of the the machine.  Maybe I was
wrong.

DAvid

-Original Message-
From: César Aracena [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 6:29 AM
To: 'David Buerer'; [EMAIL PROTECTED]
Subject: RE: [PHP] Automatically send email on special day


David. This is for you to note, as well as most of the people of this
list who think that ALL OF US use own our computers as Internet Servers,
being able to make CRON jobs or scheduling... well, WE DON'T. Some of us
don't even has cable modem or steady connection and need to build up web
sites trough a Dial Up connection and using a remote server... that's
way there are some of us who are trying to solve these kind of problems
through the scripts themselves and skip the server-side part...

I'm tired of watching replies like just make a CRON job or set up a
scheduled task so from now on, I will be including no server reach or
something like that into all my messages and suggest that all the people
who's also in my situation to do the same, so others don't forget it...
please don't take me wrong, I just want to avoid large amounts of
unusable messages.

Hope you understand, C.

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 15, 2002 3:26 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Automatically send email on special day
 
 Hey guys, you're all making this too dificult.
 
 Windows NT, Windows 2000, Windows XP, and even Window 98 all have a
built
 in
 schedule utility.  On NT, it's accessed via the AT command. In order
to
 use
 it, the Scheduler system service must be installed.
 
 Once it's installed, tell it to call the PHP executable with the
script
 which sends the emails as the first paramter.  For example, on widnow
NT
 you
 could schedule the following:
 
 AT 06:00 /every:M,T,W,Th,F,Sa,Su c:\myscripts\gobirthday.bat
 
 The contents of gobirthday.bat would be only one line,
 c:\php\php.exe c:\myscripts\gobirthday.php
 
 then every day at 6:00am the batch file gobirthday.bat would be ran
which
 executes the gobirthday.php script.  now it doesn't matter whehter you
 have
 visitors at all to your site. Every morning the birthday emails will
get
 sent.
 
 David
 
 
 - Original Message -
 From: Liam MacKenzie [EMAIL PROTECTED]
 To: NoWhErEMan [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Wednesday, August 14, 2002 10:11 PM
 Subject: Re: [PHP] Automatically send email on special day
 
 
  when the function excecutes, it checks the current date, then looks
in a
  little textfile, if it's a match, it stops the script, but if the
text
 file
  says a different date, it processes the scripts then updates the
text
 file.
 
  Follow me?
  You could also use a MySQL database.
 
 
 
 
  - Original Message -
  From: NoWhErEMan [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Thursday, August 15, 2002 3:08 PM
  Subject: Re: [PHP] Automatically send email on special day
 
 
  I can ensure ar least one visitor per day, that;s me!!
  Since my server in on my local windows mechine, i can load the page
at
 start
  up.
  But i have a question, how can i ensure the script only runs once
 though,
  per day?
  I think it is related to coding
  Say, my index.php have a script to check current day and send the
email
 if
  birthday.
  However, when more than one visitor on index.php, it will send
 duplicated
  email
 
  Nowhereman
  César aracena [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D
  :001e01c24414$789a5490$[EMAIL PROTECTED]
  Not ignored Lian. That idea is great but only if you are 100% sure
that
  your site is going to have at least one visitor per day. If you want
to
  setup a script like that in your pet's dedicated page, which maybe
will
  not have that many visitors at first, you will probably miss a lot
of
  appointments. In the other hand, if Hotmail or Yahoo want to do
that...
  fine... I think they WILL have at least ONE visitor per day for
sure.
 
  C.
 
   -Original Message-
   From: Liam MacKenzie [mailto:[EMAIL PROTECTED]]
   Sent: Thursday, August 15, 2002 1:22 AM
   To: 'NoWhErEMan'; [EMAIL PROTECTED]
   Subject: Re: [PHP] Automatically send email on special day
  
   Hey, if you don't have access to CRON, you could try and include
the
  page
   in
   your index.php.
   Set it so it only runs once though, per day.  That means that as
soon
  as
   someone visits your site they activate it for that day.  It'd only
  work if
   you had the traffic though.
  
   Just an idea.
  
   Then again, I'm having one of those days
  
   Ignore me...
  
  
   - Original Message

[PHP] Keyword exact phrase search

2002-08-15 Thread David Buerer

Has anyone bumped into or written a set of good searching routines? I need
to search across one,two, or three fields in an MySQL database in either
exact phrase (easy) or keyword with relavence (difficult.)  I'm thinking
something like a google/yahoo style search.  I've tried MySQL full text
searches, but the results it returns seem to be just a little to broad and
you end up with a bunch of irrelevant results.  

With respect to the database size that I'm searching in, right now it's
about 20MB but I'm guessing that within the next 24 months it will be up
around 2GB.  The first field I'm searching in is a CHAR(255) field.  The
second field  is a small blob and usually is only about 1 paragraph of text.
The thrid field is an entire HTML document and can be many many pages long.

Any help is appreciated,
David





RE: [PHP] Keyword exact phrase search

2002-08-15 Thread David Buerer

I'd like to agree. But i've speant a lot of time investigating, learning,
and expirimenting with Full Text search and what I've found is that first,
full text does not always return the right results and second and perhaps
more important in my situation is that full text search doesn't work on BLOB
fields.



-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 8:37 AM
To: David Buerer; '[EMAIL PROTECTED]'
Subject: Re: [PHP] Keyword  exact phrase search


I only just started getting into this, but it seems that a LOT of the work
is done for you with MySQL's FULLTEXT stuff Check it out in the MySQL
manual.

Justin French


on 16/08/02 12:59 AM, David Buerer ([EMAIL PROTECTED]) wrote:

 Has anyone bumped into or written a set of good searching routines? I need
 to search across one,two, or three fields in an MySQL database in either
 exact phrase (easy) or keyword with relavence (difficult.)  I'm thinking
 something like a google/yahoo style search.  I've tried MySQL full text
 searches, but the results it returns seem to be just a little to broad and
 you end up with a bunch of irrelevant results.
 
 With respect to the database size that I'm searching in, right now it's
 about 20MB but I'm guessing that within the next 24 months it will be up
 around 2GB.  The first field I'm searching in is a CHAR(255) field.  The
 second field  is a small blob and usually is only about 1 paragraph of
text.
 The thrid field is an entire HTML document and can be many many pages
long.
 
 Any help is appreciated,
 David
 
 
 




RE: [PHP] Keyword exact phrase search

2002-08-15 Thread David Buerer

Because to my knowledge the limitation of a TEXT field is 64K. I need to
store entire documents in the database which far exceed the 64K limitation.
Given that criteria, the only option is to use blob fields which have an
upper limit of roughly 4GB.

-Original Message-
From: Justin French [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 9:08 AM
To: David Buerer
Subject: Re: [PHP] Keyword  exact phrase search


Why would you have text in blob fields?

Justin French


on 16/08/02 1:25 AM, David Buerer ([EMAIL PROTECTED]) wrote:

 I'd like to agree. But i've speant a lot of time investigating, learning,
 and expirimenting with Full Text search and what I've found is that first,
 full text does not always return the right results and second and perhaps
 more important in my situation is that full text search doesn't work on
BLOB
 fields.
 
 
 
 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 15, 2002 8:37 AM
 To: David Buerer; '[EMAIL PROTECTED]'
 Subject: Re: [PHP] Keyword  exact phrase search
 
 
 I only just started getting into this, but it seems that a LOT of the work
 is done for you with MySQL's FULLTEXT stuff Check it out in the MySQL
 manual.
 
 Justin French
 
 
 on 16/08/02 12:59 AM, David Buerer ([EMAIL PROTECTED]) wrote:
 
 Has anyone bumped into or written a set of good searching routines? I
need
 to search across one,two, or three fields in an MySQL database in either
 exact phrase (easy) or keyword with relavence (difficult.)  I'm thinking
 something like a google/yahoo style search.  I've tried MySQL full text
 searches, but the results it returns seem to be just a little to broad
and
 you end up with a bunch of irrelevant results.
 
 With respect to the database size that I'm searching in, right now it's
 about 20MB but I'm guessing that within the next 24 months it will be up
 around 2GB.  The first field I'm searching in is a CHAR(255) field.  The
 second field  is a small blob and usually is only about 1 paragraph of
 text.
 The thrid field is an entire HTML document and can be many many pages
 long.
 
 Any help is appreciated,
 David
 
 
 
 
 




RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread David Buerer

Try this, it should work great.

$starttag='DIV'
$endtag='/DIV'

$pos_starttag=strpos(strtoupper($origstring),$starttag);
$pos_endtag=strrpos(strtoupper($origstring),$endtag)+strlen($endtag);
if($pos_starttag===False OR $pos_endtag===False) return 0;
$newstring = substr(origstring,$pos_starttag,$pos_endtag-$pos_startag-1);

return $newsttring;

-Original Message-
From: Joseph W. Goff [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 9:54 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] so nobody knows how do get rid of everything outside
or certain tags?


preg_match('!div[^]+(.*)/div!Uis',$info,$regs);
$everything_between_divs=$regs[1];

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 11:44 AM
Subject: RE: [PHP] so nobody knows how do get rid of everything outside or
certain tags?


 [snip]
 I asked this question a while ago, and I am still seeking clarification,
 I fooled with ereg_replace and they only do a piece of what I want, I
 would like to know how to keep only a chunk of text defined between 2
 tags let's say, div and /div and ignore everything else, I also have
 to search and replace certain tags between, but I know how to do that
 with ereg_replace. So can anyone help me echo only what is between the
 div tags? Please?
 [/snip]

 Why not take the the beginning div, everything in the middle, and the
end
 /div tag and explode() them into an array and then get what you want and
 write it out? I didn't see your originl post and don't know if there was
 more detail available, but I hope this helps.

 Jay

 I'm not tense.just terribly, terribly alert

 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***



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

2002-07-26 Thread David Buerer

I here ya' there Martin.

ASP is about next on my list. I'm just trying to get javascript and PHP
under my belt a little better firstwell ok, I'm waiting for my next
paying client. I've found that you do have to use what you know to know
whatever you need to do.  I couldn't live without Javascript+PHP+SQL when it
comes to site design.  ASP is next on my list.

-Original Message-
From: Martin Clifford [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:41 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: [PHP] php redirect


I don't know if and haven't learned it so it couldn't be.  After all, 
how
many programming languages does one need to know??

Heh heh heh.  Jack of all trades, master of some.  That's how I look at it.
I'd say you need to know a little of everything.  I know (X)HTML, CSS-1-2-P,
JS, PHP, SQL, etc.  The list just goes on.  And the thing is, I use ALL of
them ALL the time ;o)


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:27 AM
To: 'David Buerer'; [EMAIL PROTECTED] 
Subject: RE: [PHP] php redirect


[snip]
This is the only way I've figured out how to do it.  It seems to work really
well.

if (mysql_db_query ($dbname, $query, $link)) {
  gotourl(myurl1);}
} else {
 gorourl(myurl2);}

function gotourl(myurl)
{
  echo SCRIPT language=javascript;
  echo   window.location=$myurl;;
  echo /SCRIPT\n;
}
[/snip]

Isn't this ASP? ;^]

Jay

My other car is a broom

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*


Martin Clifford
Homepage: http://www.completesource.net
Developer's Forums: http://www.completesource.net/forums/




RE: [PHP] php redirect

2002-07-26 Thread David Buerer

What's ASP

I don't know if and haven't learned it so it couldn't be.  After all, how
many programming languages does one need to know??


-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED]] 
Sent: Friday, July 26, 2002 8:27 AM
To: 'David Buerer'; [EMAIL PROTECTED]
Subject: RE: [PHP] php redirect


[snip]
This is the only way I've figured out how to do it.  It seems to work really
well.

if (mysql_db_query ($dbname, $query, $link)) {
  gotourl(myurl1);}
} else {
 gorourl(myurl2);}

function gotourl(myurl)
{
  echo SCRIPT language=javascript;
  echo   window.location=$myurl;;
  echo /SCRIPT\n;
}
[/snip]

Isn't this ASP? ;^]

Jay

My other car is a broom

*
* Want to meet other PHP developers *
* in your area? Check out:  *
* http://php.meetup.com/*
* No developer is an island ... *
*




RE: [PHP] Speeding up PHP or MySQL

2002-07-25 Thread David Buerer

John,

You made one comment which is caught my attention:

 that's a no go :(  Or is there a way of storing common query results?

If the results to a commonly called query are the same for a time period,
than why don't you right a routine that just stores the results into a new
database that also has a results_expired field.  Then, everytime the results
are request, you can write a function which checks to see if the results are
still valid, if they are, it displays them, if not, it requeries...

i.e.

function getresults($common_query)
{
  $query=SELECT results,TIMESTAMP(expired) as dt_expired FROM storedqueries
WHERE query=$common_query;
  $results=mysql_fetch_object(mysql_query($query)) or error_handler();
  
  if($results-expired =time())
  {
//rebuild long slow query and exectue it so that $results has the result
of the new query and $query is the query
   $update_query=INSERT INTO storedqueryies (query,results,expired) VALUES
($query,$results-results,[expired_time)
   mysql_query($update_query) or error_handler();
  }

  return $results-results;
  
}



-Original Message-
From: John Holmes [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, July 24, 2002 6:49 PM
To: 'Richard Baskett'; 'PHP General'
Subject: RE: [PHP] Speeding up PHP or MySQL


 Is there anyways to speed up MySQL queries?  Or showing the results 
 through PHP? I have several queries that have about 8 left joins or 
 so.. Yes
very
 huge and when you have lots of people using these functions at once it 
 really slows down.. Are there any practices that you can think of that 
 would speed up any sql queries?  I was thinking of using stored 
 procedures,
but
 after a bit of research I found ou= t that MySQL doesn=B9t have that
yet
 so
 that's a no go :(  Or is there a way of storing common query results?
I
 am
 looking for _anything_ that will speed up showing results to large 
 queries..

How about an index on your tables?

---John Holmes...


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




RE: [PHP] pulling records from mysql

2002-07-25 Thread David Buerer

Create a column like.person_id with the auto_incr flag set.  Every
record will be given a unique id starting at 1 and incrementing by 1 each
time.  Then you can query based on person_id field to get an individual
record

-Original Message-
From: Tyler Durdin [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 8:18 AM
To: [EMAIL PROTECTED]
Subject: [PHP] pulling records from mysql


I have a column in my table named firstname with twenty records in it. How 
can i use php to pull out individual records (say for ex. record 16)? Also, 
how could i pull out all records upto number 15? Thanks in advance.



_
Send and receive Hotmail on your mobile device: http://mobile.msn.com


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




RE: [PHP] Paying Job...

2002-07-25 Thread David Buerer

And Tyler...rest assured you would never be working for me with an attitude
like that.  Nor would I ever recommend that you work for one of my clients.

It's not about making as much as you can, it's about making what is fair,
deserved, and reasonable.  Someone else said that what we're providing is a
service. He's right. First you consult with your clients,then you go sit in
a dark room and make it happen. I think that most freelancers will agree
that the job is actually about 30% code writing and 70% consultant.
Consulting and providing quality service is about relationships, honesty,
and ultimatly trust.  Trying to rape your clients just because you can will
not do any of the above.

That's just my point of view.

-Original Message-
From: Tyler Longren [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 9:05 AM
To: Martin Clifford
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] Paying Job...


Why even bother charging money if you aren't out to make as much as you can?
That's just my point of view.

tyler

On Thu, 25 Jul 2002 11:59:28 -0400
Martin Clifford [EMAIL PROTECTED] wrote:

 resists the urge to debate ethics
 
 Why didn't you just say, Charge by whichever will screw the client 
 the worst.?  Jesus.
 
 Martin
 
  Tyler Longren [EMAIL PROTECTED] 07/25/02 11:44AM 
 Charge by which ever will get you the most money.
 
 tyler
 
 On Thu, 25 Jul 2002 11:46:38 -0400
 Gerard Samuel [EMAIL PROTECTED] wrote:
 
  Basically, someone is looking to get a database driven site built, 
  and Ive never written code for money before. Im looking for advice, 
  as to how the experienced coders in here charge
  
  for their work.
  Do you charge by the page, script or by the hour (that would be 
  nice).
  
  Thanks for any input you may provide...
  
  --
  Gerard Samuel
  http://www.trini0.org:81/ 
  http://dev.trini0.org:81/ 
  
  
  
  --
  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 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] pdf to html

2002-07-25 Thread David Buerer

I can think of many reasons why displaying the pdf in the browser is a last
resort and not a first resort.  Especially in situations where the reader is
not installed.  

Like Tyler, I would be quite interested to see if anyone has any ideas on
how to convert from pdf to html.  

-Original Message-
From: Miles Thompson [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, July 25, 2002 10:06 AM
To: Tyler Longren; php-general
Subject: Re: [PHP] pdf to html


Why not just display the pdf's in the browser? The only caveat is that IE 
has to be properly patched if 5.5, and there is the minor inconvenience of 
users having to install the Acrobat Reader. Most people have already done 
that, so it's practically a non-issue.

The manual shows how to feed a pdf stored on disk to a browser. I'd imagine 
extracting and displaying a PDF from a database would be similar to doing 
the same thing for a .jpg.

Miles Thompson

At 10:03 AM 7/25/2002 -0500, Tyler Longren wrote:
Hi,

I've been searching around for ways to convert pdf to html.  I haven't 
had much luck.

I have a client that has a bunch of pdf's stored in a mysql table. They 
don't want their users to have to download the pdf file, they want the 
pdf to be displayed in the web browser all the time.  Google has 
something that allows them to convert pdf to html, so, is it possible 
for me to do the same?

These pdf's are graphic intensive...there's not much plain text.

Thanks everyone,
Tyler

--
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] Windows NT Server, FORK, SOCKETS, and seperate processes

2002-07-22 Thread David Buerer

I've got effectivly a glorified chat server which upon the arrival of a
message thorugh a socket connection goes off and runs a bunch of database
processed.  My questions is this:  How can I seperate the database
processing into a seperate processor process?  I really don't want the chat
server to have to wait until after the database processing is done to go
intercept and process another request--this just doesn't seem right.  I want
the chat server process to be able to deal with getting and receiving
messages, and another process to deal with the database processing.  That
way if one of the processes get's slow, the other isn't affected.  Something
like the fork command would work really well, but fork doesn't exist in NT.
 
Anyone have any ideas?
 
I'm running Windows NT4.0 sp6a
Apache Server 1.3.xx
MySQL
and of course, PHP 4.2.1



RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

2002-07-22 Thread David Buerer

How to I inovoke a new Thread from the middle of a PHP script?

-Original Message-
From: Paul Maine [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 10:08 AM
To: David Buerer; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


You can use threads with NT to accomplish what you are asking.

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 11:29 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


I've got effectivly a glorified chat server which upon the arrival of a
message thorugh a socket connection goes off and runs a bunch of database
processed.  My questions is this:  How can I seperate the database
processing into a seperate processor process?  I really don't want the chat
server to have to wait until after the database processing is done to go
intercept and process another request--this just doesn't seem right.  I want
the chat server process to be able to deal with getting and receiving
messages, and another process to deal with the database processing.  That
way if one of the processes get's slow, the other isn't affected.  Something
like the fork command would work really well, but fork doesn't exist in NT.

Anyone have any ideas?

I'm running Windows NT4.0 sp6a
Apache Server 1.3.xx
MySQL
and of course, PHP 4.2.1




RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

2002-07-22 Thread David Buerer

Yes, that's exactly what I want to do.  But HOW do I do it?

i.e.  I'm sitting in my accept connectinos loop in the chat daemon

While(true)
{
//waitforenwconnection
$new_connection_id=socket_accept();

//got a new connection, go process it
go_do_this_in_a_new_thread($new_connection_id);
}

What do I put in place of go_do_this_in_a_new_thread()

-Original Message-
From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 3:01 PM
To: 'David Buerer'; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


Yes. Write a daemon which listens on a socket and manages the communications
it gets from the satellite scripts and works the database for them...

The scripts send off data, and process replies. They don't do the heavy
work...

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 2:30 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes

How to I inovoke a new Thread from the middle of a PHP script?

-Original Message-
From: Paul Maine [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 10:08 AM
To: David Buerer; [EMAIL PROTECTED]
Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


You can use threads with NT to accomplish what you are asking.

-Original Message-
From: David Buerer [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 22, 2002 11:29 AM
To: '[EMAIL PROTECTED]'
Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processes


I've got effectivly a glorified chat server which upon the arrival of a
message thorugh a socket connection goes off and runs a bunch of database
processed.  My questions is this:  How can I seperate the database
processing into a seperate processor process?  I really don't want the chat
server to have to wait until after the database processing is done to go
intercept and process another request--this just doesn't seem right.  I want
the chat server process to be able to deal with getting and receiving
messages, and another process to deal with the database processing. That way
if one of the processes get's slow, the other isn't affected. Something like
the fork command would work really well, but fork doesn't exist in NT.

Anyone have any ideas?

I'm running Windows NT4.0 sp6a
Apache Server 1.3.xx
MySQL
and of course, PHP 4.2.1




RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s

2002-07-22 Thread David Buerer

I thought about this and it's actually not such a bad idea.  I struggle with
it a little though because it seems like kind of a brute force method.  I'll
end up with an awful lot of PHP.EXE processes going at the same time.
Although it would get the job done, I'm not certain that it's the right
solution. I was hoping for something a little more elegant.  I really like
the pcntl_xxx() functions, but they are only available on UNIX platforms.
And no, UNIX is not an option for this client...they are on Windows and
that's where they're going to stay.

Anyone else have any other ideas?

-Original Message-
From: Evan Nemerson [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 3:47 PM
To: David Buerer; [EMAIL PROTECTED]
Subject: Re: [PHP] Windows NT Server, FORK, SOCKETS, and seperate processe s


Either exec(), system(), or one of the functions like them (check the
manual) 
doesn't wait for anything to return- it just begins executing a new process 
and sends it on its way. Perhaps you could use this and just make whatever 
you want to do a seperate file?



On Monday 22 July 2002 15:09 pm, David Buerer wrote:
 Yes, that's exactly what I want to do.  But HOW do I do it?

 i.e.  I'm sitting in my accept connectinos loop in the chat daemon

 While(true)
 {
   //waitforenwconnection
   $new_connection_id=socket_accept();

   //got a new connection, go process it
   go_do_this_in_a_new_thread($new_connection_id);
 }

 What do I put in place of go_do_this_in_a_new_thread()

 -Original Message-
 From: Demitrious S. Kelly [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 3:01 PM
 To: 'David Buerer'; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 Yes. Write a daemon which listens on a socket and manages the 
 communications it gets from the satellite scripts and works the 
 database for them...

 The scripts send off data, and process replies. They don't do the 
 heavy work...

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 2:30 PM
 To: '[EMAIL PROTECTED]'
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes

 How to I inovoke a new Thread from the middle of a PHP script?

 -Original Message-
 From: Paul Maine [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 10:08 AM
 To: David Buerer; [EMAIL PROTECTED]
 Subject: RE: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 You can use threads with NT to accomplish what you are asking.

 -Original Message-
 From: David Buerer [mailto:[EMAIL PROTECTED]]
 Sent: Monday, July 22, 2002 11:29 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Windows NT Server, FORK, SOCKETS, and seperate 
 processes


 I've got effectivly a glorified chat server which upon the arrival of 
 a message thorugh a socket connection goes off and runs a bunch of 
 database processed.  My questions is this:  How can I seperate the 
 database processing into a seperate processor process?  I really don't 
 want the chat server to have to wait until after the database 
 processing is done to go intercept and process another request--this 
 just doesn't seem right.  I want the chat server process to be able to 
 deal with getting and receiving messages, and another process to deal 
 with the database processing. That way if one of the processes get's 
 slow, the other isn't affected. Something like the fork command would 
 work really well, but fork doesn't exist in NT.

 Anyone have any ideas?

 I'm running Windows NT4.0 sp6a
 Apache Server 1.3.xx
 MySQL
 and of course, PHP 4.2.1

-- 
Man discovers truth by reason only, not by faith.

Leo Nikolaevich Tolstoy




RE: [PHP] Formating datevariables...

2002-07-22 Thread David Buerer

Select TIMESTAMP(date_column) AS mydate

Then when you display it use the date function
DATE('mdY',mydate)

-Original Message-
From: Ragnar [mailto:[EMAIL PROTECTED]] 
Sent: Monday, July 22, 2002 4:42 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Formating datevariables...


I have a column in a mysql table with a timestamp. The value of this column
is for instance:

20020722185242

How do i change the format on this to DDMM (22072002) in php?

Thanx

-R



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




[PHP] Windows Sockets Problem Socket_Read

2002-07-18 Thread David Buerer

I'm trying to setup a basic TCP server which I will later expand.  Right now
I get this error on the loop after it receives data the first time:

Warning: socket_read() unable to read from socket [317]: in
f:\public\www\josiah\josiah2\consultation\chat\test_server2.php on line 43
socket_read() failed: reason: Incorrect function.

Any ideas?  See the server code below. 

?php
/*
 * We don't want any time-limit for how the long can hang
 * around, waiting for connections:
*/
set_time_limit(0);
 
error_reporting (E_ALL);

/* Allow the script to hang around waiting for connections. */
set_time_limit (0);

/* Turn on implicit output flushing so we see what we're getting
 * as it comes in. */
ob_implicit_flush ();

$address = '172.25.190.4';
$port = 10003;

if (($sock = socket_create (AF_INET, SOCK_STREAM, 0))  0) {
echo socket_create() failed: reason:  . socket_strerror ($sock) .
\n;
}

if (($ret = socket_bind ($sock, $address, $port))  0) {
echo socket_bind() failed: reason:  . socket_strerror ($ret) . \n;
}

if (($ret = socket_listen ($sock, 5))  0) {
echo socket_listen() failed: reason:  . socket_strerror ($ret) . \n;
}

do {
if (($msgsock = socket_accept($sock))  0) {
echo socket_accept() failed: reason:  . socket_strerror ($msgsock)
. \n;
break;
}
/* Send instructions. */
$msg = \nWelcome to the PHP Test Server. \n .
To quit, type 'quit'. To shut down the server type 'shutdown'.\n;
socket_write($msgsock, $msg, strlen($msg));

do {
if (FALSE === ($buf = socket_read ($msgsock, 2048))) {
echo socket_read() failed: reason:  . socket_strerror ($ret) .
\n;
break 2;
}
if (!$buf = trim ($buf)) {
continue;
}
if ($buf == 'quit') {
break;
}
if ($buf == 'shutdown') {
socket_close ($msgsock);
break 2;
}
$talkback = PHP: You said '$buf'.\n;
socket_write ($msgsock, $talkback, strlen ($talkback));
echo $buf\n;
} while (true);
socket_close ($msgsock);
} while (true);

socket_close ($sock);
?