Re: [PHP] Dynamic function calls within the echo function, possible?

2004-07-19 Thread Sean Malloy
I know this isn't solving your problem, but here is how I do it:

class RowAlternator
{
  private $on;
  private $off;
  private $state;

  function RowAlternator($on = On, $off = Off)
  {
$this-on = $on;
$this-off = $off;
  }

  function switchState()
  {
$this-state = !$this-state;
  }

  function Next()
  {
$this-switchState();
return $this-Current();
  }

  function Current()
  {
if ($this-state)
  return $this-on;
return $this-off;
  }
}

then...

using CSS style attributes:

$row = new RowAlternator(background-color: #EDEDED;, background-color:
#FF;);
$i = 10;
while ($i--)
{
  echo tr style=' . $row-Next() . 'tdHello/td/tr;
}

or using CSS Class definitions

$row = new RowAlternator();
$i = 10;
while ($i--)
{
  echo tr class=' . $row-Next() . 'tdHello/td/tr;
}


as far as dynamically calling functions in echo.. why not do this:

$row = 'row_color';
echo sprintf('%sbr /%sbr /%s', $row(), $row(), $row());

or something

btw, defining parameters like so: o=null

only works in PHP 5.



Jay Blanchard [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
[snip]
Well that could work, but i want to re call it every time it finds the
occurance of $row

if you said $row = row_color();
then echo $rowbr$rowbr$row;

it would output the content of $row1 three times.
Because $row =row_color calls it, defines the returned value of row_color as
the contents of it, and never calls it again. I need it to dynamicly call it
every time around.
[/snip]

Top posting == bad
replying off list == bad

Then loop through the rows with either a for loop or while loop.

while(TRUE === $row){
   echo row_color($row) . br;
}

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



Re: [PHP] Dynamic function calls within the echo function, possible?

2004-07-19 Thread Sean Malloy
 class RowAlternator
 {
   private $on;
   private $off;
   private $state;


oops, I only half removed PHP5 only syntax.

class RowAlternator
{
  var $on;
  var $off;
  var $state;

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



Re: [PHP] Error: unexpected T_ELSE on line 14...?

2004-07-18 Thread Sean Malloy
 1. The obvious ; at the end of the line.
 2. $_SESSION[Authorised]=Yes it's different to write:
$_SESSION[Authorised]==Yes


Gotta love c style languages where variable assignment is like variable
comparison.

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



Re: [PHP] Re: Templates Are Driving me Nuts

2004-07-17 Thread Sean Malloy
The template system I use is extremely simple.

Template.php:
?php
class Template
{
var $Items;
var $_document;

function Template($document)
{
$this-Items = array();
$this-_document = $document;
}

function Render()
{
echo $this-ToString();
}

function ToString()
{
$template = $this-Items;
ob_start();
require($this-_document);
return ob_get_clean();
}
}
?

and to use it?

templates/index.html:
html
head/head
body
Hello ?=$template['name']?, it is currently ?=$template['time']?
/body
/html

index.php:
?php
include_once('Template.php');
$template = new Template('./templates/index.html');
$template-Items['name'] = 'User';
$template-Items['time'] = date('d M Y', time());
$template-Render();
?

why use it?

Because you keep your html and your php code separate. That is the
goal when using any templating system.

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



[PHP] PHP5 Windows not built with Soap Enabled?

2004-07-14 Thread Sean Malloy
Am I the only one experiencing this:

Fatal error: Class 'SoapClient' not found

checking the output of phpinfo() for the 5.0.0 binary from www.php.net, it
would seem there is no soap support built in at all.

Or have I just not woken up today?

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



[PHP] Re: PHP5 Windows not built with Soap Enabled?

2004-07-14 Thread Sean Malloy
 checking the output of phpinfo() for the 5.0.0 binary from www.php.net, it
 would seem there is no soap support built in at all.

 Or have I just not woken up today?

I win the You're a Dumb Ass award for the day.

The SOAP extension isn't activated by default (PHP5 RC1). Just add
extension=php_soap.dll to the php.ini and don't forget to set the
extension_dir properly (in most cases c:\php\ext).

(I swear I checked the extensions folder. I don't know why I didn't see it
before...)

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



RE: [PHP] Screen Size detect??

2003-02-01 Thread Sean Malloy
index.htm
script language=JavaScript
function SubmitForm
{
   document.myform.var.value = javascriptvalue;
   document.myform.submit();
}
/script
body onLoad='SubmitForm();'
form name='myform' action='index.php' method='post'
input type='hidden' name='var' value=''
/form
/body

or something. I don't even know if that code works... I haven't tested it.
but that could be the basis for somehting


-Original Message-
From: Nigel Powell [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 2 February 2003 3:25 AM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] Screen Size detect??



On a slight side note to this, how can you pass javascript variables to
PHP via POST?

Newbie Powell

On Saturday, February 1, 2003, at 12:21 PM,
[EMAIL PROTECTED] wrote:

 From: Sean Malloy [EMAIL PROTECTED]
 Date: Sat Feb 1, 2003  6:48:26 AM Europe/London
 To: Dade Register [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: RE: [PHP] Screen Size detect??


 Create index.htm;

 script language=JavaScript
 var width  = screen.width;
 var height = screen.height;
 window.location = 'index.php?width=' + width + 'height=' + height;
 /script

 and in index.php

 $width = $_GET['width'];
 $height = $_GET['height'];


 etc etc


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

2003-01-31 Thread Sean Malloy
sounds like you should turn error reporting on

a blank page usually means PHP has encountered an error, but DisplayErrors
is off in php.ini

-Original Message-
From: Todd Barr [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 1 February 2003 4:47 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Bug?


Hello all

I am having issues passing vars in the url

example

here is my url
http://localhost/tsatest.php?Sub_Task=2

and here is my code
$link = odbc_connect( 'TSA','','');
$Query = SELECT * from projects where sub_task='$Sub_Task';
$Result = odbc_do($link, $Query);

All this returns is a blank screen.

any suggestions?


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




RE: [PHP] Screen Size detect??

2003-01-31 Thread Sean Malloy
Create index.htm;

script language=JavaScript
var width  = screen.width;
var height = screen.height;
window.location = 'index.php?width=' + width + 'height=' + height;
/script

and in index.php

$width = $_GET['width'];
$height = $_GET['height'];


etc etc

-Original Message-
From: Dade Register [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 1 February 2003 3:48 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Screen Size detect??


I'm trying to detect the screen size of any client
browser, or at least IE. Is there a php function that
can do this? If not, does anyone have any ideas on a
JS that would work too? Plz help. Thanx.

__
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-- 
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] converting a Recorset into an XML string

2003-01-25 Thread Sean Malloy
Personally, I would do it differently, but thats just me... However one
modification I would suggest you make:

The Line:
   $xml.=.$nombre_campo..$valor_campo./.$nombre_campo.\n;

would probably be better as this:

$xml.=.$nombre_campo..htmlspecialchars($valor_campo)./.$nombre_camp
o.\n;

just incase there is an  or a  in the data, and some XML parsers will
throw an error saying that the XML file is not well formed.

-Original Message-
From: Octavio Herrera [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 26 January 2003 9:36 AM
To: [EMAIL PROTECTED]
Subject: [PHP] converting a Recorset into an XML string


Hello everybody, I make a function that lets you convert a recordset
obtained via mysql_query() into an XML string:
maybe could be helpfull to yours

this is the function

it have 3 parameters:   $rs is the recordset you want to convert
$padre is the name for the parent node
that will contain every record on the recordset
$hijo is the name for the child node
that will contain a single record in the recordset



function rs2xml($rs,$padre,$hijo){
 $num_campos=mysql_num_fields($rs);
 $num_filas=mysql_num_rows($rs);

 if($padre!=-1)
  $xml=$padre\n;
 else
  $xml=;

 $cont1=0;
 while($cont1$num_filas){
  $fila=mysql_fetch_array($rs);
  $xml.=$hijo\n;
  $cont=0;
  while($cont$num_campos){
   $nombre_campo=mysql_field_name($rs,$cont);
   $valor_campo=$fila[$cont];
   $xml.=.$nombre_campo..$valor_campo./.$nombre_campo.\n;
   $cont++;
  }
  $xml.=/$hijo\n;
  $cont1++;
 }
 if($padre!=-1)
 $xml.=/$padre\n;
 return $xml;
}

I hope this will be helpful for you

OCTAVIO HERRERA



--
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] SELECT with WHILE NOT

2003-01-25 Thread Sean Malloy
SELECT * FROM rap WHERE rsponsor != '{$_SESSION['sid']}' ORDER by
 rsname,rfname,rcountry,rcity DESC LIMIT 20

SELECT * FROM rap WHERE rsponsor NOT IN ('{$_SESSION['sid']}') ORDER by
 rsname,rfname,rcountry,rcity DESC LIMIT 20

-Original Message-
From: Andre Dubuc [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 26 January 2003 11:28 AM
To: [EMAIL PROTECTED]
Subject: [PHP] SELECT with WHILE NOT


Hi,

Using PostgreSql 7.2 + PHP  I am trying to do a SELECT that will
choose all records except ones that have a certain id number. I can't seem
to
get the syntax to work.

Here's the code:

SELECT * FROM rap WHERE NOT rsponsor = '{$_SESSION['sid']}' ORDER by
 rsname,rfname,rcountry,rcity DESC LIMIT 20;

What I get is all the records including those with '{$_SESSION['sid']}' .

How can I accomplish an exclusion in a table-wide search?

Any help or advice will be greatly appreciated.

Tia,
Andre


--
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] SQL+php

2003-01-18 Thread Sean Malloy
I see a lot of these type of answers on the list at the moment.

I'm sick of receiving smart ass answers from people. It wastes my time, and
my bandwidth.

Either answer the fucking question, even if it hasn't been asked correctly,
or don't reply at all.

Given you are a 'PHP Professional' John, I would expect a little more from
you.

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 19 January 2003 11:42 AM
To: 'Paul Marinas'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] SQL+php


   Dose anyone know how to search and replace a string in a
 mysql_query output.

Yes.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



--
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] SQL+php

2003-01-18 Thread Sean Malloy
If you want to do it within the query itself, take a look at the mysql
replace command

REPLACE(str,from_str,to_str)

SELECT REPLACE(field,from,to) FROM table

or you can do it using PHP once the query has executed, on a record by
record basis, within a while/for loop or whatever.

-Original Message-
From: Paul Marinas [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 19 January 2003 11:07 AM
Cc: [EMAIL PROTECTED]
Subject: [PHP] SQL+php


Dose anyone know how to search and replace a string in a
mysql_query output.

Thanks, Paul

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


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




RE: [PHP] SQL+php

2003-01-18 Thread Sean Malloy
I apologise for calling you a PHP Professional, clearly I was mistaken.


;)

-Original Message-
From: John W. Holmes [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 19 January 2003 4:36 PM
To: 'Sean Malloy'; [EMAIL PROTECTED]
Subject: RE: [PHP] SQL+php


It's _for_ PHP Professionals. If I read a Woman's magazine, does that
make me a woman?

Anyhow, answers like this are a good way for people to learn not to ask
Yes or No questions. There's even a funny FAQ on this, but I can't find
the link anywhere. 

---John Holmes...


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




RE: [PHP] PHP Encoders and GPL License

2003-01-17 Thread Sean Malloy
 As far as I understand it, the GPL License states that the source 
 code of any product created from an open source solutions, or is 
 derived from the work of an open solutions, must be made availabe 
 to all users.

no. 

Any modifications made to the PHP source code must be made 
available to anyone who wants it.

It does not cover programs, applications, websites, created with the 
programming language. They are covered under their own license (of 
the authors choosing).

If you created an application, enocoded it, but had made 
modifications to existing PHP engine code, or even PHP scripting 
code from other sources, you would have to include unencoded 
versions of said scripts, and also provide the PHP source (or just 
your modifications, imported via patch or whatever) to anyone who 
wants it.

I'm not sure what the deal is with your own custom PHP extensions. 
I think once again, extensions are separate programs, and up to 
the individual to specify the licensing terms.

There are thousands of programs written in C and compiled by GCC.
GCC is GPL software. Do you go around saying You compiled your 
commercial application with an Open Source tool, therefore you must 
release all source code to the community? No. Same principle 
applies to PHP

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




RE: [PHP] Re: Php's future with Asp .NET?

2003-01-16 Thread Sean Malloy
I think that the developers of PHP know exactly where they want PHP
to sit in the big bad world of .NET/J2EE.

The whole reason the dotnet and java extensions have been written for
PHP, is to allow PHP to talk to java/net objects, but more importantly,
have PHP act as the front end, and .NET/J2EE do the business logic. I
can't remember where I read it, but one of the PHP developers was
mentioning that part of the modifications to ZE2 and its object
handling, was to enable better interactione with Java and .NET.

It will be more interesting once the Mono project reaches v1.0. Then
you will have a .NET runtime on Unix environments, as well as ASP.NET,
and the argument that 'ASP.NET is windows only' will cease to exist.

There will always be a place for PHP in the web world. As an application
engine, and as a frontend to other languages (Just look at what yahoo
are doing with PHP)

The 'ASP vs PHP' threads will still continue. What a waste of time
they are.

-Original Message-
From: Brian McGarvie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 8:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] Re: Php's future with Asp .NET?


The 'problem' with ASP is that it really requires a Windows platform... and
while Unix is still primarily the OS of choice for web-servers then ASP 
PHP will 'co-exist' there will always be a PHP and ASP camp... naturally any
broad-minded developer will keep up with both technologies as this will
ultimatley make you more sellable when looking for work or a job.

I have very little ASP experiance, but that has cost me the oppertinity to
apply for several well-paying jobs, as there is very few PHP positions
around - I'm speaking for the UK market here.

Saying that, most companies that ask for ASP don't necessarily 'need' to use
ASP, they just request it cos it's the executive-level buzzword of the
moment, if you get in you can always show them the errors of their
misconceptions - I generally have!

However  I feel that will change - in the UK atleast there is a slowly
growing number of PHP-based projcets  roles appearing, and PHP is by far
the most flexible  powerfull of the 2 - IMHO. I have been a web-developer
for several years, and have deployed solutions in ASP, Cold Fusion and PHP,
PHP remains my platform of choice as it works equally well in both Unix 
Windows platforms.

This is of course just my views  hopes for the present and future :)

Long live PHP!!!


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




[PHP] MySQL Query - Not PHP Specific

2003-01-15 Thread Sean Malloy
I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning NULL where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, ReplaceValue)

I'm not sure it was meant for that usage, but it does work none the less.


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




RE: [PHP] MySQL Query - Not PHP Specific

2003-01-15 Thread Sean Malloy
IFNULL! thanks

-Original Message-
From: Daniel Kushner [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 16 January 2003 1:51 PM
To: Sean Malloy; PHP General
Subject: RE: [PHP] MySQL Query - Not PHP Specific


http://www.mysql.com/documentation/mysql/bychapter/manual_Tutorial.html#Work
ing_with_NULL
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#Con
trol_flow_functions




Regards,
Daniel Kushner
_
Need hosting? http://thehostingcompany.us


-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 15, 2003 9:37 PM
To: PHP General
Subject: [PHP] MySQL Query - Not PHP Specific


I know this isn't a PHP question per se, but it does relate to PHP
development.

Every day I work with MySQL as my PHP database, I become more dissalusioned
with its ability as a database server. Yes its fast, but its missing so many
useful features of other DB servers. I'm digressing...


Is there a functional equivelent of SQL Servers ISNULL() command? (Yes I am
aware of the MySQL ISNULL command and it is different)

Hrm.. I just found a solution...

SQL Server ISNULL takes two arguments, CheckField, And ReplacementValue
SELECT ISNULL(t.Task, 0) FROM Users u LEFT JOIN Tasks t ON t.UserID =
u.UserID;

instead of returning NULL where a Userid has no tasks, it would return 0.

The equivelent function in MySQL is COALESCE(Field, ReplaceValue)

I'm not sure it was meant for that usage, but it does work none the less.


--
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] stupid question (Back Function)

2003-01-13 Thread Sean Malloy
You could grab the referring page and send the user back to it, but some
proxies/software stop your browser from sending that information, so it
might not work in all situations

a href=?php echo $_SERVER['HTTP_REFERER']; ?Back/a

however, quoting the docs on using the referrer:

This is set by the user agent (client browser). Not all user agents will set
this, and some provide the ability to modify HTTP_REFERER as a feature. In
short, it cannot really be trusted.

-Original Message-
From: Remon Redika [mailto:[EMAIL PROTECTED]]
Sent: Monday, 13 January 2003 8:33 PM
To: [EMAIL PROTECTED]
Subject: [PHP] stupid question (Back Function)


hi everyone,

It's Possible We used Php Scripting to Back the client Browser
Like This Below :
(ussualy I make it with java script) :

javascript:history.back(1)

but right now, i need using the 'header's function', functionaly to back
the page to previouse page.

sorry before :)


--
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] increment numbers...

2003-01-13 Thread Sean Malloy
for ($i = 1; $i = 100; $i++)
{
echo str_pad($i, 6, '0', STR_PAD_LEFT) . 'br /';  
}

is that the sort of effect you want?

-Original Message-
From: Senani [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 14 January 2003 3:22 PM
To: [EMAIL PROTECTED]
Subject: [PHP] increment numbers...


HI all,
I need help on incrementing numbers starting with a 0 or 
more on php-4.2.3.

When I increment  a number like 2 (2++). Its out put is  3 
( not 3).
But Its output had leading  0s on  php-4.0.2.
Does anybody know any function or any other simple way to do this.

Rgds
JanakaA


-- 
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] php5 cvs

2003-01-12 Thread Sean Malloy
try

private function()
{
}

-Original Message-
From: electroteque [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 12 January 2003 6:43 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] php5 cvs


hmm has the public and private function accessor changed ? i have been
building my classes with test() and _test() to differentiate from public and
private and have been waiting to try it out but i can still access both ! ??

Electroteque [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 lol no , i am gonna try and upgrade my workfrom dinasour php3 to php 4.3,
i
 have a development box here @ home i just upgraded to the 4.3 release from
 rc3 and am gonna try out version 5 then it doesnt matter how stable it is
at
 home really :D

 Danny Shepherd [EMAIL PROTECTED] wrote in message
 000b01c2b9d2$ae5e46c0$6400a8c0@DANNYS">news:000b01c2b9d2$ae5e46c0$6400a8c0@DANNYS...
  It includes the latest CVS build of ZendEngine 2.0 - AFAIK it hasn't
even
  reached beta status yet, so don't even think about using it for
production
  work. That said, I didn't have any problems building it and it seems
 pretty
  stable.
 
  A list of changes and features can be found at
  http://www.php.net/ZEND_CHANGES.txt.
 
  HTH
 
  Danny.
 
  - Original Message -
  From: electroteque [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Saturday, January 11, 2003 6:50 PM
  Subject: [PHP] php5 cvs
 
 
   hi guys just noticed php5 cvs in the snaps page , does this have the
 zend
   2.0 engine ? more specific question has it got the proper OO built in
 yet
  ?
  
  
  
   --
   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] php5 cvs

2003-01-12 Thread Sean Malloy
No the documentaton you are talking about, was that prior to ZE2 people were
using underscores to denote private functions/variables. With ZE2, they
wouldn't have to.

-Original Message-
From: Dan Rossi [mailto:[EMAIL PROTECTED]]
Sent: Sunday, 12 January 2003 11:23 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] php5 cvs


its cool , i cant remember where i saw the reference , but it was claiming
to prefix the functions with underscores to denote private functions in php
4  for the rollover of php5, it was a pretty legit resource i cant remember
where though have too many bookmarks, oh well at least i know now , i think
it meant to underscore them , to make the private functions recognisable so
then the rewrite for the proper OO in php5 can be easy as adding private
where the underscores are ??, i gave  5 a test, compiled with no problems
except my ming extension didnt seem to load properly so will stick with for
4.3 for now.
aparantly its still not true OO as you have to add the constructor of the
base class inside the sub class constructor where other languages dont need
to do this, i was told from my c++ flatmate of mine but correct me if i'm
wrong but sadly i dont know much c++ apart from modding source code now and
then :D

-Original Message-
From: Zeev Suraski [mailto:[EMAIL PROTECTED]]
Sent: Sunday, January 12, 2003 11:13 PM
To: electroteque
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] php5 cvs


Not sure what you mean by 'changed', but the way to denote private
functions is by adding 'private' to the method declaration, and not by
prefixing them with _.

You can do it using:

class bar {
 private function foo()
 {
 ...
 }
 ...
};

Zeev

At 09:43 12/01/2003, electroteque wrote:
hmm has the public and private function accessor changed ? i have been
building my classes with test() and _test() to differentiate from public
and
private and have been waiting to try it out but i can still access both !
??

Electroteque [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  lol no , i am gonna try and upgrade my workfrom dinasour php3 to php
4.3,
i
  have a development box here @ home i just upgraded to the 4.3 release
from
  rc3 and am gonna try out version 5 then it doesnt matter how stable it
is
at
  home really :D
 
  Danny Shepherd [EMAIL PROTECTED] wrote in message
  000b01c2b9d2$ae5e46c0$6400a8c0@DANNYS">news:000b01c2b9d2$ae5e46c0$6400a8c0@DANNYS...
   It includes the latest CVS build of ZendEngine 2.0 - AFAIK it hasn't
even
   reached beta status yet, so don't even think about using it for
production
   work. That said, I didn't have any problems building it and it seems
  pretty
   stable.
  
   A list of changes and features can be found at
   http://www.php.net/ZEND_CHANGES.txt.
  
   HTH
  
   Danny.
  
   - Original Message -
   From: electroteque [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Saturday, January 11, 2003 6:50 PM
   Subject: [PHP] php5 cvs
  
  
hi guys just noticed php5 cvs in the snaps page , does this have the
  zend
2.0 engine ? more specific question has it got the proper OO built
in
  yet
   ?
   
   
   
--
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] Permission Denied

2003-01-12 Thread Sean Malloy
I'm assuming you are using IIS.

If your harddrive is formatted using NTFS, you are going to have to add a
new entry to the ACL list for the directory to let the IUSR_machinename
account access the directory.

There are plenty of readmes/articles on managing NTFS permissions. I don't
have time to go into the details of how to do it, only to tell you that that
is what you have to do.

BTW; By default Windows XP (If thats what you are using) enables Simple
Sharing/File Permisisons. To turn that off

in Windows Explorer;

Tools | Folder Options | View | (Scroll Right Down to bottom) Use simple
sharing -- untick


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Monday, 13 January 2003 2:36 PM
To: [EMAIL PROTECTED]
Cc: PHP List
Subject: Re: [PHP] Permission Denied


Yes, I just added it but same error:

Warning: mkdir(c:\inetpub\wwwroot\phpiw\packs\bob) [function.mkdir]:
Permission denied in c:\inetpub\wwwroot\phpiw\classes\class.cp.php on line
28

Here's the part where I try and make the folder:

function do_dir($package) {
 umask(0);
 if(mkdir($this-currentfolder().'packs\\bob', 0777)) {
return true;
 } else {
  echo 'There is already a package by the name of '.$package.'! Delete
it and try again.brbr';
  return false;
 }
   }

Any ideas?
- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: 'Stephen' [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, January 12, 2003 6:33 PM
Subject: RE: [PHP] Permission Denied


: Did you use the umask(0) prior to the mkdir() in your script??
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
:  -Original Message-
:  From: Stephen [mailto:[EMAIL PROTECTED]]
:  Sent: Monday, 13 January 2003 9:09 AM
:  To: [EMAIL PROTECTED]
:  Subject: Re: [PHP] Permission Denied
: 
: 
:  Ok, I got it to make a directory as a absolute path but I'm
:  getting a Permission Denied error again. I'm running IIS so
:  I can't CHMOD and all the permission options are checked in
:  the options box.
: 
: 
:  - Original Message -
:  From: Jason Wong [EMAIL PROTECTED]
:  To: [EMAIL PROTECTED]
:  Sent: Sunday, January 12, 2003 4:03 AM
:  Subject: Re: [PHP] Permission Denied
: 
: 
:  : On Sunday 12 January 2003 10:10, Stephen wrote:
:  :  There's already a folder named packs but my problem was
:  not having the /
:  :  before it. One more question. How can I dynamically get
:  the path to the
:  :  current folder? Like your at
:  http://www.bob.com/joe/index.php and you want
:  :  to get the
:  http://www.bob.com/joe/ bit and do it dynamically?
:  :
:  : print_r($_SERVER) will show you which bits you can use.
:  :
:  : --
:  : Jason Wong - Gremlins Associates - www.gremlins.biz
:  : Open Source Software Systems Integrators
:  : * Web Design  Hosting * Internet  Intranet Applications
:  Development *
:  :
:  : /*
:  : I'll show you MY telex number if you show me YOURS ...
:  : */
:  :
:  :
:  : --
:  : 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] Suggestions on FAQ application?

2003-01-10 Thread Sean Malloy
I would suggest you try one of the following;

faqomatic http://faqomatic.sourceforge.net/, which is actually perl based

or phpFAQ
http://product.cybergl.co.id/dev/version.php?cmd=browseproduct_id=15

or FAQbot http://mason.gmu.edu/~bhroleno/FB.html

or knowhow^2 http://www.linuxclass.de/kh2/

or piFAQ http://pifaq.sourceforge.net/

or StandardFAQ http://www.stampede.org/~drax/StandardFAQ/

or PHPWiki (http://phpwiki.sourceforge.net/) (Not a faq system, but it would
do the job)


when hotscripts fails, try sourceforge.
when sourceforge fails, try freshmeat.



-Original Message-
From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 11 January 2003 1:52 PM
To: Timothy Hitchens (HiTCHO); 'php-gen'
Subject: Re: [PHP] Suggestions on FAQ application?


Why re-invent what is already written? I'm well aware that it's easy to
write but there may be something out there already that suits my needs and
has some features that I hadn't thought of. If you don't have a suggestion
on a package please spare me the rude replies which seem to run rampant on
here lately...

Jeff
- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: 'Jeff Lewis' [EMAIL PROTECTED]; 'php-gen' [EMAIL PROTECTED]
Sent: Friday, January 10, 2003 9:39 PM
Subject: RE: [PHP] Suggestions on FAQ application?


 It is a 30 minute write... not that hard!!


 Timothy Hitchens (HiTCHO)
 Open Platform Consulting
 e-mail: [EMAIL PROTECTED]

  -Original Message-
  From: Jeff Lewis [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, 11 January 2003 12:37 PM
  To: php-gen
  Subject: [PHP] Suggestions on FAQ application?
 
 
  I've checked Hotscripts and I can't findanything relatively
  new or that suits my needs. I was wondering if anyone uses a
  FAQ program that they could suggest?
 
  Jeff
 







--
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] Re: Source Guardian

2003-01-10 Thread Sean Malloy
Keep in mind the Works out of the box with no changes to your server 
requires the use of the function dl()

according to the PHP docs;
dl() is not supported in multithreaded Web servers. Use the extensions 
statement in your php.ini when operating under such an environment. 
However, the CGI and CLI build are not affected ! 

I haven't tested wether it actually works with servers such as 
IIS/Apache2, and given its not supported, perhaps it works, but could 
have weird results after the so/dll has been loaded after the millionth 
time.

user contributed notes off of the PHP site:
the function dl() is not supported on Multithreaded systems like Windows 
XP. You need an external library for it, that has to be loaded when your 
server does. If not, you will get a fatal error and the script will stop 
parsing.



-Original Message-
From: michael kimsal [mailto:[EMAIL PROTECTED]]
Sent: Saturday, 11 January 2003 2:39 PM
To: [EMAIL PROTECTED]; Christopher Ditty
Subject: [PHP] Re: Source Guardian


Christopher Ditty wrote:
 Does anyone here use Source Guardian?  I am about to purchase it and
 thought I'd ask before I do.  Any problems using it?
 
 Thanks
 
 CDitty
 

Hello.

We've used it to create demos.  It does work, but is being surpassed by
other options (at the time we purchased, it was the cheapest option, but 
it's not anymore).

They seem to have updated their site some - $150 for 'just' the 
obfuscator is a bit much, and the obfuscation portion was,
I thought, pretty poor.

If you relied at all on globals, or ever used 'extract' on arrays
coming from form input, it was useless.  We don't rely on globals,
but we do rely on form array extraction sometimes - completely
wasted when the system would 'obfuscate' your code.  Reason being:

?
echo $myName;
?
becomes
?
echo $uu7whfdsisdf;
?

But if you've got a form with
input type='text' name='foo[bar]'

You can't do

?
extract($_POST['foo']);
echo $bar;
?

and expect it to work, because the obfuscation will turn it into:

?
extract($_POST['foo']);
echo $uu7whfdsisdf;
?

I wrote them and told them it was fairly pointless, atleast
for systems large/advanced enough that you'd consider wanting
to protect them in the first place.

They didn't seem to have much on their site before about
how to get new .so and .dll files for newer versions of PHP
(they bundle .so and .dll files for each version of PHP
- 4.1.0, 4.1.1, etc).  Also, the support for working
'out of the box' with no need to fiddle with the php.ini
file was useful.  Ioncube's encoder answer requires your users
to install the appropriate .so or .dll file in a particular directory,
or to edit php.ini - not as useful for giving out demos.  Ioncube
is making an effort to move in that 'ease of use' direction,
but it doesn't seem to be there just yet.

Having said that, the ioncube answer offers a greater level of
security for the encrypted code - the sourceguardian stuff
is, last I checked, 'just' encrypted source code.  zend and ioncube
package encrypted byte code.  If someone decrypts zend-encoded
files, they'll only get bytecode.  If they decrypt sourceguardian
code, they get the original code.  This was how it was
last summer - they may have upgraded since then.

All in all, it's not bad.  That the files now can be run on Windows
servers is a plus, but lack of a command line version to allow
for dynamic encryption from a server isn't all that good.  If you *need*
that, you'll need to find something else.  Why?

The 'time limiting' aspect, for starters - you can set a 'timeout'
for a particular date.  Unless you put up a new trial file on a
site every day, you won't be able to offer '14 day' trials, for
a start.  The file will timeout on date X, regardless of when the
user downloaded it.  The Zend license manager is much more flexible in 
that regard, but is overkill for most smaller projects.

Does this help at all?

Michael Kimsal
http://www.logicreate.com
734-480-9961



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


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




RE: [PHP] mysql_num_rows() error

2003-01-09 Thread Sean Malloy
Are you actually checking that the query result is valid?

$conn = mysql_connect('localhost', xxx, yyy) or die('Could not connect
to db');
$result = mysql_query('select * from blah', $conn);
if ($result)
{
  echo Number of rows:  . mysql_num_rows($result);
  if (mysql_num_rows($result)  0)
  {
while ($row = mysql_fetch_row($result))
{
  for ($i = 0; $i  sizeOf($row); $i++)
  {
echo $i:  . $row[$i] . BR;
  }
}
  }
}
else
{
  echo mysql_error($conn);
}

-Original Message-
From: Phil Powell [mailto:[EMAIL PROTECTED]]
Sent: Friday, 10 January 2003 1:46 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: [PHP] mysql_num_rows() error


 Anyone know why this is happening? I have mySQL on Win2000 Server with IIS
 and PHP:

 mysql_num_rows(): supplied argument is not a valid MySQL result resource

 Here is my code:

 ?
   $conn = mysql_connect('localhost', xxx, yyy) or die('Could not
connect
 to db');
   $result = mysql_query('select * from blah');
   echo Number of rows:  . mysql_num_rows($result);
   if (mysql_num_rows($result)  0) {
while ($row = mysql_fetch_row($result)) {
 for ($i = 0; $i  sizeOf($row); $i++) {
  echo $i:  . $row[$i] . BR;
 }
}
   }
 ?

 It couldn't get any simpler.  I just installed mySQL on my machine and am
 trying to see what I can do with it giving Win2K and IIS.

 AUGH! Thanx
 Phil



--
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] something annoying about includes/relative paths.

2003-01-09 Thread Sean Malloy


Moving to PHP from an ASP backgroun, I always found one thing really
annoying about PHP.

With ASP, you could have a file structure such as:

SYSTEM
|--HTML
|  |--header.asp
|
|--LOGIC
|  |--engine.asp
|
|--core.asp

in default.asp, you would
!--#include file=system/core.asp--
in core.asp, engine.asp would be included as such
!--#include file=LOGIC/engine.asp--
in engine.asp, header.asp would be included as such
!--#include file=../HTML/header.asp--


Its a bad example. However, it demonstrates that the relative path for each
include changed depending on what file was being included.

PHP doesn't do that. Which is kind of annoying, but you get used to it.. But
I've come up with a work around.

htdocs/index.php
include('./system/core.php');

htdocs/system/core.php
define('CORE_PATH', str_replace('core.php', '', __FILE__));
include(CORE_PATH.'logic/engine.php');

htdocs/system/logic/engine.php
include(CORE_PATH.'html/header.php');

and so on and so forth. searching for __FILE__, and removing the filename
from the output, gives you a sort of relative path hack.

Hope someone finds that useful


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




[PHP] func_get_args...

2003-01-09 Thread Sean Malloy
Is this possible;

function TestRef()
{
$var = func_get_arg(0);
++$var;
}

$b = 1;
TestRef($b);
echo $b;

It doesn't seem to work. Is there a way to do it?

Or am I wasting my time trying to do this?

(Yes I am aware I could define TestRef($b)), but I can't, reason being; I'm
trying to create a couple of functions that 'sort of' emulate function
overloading, but also allow me to pass a couple of objects by reference
rather than value

Anyone tried to do this already?


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




RE: [PHP] func_get_args...

2003-01-09 Thread Sean Malloy
well upon reading user comments in manual, looks like the only solution is
to dump variables into an array, and pass the array to a function with a
single defined by-ref parameter, so it kind of defeats the purpose.

Oh well.

-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Friday, 10 January 2003 3:24 PM
To: PHP General
Subject: [PHP] func_get_args...


Is this possible;

function TestRef()
{
$var = func_get_arg(0);
++$var;
}

$b = 1;
TestRef($b);
echo $b;

It doesn't seem to work. Is there a way to do it?

Or am I wasting my time trying to do this?

(Yes I am aware I could define TestRef($b)), but I can't, reason being; I'm
trying to create a couple of functions that 'sort of' emulate function
overloading, but also allow me to pass a couple of objects by reference
rather than value

Anyone tried to do this already?


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

2003-01-08 Thread Sean Malloy
Don't write code which requires register_globals to be on.

$variable = $_POST['$var'];


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:03 PM
To: Timothy Hitchens (HiTCHO)
Cc: PHP List
Subject: Re: [PHP] Stumped...


Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
for($i = 1; $i = $vars; $i++) {
 $tempvar = 'var'.$i;
 $variable .= $$tempvar.',';
}

All this gives me is this since I have three fields input:

,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: 'Stephen' [EMAIL PROTECTED]
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do SELECT * FROM accounts WHERE num_rec LIKE '5'  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
:  -Original Message-
:  From: Stephen [mailto:[EMAIL PROTECTED]]
:  Sent: Thursday, 9 January 2003 12:28 PM
:  To: Timothy Hitchens (HiTCHO)
:  Subject: Re: [PHP] Stumped...
: 
: 
:  Thank you much, but what did you mean I can't store numbers
:  up to 45, 768, etc?
:  - Original Message -
:  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  To: 'PHP List' [EMAIL PROTECTED]
:  Sent: Wednesday, January 08, 2003 9:21 PM
:  Subject: RE: [PHP] Stumped...
: 
: 
:  : Check out:
:  :
:  : http://www.php.net/manual/en/function.serialize.php
:  :
:  : Timothy Hitchens (HiTCHO)
:  : Open Platform Consulting
:  : e-mail: [EMAIL PROTECTED]
:  :
:  :  -Original Message-
:  :  From: Stephen [mailto:[EMAIL PROTECTED]]
:  :  Sent: Thursday, 9 January 2003 12:13 PM
:  :  To: Timothy Hitchens (HiTCHO)
:  :  Cc: PHP List
:  :  Subject: Re: [PHP] Stumped...
:  : 
:  : 
:  :  How would I serialise it? I can make the numbers into an
:  :  array, but if I echo the array itself, I'd get Array and I
:  :  need the number in the db, not the word...
:  : 
:  : 
:  :  - Original Message -
:  :  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  :  To: 'Stephen' [EMAIL PROTECTED]
:  :  Cc: 'PHP List' [EMAIL PROTECTED]
:  :  Sent: Wednesday, January 08, 2003 9:09 PM
:  :  Subject: RE: [PHP] Stumped...
:  : 
:  : 
:  :  : What you can do it simply get the data and create an array
:  :  serialise the
:  :  : array and sent it to
:  :  : the database ... the issue that arises from this is
:  that you can't
:  :  : select if that record has
:  :  : 45 and 786 etc etc
:  :  :
:  :  : The other option you have is to create a table then a
:  :  second table that
:  :  : has entries that show
:  :  : you which numbers it has:
:  :  :
:  :  : Table 1:
:  :  :
:  :  : Code
:  :  : Name
:  :  : etc
:  :  :
:  :  : Table 2:
:  :  :
:  :  : Code
:  :  : Number
:  :  :
:  :  : You will end up with multiple numbers listed in table 2 but
:  :  you can then
:  :  : easily find everyone with number 45.
:  :  :
:  :  :
:  :  :
:  :  : Timothy Hitchens (HiTCHO)
:  :  : Open Platform Consulting
:  :  : e-mail: [EMAIL PROTECTED]
:  :  :
:  :  :  -Original Message-
:  :  :  From: Stephen [mailto:[EMAIL PROTECTED]]
:  :  :  Sent: Thursday, 9 January 2003 12:00 PM
:  :  :  To: Timothy Hitchens (HiTCHO)
:  :  :  Cc: PHP List
:  :  :  Subject: Re: [PHP] Stumped...
:  :  : 
:  :  : 
:  :  :  I will later select them and display them to be edited, but
:  :  :  other then that, not really...
:  :  : 
:  :  : 
:  :  :  - Original Message -
:  :  :  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  :  :  To: 'Stephen' [EMAIL PROTECTED]; 'PHP List'
:  :  :  [EMAIL PROTECTED]
:  :  :  Sent: Wednesday, January 08, 2003 8:58 PM
:  :  :  Subject: RE: [PHP] Stumped...
:  :  : 
:  :  : 
:  :  :  : Do you require searching of this data eg... select via
:  :  :  these numbers or
:  :  :  : not??
:  :  :  :
:  :  :  :
:  :  :  : Timothy Hitchens (HiTCHO)
:  :  :  : Open Platform Consulting
:  :  :  : e-mail: [EMAIL PROTECTED]
:  :  :  :
:  :  :  :
:  :  :  : -Original Message-
:  :  :  : From: Stephen [mailto:[EMAIL PROTECTED]]
:  :  :  : Sent: Thursday, 9 January 2003 11:56 AM
:  :  :  : To: PHP List
:  :  :  : Subject: [PHP] Stumped...
:  :  :  :
:  :  :  :
:  :  :  : Sorry for so many questions but this should be the last one
:  :  :  for a while.
:  :  :  :
:  :  :  : I have a form that I want to insert into a MySQL table.
:  :  This form is
:  :  :  : based on how many entries a user wants to enter. For
:  :  

RE: [PHP] Stumped...

2003-01-08 Thread Sean Malloy

Please note the single quotes.

Using double quotes:

$variable = $_POST[$var];

will not work, because you don't have a variable named $var in your code.

Have a look at

http://www.php.net/manual/en/language.types.string.php



-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:18 PM
To: Stephen; PHP List
Subject: RE: [PHP] Stumped...


Don't write code which requires register_globals to be on.

$variable = $_POST['$var'];


-Original Message-
From: Stephen [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 9 January 2003 3:03 PM
To: Timothy Hitchens (HiTCHO)
Cc: PHP List
Subject: Re: [PHP] Stumped...


Ok, I decided another easier way to do it but I have a problem now. Since
the text field contains a $ sign, PHP wants to take it as a variable so it
prints out nothing... Here's my code for getting the value to import into
the table:

$variable = '';
for($i = 1; $i = $vars; $i++) {
 $tempvar = 'var'.$i;
 $variable .= $$tempvar.',';
}

All this gives me is this since I have three fields input:

,,,

Even if I substr() out the $ sign, it still gives a blank value. Anyone have
any ideas how to fix this?


- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: 'Stephen' [EMAIL PROTECTED]
Sent: Wednesday, January 08, 2003 9:30 PM
Subject: RE: [PHP] Stumped...


: The issue with the serialise option is that is you have then in a row
: they are serialised
: and you can't do SELECT * FROM accounts WHERE num_rec LIKE '5'  you
: would have to create
: two tables as per my previous idea or you can simple implode into a coma
: separated string
: and put into database and then you could use LIKE as per above.
:
:
:
: Timothy Hitchens (HiTCHO)
: Open Platform Consulting
: e-mail: [EMAIL PROTECTED]
:
:  -Original Message-
:  From: Stephen [mailto:[EMAIL PROTECTED]]
:  Sent: Thursday, 9 January 2003 12:28 PM
:  To: Timothy Hitchens (HiTCHO)
:  Subject: Re: [PHP] Stumped...
: 
: 
:  Thank you much, but what did you mean I can't store numbers
:  up to 45, 768, etc?
:  - Original Message -
:  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  To: 'PHP List' [EMAIL PROTECTED]
:  Sent: Wednesday, January 08, 2003 9:21 PM
:  Subject: RE: [PHP] Stumped...
: 
: 
:  : Check out:
:  :
:  : http://www.php.net/manual/en/function.serialize.php
:  :
:  : Timothy Hitchens (HiTCHO)
:  : Open Platform Consulting
:  : e-mail: [EMAIL PROTECTED]
:  :
:  :  -Original Message-
:  :  From: Stephen [mailto:[EMAIL PROTECTED]]
:  :  Sent: Thursday, 9 January 2003 12:13 PM
:  :  To: Timothy Hitchens (HiTCHO)
:  :  Cc: PHP List
:  :  Subject: Re: [PHP] Stumped...
:  : 
:  : 
:  :  How would I serialise it? I can make the numbers into an
:  :  array, but if I echo the array itself, I'd get Array and I
:  :  need the number in the db, not the word...
:  : 
:  : 
:  :  - Original Message -
:  :  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  :  To: 'Stephen' [EMAIL PROTECTED]
:  :  Cc: 'PHP List' [EMAIL PROTECTED]
:  :  Sent: Wednesday, January 08, 2003 9:09 PM
:  :  Subject: RE: [PHP] Stumped...
:  : 
:  : 
:  :  : What you can do it simply get the data and create an array
:  :  serialise the
:  :  : array and sent it to
:  :  : the database ... the issue that arises from this is
:  that you can't
:  :  : select if that record has
:  :  : 45 and 786 etc etc
:  :  :
:  :  : The other option you have is to create a table then a
:  :  second table that
:  :  : has entries that show
:  :  : you which numbers it has:
:  :  :
:  :  : Table 1:
:  :  :
:  :  : Code
:  :  : Name
:  :  : etc
:  :  :
:  :  : Table 2:
:  :  :
:  :  : Code
:  :  : Number
:  :  :
:  :  : You will end up with multiple numbers listed in table 2 but
:  :  you can then
:  :  : easily find everyone with number 45.
:  :  :
:  :  :
:  :  :
:  :  : Timothy Hitchens (HiTCHO)
:  :  : Open Platform Consulting
:  :  : e-mail: [EMAIL PROTECTED]
:  :  :
:  :  :  -Original Message-
:  :  :  From: Stephen [mailto:[EMAIL PROTECTED]]
:  :  :  Sent: Thursday, 9 January 2003 12:00 PM
:  :  :  To: Timothy Hitchens (HiTCHO)
:  :  :  Cc: PHP List
:  :  :  Subject: Re: [PHP] Stumped...
:  :  : 
:  :  : 
:  :  :  I will later select them and display them to be edited, but
:  :  :  other then that, not really...
:  :  : 
:  :  : 
:  :  :  - Original Message -
:  :  :  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
:  :  :  To: 'Stephen' [EMAIL PROTECTED]; 'PHP List'
:  :  :  [EMAIL PROTECTED]
:  :  :  Sent: Wednesday, January 08, 2003 8:58 PM
:  :  :  Subject: RE: [PHP] Stumped...
:  :  : 
:  :  : 
:  :  :  : Do you require searching of this data eg... select via
:  :  :  these numbers or
:  :  :  : not??
:  :  :  :
:  :  :  :
:  :  :  : Timothy Hitchens (HiTCHO)
:  :  :  : Open Platform Consulting
:  :  :  : e-mail: [EMAIL PROTECTED]
:  :  :  :
:  :  :  :
:  :  :  : -Original Message-
:  :  :  : From: Stephen [mailto:[EMAIL PROTECTED

RE: [PHP] Random array element

2003-01-07 Thread Sean Malloy

// seed code
list($usec, $sec) = explode(' ', microtime());
$microtime = ((float)$usec + (float)$sec);
srand((double) $microtime * 100);
//~ seed code

$randNumber = array();
$weekday =
array(monday,tuesday,wednesday,thursday,friday,saturday,sunday
);
for ($p = 0; $p  10; $p++)
{
  randNumber[] = rand(0, 6); // rand(int minnumber, int maxnumber);
}
$randDay1 = weekday[randNumber[0]];
$randDay2 = weekday[randNumber[1]];


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

2003-01-07 Thread Sean Malloy
SMTP = port 25


telnet mailserver 25

should do the trick

-Original Message-
From: Bruce Levick [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 10:35 AM
To: Timothy Hitchens (HiTCHO)
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] restrictions


Thanks,
Tried this and I get.

Cannot opeen connection to host on port 23



-Original Message-
From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 08, 2003 9:32 AM
To: Bruce Levick; 'Marco Tabini'
Cc: [EMAIL PROTECTED]
Subject: RE: [PHP] restrictions


In windowsxp do the following:

Start - Run

Open: cmd

At the shell type:

telnet x.x.x.x 25 x.x.x.x being the smtp server

If you get a prompt then you have other issues such as relay etc etc



HiTCHO has Spoken! 
Timothy Hitchens (HiTCHO)
[EMAIL PROTECTED] 

 -Original Message-
 From: Bruce Levick [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 8 January 2003 9:25 AM
 To: Marco Tabini
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] restrictions
 
 
 Well I can't be totally sure but I think all outgoing mail
 points to an external SMTP server.
 
 -Original Message-
 From: Marco Tabini [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, January 08, 2003 9:11 AM
 To: Bruce Levick
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] restrictions
 
 
 Hello Bruce--
 
 That depends on what restrictions are imposed on your box, of
 course. Does your company use an SMTP-compatible mail server 
 for your internal mail? If so, you could use the server your 
 mail client points to to perform your tests.
 
 Cheers,
 
 
 Marco
 --
 
 php|architect - The Monthly Magazine for PHP Professionals
 Come check us out on the web at http://www.phparch.com!
 GET YOUR FREE COPY TODAY! Simply register  download!
 
 --
 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] HTTP_WEFERER

2003-01-07 Thread Sean Malloy
Elmer Fudd been coding your PHP for you?

I dount it ever worked ;)

-Original Message-
From: bill [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 12:41 PM
To: [EMAIL PROTECTED]
Subject: [PHP] HTTP_WEFERER


A script started acting wonky with no changes to it.  Doing a bit of debug
at
the time, I uncovered an odd variable called

HTTP_WEFERER

What is that?  I check of the php.net website yielded no results.

I'm guessing it is a variable set on the server.   My first thought was a
mangled HTTP_REFERER variable, which was missing, but the value was some
long
string.

Any ideas?

thanks,

bill


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

2003-01-07 Thread Sean Malloy

I'm not really sure what you mean in terms of ASP needing two or more pages?

%
dim pageAction
pageAction = Request(action)

select case pageAction
  case postit: InsertFormData()
  case else : ShowForm()
end select

sub InsertFormData()
end sub

sub ShowForm()
  Response.Write(htmlhead/headbodyTheForm/body/html)
end sub
%

or whatever.


as far as isset goes?

function isset(byval checkVar)
  dim ret
  if (len(checkVar)  0) then
ret = true
  else
ret = false
  end if
end function



The ONLY thing I can think of that ASP misses that can be done easily in
PHP, is dynamic includes, ie:

$code = _GET['code'];
include($code.'.php');


the asp inlude equivelent is
!--#include file=whatever.asp--

and thats handled by the SSI engine before it gets passed over to the ASP
engine. So no dynamic includes for ASP.

Ofcourse there are other features that PHP has that ASP does not, and vice
versa. Right tool for the job, right tool for the job.



-Original Message-
From: See kok Boon [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 6:29 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP vs. ASP


There is one minor difference that caused a major change in structure of the
two scripting language.

PHP offers the isset() function but ASP don't. in a way there are the pros
and cons.

For PHP, you can create the whole site in one page, even though that would
not be advisable. Because of isset(), you can get input and display output
using the same page. However, this would result in security loop holes.

Whereas for ASP, without the isset() keyword, ASP structures are usually
made up of at least 2 pages. One for receiving input and the other for
display the result, output. This of cos patches the security holes.

In a way, PHP provides a simpler way for programmer. Also, one can chose not
to use isset() !!

But ASP only supported on win platforms... =(



-Original Message-
From: Anthony Rodriguez [mailto:[EMAIL PROTECTED]]
Sent: 04 January 2003 10:50
To: [EMAIL PROTECTED]
Subject: [PHP] PHP vs. ASP

Hi!
How does PHP differs from ASP?

Are there any advantages in using PHP over ASP? Or the other way around?

Thanks!



--
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] PHP vs. ASP

2003-01-07 Thread Sean Malloy
oops

function isset(byval checkVar)
  dim ret
  if (len(checkVar)  0) then
ret = true
  else
ret = false
  end if
  isset = ret
end function

meh

-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 8 January 2003 6:42 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] PHP vs. ASP



I'm not really sure what you mean in terms of ASP needing two or more pages?

%
dim pageAction
pageAction = Request(action)

select case pageAction
  case postit: InsertFormData()
  case else : ShowForm()
end select

sub InsertFormData()
end sub

sub ShowForm()
  Response.Write(htmlhead/headbodyTheForm/body/html)
end sub
%

or whatever.


as far as isset goes?

function isset(byval checkVar)
  dim ret
  if (len(checkVar)  0) then
ret = true
  else
ret = false
  end if
end function



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




[PHP] Using VS.NET for PHP Projects

2003-01-06 Thread Sean Malloy

I know I can use Visual Studio to edit PHP files as plain text, but has
anyone seen any way of creating some sort of add-in, or macro or whatever,
which would do syntax highlighting on PHP files?



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




[PHP] Using VS.NET for PHP Projects - Revisit

2003-01-06 Thread Sean Malloy
Hi.

I kind of got PHP syntax highlighting working within Visual Studio.NET

I've created a page, which mentions the steps you need to take to get it
working, as well as a screen shot. Everyone loves screen shots.

http://www.quake-au.net/php/php_and_vsdotnet.htm

Hope someone finds it useful apart from me.

Regards,

Sean

-Original Message-
From: Sean Malloy [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 7 January 2003 1:34 PM
To: PHP General
Subject: [PHP] Using VS.NET for PHP Projects



I know I can use Visual Studio to edit PHP files as plain text, but has
anyone seen any way of creating some sort of add-in, or macro or whatever,
which would do syntax highlighting on PHP files?



--
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] undocumented OOP feature/bug?

2003-01-05 Thread Sean Malloy
Consider the following code...

class A
{
  function Go()
  {
switch (isset($this))
{
  case true: echo 'Called Dynamicallybr /'; break;
  case false: echo 'Called Staticallybr /'; break;
}
  }
}

class B
{
  function Go()
  {
A::Go();
  }
}

A::Go();
$a = new A();
$a-Go();

B::Go();
$b = new B();
$b-Go();


My understanding is that the output should be:

Called Statically
Called Dynamically
Called Statically
Called Statically

Yet the output is actually:

Called Statically
Called Dynamically
Called Statically
Called Dynamically


Now my question is, is this what was intended?

It seems that if you call a static class from within a dynamic instance of a
class, the static class then decides $this should reference the class from
which the static class was called

Anyone else come across this?

It could be useful, but right now, its bloody annoying! I need a class to be
called from within another clas, and it needs to know wether it has had an
instance created, or wether it is being statically called, and now I'll have
to write some kludge code instead...




///
// Sean Malloy
// Developer
// element
// t: +61 3 9510 
// f: +61 3 9510 7755
// m: 0413 383 683
///

DISCLAIMER:
© copyright protected element digital pty ltd 2002.
the information contained herein is the intellectual property
of element digital pty ltd and may contain confidential material.
you must not disclose, reproduce, copy, or use this information
in any way unless authorised by element digital pty ltd in writing
or except as permitted by any applicable laws including the
copyright act 1968 (cth).


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




RE: [PHP] makeing an array

2003-01-02 Thread Sean Malloy
see example 2.

 -Original Message-
 From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 1 January 2003 11:00 PM
 To: Sean Malloy; [EMAIL PROTECTED]
 Subject: Re: [PHP] makeing an array


 Your example of:

 for ($i = 0; $i  count($comment); $i++)

 Is very bad as the count will be parsed each loop.

 The count as I had it gets parsed only once.


 Timothy Hitchens (HiTCHO)
 [EMAIL PROTECTED]


 HiTCHO | Open Platform Web Development
 Consulting - Outsourcing - Training - Support


 - Original Message -
 From: Sean Malloy [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, January 01, 2003 9:40 PM
 Subject: RE: [PHP] makeing an array


  why the $x variable aswell?!
 
  for ($i = 0; $i  count($comment); $i++)
  {
  echo $comment[$i].'br /';
  }
 
  or even faster:
 
  $i = count($comment);
  while ($i--)
  {
  echo $comment[$i].'br /';
  }
 
   -Original Message-
   From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]]
   Sent: Wednesday, 1 January 2003 4:41 PM
   To: Philip J. Newman; [EMAIL PROTECTED]
   Subject: Re: [PHP] makeing an array
  
  
   Use the count like following inside to ensure that you don't
   call on a non existent index.
  
   for ($i = 0, $x = count($comment); $i  $x; $i++)
   {
   echo $comment[$i].'br /';
   }
  
   Why do you want to echo out $comment_1 ???
  
  
  
   Timothy Hitchens (HiTCHO)
   [EMAIL PROTECTED]
  
  
   HiTCHO | Open Platform Web Development
   Consulting - Outsourcing - Training - Support
  
  
   - Original Message -
   From: Philip J. Newman [EMAIL PROTECTED]
   To: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED];
   [EMAIL PROTECTED]
   Sent: Wednesday, January 01, 2003 3:29 PM
   Subject: Re: [PHP] makeing an array
  
  
So in saything that I could do this ...
   
$s = 10
   
$comment[1] = '$comment_1';
$comment[2] = '$comment_2';
$comment[3] = '$comment_2';
   
for($i = 0; $i = $s; $i++) {
   
 echo $comment[$i].br;
   
}
   
   
   
- Original Message -
From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
To: Philip J. Newman [EMAIL PROTECTED];
   [EMAIL PROTECTED]
Sent: Wednesday, January 01, 2003 6:12 PM
Subject: Re: [PHP] makeing an array
   
   
 Example of an Array:

 $my_first_array = array(1 = 'first', 2 = 'second', 3 =
 'third');

 You can now access these like so:

 echo $my_first_array[1];   etc etc

 of if you had this:  $my_first_array = array('first_name' =
 'Philip',
 'last_name' = 'Newman');

 You could do this:

 echo $my_first_array['first_name'];

 The thing to remember is that array's start at 0 see below!! (I
   started
at
 1 at the top to make it easier).

 You can also make an array like so:

 $first[] = 'Philip';
 $first[] = 'John';
 $first[] = 'Paul';

 Now you can simply do:

 echo $first[0];  // this could output 'Philip';

 You can then look at multi dimensional etc...

 I trust this get's you on your way.


 Timothy Hitchens (HiTCHO)
 [EMAIL PROTECTED]


 HiTCHO | Open Platform Web Development
 Consulting - Outsourcing - Training - Support


 - Original Message -
 From: Philip J. Newman [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, January 01, 2003 2:57 PM
 Subject: [PHP] makeing an array


  Can someone help me make an array ...
 
  I have $foo amount of loops to preform (1-20), and would
   like to make
the
  veriable work for me like $comment_1, $comment_2 etc etc.
 
  http://nz.php.net/manual/en/function.array.php makes no sence to
 me
after
 i
  read it and read it ...
 
  help me please
 
  ---
  Philip J. Newman.
  Head Developer.
  PhilipNZ.com New Zealand Ltd.
  http://www.philipnz.com/
  [EMAIL PROTECTED]
 
  Mob: +64 (25) 6144012.
  Tele: +64 (9) 5769491.
 
  VitalKiwi Site:
  Philip J. Newman
  Internet Developer
  http://www.newman.net.nz/
  [EMAIL PROTECTED]
 
  *
Friends are like Stars,
You can't always see them,
But you know they are there.
 
  *
 
  ICQ#: 20482482
  MSN ID: [EMAIL PROTECTED]
  Yahoo: [EMAIL PROTECTED]
  AIM: newmanpjkiwi
 
 
  --
  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

RE: [PHP] makeing an array

2003-01-01 Thread Sean Malloy
why the $x variable aswell?!

for ($i = 0; $i  count($comment); $i++)
{
echo $comment[$i].'br /';
}

or even faster:

$i = count($comment);
while ($i--)
{
echo $comment[$i].'br /';
}

 -Original Message-
 From: Timothy Hitchens (HiTCHO) [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, 1 January 2003 4:41 PM
 To: Philip J. Newman; [EMAIL PROTECTED]
 Subject: Re: [PHP] makeing an array


 Use the count like following inside to ensure that you don't
 call on a non existent index.

 for ($i = 0, $x = count($comment); $i  $x; $i++)
 {
 echo $comment[$i].'br /';
 }

 Why do you want to echo out $comment_1 ???



 Timothy Hitchens (HiTCHO)
 [EMAIL PROTECTED]


 HiTCHO | Open Platform Web Development
 Consulting - Outsourcing - Training - Support


 - Original Message -
 From: Philip J. Newman [EMAIL PROTECTED]
 To: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Wednesday, January 01, 2003 3:29 PM
 Subject: Re: [PHP] makeing an array


  So in saything that I could do this ...
 
  $s = 10
 
  $comment[1] = '$comment_1';
  $comment[2] = '$comment_2';
  $comment[3] = '$comment_2';
 
  for($i = 0; $i = $s; $i++) {
 
   echo $comment[$i].br;
 
  }
 
 
 
  - Original Message -
  From: Timothy Hitchens (HiTCHO) [EMAIL PROTECTED]
  To: Philip J. Newman [EMAIL PROTECTED];
 [EMAIL PROTECTED]
  Sent: Wednesday, January 01, 2003 6:12 PM
  Subject: Re: [PHP] makeing an array
 
 
   Example of an Array:
  
   $my_first_array = array(1 = 'first', 2 = 'second', 3 = 'third');
  
   You can now access these like so:
  
   echo $my_first_array[1];   etc etc
  
   of if you had this:  $my_first_array = array('first_name' = 'Philip',
   'last_name' = 'Newman');
  
   You could do this:
  
   echo $my_first_array['first_name'];
  
   The thing to remember is that array's start at 0 see below!! (I
 started
  at
   1 at the top to make it easier).
  
   You can also make an array like so:
  
   $first[] = 'Philip';
   $first[] = 'John';
   $first[] = 'Paul';
  
   Now you can simply do:
  
   echo $first[0];  // this could output 'Philip';
  
   You can then look at multi dimensional etc...
  
   I trust this get's you on your way.
  
  
   Timothy Hitchens (HiTCHO)
   [EMAIL PROTECTED]
  
  
   HiTCHO | Open Platform Web Development
   Consulting - Outsourcing - Training - Support
  
  
   - Original Message -
   From: Philip J. Newman [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Wednesday, January 01, 2003 2:57 PM
   Subject: [PHP] makeing an array
  
  
Can someone help me make an array ...
   
I have $foo amount of loops to preform (1-20), and would
 like to make
  the
veriable work for me like $comment_1, $comment_2 etc etc.
   
http://nz.php.net/manual/en/function.array.php makes no sence to me
  after
   i
read it and read it ...
   
help me please
   
---
Philip J. Newman.
Head Developer.
PhilipNZ.com New Zealand Ltd.
http://www.philipnz.com/
[EMAIL PROTECTED]
   
Mob: +64 (25) 6144012.
Tele: +64 (9) 5769491.
   
VitalKiwi Site:
Philip J. Newman
Internet Developer
http://www.newman.net.nz/
[EMAIL PROTECTED]
   
*
  Friends are like Stars,
  You can't always see them,
  But you know they are there.
   
*
   
ICQ#: 20482482
MSN ID: [EMAIL PROTECTED]
Yahoo: [EMAIL PROTECTED]
AIM: newmanpjkiwi
   
   
--
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] Some discoveries I've made. Anyone care to confirm/deny

2002-12-19 Thread Sean Malloy
Three different topics, perhaps suited to three seperate emails, but I'll
cover them all in one.

Firstly, something regarding accessing form/query string variables, on
diffferent versions of PHP. Starts to become a nightmare, but you also want
to make sure you _aren't_ requiring register_globals to be on...

so what I do;

function Form($var = null)
{
if (function_exists('version_compare')) // added in 4.1.0
{
return @$_POST[$var];
}
global $HTTP_POST_VARS;
return @$HTTP_POST_VARS[$var];
}

then just

$variable = Form('field');

you can adapt the code for the other various http variable arrays etc. I
have encapsulated it in a class, and also, to remove the call to the
function_exists function every time I attempt to get variable

define('MY_PHP_VERSION', function_exists('version_compare'));

then the if statement becomes if (MY_PHP_VERSION) {




Now, a couple of other things to discuss.

can anyone else confirm my conclusion;

define('MYSTRING', 'Hello World');
for ($i = 0; $i  5000; $i++) { echo MYSTRING; }

class Msg { function MyString() { return 'Hello World'; } }
for ($i = 0; $i  5000; $i++) { echo Msg::MyString(); }

that creating a static class, with static members, and calling those,
instead of using define() variables, is actually faster?



thirdly,

for ($i = 0; $i  5000; $i++) { echo $i; }

$i = 5000; while ($i--) { echo $i; }

that the decrementing while loop is actually faster than a for loop?

btw I'm aware that a decrementing while loop can not be a replacement for
every for loop situation, but there are times when you can use it instead,
and from what I can see, its faster.



Hope I made sense. I'm in a rush! Also my first post to the list for about 4
years! These things could have been discussed already so I apologise, just
in case.

Regards,

Sean




///
// Sean Malloy
// Developer
// element
// e: [EMAIL PROTECTED]
// t: +61 3 9510 
// f: +61 3 9510 7755
// m: 0413 383 683
///

DISCLAIMER:
© copyright protected element digital pty ltd 2002.
the information contained herein is the intellectual property
of element digital pty ltd and may contain confidential material.
you must not disclose, reproduce, copy, or use this information
in any way unless authorised by element digital pty ltd in writing
or except as permitted by any applicable laws including the
copyright act 1968 (cth).


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




RE: [PHP] creating random strings?

2002-12-19 Thread Sean Malloy
My comment would be on the readability and portability of the code Think
of someone else coming along to look at that! ;)

This is what I would do; create one function, GenerateString(int $length,
int $type)

function GenerateString($length = 6, $type = 1)
{
  $string = '';
  // seed rand function
  list($usec, $sec) = explode(' ', microtime());
  $microtime = ((float)$usec + (float)$sec);
  srand((double) $microtime * 100);

  // loop till $length - 1
  for ($i = 0; $i  $length; $i++)
  {
// its a password, set the choice to be between 1 and 4
if ($type == 2)
{
  $choice = rand(1, 4);
}
// its a username, set the choice to be between 1 and 2
else
{ $choice = rand(1, 2); }

switch ($choice)
{
  //generate a random number representing ascii character between a-z
  case 1:
  case 2: $min = 97; $max = 122; break;
  //generate a random number representing ascii character between 0-9
  case 3:
  case 4: $min = 48; $max = 57; break;
}
// add the character to our string
$string .= chr(rand($min, $max));
  }
  // return our generated string
  return $string;
}

// for readability
define('L_USER', 1);
define('L_PASS', 2);

//for a username, you want 8 character a - z
$username = GenerateString(8, L_USER);

//for a username, you want 6 character a - z and 0-9
$password = GenerateString(6 L_PASS);


Hope that gives you some alternative ideas to explore


 -Original Message-
 From: Paul Chvostek [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 20 December 2002 10:47 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] creating random strings?



 I need to create batches of randomly generated usernames and passwords.
 To start off, I have:

  $validuchars='abcdefghijkmnopqrstuvwxyz';
  $validpchars='abcdefghijkmnopqrstuvwxyz23456789';
  $lenu=strlen($validuchars)-1;
  $lenp=strlen($validpchars)-1;

 The first method I came up with was:

  $uid=''; for($i=8;$i;$i--) $uid.=substr($validchars,mt_rand(0,$lenu),1);
  $pwd=''; for($i=8;$i;$i--) $pwd.=substr($validchars,mt_rand(0,$lenp),1);

 But I'm wondering if there's any significant benefit to this instead:

  for( $uid=''; strlen($uid)8;
 $uid.=substr($validuchars,mt_rand(0,$lenu),1) );
  for( $pwd=''; strlen($pwd)8;
 $pwd.=substr($validpchars,mt_rand(0,$lenp),1) );

 I can't see any difference in speed.  Does the savings of the $i variable
 have any signficance at all?

 Another thing I was thinking of doing was making more pronouncable
 usernames with something like:

  $cons=bcdfghjklmnpqrstvwxyz;
  $vowels=aeiouy;
  $lenv=strlen($vowels)-1;
  $lenc=strlen($cons)-1;
  $uid=; for($i=4;$i;$i--)
   $uid.=substr($cons,mt_rand(0,$lenc),1) .
 substr($vowels,mt_rand(0,$lenv),1);

 Any thoughts?

 Incidentally, I'm guaranteeing uniqueness of usernames with a unique
 index in the MySQL table that stores this stuff.  Including the INSERT,
 I can create about 10 of these in 60 seconds.  So this is more a
 question of style than of practical limitations.  ;)

 --
   Paul Chvostek [EMAIL PROTECTED]
   Operations / Abuse / Whatever  +1 416 598-
   it.canada - hosting and development  http://www.it.ca/


 --
 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] Another problem with conditional statements

2002-12-19 Thread Sean Malloy
Its all wrong. You shouldn't be using a switch statement anyway. A switch is
for evaluating a single variable.

alss, your code if ($a  $b == 124) is the equivelent of writing if ($a ==
true  $b == 124).


if ($a == $b)
{
// do struff
}
elseif ( ($a == 124)  ($b == 124) )
{
//do stuff
}
elseif ( ($a == 124)  ($b == 755) )
{
//do stuff
}
elseif ( ($a == 124)  ($a != $b) )
{
 // do stuff
}
else {
// do default
}


a switch statement is used in this context;

$a = 1;

switch ($a)
{
 case 1: $blah = $a; break;
 case 2: $blah = 'something else'; break;
 default: $blah = 'nothing';
}

you evaluate a single variable, otherwise, you are stuck with using is/else
statements


 -Original Message-
 From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 20 December 2002 11:19 AM
 To: PHP General
 Subject: [PHP] Another problem with conditional statements


 Hi,

 This should be as simple as breathing, but not today. I have two variables
 $a and $b which I need to compare in a switch statement in
 several different
 ways, but no matter what I do it's wrong.

 This is what I have tried, can someone tell me how it should be.

 TIA

 switch (true):

 case ($a == $b): This one seems simple enough.
 do sum stuff;
 break;

 case ($a  $b == 124):   This appears not to work.
 do sum stuff;
 break;

 case ($a == 124  $b == 755):  If $a is equal to 124 and $b
 is equal to
 755 then it should be true..doesn't work.
 do sum stuff;
 break;

 case ($a == 124  $b != 124):   Nope, this doesn't appear to work
 either.
 do sum stuff;
 break;

 endswitch;



 --
 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] Another problem with conditional statements

2002-12-19 Thread Sean Malloy
Nowhere in the documentation does it specify switch should be used in the
context you are attempting.

The docs show a single variable and checking the case of that variable.

I'm not going to berate you on syntax. If you can get it working like that
then good for you. However, I would strongly advise you to use the
if/elseif/else statements instead.

an example of switch

$action = $_POST['action']
switch ($action)
{
case 'help': showHelp(); break;
default : showDefault();
}

not

$action = $_POST['action']
switch (true)
{
case ($action == 'help'): showHelp(); break;
default : showDefault();
}


 -Original Message-
 From: Beauford.2002 [mailto:[EMAIL PROTECTED]]
 Sent: Friday, 20 December 2002 12:46 PM
 To: Rick Emery
 Cc: PHP General
 Subject: Re: [PHP] Another problem with conditional statements


 I believe you are incorrect. Switch will look for the first case statement
 that is true and execute that statement. The following works - case one is
 incorrect so it doesn't get executed but the second case does. Paste this
 into a test.php file and you will see it works.. Read the manual.

 $a=2;
 $b=4;

 switch (true) {
 case ($a  $b) and ($b  5):
 echo Incorrect;
 case ($a == 2):
 echo Correct;
  }

 So my original question is still stands. The switch statement is correct,
 but there is a problem with my conditional statements.

 - Original Message -
 From: Rick Emery [EMAIL PROTECTED]
 To: Beauford.2002 [EMAIL PROTECTED]; PHP General
 [EMAIL PROTECTED]
 Sent: Thursday, December 19, 2002 7:33 PM
 Subject: Re: [PHP] Another problem with conditional statements


  switch() does not work that way.  Switch uses the value in the
 parentheses
 and selects a
  CASE based upon that value.  Read the manual.
 
  You will have to use a series of if()-elseif()-else()
  - Original Message -
  From: Beauford.2002 [EMAIL PROTECTED]
  To: PHP General [EMAIL PROTECTED]
  Sent: Thursday, December 19, 2002 6:19 PM
  Subject: [PHP] Another problem with conditional statements
 
 
  Hi,
 
  This should be as simple as breathing, but not today. I have
 two variables
  $a and $b which I need to compare in a switch statement in several
 different
  ways, but no matter what I do it's wrong.
 
  This is what I have tried, can someone tell me how it should be.
 
  TIA
 
  switch (true):
 
  case ($a == $b): This one seems simple enough.
  do sum stuff;
  break;
 
  case ($a  $b == 124):   This appears not to work.
  do sum stuff;
  break;
 
  case ($a == 124  $b == 755):  If $a is equal to 124 and
 $b is equal
 to
  755 then it should be true..doesn't work.
  do sum stuff;
  break;
 
  case ($a == 124  $b != 124):   Nope, this doesn't appear to work
  either.
  do sum stuff;
  break;
 
  endswitch;
 
 
 
  --
  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