Re: [PHP] RE: Reaching the PHP mailing list owners

2007-10-31 Thread Alan Milnes
 I am VERY computer literate, and VERY message-oriented ILLITERATE. I have
 coded HTML for years, and although not a fancy programmer I think my pages
 are OK. Could be better, but OK. (http://www.miscelpage.com,
 http://www.boundarycountyfire.com, http://www.curleycreek.com,
 http://www.theonlinewriter.com, etc. etc., etc)

One thing to watch - it's not strictly a PHP problem but it may
influence the speed of your pages - is that your pages aren't valid
html, see the results from the validator below:-

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.boundarycountyfire.comcharset=%28detect+automatically%29doctype=Inlinegroup=0

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.miscelpage.comcharset=%28detect+automatically%29doctype=Inlinegroup=0

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.theonlinewriter.com%2Fcharset=%28detect+automatically%29doctype=Inlinegroup=0

Best to get these fixed before you go much further.

Cheers

Alan

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



Re: [PHP] if inside an echo.

2007-07-31 Thread Alan Milnes
On 31/07/07, Hulf [EMAIL PROTECTED] wrote:
 I am outputting a selectbox and want to do the follwoing. How can I add the
 IF statement inside the the echo?

Something like this:-

for ($value = 0; $value = 2000; $value += 100) {

 echo option value=\$value\;
 if ($min_rent==$value) {
 echo selected=\selected\;
  }
 echo  $value/option;

Alan

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



Re: [PHP] need help,pls

2007-07-26 Thread Alan Milnes

On 26/07/07, esimaje juan toritseju [EMAIL PROTECTED] wrote:

hi,
  My name is Juan, i need help from you and i will be greatful if you could 
assist me,i have
got an academic project to create a website .Within the page i should create a login 
session  for users ,i will have a database to save designs, i do know how to 
create the database but,  do not know how to create the loggin sessions for users 
and also use flash in


Have a look here for some ideas:-

http://www.intranetjournal.com/php-cms/

Alan

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



Re: [PHP] Strategy when working with designer(s)?

2007-07-24 Thread Alan Milnes

On 24/07/07, Simon [EMAIL PROTECTED] wrote:

I have always seen the programmer as the Leader* of the production of
the project.  He is the one to give the final word on what is Possible
or not, and that is precisely what cause most problems (also known as
scope of the project).


The 'Leader' should be an IT Architect who understands both:

a) what is feasible with the technology and
b) the business problem that is being solved.

His job is to build a design that the various 'workers' (Web Design /
Scripting / DB etc) can then implement within the agreed budget and
timescales.


Simon says 1) Designer does his whole job and shows the design when finished 
and
approved


Well in a dream world that would be nice but I've never seen it happen
in more than 20 years in the industry ...

Alan

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



Re: [PHP] Error on installing under Windows Vista leads to inability to uninstall 5.2.3

2007-07-18 Thread Alan Milnes

On 18/07/07, Stephan G [EMAIL PROTECTED] wrote:

I have tried to install the following on my Windows Vista Home Premium
System:


Ah I see the problem there 

Vista is not a mature OS yet - wait until at least SP1 before trying it.


 1.  How can I uninstall this and remove it from my system?


Best bet is to wipe the disk and install a decent OS - Ubuntu or WinXP perhaps.

Alan

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



Re: [PHP] Finding text in a variable

2007-07-07 Thread Alan Milnes

On 07/07/07, Robert Cummings [EMAIL PROTECTED] wrote:

On Fri, 2007-07-06 at 22:46 +0100, Alan Milnes wrote:
 I have a piece of code which uses curl to get a web page and puts it
 into a variable.  I now need to search that variable and find
 everything between `div class=msgarea` and the next `/div`

 From what I have found elsewhere I think I will need to use a regular
 expression but can anyone point me in the right direction as to
 exactly how I would go about this?

Something like the following:

?php

if( preg_match( '/div class=msgarea(.*)\\/div/Uims', $content,
$bits ) )
{
print_r( $bits );
}

?


Cheers - that did the trick.

Alan

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



Re: [PHP] Using PHP to retrieve a Yahoo Groups Web Page

2007-07-06 Thread Alan Milnes

On 06/07/07, Greg Donald [EMAIL PROTECTED] wrote:


Specifically you need these two options:

CURLOPT_COOKIEFILE
CURLOPT_COOKIEJAR

http://us2.php.net/manual/en/function.curl-setopt.php


Thanks - that was it.

Alan

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



[PHP] Finding text in a variable

2007-07-06 Thread Alan Milnes

I have a piece of code which uses curl to get a web page and puts it
into a variable.  I now need to search that variable and find
everything between `div class=msgarea` and the next `/div`


From what I have found elsewhere I think I will need to use a regular

expression but can anyone point me in the right direction as to
exactly how I would go about this?

Cheers

Alan

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



Re: [PHP] PHP as a strategic BUSINESS language

2007-07-05 Thread Alan Milnes

On 05/07/07, Jochem Maas [EMAIL PROTECTED] wrote:


6. IBM, Oracle and others seem to be less sure about whether php will ever
be a major player in the business solutions arena (often referred to as
'being enterprise ready') ... there may be some way to go in this sense but 
there
are plenty of people doing their best to make it possible by working on the core
of php and developing frameworks/utilities that are up to the job.


I don't think IBM have much doubts:-

http://www.ibm.com/developerworks/opensource/top-projects/php.html

http://www.zend.com/products/zend_core/zend_core_for_ibm

Alan

Disclaimer: I work for IBM but these are my own views.

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



[PHP] Using PHP to retrieve a Yahoo Groups Web Page

2007-07-04 Thread Alan Milnes

I have spent the afternoon trawling the web for how to retrieve a
Yahoo Groups Web Page using PHP.  The best option seems to be curl,
which is installed on my host.  I need to understand how to set the
cookies so that Yahoo accepts my response.

The code I have is:-

$url=http://uk.groups.yahoo.com/group/gameplan/message/17162;;

$c = curl_init ($url);

curl_setopt ($c, CURLOPT_VERBOSE, 1); // For testing
curl_setopt ($c, CURLOPT_COOKIE, PU='t=2');
curl_setopt ($c, CURLOPT_COOKIE, B='fjdqm0h38nja8b=3s=en');
curl_setopt ($c, CURLOPT_COOKIE,
G='v=7data=aV_mWZSWJqXQjMVAffABJZF90G5YVfEqEKS_8sCOGC3UJKe0r0CgoZ9Ys5lC44k1cNbU1Es8YvlWBV8HeBernGvtIA-WSq4kLkSKiwcQMo-uYLWwGFoQogK4oDv-rdb1JieLv7LLxUJvjCmZu8wAfBp8WO9dBI4gkypKEQK88Tcgb47bGiHVRZssV0LYodF64CAmb78Cu3I51FOXw1iZbUE76-qwQo2nz_qm-z21RwG8Tnm9yMed8ge588576Tqtxf7ebc3v06bvVYknMxT3AuuLpzSXb3MbyBxWXousng1nkcdooFGrFlVfSwcbl2scqfr8hBOoJLeoPdY6_aLrEtZghtVg1tvwclO3fSvXVa7TBhhHHzJ1JrD7_q-8mN140EjYon9Z4ump3lh6NHerJHlKE63J0t-syUMDNo3muAzYFQulYjQn=8');

curl_exec ($c);

The page outputs:-

Aren't you supposed to be somewhere else?

I'm guessing that perhaps the cookies aren't being set properly.

Any pointers / articles / sites?  Can I use a cookies.txt file from a
valid visit to the site to set this up?

Cheers

Alan

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



Re: [PHP] Hi. I need your help here

2007-06-24 Thread Alan Milnes

Here are a couple of links that will help you:-

http://uk2.php.net/trim

http://www.catb.org/~esr/faqs/smart-questions.html

Alan

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



Re: [PHP] why so slow?

2006-11-02 Thread Alan Milnes

Robin Vickery wrote:

include(http://www.squareinch.net/include/misc.inc;);
Don't call files .inc - call them .inc.php if you really must have the 
inc somewhere, that way the Web Server will actually treat it as a php 
file and not display your details to the world if accessed directly.


Alan

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



[PHP] Creating new table from distinct entries

2006-10-19 Thread Alan Milnes

PHP 4.4.4
MySQL 4.1.21-community-nt

I have a table in my database that has a Primary key on 2 fields  (MyID 
and MyChange) and a field that indicates if there is a problem with the 
record (MyError)- I want to create a new table that only has unique 
MyIDs and where there is more than 1 I only want the record with the 
highest MyChange number.  The table has about 50 fields so I have the 
following code:-


$myquery=CREATE TABLE mystats SELECT  *, DISTINCT MyID FROM oldstats 
WHERE MyError IS NULL ORDER BY MyChange DESC ;;

$myresult = mysql_query($myquery);

but I am getting an MySQL error #1064.

Any ideas or suggestions as to where I am going wrong?

Alan

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



Re: [PHP] Text from Excel csv file loaded into MySQL table

2006-10-17 Thread Alan Milnes

Richard Lynch wrote:

Ah...

Try something like this:

?php
  $file = fopen($filename, r) or die(Could not open $filename);
  while (!feof($file)){
$values = fgetcsv($file, 100);
array_walk($values, 'mysql_real_escape_string');
$values_sql = implode(', ', $values);
$query = insert into invw2wfinal ;
$query .= values('$values') ;
$result = mysql_query($query) or die(mysql_error());
  }
?

This assumes that no record (all 4 fields) with overhead is move than
1Mb in size -- Change the 100 if you have monster fields.  And
count on needing to tweak my.cnf in that case anyway.
  
Looks a lot neater than my code!  Is it version dependent?  Running on 
MySQL 4.1.21 and PHP 4.4.4 (not my Server so I can't control that) 
generates the following warnings:-


mysql_real_escape_string() expects parameter 2 to be resource, integer 
for each of the fields then when it goes to do the query it returns 
Column count doesn't match value count at row 1, if I echo the query 
it reads insert into invw2wtest values('Array').



Thanks,

Alan

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



[PHP] Text from Excel csv file loaded into MySQL table

2006-10-16 Thread Alan Milnes


Can anyone point me to a really good end to end tutorial on extracting 
text from an Excel csv file and uploading it into MySQL via a PHP 
script?  There are lots of bits and pieces on the Web and in the PHP 
manual but I haven't found a really comprehensive article yet. I have 
Welling and Thomson's book but again it's not detailed enough.


I've got a script at the moment which works fine with known values 
(generated by a program I own) but I now need to cater for files 
prepared by other people which may have all sorts of characters in them.


A typical line of text may look something like this:-

123456,99,Computer Systems,Desktops/Towers,HP,DX6100M,DX6100M,127 
SHAWAK HARBAN, DUCK'S POINT,MUMBAI


I think I need to do something like this:-

Open the file
   Get the current line
   Convert it to an array (making sure I handle any commas etc in 
the user text)

   Map the array to the MySQL fields
   Upload it to the database, escaping as appropriate
Continue until all lines have been read.

I know I'm not the first person to have had to do this but can't find 
exactly what I'm looking for.


Thanks

Alan  


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



Re: [PHP] Text from Excel csv file loaded into MySQL table

2006-10-16 Thread Alan Milnes

Chris Boget wrote:
Can anyone point me to a really good end to 
end tutorial on extracting text from an Excel 
csv file and uploading it into MySQL via a 
PHP script?  



Actually, depending on the integrity of the data and the consistency of
the format in the CSV file, you can do this simply and easily using just
MySQL.  Take a look at the following pages:
  
Thanks for that.  As there will be a team of people creating the data 
and loading it I need to do some validation etc before it goes into the 
database.


Currently I have this and it looks like it might work:-

# Open file
$fptr = fopen($filename, r);

# Check if file is open
if($fptr) {
   $current_line = fgets($fptr,4096);

   $retval = TRUE;
   echo open;
  
 while($current_line  $retval)

   {

$mystring=csv_string_to_array($current_line);

$query =
insert into invw2wfinal
(
FIELD1,
FIELD2,
FIELD3,
FIELD4
  
)

values
(

'. mysql_real_escape_string($mystring[0]) .',
'. mysql_real_escape_string($mystring[1]) .',
'. mysql_real_escape_string($mystring[2]) .',
'. mysql_real_escape_string($mystring[3]) .'
);

 $result = mysql_query($query);
 

   if(!$result)

   {
echo h1Processing halted due to Error No:;
   echo mysql_errno().: ;
   echo mysql_error().BR;
   echo /h1;
   $retval = FALSE;
   die;
   }
   elseif(mysql_affected_rows() == 0)
   {
 $retval = FALSE;
   die;
   }
 set_time_limit(0);
 $current_line = fgets($fptr,4096);
   }
} 


fclose($fptr);


function csv_string_to_array($str){

  $expr=/,(?=(?:[^\]*\[^\]*\)*(?![^\]*\))/;

  $results=preg_split($expr,trim($str));

  return preg_replace(/^\(.*)\$/,$1,$results);

}

Alan

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



Re: [PHP] Using mysql_real_escape_string

2006-10-10 Thread Alan Milnes

Thanks everyone.

Alan

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



[PHP] Using mysql_real_escape_string

2006-10-09 Thread Alan Milnes


OK this should be really obvious but I just can't figure it out.  I have 
a script that opens a file, reads it line by line and inserts the 
contents into a database.  I know I need to use mysql_real_escape_string 
to properly escape the contents but I don't know where exactly to place 
it in the script.


Any pointers, liks, guidance etc gratefully received!

Alan

*CODE:*

//Input check file
$filename=input/w2wcheck.txt;   


echo h2$filename/h2;

# Open file
$fptr = fopen($filename, r);

# Check if file is open
if($fptr) {
   $current_line = fgets($fptr,4096);
  
   $retval = TRUE;

   echo open;
  
 while($current_line  $retval)

   {
   list(
$UNIQUEID,
$ASSETID   ,
$CNF 
  
   ) = explode(,,$current_line);

 $query = insert into invw2wcheck (

UNIQUEID,
ASSETID   ,
CNF
  
)

values
(
'$UNIQUEID',
'$ASSETID   ',
'$CNF'

);

 
 $result = mysql_query($query);
 

   if(!$result)

   {
echo h1Processing halted due to Error No:;
   echo mysql_errno().: ;
   echo mysql_error().BR;
   echo /h1;
   $retval = FALSE;
   die;
   }
   elseif(mysql_affected_rows() == 0)
   {
 $retval = FALSE;
   die;
   }

 $current_line = fgets($fptr,4096);
   }
} 


fclose($fptr);

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



[PHP] Distribution of records

2006-02-18 Thread Alan Milnes

Hi Guys,

I'm looking for some help in buiding up the right queries / code for 
this.  I have a database that tracks all the plays of my Football Team.  
Here are the relevant Fields:-


Formation
OCall
DCall
OYards
Key

The key is an amalgam of the first 3 fields so a typical record might 
look like this:-


Formation - I
OCall - RT
DCall - BZ
OYards - 5
Key - IRTBZ

What I want to do is to produce report that looks like this:-

Form
OCall
DCall
OYards - Median
OYards - Mean
OYards  0
OYards 0 - 4
OYards 5+

So in other words for every combination of Formation, OCall and DCall I 
want to report how many times it occured, what the Median and Mean 
values were and what the distribution of plays was.


I reckon I'm going to have to create an array and then loop over the 
array pulling out the relevant information but are there any special 
techniques I should consider?


Thanks

Alan

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



[PHP] PHP / MySQL Authentication class

2005-11-14 Thread Alan Milnes
Can anyone point me to a good User Authentication class written in PHP 
(Version 5 preferably) that uses MySQL as the backend.  If the output is 
valid XHTML then even better. There are lots of hits on Google but I 
need some help sorting the wheat from the chaff.


It's for a hobbyist site so I'm looking for something using cookies that 
will keep people logged in between visits and provide some 
personalisation.  Obviously it needs to be reasonably secure but it's 
not a banking system or anything.


Thanks!

Alan

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



[PHP] Class / app for reading web pages and storing in a mySQL DB

2005-08-08 Thread Alan Milnes
I'm interested in extracting a series of web pages from a Yahoo forum 
and storing them in a MySQL database so I can generate things like most 
number of posts etc.  I've searched on Google but most of the links seem 
to be for email harversters!


Anyone have any tips for where to look?

Alan

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



Re: [PHP] sorry for asking here,a small apache query

2005-08-06 Thread Alan Milnes

babu wrote:


Hi all,

I am sorry for asking in php forum.i am subscribed to php and not to apache.but 
i hope many people in this group also the solution to this query.


If you know you are in wrong place why ask here?

Alan

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



Re: FW: [PHP] [NEWBIE GUIDE] For the benefit of new members

2005-08-05 Thread Alan Milnes

Jay Blanchard wrote:


6. PHP is a server side scripting language. Whatever processing PHP does
takes place BEFORE the output reaches the client. Therefore, it is not
possible to access users' computer related information (OS, screen size
etc) using PHP. Nor can you modify any the user side settings. You need 
to go for JavaScript and ask the question in a JavaScript list.


On the other hand, you can access the information that is SENT by the
user's browser when a client requests a page from your server. You can
find details about browser, OS etc as reported by 
this request. 
(contributed by Wouter van Vliet and reworded by Chris W Parker.)


 


You might want to add to this:-

To see what information PHP can provide look in the manual for $_SERVER.

That way you give people a pointer along the way 

Alan



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



Re: [PHP] Setting clock backwards hangs webserver (PHP+THTTPD)

2005-07-27 Thread Alan Milnes

Vinoo S Warrier wrote:


Hi all,
Iam running PHP on THTTPD 2.21b

I have a simple php script that sets the system clock (using exec(date -s 
MMDDhhmm.ss) and returns a page showing the system time

when i use it to set the time forwards, it works fine
but if i use it and set the time backwards (even a few seconds), the webserver 
hangs. also it hangs only for exactly the amount of time needed for the 
backwards-set time to catch up with the original time. when the clock catches 
up with the original time, the page is returned. till then it hangs

it's almost as if the webserver is waiting for the time to come back to the 
request-received time before sending the page.

Sounds like a Server problem rather than PHP - is this behaviour 
supported by the Server?  At work we used to have to power the servers 
off for an hour at clock change time because of logging conflicts etc.


Alan

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



Re: [PHP] Urgent:Php5 fully oops supported? Difference between java oops php5 oops

2005-07-26 Thread Alan Milnes

Tamilarasi Palanisamy (tpalanis) wrote:


Hi,
 


Hi

   I want to know whether Php5 fully oops ? 


That depends - what do you want to do?


Difference between java
oops  php5 oops.
 

I don't know - I'm a PHP programmer and I've never written a single line 
of Java code in my life.



I need immediately.

 


Perhaps this will help you get better answers:-

http://www.catb.org/~esr/faqs/smart-questions.html

Regards

Alan

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



Re: [PHP] how to post a question?

2005-07-22 Thread Alan Milnes

Chirantan Ghosh wrote:


I was wondering how can I ask a question to the other subscribers?

 


Try reading this first:-

http://www.catb.org/~esr/faqs/smart-questions.html

Alan

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



[PHP] Re: Missing or wrong reply-to headers in this mailing list

2005-07-13 Thread Alan Milnes

Rasmus Lerdorf wrote:


Please search the archives for the complete and authoritative answer to
that.  The short version is that munging the reply-to header is
technically incorrect and from a usability point of view it errors on
the side of exposing someone's potentially private email. 

Oh I've read it and understand it - I just think it's completely wrong 
from a usability and conceptual perspective.


People shouldn't need to know how to configure things like this:-

:0 Whc: msgid.lock
| formail -D 16384 msgid.cache
:0 a:
duplicates

to participate on a mailing list.

The whole point of the web, and especially a server side language like 
PHP, is that it doesn't care what user-agent is accessing it.  You can't 
assume that everyone is using *nix systems to particpate in this list.  
Due to work  related reasons  I have to use both Linux and Windows.


Alan

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



Re: [PHP] Missing or wrong reply-to headers in this mailing list

2005-07-12 Thread Alan Milnes

Chris W. Parker wrote:


This has come up many times in the past and so far it has not changed.
Just hit the Reply to All button and you'll be fine.
 

The problem with that is that people then get a personal message *and *a 
list message.  Why can't this group be set up properly so reply goes to 
the list as with virtually every other mailing list I am part of?


Alan

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



Re: [PHP] FW: php pages

2005-04-01 Thread Alan Milnes
bruce wrote:
hey guys
can someone tell me why this seems to work.. is it because a security
attribute hasn't been correctly set?
 

It's called an easter egg - check out your phpinfo on April 1st ...
http://www.phpfreaks.com/articles/229/0.php
Alan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php