[PHP] Microsoft SQL Server varchar(500) field text concatenated at 255characters.

2003-03-28 Thread Scott Houseman
Hi There.

I am using PHP 4.3.0 on WIN32 to query data from a Microsoft SQL Server.
One field I am requesting is type VARCHAR size 500. For some reason, PHP
is returning only the first 255 characters of the text from that field.
If I change the field type to TEXT, all of the data in that field is returned.

Unfortunately, an ASP application is also using that database, and when I change
the field type to TEXT, it pukes completely.
I would rather try to resolve the issue in PHP than waste my time looking at ASP code.
Has anyone got an idea why this might be hapenning?

Many thanks.

Scott
--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
Tel. +27 12 342 3840 x3806
Fax. +27 12 342 1842
Mob. +27 82 491 8021
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Serial device /dev/ttyS0

2003-01-14 Thread Scott Houseman
Hi.

Would it be possible to use PHP to communicate with
a serail device e.g. a modem.
I would like to send AT commands to a GSM modem 
be able to read the resulting output.

I know PHP may not be ideal for this, but I think if
it's possible, it would be the quickest way of knocking something
together.

Thanks

Scott
--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] money

2003-01-09 Thread Scott Houseman
Hi There.

Try this

//To get a comma rather that a period:

$fTotalPrice = $iQuantity * $fUnitPrice;
$fTotalPrice = str_replace( '.', ',', $fTotalPrice );

//To check wether to add a zero to the end of a float:

// Get part of float after comma.
$iDecimal = substr( $fTotalPrice, strpos( $fTotalPrice, ',' ) +1 );
if ( strlen( $iDecimal ) == 1 )
{
	$fTotalPrice .= '0';
}

I haven't tested this, but it should work.

Cheers

Scott

On 2003/01/09 12:44, Wilbert Enserink wrote:

Hi all,



I'm busy making a swebstore. I have troubles with the format of money.

I wanrt to display amounts like 2 products a ? 6,25 = ? 12,50


Whatever I try I can't get the comma there (it's showing a point . and it doesn't display the second number behind the comma i.e. 12.5

Anybody knows how to make me my money? :-)

regards Wilbert




-
Pas de Deux
Van Mierisstraat 25
2526 NM Den Haag
tel 070 4450855
fax 070 4450852
http://www.pdd.nl
[EMAIL PROTECTED]
-


--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] Can you insert into $_POST manually?

2003-01-09 Thread Scott Houseman
Hi.

If you add them to the $url variable as in a query string, they
should be available in that page's $_GET array e.g.
if $url = http://myhost.com/mypage.php?id=$idpage=$pageuser=$user;

then you would have the values

$_GET{'id'}
$_GET{'page'}
$_GET{'user'}

created for you with the values as given.

Cheers

Scott

On 2003/01/09 02:04, Noel Wade wrote:

Hi all,

So I have a page that processes information and then echos out a redirect
that looks like this:

META HTTP-EQUIV=REFRESH CONTENT=4; URL=? echo $url ?;

The thing is, there are some variables that I would love to pass in $_POST
or $HTTP_POST_VARS to the page referred to in $url.

Is there any way to stuff this data into either of these globals so that the
$url page can access 'em?

Thanks a bunch!

--Noel






--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] Text editors

2003-01-07 Thread Scott Houseman
Hi there.

I find that the Maguma Studio works very nicely.

http://www.maguma.com/

I've only used the 'light' version, as it's free.

Cheers

Scott


On 2003/01/07 11:59, Karl James wrote:

Hello guys,
Right now im using dreamweaver mx 
 
I was wondering if anyone knew of any good free text editors that has
line counts
And is good for php….
 
Thanks 
karl

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002
 


--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] Out with the new, In with the old

2002-12-11 Thread Scott Houseman
Hi

Try and get them (your hosting company)to configure your site with a 
prepend file e.g. prepend.php for your domain.
in this file, do something like:

?php
//
// DECLARE ARRAYS
//
$_GET = array( );
$_POST = array( );
$_SERVER = array( );
// etc..
while ( list( $sKey, $mVal ) = each( $HTTP_GET_VARS ) )
{
	$_GET{$sKey} = $mVal;
}
// Do this for all arrays which you want to use in your code.
?

As this file will be auto prepended everytime php is invokded,
these variables will always be available, although they will NOT
be global. That might be a problem if you are using them in the global
scope.

Hope this is useful.

Cheers


Scott

On 2002/12/12 08:14, Jonathan wrote:
I began to develop a small session based shopping cart using newer syntax.
For example, $_SERVER, $_REQUEST, $_SESSION, etc.  Anyway, I'm almost done
with the cart and just found out that the hosting company for the client is
running PHP 4.0.6.  Is there anyway around this besides changing all of my
variable names?



===
Jonathan Villa
Application Developer
IS Design  Development
www.isdesigndev.com http://www.isdesigndev.com/ 
414.429.0327
===





--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] Newbie : How work with parameters?

2002-11-27 Thread Scott Houseman
Use the superglobal array $_GET

echo $_GET{'id'}; // should return abc

Cheers

Scott

Stéphane Génin wrote, On 11/27/2002 10:58 AM:

Hello,

I want to read the parameters in the URL, but I can't find the right way to
do that. I've tried several things :

my URL is:  http://localhost/test.php?id=abc

I tried to use the $id, but in this case, I have a notice with 'undefined
variable'.
I have the same problem if I try the variable $QUERY_STRING (still undefined
variable).

Do you know what is the best way to read this parameters?

Many thanks
Stéphane





--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] Sending POST vars to pop-up window - How?

2002-11-24 Thread Scott Houseman
Hi there

Try this:

Leave your form tag as it is.
Put a TARGET=_NEW parameter into your form tag.
This should submit the form via POST to a new window.

You could then put some javascript into this window's html to resize the
window etc.

OR

when the submit button is clicked,
in the onClick( ) method

open a new window with javascript.
format size toobars etc.
Set the form's TARGET value to the new window's name.
form.submit( );

I think this could also work.

Regards

Scott

Monty wrote, On 11/25/2002 9:16 AM:

I'm writing a poll app. I want it to work this way:

1. On web page, user selects choice, clicks VOTE.

2. Clicking VOTE triggers a pop-up window.

3. PHP script running in pop-up records vote, displays results.

Problem is, POSTed vars that come from forms aren't available in the popup
window if I make the FORM action = javascript:popWin('/poll.php').

Is setting the vote choice in a session var the only way to make this work,
or is there a way to pass vars via a form POST to the popup window?

Thanks!

Monty






--
Scott Houseman
Senior Software Developer
Junk Mail Publishing (Pty) Ltd
T + 27 12 342 3840 ext 2806 F +27 12 342 3876
E [EMAIL PROTECTED] | www.junkmail.co.za
A 1312 Pretorius Street, Hatfield, Pretoria
P O Box 6574, Pretoria, 0001, South Africa
+27 82 491 8021


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




Re: [PHP] newbie question

2002-10-03 Thread Scott Houseman

This is very simple

To access variables from GET form, which you would use request.querystring( ) for in 
ASP,
use the $_GET array in PHP, e.g. $var = $_GET{'var'}
To access POST form values, which you would use request.form( ) for in ASP, use the 
$_POST
array in PHP e.g. $var = $_POST{'var'}.

Cheers!

Scott

On 10/2/2002 1:24 PM, Remon Redika wrote:
 I am newbie in php
 I have var $query_string in my address page.
 I want get value of query string.
 For example I give string on my query string like 
 www.mypages.com?var=numberx
 I just want get a value of var or numberx
 I usually do this var on asp
 request.querystring(var) , so I'll get the value = numberx
 how i do it on php...?
 sorry about my English.


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] Complete development software

2002-10-03 Thread Scott Houseman

http://www.nusphere.com/

On 10/3/2002 4:51 PM, Ray, James A wrote:
 Other then Abriasoft, is there another complete software package that
 contains PHP, MYSQL, APACHE and PERL for Windows?
  
 Thank you
  
 Jim
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] get access to define() constants with dynamic names

2002-10-02 Thread Scott Houseman

Hi Heiko

Try this:
$aName = TEAM;
eval( '$myString = G_T_'.$aName.';' ); // evaluates to: $myString = G_T_TEAM
echo $myString; // Should print out SAFETOUR_team

I haven't tested this, but it should work.

Regards

Scott

On 10/2/2002 10:47 AM, Heiko Mundle wrote:
 Hi all,
 
 my script knows three different constants
 
 define(G_T_USER,user_profile);
 define(G_T_TEAM,SAFETOUR_team);
 define(G_T_CALL,SAFETOUR_call);
 
 Is it possible to get access to them, if I have the names (USER, TEAM, 
 CALL) in a variable?
 
 It must be something like that:
 
 aName = TEAM;
 myString = G_T_$sName; // myString = SAFETOUR_team
 
 
 Any hint to solve this problem would be useful.
 
 heiko
 
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] PHPDoc?

2002-10-01 Thread Scott Houseman

www.phpdoc.de is one I know of.
I'm not surewhat the current development activity is, but I think it's still in beta.
The front page states 'Last update: 2000/12/03' - so I don't know what's happening 
there.

Regards

Scott

On 10/1/2002 4:18 PM, Francis wrote:
 Is their any comparable tool/util whatever to automaticly create
 documentation from your PHP Code (like java's JavaDoc)?
 
 
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] 4.0.2 = 4.2.3, form vars are empty?

2002-09-27 Thread Scott Houseman

This is almost certainly due to the new superglobals arrays which are used in newer 
versions of php.
in short, you will not be aqble to use the value 'name' from a posted form by simply 
refering
to '$name', but should rather use '$_POST[name]'.See the php manual for more info.

To solve this issue with your older app:

edit php.ini
find 'register_globals', this will probably be set to 'off'
change it to 'register_globals = on'

Cheers

Scott



Qmail List wrote:
 Hello List,
 
 I'm putting a php app that has been off-line for about 18 months back
 on-line. During my absence from php I had heard about some security issues,
 so figured I'd try the latest 4.2.3 release.
 
 Sessions and the DB are fine, but GET/POST vars are continually empty. I
 mean a form submission from .html to .php (about the simplest thing
 possible) the variables are not getting populated with their form values.
 
 Actually, phpinfo() does show the variables and their values if I throw it
 in the .php file. But tailing the mysql log shows the following:
 
 SELECT * FROM users WHERE username='' AND password=''
 
 from this code.
 
 $query = mysql_query(SELECT * FROM users WHERE username='$username' AND
 password='$password');
 
 
 Regards, Thx
 
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] Auto-increment value

2002-09-18 Thread Scott Houseman

Hi there.

You can use the function mysql_insert_id( [link id] ).

regards

Scott

Faisal Abdullah wrote:
 Hi people,
 
 I have a table with a column called ID (auto-increment).
 Is it possible to know the value of ID, right after inserting 
 a row? 
 
 I'm using postgresql.
 
 Thanks.
 
 Sincerely,
 Faisal
 
 __
 
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




Re: [PHP] class Problem

2002-09-17 Thread Scott Houseman

Hi there.

Try doing it this way:
You need to access the class's variable using the $this identifier
e.g.
  class MenueItem {
   var $ID_Menue;
   var $Name;
   var $Parent_ID;
   var $Next_ID;
   var $Prev_ID;
   
 
   function Write() {
   echo Parent_ID:  . $this-Parent_ID . BR;// Not $MI
   //(no output at all!)
   }
   
 


Regards

-Scott

David Eggler wrote:
 I create a Instance fo the Class MenueItem in Menue. I change the value of 
 one of its variables. But when i call the function within MenueItem there 
 seems not to be a value:
 The intresting thing is it works with Other variables, even i cant echo 
 them, they have a value
 
 Thanks for help
 
 class Menue {
 
   function Makechilde($somvalue) {
   echo Next_ID:  . $Parent_ID . BR; //Works
   $MI-Parent_ID = $Parent_ID;
   echo Parent_ID:  . $MI-Parent_ID . BR;//correct output
   $MI-write();
 
   }
 }
 
 class MenueItem {
   var $ID_Menue;
   var $Name;
   var $Parent_ID;
   var $Next_ID;
   var $Prev_ID;
   
 
   function Write() {
   echo Parent_ID:  . $MI-Parent_ID . BR;
   //(no output at all!)
   }
   
 }
 
 


-- 
////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




RE: [PHP] Cry for help

2002-09-12 Thread Scott Houseman

Hi Chad.

Some really excellent places to start:

http://www.onlamp.com/php/
http://www.phpbuilder.com/
http://www.devshed.com/Server_Side/PHP
http://www.zend.com/zend/tut/

Good luck!

Regards

-|Scott

 -Original Message-
 From: Chad Winger [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 12, 2002 10:44 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Cry for help


 I need to learn PHP and databases. If I had those skills, I would
 be so much
 more succesful with my web designs. What I usually do, is make the html
 templates, and then hire someone, usually expensively, to do the PHP and
 MySQL bankend.

 Unfortunately, my programming skill is ZERO. Ok, maybe not zero,
 I do have a
 little bit of PERL experience, but it mainly comes in the form of
 downloading prewritten scripts, and lots of trial and error in
 editing them
 using common sense and drawing on my experience of BASIC which I learned
 when I was 6 years old!

 I have browsed hours on the net looking for help in this sort of thing. I
 have downloaded programs, I have read hours of documents and
 manuals, and
 still, I am no further along than where I started. Programming
 and databases
 are more of a mystery to me than women are. I'm absolutely CLUELESS.

 So basically, I need to learn this stuff as soon as humanly
 possible, but I
 have NO IDEA where to start. Let me tell you first what I have
 done thusfar.

 First thing I did was download something called mySQL Max version 3.23.49
 directly from the website of mysql. I was under the impression that this
 program would be something along the lines of MS Access in the
 standpoint of
 user interface, and it would allow you to create tables etc. (I
 do know how
 to create some rudimentary tables in MS Access). So after I installed this
 program, I clicked on the icon to start it, and to my surprise, the only
 thing that happened was the an MS-Dos box popped up for about 2/10ths of a
 second and then disappeared. So to me it was a waste of 2 hours of
 downloading.

 After a bit more of prodding I saw that there was some configuring to do.
 For the life of me, I have no idea where to look, and even if I did, I
 wouldnt have any idea what I need to configure anyways. Basically
 I want to
 have this installed so that during my learning process of PHP, I can test
 and run things on my local machine, and not have to connect to
 the internet,
 upload files etc.


 Secondly, I downloaded something similar, called Easy PHP. The
 website said
 it would install this and that and then something else that would
 allow you
 to run PHP scripts on your local machine as well as being an
 editor to help
 you write scripts. So I downloaded this as well. So 27 MB and 3
 hours later
 I have yet another useless program with no interfaces nothing. Just
 something that runs in the background.

 So now I talked with my roommate and explained these issues to him. He
 pointed me to a software called CodeCharge. So I downloaded that and spent
 hours looking through the templates and what not, and although I can see
 this is a step in the right direction, it still leaves me with more
 questions than answers. It wants me to specify DNS or ODBC or ASPI etc etc
 and I have no clue what that is, what it means or what is does.

 Furthermore I see no way to use existing html files that I have created as
 templates. Just existing ugly templates that come with the software. I'm
 sure there is a way to do that, but I haven't figured it out.

 So what are my questions? Basically want to do is create sets of HTML
 templates for various sections of sites. Then using the
 templates, code the
 PHP to pull the correct information from a database, manipulate
 it, and then
 return it together with templates. For example. On this a site
 that I am now
 working on, there is a section that will contain headlines to various news
 stories. In the HTML it looks something like this:


 A HREF=1.htmHEADLINE/ABR
 DATE

 All this would simply create is something that looks like this Below:

 Headline
 September 12, 2002

 Obviously clicking the headline would take you to another page that would
 give you the entire story. To me, drawing on common sense, what you are
 really saying is this:


 A HREF=1.htm{LOOK IN THE DATABASE FOR A HEADLINE AND PRINT IT
 HERE}/ABR
 {LOOK IN THE DATABASE FOR THE DATE OF THE ABOVE HEADLINE AND
 PRINT IT HERE}

 Makes sense no? So really for this template, it would use 2 sections from
 the database: Headline and Date and the PHP tells the server where to
 put what depending on which templates is being used

 I don't want to drag this on, but in other words for these sites that I am
 creating there are basically 1 thing that I need to accomplish.

 #1 is that I need a control panel that is somewhere that I can go to any
 computer and log in to. When I do that I can log-in and that will bring me
 to and ADD/EDIT/DELETE form for any section of the site, and if I
 go to add,
 then I will type the various bits of 

[PHP] PHP as a tool for developing enterprise systems.

2002-09-11 Thread Scott Houseman

Dear all.

I have just had a discussion in which it was said that PHP cannot be used
to develop a *true* enterprise system.
In light of this, I would be very interested to hear you
comments/opinions/arguments on:
1. What would you consider to be a true enterprise system?
2.Is his statement correct? If so, what features does PHP lack which make
this so?
3.If this is not true, what arguments can I use to refute this?

Regards

-|Scott

////
// Scott Houseman //
// Jam Warehouse http://www.jamwarehouse.com/ //
// Smart Business Innovation  //
// +27 21 4477440 / +27 82 4918021//
////


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




RE: [PHP] combine 2 integer

2002-09-09 Thread Scott Houseman

Hi there.

You could join the two using a period(.) this will concatenate the two
strings.

$a = 1;
$b = 2;
$together = $a.$b; // $together  == '12'

regards

-|Scott

 -Original Message-
 From: Meltem Demirkus [mailto:[EMAIL PROTECTED]]
 Sent: Monday, September 09, 2002 11:39 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] combine 2 integer


 Hi,

 I want to add one integer to the end of another , which function can I
 use?..

 thanks

 meltem


 --
 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] Sorting a text string

2002-09-05 Thread Scott Houseman

Hi There.

One way of doing this:

split each string into an array, delimited by the periods

$sDate = '04.09.2002';
$aDate = split( '.', $sDate );

this will give you an array like

array(
[0]='04',
[1]='09',
[2]='2002'
)

now reverse the array:

$aDate = array_reverse( $aDate );

join back into a string, using periods:

$sDate = join( '.', $aDate );

$sDate = '2002.09.04'

HTH

Regards

-|Scott

 -Original Message-
 From: Bård Tommy Nilsen [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 05, 2002 10:36 AM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Sorting a text string



 I want to sort text strings, but how could i do this ?

 Example:

 04.09.2002
 05.09.2002
 19.03.1999


 Is there a way to change the string to something like this ...

 2002.09.04
 2002.09.05
 1999.03.19

 Or is there a better way to solve this ??


 Bård Tommy Nilsen

 --
 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] dropdown Newbie question

2002-09-05 Thread Scott Houseman

Hi there.

The value from that dropdown will be returned to you in the variable

$_POST OR $_GET, depending on which method you used to submit the form.

Assuming you use POST, you can access the selected value like this:

$var_from_dropdown = $_POST['theme'];

Regards

-|Scott


 -Original Message-
 From: Mario Ohnewald [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 05, 2002 1:11 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] dropdown Newbie question
 
 
 Hello!
 I am very new in php and i have a little dummy question ;D
 I have a dropdown box with a entry in it called Coctail Blue
 Now i want to put the selected string  (Coctail Blue in this 
 case) in to a
 variable when i press the button below.
 options.php is the page it should go after.
 
 // ..SNIP ...
 
 // Start Dropdown
 echo '
 form name=theme action=options.php target=right class=menu
 nbsp;nbsp;select name=theme';
 for($i=0;$isizeof($theme_name);$i++)
 {
 echo option value='.$i.'.$theme_name[$i]./option\n;
 }
 //end dropdown
 
 // Button
 echo '/selectnbsp;nbsp;input type=submit name=get value=select';
 
 //doesnt work:
 $var_from_dropdown = theme
 
 // ..SNIP ...
 
 
 What did i do wrong?
 
 Thank you!
 Mario
 
 
 -- 
 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] Array Javascript

2002-09-05 Thread Scott Houseman

Hi

To Assign values from an array in PHP to JavaScript,
you could try something like this.

$Array = array( 'one', 'two', 'three' );

Now in your JavaScript:

SCRIPT LANGUAGE=JavaScript

JSArray = new Array(?= sizeof( $Array )?);
?php
for ( $iSubscript = 0; $iSubscript  sizeof( $Array ); $iSubscript++ )
{
// Add each member of the php array to the JS array
echo 'JSArray['.$iSubscript.'] = '.$Array[$iSubscript].';';
}
?

/SCRIPT

Regards

-|Scott


 -Original Message-
 From: kale [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, September 05, 2002 1:12 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Array Javascript 
 
 
 Hy,
 I have an array make with a javascript. 
 How can I read values with PHP from it?
 Kale.
 
 
 -- 
 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] how get a image?

2002-09-04 Thread Scott Houseman

Hi there

Have a look at
http://www.php.net/manual/en/features.file-upload.php

It should explain all.

Regards

-Scott


 -Original Message-
 From: skitum [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, September 04, 2002 10:35 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] how get a image?
 
 
 Hi all,
 
 I have a input button like this: input name=imagen type=FILE 
 id=imagen height=1 
 How can i get this image? I need to receive it as a attachment 
 file or insert it into a MySQL database.
 
 Any Ideas?
 Thanks for help.
 
 Peace  Love
 skitum
 

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




RE: [PHP] Class operator :: Problem

2002-09-03 Thread Scott Houseman

Hi There

Try doing it this way:

?
class a {
  function test() {
 echo Hallo;
  }
}

$testfunct = a::test();;

eval($testfunct);

?

Regards
-|Scott

 -Original Message-
 From: Unger, Christian [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, September 03, 2002 2:51 PM
 To: '[EMAIL PROTECTED]'
 Subject: [PHP] Class operator :: Problem
 
 
 I have problems to make a dynamic call, please help me
 
 ?
 class a {
   function test() {
  echo Hallo;
   }
 }
 
 $testfunct = a::test;
 
 $testfunct();
 
 ?
 
 returns:
 Fatal error: Call to undefined function: a::test() in
 /usr/local/share/version2.mypsi.de/index.html on line 10
 
 ---
 Christian Unger
 IT-Consultant
 
 PSI Infrastruktur Services GmbH
 Dircksenstr. 42-44
 10178 Berlin
 
 Tel: 030 / 2801 - 2536
 Fax: 030 / 2801 - 297 2536
 e-Mail: [EMAIL PROTECTED]
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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




RE: [PHP] Mail()....

2002-08-30 Thread Scott Houseman

Hi there.

Not on a plaintext mail, this will be decided by the mail client.
If your format the mail using html, then you will be able to format the
font.

Regards

-Scott

 -Original Message-
 From: Brian McGarvie [mailto:[EMAIL PROTECTED]]
 Sent: Friday, August 30, 2002 10:45 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] Mail()


 Is there a way to set the font on a plaintext email?



 --
 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] working with ssl

2002-08-29 Thread Scott Houseman

Hi Andy.

I would recommend running PHP as an Apache module as well as mod_ssl - which
will require openssl as well.
Have a look at http://www.modssl.org

Regards

-Scott


 -Original Message-
 From: Andy [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, August 29, 2002 3:36 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] working with ssl


 Hi there,

 I would like to serve some php pages crypted with ssl. Now I am wondering
 what ssl sw to install. I found openssl but this seams to be in alpha
 stadium. How do I install ssl with php anyway. Can somebody give me a hint
 on that?

 Thanx in advance,

 Andy




 --
 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] Virtual includes

2002-08-26 Thread Scott Houseman
Hi there.

This should work I think.

include( '../forum/include/test.php' );

This uses the path in relation to the current directory the script resides
in.

Regards

-Scott

 -Original Message-
 From: Gregory Barker [mailto:[EMAIL PROTECTED]]
 Sent: 26 August 2002 11:12
 To: [EMAIL PROTECTED]
 Subject: [PHP] Virtual includes


 Hi all,

 I'm trying include .php files which reside in alternative directories or
 sub-directories. Such as a file which reside in www/chat/page.php, and for
 this page I would like to include a file which resides in
 www/forum/include/

 I've tried the following which just results in a error:
 include '/forum/include/test.php'; aqnd multiple variations of it.

 How do I get around this problem?

 Greg


 --
 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] Image library

2002-08-21 Thread Scott Houseman

Hi there.

Which way would be the most efficient/fastest to access images from an image
library.
A) Store image files in a hash directory structure AND storing each file's
information in a mysql table
OR
B) Storing image information in mysql table AND storing the image in a BLOB
field in that table.

The way I see it, considerations to be taken into acount:
- Is it quicker/better to retrieve image from table  then stream out to
browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
SRC=/imagelib/5/f/10
- Will a database OR filesystem be more scalable i.e. which wil perform
better when there are 1 images in the libary?

Thanks in advance

Regards

-Scott

--
Scott Houseman
Jam Warehouse http://www.jamwarehouse.com/
Smart Business Innovation
+27 21 4477440 / +27 82 4918021


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




RE: [PHP] Image library

2002-08-21 Thread Scott Houseman

Hi all.

This confirms what I suspected.

The hash algrithm:

I have a directory structure: dirs 0 - f, and within each of these, the same
dir structure 0 - f.
When an image gets uploaded into the library, do an md5sum of the file, take
the first 2 chars of that hash
and there's your path. e.g
$PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'

I'm not sure what the mathematical randomness of this is, but I'm sure it's
pretty random, and the chances
of collision should be virtually null, the only time you should overwrite a
file is if you upload the exact same file(?)
Is there a better way of doing this?

Cheers

-Scott

 -Original Message-
 From: Justin French [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 03:25
 To: [EMAIL PROTECTED]; PHP General
 Subject: Re: [PHP] Image library


 on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:


  Which way would be the most efficient/fastest to access images
 from an image
  library.
  A) Store image files in a hash directory structure AND storing
 each file's
  information in a mysql table
  OR
  B) Storing image information in mysql table AND storing the
 image in a BLOB
  field in that table.

 From all accounts I've read on this list, a database is not
 usually faster
 than a filesystem.  And for large amounts of files, like 1000's,
 a hash will
 speed it up more.


  The way I see it, considerations to be taken into acount:
  - Is it quicker/better to retrieve image from table  then stream out to
  browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
  SRC=/imagelib/5/f/10
  - Will a database OR filesystem be more scalable i.e. which wil perform
  better when there are 1 images in the libary?

 Filesystem should be quicker.  You need to think about how you hash the
 files up for the most even spread of files in each directory I guess.


 Justin




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




RE: [PHP] Image library

2002-08-21 Thread Scott Houseman

Hi there.

So what you are suggesting is using an AUTO_INCREMENT field, possibly the
image's Primary Key as an identifier
for that image file., which is fine by me, but surely one should store files
across directories, as 1 images
in a single directory might slow down access to those images in the
filesystem, or not so?

Thanks for your input.

Regards

-Scott

 -Original Message-
 From: DL Neil [mailto:[EMAIL PROTECTED]]
 Sent: 21 August 2002 04:31
 To: [EMAIL PROTECTED]; Bogdan Stancescu
 Subject: Re: [PHP] Image library


 Scott (confirming Bogdan),

 Libraries of all types have had this concern for years - even though books
 are uniquely identified by ISBN, that is still not good enough for library
 purposes (eg multiple copies of a single title). So they, exactly
 as Bogdan
 suggests, use an Accession number sequence - which can be
 implemented very
 neatly in MySQL (from PHP) as an AUTO_INCREMENT field.

 Regards,
 =dn

  I've seen this kind of random approach several times and I keep
  wondering why not counting the files instead. Yes, it may take a little
  longer when uploading but I personally think the safety of the approach
  is worth the insignificant speed sacrifice.
 
  Bogdan
 
  Scott Houseman wrote:
   Hi all.
  
   This confirms what I suspected.
  
   The hash algrithm:
  
   I have a directory structure: dirs 0 - f, and within each of
 these, the
 same
   dir structure 0 - f.
   When an image gets uploaded into the library, do an md5sum of
 the file,
 take
   the first 2 chars of that hash
   and there's your path. e.g
   $PICDBPATH.'/a/7/a7b8be10b0e69fe3decaa538f1febe84'
  
   I'm not sure what the mathematical randomness of this is, but I'm sure
 it's
   pretty random, and the chances
   of collision should be virtually null, the only time you should
 overwrite a
   file is if you upload the exact same file(?)
   Is there a better way of doing this?
  
   Cheers
  
   -Scott
  
  
  -Original Message-
  From: Justin French [mailto:[EMAIL PROTECTED]]
  Sent: 21 August 2002 03:25
  To: [EMAIL PROTECTED]; PHP General
  Subject: Re: [PHP] Image library
  
  
  on 21/08/02 9:45 PM, Scott Houseman ([EMAIL PROTECTED]) wrote:
  
  
  
  Which way would be the most efficient/fastest to access images
  
  from an image
  
  library.
  A) Store image files in a hash directory structure AND storing
  
  each file's
  
  information in a mysql table
  OR
  B) Storing image information in mysql table AND storing the
  
  image in a BLOB
  
  field in that table.
  
  From all accounts I've read on this list, a database is not
  usually faster
  than a filesystem.  And for large amounts of files, like 1000's,
  a hash will
  speed it up more.
  
  
  
  The way I see it, considerations to be taken into acount:
  - Is it quicker/better to retrieve image from table  then stream out
 to
  browser OR simply direct the browser to the file?
  i.e IMG SRC=/imagelib/image.php?iImageID=10 OR IMG
  SRC=/imagelib/5/f/10
  - Will a database OR filesystem be more scalable i.e. which
 wil perform
  better when there are 1 images in the libary?
  
  Filesystem should be quicker.  You need to think about how
 you hash the
  files up for the most even spread of files in each directory I guess.
  
  
  Justin
  
  
  
  
 
 
 
  --
  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] !--#exec cgi= equivalent in PHP

2002-08-20 Thread Scott Houseman

Hi Peter.

I think fopen( http://site/PATH_TO_PERLSCRIPT.CGI; ) should do the trick.

It will basically return the output of that script.

Hope this helps.

-Scott

-Original Message-
From: Peter Janett [mailto:[EMAIL PROTECTED]]
Sent: 20 August 2002 09:47
To: [EMAIL PROTECTED]
Subject: [PHP] !--#exec cgi= equivalent in PHP


I'm converting over some .shtml files that call an external Perl script with
the following format:
!--#exec cgi= PATH_TO_PERLSCRIPT.CGI --

I'm not sure what php function to use, as I'm returning the results of a
Perl script, not really a UNIX command.

Thanks,

Peter Janett

New Media One Web Services

New Upgrades Are Now Live!!!
Windows 2000 accounts - Cold Fusion 5.0 and Imail 7.1
Sun Solaris (UNIX) accounts - PHP 4.1.2, mod_perl/1.25,
Stronghold/3.0 (Apache/1.3.22), MySQL 3.23.43

PostgreSQL coming soon!

http://www.newmediaone.net
[EMAIL PROTECTED]
(303)828-9882



--
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] Freetds + Sybase-ct + mssql problems

2002-08-20 Thread Scott Houseman

Hi.

I cant tell you off-hand what the problem might be, but this article is very
helpful, and might answer your question:

http://www.phpbuilder.com/columns/alberto2919.php3?print_mode=1

-Scott

 -Original Message-
 From: Benji Spencer [mailto:[EMAIL PROTECTED]]
 Sent: 20 August 2002 05:21
 To: [EMAIL PROTECTED]
 Subject: [PHP] Freetds + Sybase-ct + mssql problems


 I finally got PHP 4.0.6 compiled with
 sybase-ct=/usr/local/freetds for use
 with mssql. However, it seems like php doesn't know where to find the
 interfaces file. Is there a configuration option which allows me to tell
 PHP where to find the interfaces file and/or where is it looking for the
 interfaces file?

 my PHP script

 ?
 $ms_conn=mssql_connect(interface_name,'username','password');
 ?

 and the results

 Warning: Sybase: Unable to connect in
 /usr/local/apache/localhost/htdocs/go.php on line 2

 putting sybase.interface_file=/usr/local/freetds/interfaces in php.ini
 also didn't seem to make a difference. anyone have ideas?

 benji

 ---
 Ben Spencer
 Web Support
 [EMAIL PROTECTED]
 x 2288


 --
 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] Passing a PHP variable to javascript

2002-08-19 Thread Scott Houseman

Hi Michael.

Use:
?php
$text = 'Hello, world!';
?
SCRIPT LANGUAGE=JavaScript
alert( '?= $text?' );
/SCRIPT

If this page is parsed by php i.e. its a .php file rather than .html or .js
file,
then the variable will be output as a string constant in the javascript
code.

Cheers!

Scott
- Original Message -
From: Michael [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 19, 2002 2:54 PM
Subject: [PHP] Passing a PHP variable to javascript


 Hello everyone,

 This may seem a newbie question...

 I have a PHP variable containing the text of the alert I want to display
 ($text) and I want to have it displayed in a javascript alert box
 (something like alert($text) ).
 I couldn't find out how to sort this out...

 Regards,
 Michael




__
 Pour mieux recevoir vos emails, utilisez un PC plus performant !
 Découvrez la nouvelle gamme DELL en exclusivité sur i (france)
 http://www.ifrance.com/_reloc/signhdell


 --
 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] Drop down reload

2002-08-16 Thread Scott Houseman

Hi there.

You would need to use JavaScript for this, specifically an onChange( ) event
for
the select field(s).
Your JavaScript should basically reload the page once an option has been
selected from the first
select field, passing through a variable containing the value of the option
which has just been selected, you can then use php to retrieve the
appropriate records for the second
select field when the page is reloaded.

Cheers

Scott
- Original Message -
From: Christian Ista [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, August 16, 2002 1:53 PM
Subject: [PHP] Drop down reload


 Hello,

 Could you tell me if it possible to reload the current page when I
 select a value in a drop down ?

 On a page, I have 2 drop down, the content on the first one come from
 the database. The content of the second one too (from database) but
 depend of the first drop down value.

 An idea to do that ?

 Bye



 --
 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] OO code and private functions

2002-08-16 Thread Scott Houseman

Hi there.

Not at the moment, but I think this is a feature of the new Zend engine 2,
currently in development.

Cheers

Scott
- Original Message -
From: Richard Black [EMAIL PROTECTED]
To: Php-General [EMAIL PROTECTED]
Sent: Friday, August 16, 2002 4:24 PM
Subject: [PHP] OO code and private functions


 Can I make a function private in PHP, so that it can only be called from
 within an object of that class???

 Just discovering the wonders of OO PHP... :-)

 ==
 Richard Black
 Systems Programmer, DataVisibility Ltd - http://www.datavisibility.com
 Tel: 0141 435 3504
 Email: [EMAIL PROTECTED]


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




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




Re: [PHP] smarter way to write config file?

2002-04-16 Thread Scott Houseman

what about something like this:

$cfgAdminEmail = ( $local ) ? [EMAIL PROTECTED] : [EMAIL PROTECTED];
$cfgReportErrors = ( $local ) ? 1 : 0;
$cfgSendMail = ( $local ) ? 0 : 1;

Hope this helps

--Scott
- Original Message -
From: Justin French [EMAIL PROTECTED]
To: php [EMAIL PROTECTED]
Sent: Tuesday, April 16, 2002 6:58 AM
Subject: [PHP] smarter way to write config file?


 Hi all,

 Currently i've got a config file for each website, and I split it into
 essentially two config files, based on the server name, so that I can have
1
 file for both my local server and the live server.

 something like:

 ?

 if($local)
 {
 $cfgAdminEmail = [EMAIL PROTECTED];
 $cfgReportErrors = 1;
 $cfgSendMail = 0;
 }
 else
 {
 $cfgAdminEmail = [EMAIL PROTECTED];
 $cfgReportErrors = 0;
 $cfgSendMail = 1;
 }

 ?

 But of course, there's more like 20 config elements.  The small problem
I'm
 having is making sure that I keep both halves (live and local) the same
(but
 with different settings).


 What i was hoping was that there may be a way of writing the config once,
 and having it work in both situations, perhaps with a switch, or with some
 other language construct I have no idea about:

 I know this isn't the answer, but I was hoping for something like:

 ?
 $cfgAdminEmail = [EMAIL PROTECTED]|[EMAIL PROTECTED];
 $cfgReportErrors = 1|0;
 $cfgSendMail = 0|1;
 ?

 Where both the options local|live were declared in one hit.


 Whatever solution there is (arrays?  switches?) it has to be easy to
 maintain, otherwise it's a step backwards I guess.


 Any suggestions appreciated, or pointers to stuff in the manual i've never
 heard of!!!


 Justin French




 --
 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] Downloading files

2002-04-09 Thread Scott Houseman

Try this:

?php
// Open the file to send.
$sFilePath = /home/scott/public_html/TEST.doc;
$iFilePointer = fopen( $sFilePath, r );
// Get file content.
$sContents = fread( $iFilePointer, filesize( $sFilePath ) );
// Close the file.
fclose( $iFilePointer );
// Send HTTP headers.
header( Expires: 0 );
header( Cache-Control: no-cache );
header( Content-Type: application/save-as );
header( Content-Disposition: attachment; filename=.basename(
$sFilePath ).;);
header( Content-Length: .filesize( $sFilePath ) );
// Feed file to client.
echo $sContents;
?

As you give the client Content-Type: application/save-as - it will not know
what mime type the file is,
and the browser will give the user a save-as prompt.
This works in explorer - I haven't checked it in Mozilla etc - so you might
have to tweak it a bit.

Cheers

Scott
- Original Message -
From: Declan Kenny [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, April 09, 2002 1:20 PM
Subject: [PHP] Downloading files


 Hi folks,

 Ok I am trying to make a download area for files (including word files).
 How do I force a download of a word document rather than have it opening
in
 IE?

 Declan



 --
 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] Evaluating php code.

2002-04-03 Thread Scott Houseman

Hi Rasmus.

Thanks for the help.
I've implemented your code in a method in class 'RendererParam' as follows:
//--
---
// evaluateParameter
//--
---
/**
Evaluate the parameter's code.
*/
function evaluateParameter ( ) {
// Give variable containing error message global scope.
global $php_errormsg;
echo Evaluate code...BR;
// Supress error reporting.
error_reporting( 0 );
// Set 'track_errors' on.
ini_set( 'track_errors', true );
// Clean out error variable.
$php_errormsg = ;
// Start output buffering.
echo eval( $this-sParamName.' = '.$this-sParamValue.';' )BR;
ob_start( );
// Evaluate this parameter.
eval( $this-sParamName.' = '.$this-sParamValue.';' );
// Get the output buffer contents.
$sBufferOutput = ob_get_contents( );
// End output buffering.
ob_end_clean( );
echo '$sBufferOutput = '.$sBufferOutput.'BR';
if ( trim( $php_errormsg ) != '' ) {
echo Error was: $php_errormsgbr\n;
return false;
}
else {
echo Output was: $sBufferOutputbr\n;
return true;
}
}
//--
---
Example output:

Evaluate code...
eval( $AUTHOR.' = '.$oArticle-oAuthor-getName( ).';' )

This works greate for parse errors, which is all I really want to check for.
But I have picked up a problem.
As the parameters (read variables )  their values entered by the user may
not be in scope at the time they are entered,
in the above case I would get a fatal error:

Fatal error: Call to a member function on a non-object
in /var/www/vne/vne_classes/entity/RendererParam.inc(350) : eva()'d
code on line 1

This is most obviously because I am trying to call a method of an object
which does not exist
If I understand correctly, 'error_reporting( 0 );' will supress error
messages, but this fatal error will still cause
the php preprocessor to die.

Doing a 'global $$this-sParamName, $$this-sParamValue;' will not help
either, as these given variables/objects
will not necessarly be available in the scope outside of this method either.

So...
Is there any way of telling the parser to ignore this fatal error and carry
on, or alernatively,
a way of parsing a string at face value for parse errors ie. 'Look for
syntax errors, but don't evaluate the code.'?

Thanks again for the help, it is much appreciated

Regards

Scott

- Original Message -
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Scott Houseman [EMAIL PROTECTED]
Cc: php-general [EMAIL PROTECTED]
Sent: Wednesday, April 03, 2002 10:33 AM
Subject: Re: [PHP] Evaluating php code.


  Ideally, i'd like to evaluate the code the user has submitted, and if an
  error is generated, notify the user of that fact.
  Eval always returns false, and I'd like no runtime error to be
generated.
  Perhaps an error-handler is what's needed?
 
  What can you suggest?

 I think this should illustrate how to do that:

 ?
 $code = '

 ?
 $a = 1;
 print $a;
 ?

 ';

 error_reporting(0);
 ini_set('track_errors',true);
 $php_errrormsg='';
 ob_start();
 eval('?'.$code);
 $output = ob_get_contents();
 ob_end_clean();
 if($php_errormsg) echo Error was: $php_errormsgbr\n;
 else echo Output was: $outputbr\n;
 ?

 A couple of tricks:

 1. Turning off PHP's error_reporting makes sure no errors are shown by PHP
 2. Turning on track_errors puts any errors into the $php_errormsg variable
 3. Turning on output buffering lets you catch the output from the code you
are testing
 4. Preceding the eval()'ed code with ? makes sure you start the code off
in normal HTML mode since eval() actually assumes what you feed it
starts in PHP mode which is likely not the case for you.

 -Rasmus




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




[PHP] Evaluating php code.

2002-04-02 Thread Scott Houseman

Dear all.

We are currently busy developing an online press application, which makes
use of templates  renderers.
The system works as follows template-renderer-renderer parameters.
The renderer does business logic, making variables available for the
template, which simply renderers the variables
to html, using variables embedded in html e.g. DIV CLASS=headline?=
$__HEADLINE__?/DIV
These renderers can also have parameters, which are basically user-definable
variables e.g. a user can create the
parameter called $__HEADLINE__? with the parameter value of e.g.
'$oArticle-getHeadLine( )'
This will thus be evaluated by the rendering engine as '$__HEADLINE__ =
$oArticle-getHeadLine( );'

Fnally, my question:

These renderer parameters are added using a html form interface and then
stored in a database.
Can anyone suggest a way of evaluating code on form submission, checking for
parse errors etc.
I know most programmers would frown at the idea of evaluating user code, but
the enviroment it will be running in will be a secure intranet etc.

Ideally, i'd like to evaluate the code the user has submitted, and if an
error is generated, notify the user of that fact.
Eval always returns false, and I'd like no runtime error to be generated.
Perhaps an error-handler is what's needed?

What can you suggest?

Many thanks

Scott

--
Scott Houseman

Software Developer
JAM Warehouse
[EMAIL PROTECTED]
+27 82 4918021


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




Re: [PHP] string to array??

2002-01-17 Thread Scott Houseman

Hi There.

You should use this function:

split -- split string into array by regular expression

array split (string pattern, string string [, int limit])


So, to split a string ( e.g. a sentence ) so that each word in the string is
an element of the array do something like this

?php
$sMyString = 'The cat sat on the mat.';
$aMyArray = split ( ' ', $sMyString );
?

This will return:

$aMyArray[0] == 'The';
$aMyArray[1] == 'cat'; ... etc

If limit is set, the returned array will contain a maximum of limit
elements with the last element containing the whole rest of string. 

Cheers

Scott

- Original Message -
From: Sandeep Murphy [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, January 17, 2002 12:41 PM
Subject: [PHP] string to array??


 hi,

 can i convert a string to an array?? if so how shud the syntax read??

 Thnx,

 sands

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] thnx..

2002-01-17 Thread Scott Houseman

Create the class like such:

?php

Class A
{
var $id;

function x ( $whatever )
{
// assign $id's value.
$newval = $whatever++;
$this-id = $newval;
}
//
// Return the value of $id.
//
function getId ( )
{
return $this-id;
}
}

?

To retrieve this variable in another php script do this then:

?php

require (example1.php);

$news = new A();

$news-x ( 5 );

print ( Value of id is .$news-getId() ); // This will print out '6'.

?

Cheers


 Hi guys!!

 Thnx a bunch, it worked out... I used the split function...

 Meanwhile, hv another question !!

 I hv a var $id declared within a function x of a class called A

 I need to access this var $id in another php file...

 I do the following:

 ?php

 require (example1.php);

 $news = new A();

 // I want to something like this:  print ($news-A-$id);

 //print ($news-id); ?

 How do i achieve this??

 Thanks again to all of u!!

 sands


 -Original Message-
 From: Neil Freeman [mailto:[EMAIL PROTECTED]]
 Sent: quinta-feira, 17 de Janeiro de 2002 12:41
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] string to array??


 You just have to remember that a string is simply a character array :)

 Nick Wilson wrote:

  -BEGIN PGP SIGNED MESSAGE-
  Hash: SHA1
 
  * On 17-01-02 at 12:57
  * Steve Edberg said
 
   Actually, you can treat a string as an array without any further
   processing:
  
 $Globbot = 'dribcot';
 echo $Globbot[0];   # echoes 'd'
 echo $Globbot[6];   # echoes 't'
  
   Check out 'String access by character' about halfway down the page at
  
 http://www.php.net/manual/en/language.types.string.php
  
   (or, in Portuguese,
  
 http://www.php.net/manual/pt_BR/language.types.string.php
  
  
 
  Hmmm. I didn't know that!
 
   Actually, using the [] syntax is deprecated - using {} is the new way
   - but I'm a creature of habit...
  
 
  Or that!
 
  - --
 
  Nick Wilson
 
  Tel:+45 3325 0688
  Fax:+45 3325 0677
  Web:www.explodingnet.com
 
  -BEGIN PGP SIGNATURE-
  Version: GnuPG v1.0.6 (GNU/Linux)
 
  iD8DBQE8Rrz+HpvrrTa6L5oRAn4kAKCx41//DDBp/bPzPprs2Zls0xjGJgCgk5tz
  x16a8iDFuzEmsgSg5Iv/8Ms=
  =smoj
  -END PGP SIGNATURE-
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
  ***
   This message was virus checked with: SAVI 3.52
   last updated 8th January 2002
  ***

 --
 
  Email:  [EMAIL PROTECTED]
  [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Re: Passing variables with include()

2002-01-14 Thread Scott Houseman

Hi Al.

While we are on topic, what are the key differences between include() 
require() ?

Cheers

Scott

- Original Message -
From: Martin Wickman [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, January 14, 2002 3:40 PM
Subject: [PHP] Re: Passing variables with include()


 Imar De Vries wrote:

  Imar De Vries wrote:
 
 
 - Including remote files *is* possible. The php manual does not mention
this
 does not work, and when I add the variable to the call (include
 /calculate_drivers?serie_id=3.php) the code is processed perfectly.
The
 thing is, I can not pass the variable with the call, because it's value
is
 determined by the form field. I could use a switch statement of course,
but
 that adds a lot more text to the code.
 
 
  I just changed the code to (include
  .../calculate_drivers?serie_id=$serie_id.php)
 
  ... and this worked! Weird solution...

 Not really. The http://.../foo.php request returns html and not php.
 The foo.php file is parsed and executed by the remote server and
 returned to you as html. By adding serie_id=xxx you actually give the
 remote php-script the name and value of the variable.

 You should think of include/require as a way to *include* any file
 into your script. Instead of cutting and pasting code into your file,
 you use include. Thats the way it works in practice. No magic is going
 on here :-)


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] session_id()

2001-12-07 Thread Scott Houseman

This is most probably because PHP sessions use browser cookies to store
data - thus each browser
would have a  different session id, as they all store their cookies in
separate locations on your
PC's hard drive.

Regards

-- Scott
- Original Message -
From: Gede Gilijk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, December 07, 2001 10:12 AM
Subject: [PHP] session_id()


 This is a simple autentification script using session
 I try to echo the session_id().
 But to my surprise, the value of session_id() is different - in
 configuration -
 if I use difference browser.

 IE :
 9ff68d81039d9ece3ba9840328b91488

 Opera :
 7aa4895172b5a4785c9fb754eaf792aa

 NN :
 1007630964

 Anybody face this thing ?

 ?
 session_start();

  echo h1Members only/h1;

  // Check session variable
  if (session_is_registered(valid_user))
  {
  echo pYou log in as $valid_user./p;
  $sess_id = session_id();
  echo $sess_idbr;
  } else {
  echo pYou have not login yet/p;
  }

  echo a href=\authmain.php\Back to main page/a;

  ?

 Regards,

 Gede Gilijk



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP Redirect / header(location: )

2001-11-09 Thread Scott Houseman

Make sure that there is no output from your PHP script - or any HTML code
whatsoever - before you call the header function.
Cheers
Scott
- Original Message -
From: phantom [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 09, 2001 11:01 AM
Subject: [PHP] PHP Redirect / header(location: )


 I am trying to set up a redirect scirpt that in ASP was
 response.redirect(escape(newpage.asp)).

 I tried in PHP  header(location: newpage.php)

 but all i got was an error message saying that my header content had
 already been sent.  This PHP script was above the html script.

 Am I doing something wrong?  Thank you.


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]