Re: [PHP] Unicode Problem

2006-10-05 Thread Penthexquadium
On Thu, 05 Oct 2006 18:14:59 -0400, [EMAIL PROTECTED] wrote:

> I have a webpage that allows users to post news stories for their department. 
>  The site uses AJAX to send the data to the webserver.  The problem I'm 
> having is when the user uses some unicode characters like bullets or MS Word 
> quotes, the page comes out weird.  
> 
> Here's the process.
> 1. The user enters the story and clicks save.
> 2. The javascript uses the escape function to turn the text into something 
> that can be posted to the server.  This function turns spaces into %20, but 
> it turns unicode characters into a longer string like %u.
> 3. The javascript then sends the data to the processing page.
> 4. The PHP processing page receives the data and saves it to the mySQL 
> database server.
> 
> The problem I see is that any unicode character is saved in it's escaped 
> unicode sequence.  For example a bullet is saved into the database as a 
> literal %u2022.  What I need to know is what function can I use so that it's 
> either saved as the unicode bullet character or displayed back on the page as 
> the bullet?  
> 
> Thank you
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

If you post that data via POST method, use encodeURIComponent() to
encode the string, and then the server-side script can accesses it
directly.

--
Sorry for my poor English.

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



RE: [PHP] Unicode Problem

2006-10-05 Thread Robbert van Andel
I know it's Unicode because the javascript is encoding it as Unicode (and
it's doing so correctly).  I guess the gist of my question is how to do I do
a reverse.  How do I take %u2022 and get make that display as the bullet
character?

-Original Message-
From: Dotan Cohen [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 05, 2006 3:44 PM
To: [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Subject: Re: [PHP] Unicode Problem

On 06/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have a webpage that allows users to post news stories for their
department.  The site uses AJAX to send the data to the webserver.  The
problem I'm having is when the user uses some unicode characters like
bullets or MS Word quotes, the page comes out weird.
>
> Here's the process.
> 1. The user enters the story and clicks save.
> 2. The javascript uses the escape function to turn the text into something
that can be posted to the server.  This function turns spaces into %20, but
it turns unicode characters into a longer string like %u.
> 3. The javascript then sends the data to the processing page.
> 4. The PHP processing page receives the data and saves it to the mySQL
database server.
>
> The problem I see is that any unicode character is saved in it's escaped
unicode sequence.  For example a bullet is saved into the database as a
literal %u2022.  What I need to know is what function can I use so that it's
either saved as the unicode bullet character or displayed back on the page
as the bullet?
>
> Thank you
>

I doubt that MS Word quotes are unicode. And as long as the users are
coping/ pasting between MS products (Word->IE) you're going to have a
hard time deciphering those funny characters. Try to encourage them to
use Firefox, and if possible to use a UTF-8 compliant word processor.
Mine is Kword, but I don't think that's available for Windows.

Dotan Cohen
http://what-is-what.com
98

-- 
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] Miserable escape string problem

2006-10-05 Thread Robert Cummings
On Fri, 2006-10-06 at 01:35 +0200, [EMAIL PROTECTED] wrote:
> Dave Goodchild wrote:
> > Is this really worth all the keystrokes? Do we not have any more 
> > valuable ways to spend our time?
> 
> Good point Dave. But on the wrong side.
> 
> By counting all the keystrokes the PHP developers have to type extra
> for code like this:
> "{{$foo}: {$bar}}"


> '{'.$var1.': '.$var2.'}'

My prefered way is definitely this one. It's simple really, let me sing
it for you...

"in, out... in, out... shake it all about..." ;)

When adding variable data to strings, by using the in, out (shake it all
about method), the technique is identical whether you are using object
properties, nested array fields, simple variables, functions, constants.
That's right, I said one way fits every last one of them, try that with
your precious interpolation :B Interestingly, it also happens to be the
fasted method from a processor standpoint :)

Cheers,
Rob.


> etc.
> 
> vs. such code
> "\{$foo: $bar}"
> 
> and actually not accounting for the ease of reading and assimilating
> such code, guess what's better? Ramp about it? Or try rise the problem?

I have a PHP coprocessor embedded in my skull, it's all easy to read...
well as long as the braces are properly formatted anyways *haha* ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Miserable escape string problem

2006-10-05 Thread intra_test

Dave Goodchild wrote:
Is this really worth all the keystrokes? Do we not have any more 
valuable ways to spend our time?


Good point Dave. But on the wrong side.

By counting all the keystrokes the PHP developers have to type extra
for code like this:
"{{$foo}: {$bar}}"
'{'.$var1.': '.$var2.'}'
etc.

vs. such code
"\{$foo: $bar}"

and actually not accounting for the ease of reading and assimilating
such code, guess what's better? Ramp about it? Or try rise the problem?

ciao

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



Re: [PHP] Miserable escape string problem

2006-10-05 Thread Dave Goodchild

Is this really worth all the keystrokes? Do we not have any more valuable
ways to spend our time?

On 06/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:


Richard Lynch wrote:
> $curly = '{';
> echo "$curly$var1: $var2}";
>
Horrendous workaround.


Google Kreme wrote:
> On 05 Oct 2006, at 11:37 , Chris Shiflett wrote:
>> Google Kreme wrote:
>>> So what is "{{$var1} : {$var2}}"
>>
>> Within a quoted string, you can surround variable names with braces for
>> clarity. This is especially helpful for situations like this, where the
>> rest of the string interferes with syntax.
>
> Heh.  It was a rhetorical question.  He said there was no way to escape
> the {'s
>
> Of course there is... that was my point.
I suggest you bring yourself up to speed on what escaping really means.
Your suggestion under no circumstances escaping.


Actually, PHP Documentation does mention it:
"Since you can't escape '{', this syntax"

See here(thanks go John Wells for posting about it):

http://uk2.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Now you may go on a rampage about what escaping means, but honestly, I
don't want to hear about it.




Richard Lynch wrote:
> The whole thing with {} inside a string has always struck me as a
> total hack to fix something that wasn't broken in the first place, and
> I can never get it to do what I want.
>
> "Don't use it" is my solution.
>
> :-)
Bingo. That is what I am trying to do. But I am not allowed since there
is no escaping for this thing.


Thanks all for the replies. My intention was to bring to light YA PHP
design problem. Looks to me like I didn't really succeed, but at least
it's out.


Regards

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





--
http://www.web-buddha.co.uk


Re: [PHP] Miserable escape string problem

2006-10-05 Thread intra_test

Richard Lynch wrote:

$curly = '{';
echo "$curly$var1: $var2}";


Horrendous workaround.


Google Kreme wrote:
> On 05 Oct 2006, at 11:37 , Chris Shiflett wrote:
>> Google Kreme wrote:
>>> So what is "{{$var1} : {$var2}}"
>>
>> Within a quoted string, you can surround variable names with braces for
>> clarity. This is especially helpful for situations like this, where the
>> rest of the string interferes with syntax.
>
> Heh.  It was a rhetorical question.  He said there was no way to escape
> the {'s
>
> Of course there is... that was my point.
I suggest you bring yourself up to speed on what escaping really means.
Your suggestion under no circumstances escaping.


Actually, PHP Documentation does mention it:
"Since you can't escape '{', this syntax"

See here(thanks go John Wells for posting about it):
http://uk2.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Now you may go on a rampage about what escaping means, but honestly, I
don't want to hear about it.




Richard Lynch wrote:
> The whole thing with {} inside a string has always struck me as a
> total hack to fix something that wasn't broken in the first place, and
> I can never get it to do what I want.
>
> "Don't use it" is my solution.
>
> :-)
Bingo. That is what I am trying to do. But I am not allowed since there
is no escaping for this thing.


Thanks all for the replies. My intention was to bring to light YA PHP
design problem. Looks to me like I didn't really succeed, but at least
it's out.


Regards

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



Re: [PHP] Re: Really strange / TYPO

2006-10-05 Thread John Wells

On 10/5/06, Richard Lynch <[EMAIL PROTECTED]> wrote:

include_path is a much more powerful and flexible construct which will
save you an inordinate amount of trouble if you just figure out how it
works and use it...


Point well taken Richard, thanks.

I've always been curious, iIs there a point in which adding some
number of paths to include_path causes a performance hit?  If my
application for example is spread out across 6 or 7 folders
(controllers, models, library, plugins, scripts, etc etc), is it
really better to shove all of those into include_path?

Thanks,
John W

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



Re: [PHP] Unicode Problem

2006-10-05 Thread Dotan Cohen

On 06/10/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

I have a webpage that allows users to post news stories for their department.  
The site uses AJAX to send the data to the webserver.  The problem I'm having 
is when the user uses some unicode characters like bullets or MS Word quotes, 
the page comes out weird.

Here's the process.
1. The user enters the story and clicks save.
2. The javascript uses the escape function to turn the text into something that 
can be posted to the server.  This function turns spaces into %20, but it turns 
unicode characters into a longer string like %u.
3. The javascript then sends the data to the processing page.
4. The PHP processing page receives the data and saves it to the mySQL database 
server.

The problem I see is that any unicode character is saved in it's escaped 
unicode sequence.  For example a bullet is saved into the database as a literal 
%u2022.  What I need to know is what function can I use so that it's either 
saved as the unicode bullet character or displayed back on the page as the 
bullet?

Thank you



I doubt that MS Word quotes are unicode. And as long as the users are
coping/ pasting between MS products (Word->IE) you're going to have a
hard time deciphering those funny characters. Try to encourage them to
use Firefox, and if possible to use a UTF-8 compliant word processor.
Mine is Kword, but I don't think that's available for Windows.

Dotan Cohen
http://what-is-what.com
98

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



Re: [PHP] Help on objects

2006-10-05 Thread Martin Alterisio

2006/10/5, Satyam <[EMAIL PROTECTED]>:




- Original Message -
*From:* Martin Alterisio <[EMAIL PROTECTED]>
*To:* Satyam <[EMAIL PROTECTED]>
*Cc:* Deckard <[EMAIL PROTECTED]> ; php-general@lists.php.net
*Sent:* Thursday, October 05, 2006 3:50 PM
*Subject:* Re: [PHP] Help on objects

2006/10/5, Satyam <[EMAIL PROTECTED]>:
>
> I've seen you already had a good answer on the errors in the code so I
> won't
> go on that.  As for OOP, the one design error you have is that you are
> asking for an action, not an object.   You want to make SQL inserts,
> that is
> your purpose, and that is an action, which is solved by a statement, not
> by
> an object.   There is no doer.  Objects are what even your English
> teacher
> would call objects while describing a sentence.  You are asking for a
> verb,
> you don't have a subject, you don't have an object.   Of course you can
> wrap
> an action in a class, but that is bad design.  Classes will usually have
> names representing nouns, methods will be verbs, properties adjectives,
> more
> or less, that's OOP for English teachers.
>
> Satyam
>

You're wrong, partially:


I am sure you could have stated that in a more courteous way.



I apologize, english is not my first language and I usually can't express
myself correctly. As a fellow compatriot I hope you'll understand there
weren't ill intentions on what I said.


[PHP] Re: PHP5 || Catch Error & Send POST Vars...

2006-10-05 Thread sit1way
Hey all.

Loving Try Catch error handling in PHP5!

Got a problem though:

I'd like to catch errors and send POST vars to my error display page.

So:

try {
$r = new query($sql);

if(!$r) {
 throw new Exception($err);
}
}
catch (Exception $e) {
$this->err_msg = $e->getMessage();

/* somehow kick user to error display screen with POST vars */
?
}

Thought about using CURL(), but that won't kick the user to the error 
screen.

Any ideas?

TIA,

--Noah

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



[PHP] Unicode Problem

2006-10-05 Thread php
I have a webpage that allows users to post news stories for their department.  
The site uses AJAX to send the data to the webserver.  The problem I'm having 
is when the user uses some unicode characters like bullets or MS Word quotes, 
the page comes out weird.  

Here's the process.
1. The user enters the story and clicks save.
2. The javascript uses the escape function to turn the text into something that 
can be posted to the server.  This function turns spaces into %20, but it turns 
unicode characters into a longer string like %u.
3. The javascript then sends the data to the processing page.
4. The PHP processing page receives the data and saves it to the mySQL database 
server.

The problem I see is that any unicode character is saved in it's escaped 
unicode sequence.  For example a bullet is saved into the database as a literal 
%u2022.  What I need to know is what function can I use so that it's either 
saved as the unicode bullet character or displayed back on the page as the 
bullet?  

Thank you

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



Re: [PHP] Testing people

2006-10-05 Thread Dotan Cohen

It's not exactly what you describe, but you should take a look at:
http://www.bigredspark.com/survey.html

Dotan Cohen
http://what-is-what.com
7

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



Re: [PHP] Re: Really strange / TYPO

2006-10-05 Thread Deckard
Hi Richard,

Thank you so much for your answer.

dbInsert.php is in /var/www/html/classes while config.inc.php is in
/var/www/html

With your code, the file is always searched in /var/www/html/classes and
not in /var/www/html

Warm Regards,
Deckard

Richard Lynch wrote:
> On Thu, October 5, 2006 2:34 am, John Wells wrote:
>> [code]
>> // Consider *where* you create this
>> // Define it as a constant if you'd like...
>> define('BASE_PATH', dirname(__FILE__));
>>
>> // Now build the path, like (assuming it was created
>> // in  a file located at /var/www/html
>> include_once(BASE_PATH . '/config.inc.php');
>> [/code]
> 
> Gah!
> 
> Now you've made it even HARDER to move the include files out of the
> web tree, or wherever is more convenient and safer.
> 
> include_path is a much more powerful and flexible construct which will
> save you an inordinate amount of trouble if you just figure out how it
> works and use it...
> 

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



Re: [PHP] Use PHP to disable htaccess

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 2:50 pm, Justin Cook wrote:
> I took over a website that uses a htaccess file to auto append a file
> to every page. I have one page that I do not want to do this one. Is
> there a way to disable the htaccess file with a php statement on this
> one page? Thanks!

Not with a PHP statement, but maybe throw this in .htaccess:


  php_value auto_append ""


Never tried it, but it should work...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] socket https.

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 3:30 pm, João Cândido de Souza Neto wrote:
> I´m using CURL, but it cannot send any data to server by POST mothod.
>
> Have you got any example abaut this to show me?

$curl = curl_init();
curl_setopt($curl, 'https://example.com/example.php');
curl_setopt($curl, CURLOPT_POST, 1);
$data = "x=" . urlencode($x);
$data .= "&y=" . urlencode($y);
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
$result = curl_exec($curl);

More info:
http://php.net/curl

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 3:42 pm, Rahul S. Johari wrote:
> Richard, I corrected that mistake in a previous email you must have
> missed.
> I had copied the wrong code in my email to the list. The correct code
> is
> indeed  action="https://www.myurl.com/imsafm2_main.php";>
>
> I'm pretty baffled at this stage. I don't understand why this won't
> work
> over SSL. Over the internet I have found a few more people in my
> situation... their posts in forums gone unanswered. Is there no
> solution for
> this? Are there only a handful who encounter this problem?

I suspect that only a handful *DO* encounter it.

Try using Firefox and see if you get a better idea of what's going
wrong by watching the LiveHTTPHeaders extension output.

Also try a form that does NOT have file upload, but IS POST.
And try a GET form and a form that has no file upload but has the
enctype as if it was file upload.

If you can narrow it down like that, you may find a setting in
httpd.conf for the SSL that is the key.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] See if this makes any sense / Att. Richard Lynch

2006-10-05 Thread Deckard
Hi Richard,

Richard Lynch wrote:
> I'm baffled why you'd be rolling your own instead of using an existing
> abstraction layer, and even more baffled why you wouldn't just skip
> all this and just do:
I'm already using AdoDB, which is excelent, but somethings requires a
lot of code.
I'm trying to wrote classe that allow me to reduce the code.

Richard: it's also a matter of learning something i don't know yet.

I consider myself as an expert in qmail servers.
If you go to the qmail mailing list, you'll see lots of responses from
me to other people.

That's what i'm seeking here: help. Not that someone do the my job for me.

Best Regards,
Deckard

> 
> $query = "insert ...";
> $insert = mysql_query($query, $connection);
> 
> It's not like you can take your MySQL user-creating queries and
> directly map them to ANY other database on the planet...
> 
> So what does the DB abstraction and class OOP stuff gain you?
> 
> Nada.
> 
> On Thu, October 5, 2006 2:18 pm, Deckard wrote:
>> Hi,
>>
>> I've burned my brain, checked other sites and come to a code that
>> works.
>>
>> I ask you, please, to see if this makes any sense and/or can be
>> improved.
>>
>> I'd really appreciate.
>>
>> Warm Regads,
>> Deckard
>>
>> dbInsert.php:
>> ---
>> >
>> /*
>> *class to make inserts
>> *
>> */
>>
>>
>>  // includes
>>  include_once('/var/www/html/config.inc.php');
>>  include_once('adodb/adodb.inc.php');
>>
>>  class dBInsert
>>  {
>>   // global variables
>>   var $table;
>>   var $sql;
>>
>>  // constructor
>>  function dBInsert($table, $sql)
>>  {
>>   $this->table = $table;
>>   $this->sql   = $sql;
>>
>>   return(TRUE);
>>  }
>>
>>
>>   // function that constructs the sql and inserts it into the database
>>   function InsertDB($table, $sql)
>>{
>>
>> print($sql);
>> // connect to MySQL
>> $conn = &ADONewConnection('mysql');
>>  $conn->debug=1;
>> $conn->PConnect('localhost', 'gamito', 'ble', 'wordlife');
>>
>>  // execute the insert
>>  if ($conn->Execute($sql) === false)
>>   print 'error inserting: '.$conn->ErrorMsg().'';
>>
>>  return (TRUE);
>>
>>}
>>
>> }
>>
>> ?>
>> --
>>
>> testedb.php
>> --
>> >
>>  include_once("classes/dBInsert.php");
>>
>>  $sql = "INSERT INTO wl_admins VALUES ('',3)";
>>  $dBInsert = new dBInsert('wl_admins', $sql);
>>  $dBInsert->InsertDB('wl_admins', $sql);
>>
>> ?>
>> --
>>
>> --
>> 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] RE:[PHP] Client Computer Registration

2006-10-05 Thread Rahul S. Johari

Exactly!
This is where I'd like to bring focus back on what it really was. Neither is
keybank.com allowing access to a 'registered' computer simply because it's
registered, nor is it laying a file, key or id certificate on the client's
machine to enable it to login. As Wesley pointed out, they are just adding
an extra layer of authentication, which in all honesty may not do much but
just identify which system the client logged on last from (for the purpose
of tracing a transaction) But it's not creating any vulnerabilities
either, at least in my opinion.

I had meaning to clarify this. I wasn't ask to install any certificate / key
/ software or file on my system by the bank. So they are definitely not
using any such method which requires such kind of an authentication.

I thought they are mapping to the MAC Address or some Hardware Component,
but as pointed out, that is pretty impossible or requires ActiveX or
something, well then that's not happening either because I didn't get any
ActiveX notification or anything.

Basically I have to login using my Username and password and then I have to
register the system and give it a label (like Home, Wife's Computer, etc).
But every time I login, be it from any computer, pre-registered or not, I
have to always use my username & password. There is no automatic login or
any such thing. 

@Kristen ... No you're not missing anything. That's exactly how it is.

@Joe... Thanks. Yes I do also believe they are just using Cookies.

@Bruce... Yes I've definitely heard about the kind of security you're
referring to, where the client is required to download App and it
communicates with the server. But I guess that's not what Keybank.com is
doing. 

Considering that they are more then likely using cookies, I'm probably not
going to implement this in my application for now... And possibly look at
some other alternates.

Thanks.


On 10/4/06 3:36 AM, "Wesley Acheson" <[EMAIL PROTECTED]> wrote:

> I don't see how its that much of a secuity risk, they create a ssh
> tunnel.  All it does is add an extra layer of authentication.  Its not
> like the password requirements are bypassed.
> 
> 
> On 10/3/06, Richard Lynch <[EMAIL PROTECTED]> wrote:
>> On Tue, October 3, 2006 2:33 am, Wesley Acheson wrote:
>>> They could also be doing something like giving the client an SSH key
>>> to download, I've heard of this situation in a bank before.
>> 
>> Is the key tied to my hardware?
>> 
>> At least that stops the virus/Trojan scenario.
>> 
>> But not the petty thief who breaks in and takes my computer, and "oh
>> look, now I have his bank account too!  Sweet!!!"
>> 
>> Puhleeze!
>> 
>> Do you really want to bank with a place that does this?
>> 
>> --
>> Some people have a "gift" link here.
>> Know what I want?
>> I want you to buy a CD from some starving artist.
>> http://cdbaby.com/browse/from/lynch
>> Yeah, I get a buck. So?
>> 
>> 

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] RE:[PHP] Client Computer Registration

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 2:36 am, Wesley Acheson wrote:
> I don't see how its that much of a secuity risk, they create a ssh
> tunnel.  All it does is add an extra layer of authentication.  Its not
> like the password requirements are bypassed.

My fault.

Somehow we got fixated on the idea that registering the computer
bypassed login.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] need loop help

2006-10-05 Thread Richard Lynch
Change ${$fields[$j]} to $_POST[$fields[$j]] everywhere?

Or you could make the whole thing a lot more readable:

foreach($fields as $field){
  $data[$field] = isset($_POST['field']) && $_POST['field'] == 'on' ?
1 : 0;
}

On Tue, October 3, 2006 4:48 pm, Charles Kline wrote:
> hi all.
>
> i am trying to modify some old code and struggling a bit with this
> one:
>
> // returns an array of the names in the form post
> $fields = $_SESSION['case']->getComplaintKeys();
>
> // here is the array returned
> Array ( [0] => eligibility [1] => payment [2] => service [3] =>
> document [4] => licensing [5] => source [6] => date [7] => contact
> [8] => description [9] => status )
>
> for ($j = 0; $j < count($fields); $j++) {
>if (${$fields[$j]} == 'on') ${$fields[$j]} = 1;
>if (is_null(${$fields[$j]})) ${$fields[$j]} = 0;
>$data[$fields[$j]] = ${$fields[$j]};
> }
>
> The problem I am having is that the code is now on a more secure
> server with register_globals off (and I don't want to turn that on).
>
> I am not sure how to get the POST data sorted out using this method.
> Hope it is clear what I mean.
>
> Thanks,
> Charles
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



RE: [PHP] Re: Understanding persistent connections with oci8

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 12:34 pm, Mendonce, Kiran (STSD) wrote:
> I understand the performance boost one can get by reusing existing
> connections. And I did see for myself that with the default settings,
> oci_pconnect() does reuse all the connections.
>
> But what should happen if there are idle connections and the timeout
> is
> reached ? That is my question. What is the purpose of the
> persistent_timeout setting ? Does it give the user a means of
> specifying
> a timeout after which idle connections are removed ?

Yes.

Their claim is that your tests are invalid because your have MULTIPLE
Apache processing swapping the connections around, so they are NOT
idle for 10 seconds.

To prove them wrong, you would need to:
Set up a dev server on a private network with Apache having ONE, and
ONLY ONE, child.
Set the timeout to 10 seconds.
Surf to a test page.
Wait 10 seconds.
See if the connection goes away.

If anybody else on the planet (or off-planet, for that matter,
assuming our astronauts have time to surf to your site) can surf to
the site and keep the connection "alive" by having Apache re-use it,
then it's going to stay alive.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Breaking lines

2006-10-05 Thread Richard Lynch
On Tue, October 3, 2006 5:11 pm, Google Kreme wrote:
> As I understand it then, the .ht* is no less secure because, for all
> intents and purposes, it is 'outside' the webtree since Apache will
> never display it, and you need some other sort of access to the
> machine (ftp, ssh, etc) to access it.  As I understand it, you can't
> even access .ht* files via webDAV.

Until somebody installs a new Apache, and doesn't merge in the correct
.ht* settings.

Or Apache gets started by hand in a panic from a crashed server and
reads the wrong httpd.conf file with no .ht* settings to protect your
include files.

Or somebody takes out the .ht* settings, thinking they are just cruft.

Or the .htaccess file you used to protect your PHP files doesn't get
put into the tarball with:
tar cf tarball.tar *
so when you untar it on the new box to install it, your protection is
*GONE*

Or somebody turns .ht* OFF in httpd.conf to wring out more
performance, but your .ht* access controls are in .htaccess in your
directories.

These are only *some* of the rather obvious ways in which having the
files in the webtree but protected by a configuration to Apache can go
wrong.

And these are *ALL* common mistakes that anybody could make without
too much of a stretch in the imagination of "what could go wrong"

In fact, *MOST* of them are things I have actually seen happen...
[Or, to be more precise, things I was dumb enough to do :-)]

If the files aren't in the webtree, somebody has to write a script of
some kind to expose them -- which is still possible, but you have to
work a little harder at it, with little or no concept of Security, to
do that.  And *that* happens sometimes, but then they usually write
such an appallingly bad script that /etc/passwd and everything else on
the entire machine is exposed, which will probably get caught sooner
than a not-quite-right configured Apache that's working "just fine"

Or somebody could come along and ADD a vhost to expose that directory,
effectively putting it IN the webtree...  But, you'd have to work
pretty hard at being smart enough to do a vhost and dumb enough to
expose your include files like that.

It's up to you; But I believe that the .ht* route is too fraught with
potential common mistakes to undo the security.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Rahul S. Johari

Richard, I corrected that mistake in a previous email you must have missed.
I had copied the wrong code in my email to the list. The correct code is
indeed https://www.myurl.com/imsafm2_main.php";>

I'm pretty baffled at this stage. I don't understand why this won't work
over SSL. Over the internet I have found a few more people in my
situation... their posts in forums gone unanswered. Is there no solution for
this? Are there only a handful who encounter this problem?


On 10/5/06 4:25 PM, "Richard Lynch" <[EMAIL PROTECTED]> wrote:

> On Wed, October 4, 2006 3:02 pm, Rahul S. Johari wrote:
>> http://www.myurl.com/imsafm2_main.php";
> 
> If you MOVED everything to the SSL server, then http://www.myurl.com
> ain't the right ACTION anymore.  It's now https://www.myurl.com

Rahul S. Johari
Supervisor, Internet & Administration
Informed Marketing Services Inc.
500 Federal Street, Suite 201
Troy NY 12180

Tel: (518) 687-6700 x154
Fax: (518) 687-6799
Email: [EMAIL PROTECTED]
http://www.informed-sources.com

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



Re: [PHP] set cookie with non-english

2006-10-05 Thread Richard Lynch
On Tue, October 3, 2006 11:18 pm, Ahmad Al-Twaijiry wrote:
> I already made the application with cookies, it's will be very
> defaucalt to go and replace cookies with session,
>
> is it possible to use cookies & session in the same time ? (
> session_start() & setcookie in the same page ?)

Sure...

Though if it's hard to convert your Cookies code to session_start()
you've done something very wrong already... ;-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] socket https.

2006-10-05 Thread Jo�o C�ndido de Souza Neto
I´m using CURL, but it cannot send any data to server by POST mothod.

Have you got any example abaut this to show me?

Thanks.

""Richard Lynch"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> You may want to look at using CURL which handles all the grunge of the
> SSL exchange...
> http://php.net/curl
>
> Or maybe fsockopen has been fixed up to do that also?...
>
> On Thu, October 5, 2006 12:33 pm, João Cândido de Souza Neto wrote:
>> Hi everybody.
>>
>> I must to connect a https server by a fsockopen but it seems not
>> working.
>>
>> I´ve got openssl instaled in my php and when i run the follow line.
>>
>> $sock = fsockopen("ssl://wwws.aymorefinanciamentos.com.br", 80,
>> $errno,
>> $errstr, 30);
>>
>> My var $sock returns false without any error string.
>>
>> Could anyone help me?
>>
>> --
>> João Cândido de Souza Neto
>> Curitiba Online
>> [EMAIL PROTECTED]
>> (41) 3324-2294 (41) 9985-6894
>> http://www.curitibaonline.com.br
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So? 

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



Re: [PHP] PHP jump to other page

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 1:17 pm, Groundhog wrote:
> how can I jump to another page after IF..ELSE statement, for example:
>
> IF (statement == TRUE)
>{ stay on this page, index.php }
> ELSE { jump to index2.php
  require 'index2.php';
  exit;

}

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] File Uploads not working over SSL

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 3:02 pm, Rahul S. Johari wrote:
> http://www.myurl.com/imsafm2_main.php";

If you MOVED everything to the SSL server, then http://www.myurl.com
ain't the right ACTION anymore.  It's now https://www.myurl.com

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Really strange / TYPO

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 2:34 am, John Wells wrote:
> [code]
> // Consider *where* you create this
> // Define it as a constant if you'd like...
> define('BASE_PATH', dirname(__FILE__));
>
> // Now build the path, like (assuming it was created
> // in  a file located at /var/www/html
> include_once(BASE_PATH . '/config.inc.php');
> [/code]

Gah!

Now you've made it even HARDER to move the include files out of the
web tree, or wherever is more convenient and safer.

include_path is a much more powerful and flexible construct which will
save you an inordinate amount of trouble if you just figure out how it
works and use it...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Really strange

2006-10-05 Thread Richard Lynch
On Wed, October 4, 2006 7:32 pm, Deckard wrote:
> I have this line of code:
> include_once('../config.inc.php');

DON'T DO THAT!

Sooner or later, you're gonna need to move/copy this file somewhere
else, and ../ ain't gonna be right.

> Warning: main(): Failed opening '../config.inc' for inclusion
> (include_path='.:/usr/share/pear') in

Here is your ANSWER.

*CHANGE* your include_path to have:
/var/www/html
in it.


All that said, also make sure the file is readable to PHP, as it
should have "worked" I think...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Testing people

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 5:36 am, Ryan A wrote:
> 2. I have noticed if you are displaying 4 (a-d) choices and the answer
> for question 10 (for example) is always on choice B it kind of sticks
> in the head and students dont really read everything they just
> memorize the location of the answer (maybe unconsciously) and click
> that.. i have an idea of making the answers "jump around"

So put them out in random order.
[shrug]

> I thought of having a hidden text box everytime for each question...
> but that can be quite easily found out... any other suggestions?

Don't send the correct answer to the browser at all.

And don't tie the "ABCD" to the correct answer.



Your HTML could look like this:
A  cat
B  dog
C  trout
D  bat

To test if the answer is correct:

$q = $_REQUEST['q'];
foreach($q as $index => $a){
  if ($correct[$index] == $a) echo "CORRECT";
  else echo "INCORRECT:  Correct is $correct[$index]";
  echo "\n";
}

You could also use the index to $answer as the value with:
$correct[47] = 16;
 bat
if ($correct[$index] == $a){

and all the other code the same.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Use PHP to disable htaccess

2006-10-05 Thread Justin Cook
I took over a website that uses a htaccess file to auto append a file to every 
page. I have one page that I do not want to do this one. Is there a way to 
disable the htaccess file with a php statement on this one page? Thanks!

Re: [PHP] confused about where to load images

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 5:15 am, Meline Martirossian wrote:
> I have just made my first php mini website. I have my header, footer,
> navigation and main pages.
> The header, footer and navigation appear as "includes" in my main
> page.
>
> When I click on my navigation links, I get a new blank browser window
> with the image on it. This is not what I want.
>
> Can you help me with instructing the server to load the image on my
> main page and in the designated area instead of a new blank page?
>
> http://www.squareinch.net/portfolio2.php

Invalid Input";
  require 'footer.inc';
  exit;
}
//In an IDEAL world, you program the logos into a DB
//You then check that '$logo' is *in* the DB, so you know it's
//a valid logo.
//Unless they hack your DB *and* muck with your URL at same time...
// end of input validty section
?>


Put the square inch logo here or whatever is there when there
is no image selected


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Help on objects

2006-10-05 Thread Satyam

  - Original Message - 
  From: Martin Alterisio 
  To: Satyam 
  Cc: Deckard ; php-general@lists.php.net 
  Sent: Thursday, October 05, 2006 3:50 PM
  Subject: Re: [PHP] Help on objects


  2006/10/5, Satyam <[EMAIL PROTECTED]>:
I've seen you already had a good answer on the errors in the code so I won't
go on that.  As for OOP, the one design error you have is that you are
asking for an action, not an object.   You want to make SQL inserts, that 
is 
your purpose, and that is an action, which is solved by a statement, not by
an object.   There is no doer.  Objects are what even your English teacher
would call objects while describing a sentence.  You are asking for a verb, 
you don't have a subject, you don't have an object.   Of course you can wrap
an action in a class, but that is bad design.  Classes will usually have
names representing nouns, methods will be verbs, properties adjectives, 
more 
or less, that's OOP for English teachers.

Satyam


  You're wrong, partially: 

I am sure you could have stated that in a more courteous way.

Re: [PHP] See if this makes any sense

2006-10-05 Thread Richard Lynch

You do *NOT* want to re-connect to the database on every InsertDB!

That's very expensive in resources/time.

Do that once in the constructor and be done with it for as many
Inserts as you need.

I'm baffled why you'd be rolling your own instead of using an existing
abstraction layer, and even more baffled why you wouldn't just skip
all this and just do:

$query = "insert ...";
$insert = mysql_query($query, $connection);

It's not like you can take your MySQL user-creating queries and
directly map them to ANY other database on the planet...

So what does the DB abstraction and class OOP stuff gain you?

Nada.

On Thu, October 5, 2006 2:18 pm, Deckard wrote:
> Hi,
>
> I've burned my brain, checked other sites and come to a code that
> works.
>
> I ask you, please, to see if this makes any sense and/or can be
> improved.
>
> I'd really appreciate.
>
> Warm Regads,
> Deckard
>
> dbInsert.php:
> ---
> 
> /*
> * class to make inserts
> *
> */
>
>
>  // includes
>  include_once('/var/www/html/config.inc.php');
>  include_once('adodb/adodb.inc.php');
>
>  class dBInsert
>  {
>   // global variables
>   var $table;
>   var $sql;
>
>  // constructor
>  function dBInsert($table, $sql)
>  {
>   $this->table = $table;
>   $this->sql   = $sql;
>
>   return(TRUE);
>  }
>
>
>   // function that constructs the sql and inserts it into the database
>   function InsertDB($table, $sql)
>{
>
> print($sql);
> // connect to MySQL
> $conn = &ADONewConnection('mysql');
>   $conn->debug=1;
> $conn->PConnect('localhost', 'gamito', 'ble', 'wordlife');
>
>   // execute the insert
>   if ($conn->Execute($sql) === false)
>print 'error inserting: '.$conn->ErrorMsg().'';
>
>   return (TRUE);
>
>}
>
> }
>
> ?>
> --
>
> testedb.php
> --
> 
>  include_once("classes/dBInsert.php");
>
>  $sql = "INSERT INTO wl_admins VALUES ('',3)";
>  $dBInsert = new dBInsert('wl_admins', $sql);
>  $dBInsert->InsertDB('wl_admins', $sql);
>
> ?>
> --
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] See if this makes any sense

2006-10-05 Thread Brad Bonkoski

Deckard wrote:

Hi,

I've burned my brain, checked other sites and come to a code that works.

I ask you, please, to see if this makes any sense and/or can be improved.

I'd really appreciate.

Warm Regads,
Deckard

dbInsert.php:
---
table = $table;
  $this->sql   = $sql;

  return(TRUE); 
 }


  // function that constructs the sql and inserts it into the database
  function InsertDB($table, $sql)
   {

print($sql);
// connect to MySQL
$conn = &ADONewConnection('mysql');
$conn->debug=1;
$conn->PConnect('localhost', 'gamito', 'ble', 'wordlife');

// execute the insert
if ($conn->Execute($sql) === false)
 print 'error inserting: '.$conn->ErrorMsg().'';

return (TRUE);

   }

}

?>
--

testedb.php
--
InsertDB('wl_admins', $sql);

?>
--

  
#1. If $table and $sql are class variables, why are you passing them as 
params to the InsertDB method?

#2. You don't even us the $table param.

Otherwise, not sure what this buys you...

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



[PHP] See if this makes any sense

2006-10-05 Thread Deckard
Hi,

I've burned my brain, checked other sites and come to a code that works.

I ask you, please, to see if this makes any sense and/or can be improved.

I'd really appreciate.

Warm Regads,
Deckard

dbInsert.php:
---
table = $table;
  $this->sql   = $sql;

  return(TRUE); 
 }


  // function that constructs the sql and inserts it into the database
  function InsertDB($table, $sql)
   {

print($sql);
// connect to MySQL
$conn = &ADONewConnection('mysql');
$conn->debug=1;
$conn->PConnect('localhost', 'gamito', 'ble', 'wordlife');

// execute the insert
if ($conn->Execute($sql) === false)
 print 'error inserting: '.$conn->ErrorMsg().'';

return (TRUE);

   }

}

?>
--

testedb.php
--
InsertDB('wl_admins', $sql);

?>
--

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



Re: [PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread John Wells

On 10/5/06, sit1way <[EMAIL PROTECTED]> wrote:

Hey all.

I've got a simple object method that sets object vars based on a passed
array:

**
function set($arr) {

foreach($arr as $name => $value) {

if(is_array($this->name)) {
  $this->$name[] = $value;
}
else {
  $this->$name = $value;
   }
   }
}
*

Getting a fatal error when I include the file that contains this method:

Fatal error: Cannot use [] for reading in path/to/my/file on line X

Looks like PHP does not like the syntax of "$this->$name[]".

Any clues how to set object array value in a loop?



I think the problem is the use of the dollar sign before the property
name.  Try this instead:

[code]
if(is_array($this->name)) {
  $this->name[] = $value;
}
else...
[/code]

HTH,
John W



TIA,

--Noah

--
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] socket https.

2006-10-05 Thread Jo�o C�ndido de Souza Neto
Out of PHP 4.3.0 fsockopen has been fixed up to do that.

""Richard Lynch"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> You may want to look at using CURL which handles all the grunge of the
> SSL exchange...
> http://php.net/curl
>
> Or maybe fsockopen has been fixed up to do that also?...
>
> On Thu, October 5, 2006 12:33 pm, João Cândido de Souza Neto wrote:
>> Hi everybody.
>>
>> I must to connect a https server by a fsockopen but it seems not
>> working.
>>
>> I´ve got openssl instaled in my php and when i run the follow line.
>>
>> $sock = fsockopen("ssl://wwws.aymorefinanciamentos.com.br", 80,
>> $errno,
>> $errstr, 30);
>>
>> My var $sock returns false without any error string.
>>
>> Could anyone help me?
>>
>> --
>> João Cândido de Souza Neto
>> Curitiba Online
>> [EMAIL PROTECTED]
>> (41) 3324-2294 (41) 9985-6894
>> http://www.curitibaonline.com.br
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>
>
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So? 

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



Fwd: [PHP] confused about where to load images

2006-10-05 Thread mel

 I still can't make it work.

This is what I have for the link to my images in navbar.php:

foreach($row as $jobType)
{
$row = mysql_fetch_array($result2,MYSQL_ASSOC);
echo "{$row 
['jobType']}";


}

and this is what I have in my homehome.php (inside the grey frame)  
where I want the images to load:



height="289">



http://www.squareinch.net/homehome.php

if www is my main directory, my file structure is:
www/homehome.php
www/images/...
www/include/header.html
www/include/footer.html
www/include/navbar.php

Thank you



On Oct 5, 2006, at 4:19 AM, Jeremy Jefferson wrote:


foreach($row as $jobType)
{
$row = mysql_fetch_array($result2,MYSQL_ASSOC); /* array variable= 
$row */
echo " 
{$row['jobType']}  ";

}
- Original Message -
From: Mel
To: Jeremy Jefferson
Sent: Thursday, October 05, 2006 7:00 AM
Subject: Re: [PHP] confused about where to load images

Hello Jeremy and thank you so much for your reply.

I am not sure where to add your code!!

My logos are dynamically generated by the code bellow from a MySql  
database!


foreach($row as $jobType)
{
$row = mysql_fetch_array($result2,MYSQL_ASSOC); /* array variable= 
$row */
echo "{$row['jobType']}  
 ";

}



On Oct 5, 2006, at 3:41 AM, Jeremy Jefferson wrote:

You need to change the logo links to link to portfolio2.php? 
logo=logonamehere









Re: [PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread Richard Lynch
It may be easier to do:

$array = $this->$name;
$array[] = $value;

Some combination of {} and $this->{$name}[] = $value may also work...

As it stands now, $name[] looks like you are trying to get an index on
$name FIRST, and then use $this-> on that SECOND...

I think.

On Thu, October 5, 2006 11:42 am, sit1way wrote:
> Hey all.
>
> I've got a simple object method that sets object vars based on a
> passed
> array:
>
> **
> function set($arr) {
>
> foreach($arr as $name => $value) {
>
> if(is_array($this->name)) {
>   $this->$name[] = $value;
> }
> else {
>   $this->$name = $value;
>}
>}
> }
> *
>
> Getting a fatal error when I include the file that contains this
> method:
>
> Fatal error: Cannot use [] for reading in path/to/my/file on line X
>
> Looks like PHP does not like the syntax of "$this->$name[]".
>
> Any clues how to set object array value in a loop?
>
> TIA,
>
> --Noah
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] guess documentroot

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 8:42 am, Javier Ruiz wrote:
> Is it possible to get the path of a file relative to the document root
> of
> the webserver using php?
> For example...
>
> if we have a script like
> http://localhost/mydir/myseconddir/index.php
>
> is there a way to get that it's runing on
> /mydir/myseconddir/
>
> ??
>
> something like getcwd() but webserver relative, not filesystem.

Anytime you got a question like this, about what data PHP has
available to you, the answer is:



-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Miserable escape string problem

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 11:37 am, [EMAIL PROTECTED] wrote:
> John Wells wrote:
> 
>> Excerpt:
>> Since you can't escape '{', this syntax will only be recognised when
>> the $ is immediately following the {. (Use "{\$" to get a literal
>> "{$").
>>
>> Does that help?
>
> Not really, John.
> ===
> $var1 = 1; $var2 = 2;
> print("{\$var1: $var2}");
> ===
>
> will output "{$var1: 2}". I need this output "{1: 2}".
> What I need is an escape character for the {, but it looks like
> PHP doesn't have any.

$curly = '{';
echo "$curly$var1: $var2}";

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Google Kreme

On 05 Oct 2006, at 11:37 , Chris Shiflett wrote:

Google Kreme wrote:

So what is "{{$var1} : {$var2}}"


Within a quoted string, you can surround variable names with braces  
for
clarity. This is especially helpful for situations like this, where  
the

rest of the string interferes with syntax.


Heh.  It was a rhetorical question.  He said there was no way to  
escape the {'s


Of course there is... that was my point.

--
No man is free who is not master of himself

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Richard Lynch
On Thu, October 5, 2006 10:55 am, [EMAIL PROTECTED] wrote:
> The point is, \ should escape only the {, just like
> it does when you escape a variable like this "\$var1"
> In this case, \ only escapes the $.

The whole thing with {} inside a string has always struck me as a
total hack to fix something that wasn't broken in the first place, and
I can never get it to do what I want.

"Don't use it" is my solution.

:-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



Re: [PHP] Help on objects

2006-10-05 Thread Satyam


- Original Message - 
From: "Robert Cummings" <[EMAIL PROTECTED]>

To: "Satyam" <[EMAIL PROTECTED]>
Cc: "Deckard" <[EMAIL PROTECTED]>; 
Sent: Thursday, October 05, 2006 11:16 AM
Subject: Re: [PHP] Help on objects



On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote:
I've seen you already had a good answer on the errors in the code so I 
won't

go on that.  As for OOP, the one design error you have is that you are
asking for an action, not an object.   You want to make SQL inserts, that 
is
your purpose, and that is an action, which is solved by a statement, not 
by
an object.   There is no doer.  Objects are what even your English 
teacher
would call objects while describing a sentence.  You are asking for a 
verb,
you don't have a subject, you don't have an object.   Of course you can 
wrap

an action in a class, but that is bad design.  Classes will usually have
names representing nouns, methods will be verbs, properties adjectives, 
more

or less, that's OOP for English teachers.


Properties are very often nouns in addition to adjectives. For instance
a linked list class will undoubtedly have noun objects referring to the
current link, the next link, etc.

Cheers,
Rob.
--


Indeed, they often are:  you as an object are defined by properties such as 
height, color of your hair and many other adjectives and you have many other 
objects which define you, fingers, legs, etc, which are also properties. 
Being more detailed, instead of the color of your hair being a property of 
you as a whole, you might have a property pointing to a hair object (a noun) 
which has a color property.


Other noun properties might not be so helpful in defining you, your friends 
might give a hint of who you are, your clients do not.  But, after all, 
neither does your hair, mine is deserting me and I'm still myself.  So, I 
would say that while adjectives define an object, nouns are relations in 
between objects and might not define neither.


Anyway, I didn't mean this analogy to be complete, nor I mean to teach OOP 
to English teachers, and though it can be talked much about, stretching it 
too far would certainly break it.  I don't mean to defend it very strongly.


Cheers

Satyam

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



Re: [PHP] socket https.

2006-10-05 Thread Richard Lynch
You may want to look at using CURL which handles all the grunge of the
SSL exchange...
http://php.net/curl

Or maybe fsockopen has been fixed up to do that also?...

On Thu, October 5, 2006 12:33 pm, João Cândido de Souza Neto wrote:
> Hi everybody.
>
> I must to connect a https server by a fsockopen but it seems not
> working.
>
> I´ve got openssl instaled in my php and when i run the follow line.
>
> $sock = fsockopen("ssl://wwws.aymorefinanciamentos.com.br", 80,
> $errno,
> $errstr, 30);
>
> My var $sock returns false without any error string.
>
> Could anyone help me?
>
> --
> João Cândido de Souza Neto
> Curitiba Online
> [EMAIL PROTECTED]
> (41) 3324-2294 (41) 9985-6894
> http://www.curitibaonline.com.br
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] Re: socket https.

2006-10-05 Thread Jo�o C�ndido de Souza Neto
I found it myself. I change to the port 443.

""João Cândido de Souza Neto"" <[EMAIL PROTECTED]> escreveu na 
mensagem news:[EMAIL PROTECTED]
> Hi everybody.
>
> I must to connect a https server by a fsockopen but it seems not working.
>
> I´ve got openssl instaled in my php and when i run the follow line.
>
> $sock = fsockopen("ssl://wwws.aymorefinanciamentos.com.br", 80, $errno, 
> $errstr, 30);
>
> My var $sock returns false without any error string.
>
> Could anyone help me?
>
> -- 
> João Cândido de Souza Neto
> Curitiba Online
> [EMAIL PROTECTED]
> (41) 3324-2294 (41) 9985-6894
> http://www.curitibaonline.com.br 

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Chris Shiflett
Google Kreme wrote:
> So what is "{{$var1} : {$var2}}"

Within a quoted string, you can surround variable names with braces for
clarity. This is especially helpful for situations like this, where the
rest of the string interferes with syntax.

A more common example is when a variable name is immediately followed by
an alphabetic character:



When you try this, PHP thinks $animals is the name of the variable. If
you want to be clear that the name of the variable is $animal, you can
use braces:

$string = "I like {$animal}s.";

So, I don't consider this a workaround. It's clean, intuitive syntax for
exactly these types of scenarios.

Hope that helps.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



[PHP] socket https.

2006-10-05 Thread Jo�o C�ndido de Souza Neto
Hi everybody.

I must to connect a https server by a fsockopen but it seems not working.

I´ve got openssl instaled in my php and when i run the follow line.

$sock = fsockopen("ssl://wwws.aymorefinanciamentos.com.br", 80, $errno, 
$errstr, 30);

My var $sock returns false without any error string.

Could anyone help me?

-- 
João Cândido de Souza Neto
Curitiba Online
[EMAIL PROTECTED]
(41) 3324-2294 (41) 9985-6894
http://www.curitibaonline.com.br 

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



[PHP] Re: Simple Array Question...

2006-10-05 Thread Colin Guthrie
Russell Jones wrote:
> lets say I have an array...
> 
> $myArray = array (
> 
> "firstkey" => "first val",
> "secondkey" => "second val"
> 
> )
> 
> 
> Can I still call these by their numeric order? ie, echo $myArray[0] shoudl
> print out "first val"...


No, but you can do:
$myArrayNumeric = array_values($myArray);
echo $myArrayNumeric[0];

Col.

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread intra_test

Google Kreme wrote:

On 05 Oct 2006, at 10:50 , [EMAIL PROTECTED] wrote:

So, yes, there is no escaping for { in PHP and that would be it.


So what is "{{$var1} : {$var2}}" ??

A workaround.

ciao

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread tg-php
Unneeded clutter, yes.. but I owe you an apology and since the mistake was 
public, I'll make the apology public as well.

I use a 'universal' email checker called ePrompter.  It does text-only, no 
HTML, so it filters out HTML messages, but have never had a problem with it 
filtering out braces, brackets, or any stuff like that.  Even HTML tags used in 
text messages make it through ok I believe.

Anyway, my apology for my screwup.  See what you get for trusting technology?  
:)

Best of luck!

-TG

= = = Original message = = =

> Either your mail client is broken, or you're misquoting him on purpose:
> 
> Using this string:
> "$var1: $var2"
> of course it doesn't work as some might expect.
Thanks Chris, I already emailed him on private 'cause I didn't
want to clutter the list unneeded.


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



[PHP] Simple Array Question...

2006-10-05 Thread Russell Jones

lets say I have an array...

$myArray = array (

"firstkey" => "first val",
"secondkey" => "second val"

)


Can I still call these by their numeric order? ie, echo $myArray[0] shoudl
print out "first val"...


Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Google Kreme

On 05 Oct 2006, at 10:50 , [EMAIL PROTECTED] wrote:

So, yes, there is no escaping for { in PHP and that would be it.


So what is "{{$var1} : {$var2}}" ??


--
MEGAHAL: within my penguin lies a torrid story of hate and love.

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Chris Shiflett
[EMAIL PROTECTED] wrote:
> I'd like to have the output as "{11: 22}".

My previous example demonstrates that:

> echo "{{$foo}: {$bar}}";

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread intra_test

Either your mail client is broken, or you're misquoting him on purpose:

Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.

Thanks Chris, I already emailed him on private 'cause I didn't
want to clutter the list unneeded.


To address the original question, a backslash does not escape the brace.
Are you wanting the variables to be evaluated? Here's an example that
demonstrates both:


It occurs to me I wasn't clear enough, although one could have figure
it out.
By using this:
===
$var1 = 11; $var2 = 22;
outputstringfunction("{$var1: $var2}"); //hypothetical code
===
I'd like to have the output as "{11: 22}".
By using "{{$var1}: {$var2}}" it works just fine, but this is a mess,
I can't live with. What I am using now is "{ $var1: $var2}", better.

I guess what I am asking for is more or less uninteresting to most of
the PHP developers(many are just coders, really... for the difference
search the net) that eat up whatever offered, so I might just rest my
case.

So, yes, there is no escaping for { in PHP and that would be it.





Hope that helps.

Chris



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



[PHP] Re: How to Set Object Array Value || In $this->$name[] Format...

2006-10-05 Thread sit1way
Hey all.

I've got a simple object method that sets object vars based on a passed 
array:

**
function set($arr) {

foreach($arr as $name => $value) {

if(is_array($this->name)) {
  $this->$name[] = $value;
}
else {
  $this->$name = $value;
   }
   }
}
*

Getting a fatal error when I include the file that contains this method:

Fatal error: Cannot use [] for reading in path/to/my/file on line X

Looks like PHP does not like the syntax of "$this->$name[]".

Any clues how to set object array value in a loop?

TIA,

--Noah

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread Chris Shiflett
[EMAIL PROTECTED] wrote:
> Let's look at your original message:
>
> Using this string:
> "$var1: $var2"
> of course it doesn't work as some might expect.

Either your mail client is broken, or you're misquoting him on purpose:

Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.

To address the original question, a backslash does not escape the brace.
Are you wanting the variables to be evaluated? Here's an example that
demonstrates both:



Hope that helps.

Chris

-- 
Chris Shiflett
http://shiflett.org/

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



Re: [PHP] Miserable escape string problem

2006-10-05 Thread intra_test

John Wells wrote:


Excerpt:
Since you can't escape '{', this syntax will only be recognised when
the $ is immediately following the {. (Use "{\$" to get a literal
"{$").

Does that help?


Not really, John.
===
$var1 = 1; $var2 = 2;
print("{\$var1: $var2}");
===

will output "{$var1: 2}". I need this output "{1: 2}".
What I need is an escape character for the {, but it looks like
PHP doesn't have any.

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread tg-php
Let's look at your original message:

Using this string:
"$var1: $var2"
of course it doesn't work as some might expect.


It works exactly as expected.  Within double-quotes, things like variables get 
evaluated.  In this case $var1 and $var2 will be replaced by their values.  
That's what's "expected".


But why in the name of [whatever, too many to list] doesn't this one 
below work?
"\$var1: $var2"

If \ is an escape character why does it also appear in the string output?
Why does the above \ escape $var1 and not only the ?


In the test I did, it behaves exactly as it's expected to behave.  "\" escapes 
the next character.  Or in the case of some characters, there may be more than 
one after the \ that get interpreted.  For example "\x41" is hexdecimal value 
41.

The \$var1 above is indicating you want to display a "$" literally and not 
interpret it despite being contained within double-quotes.  The "var1" part, 
not having a "$" on the front of it, doesn't get interpretted as anything and 
is output literally as "var1".

Maybe rephrasing the question would help because reading your original message 
doesn't tell me anything except that there's a communication problem.

Unless "\$var1: $var2" does NOT output "$var1: ", then everything is 
functioning as designed and expected.

-TG


= = = Original message = = =

Sorry tg, you missed the whole point. Read again.
> The escaping works fine for me.. using the code:
>
> $var1 = 1;
> $var2 = 3;
>
> echo "\$var1: $var2";
> print "\$var1: $var2";
> print ("\$var1: $var2");
>
> All output:
>
> $var1: 3
>
> as expected.
>
> Is there a way to re-define the escape character or something?  I can't think 
> of why that wouldn't escape the $ properly
>   


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Miserable escape string problem

2006-10-05 Thread John Wells

On 10/5/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:

Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.

But why in the name of [whatever, too many to list] doesn't this one
below work?
"\{$var1: $var2}"

If \ is an escape character why does it also appear in the string output?
Why does the above \ escape {$var1 and not only the {?

Miserable.



First up:
http://uk2.php.net/manual/en/language.types.string.php#language.types.string.syntax.double

Excerpt:
Again, if you try to escape any other character, the backslash will be
printed too! Before PHP 5.1.1, backslash in \{$var} hasn't been
printed.

Then:
http://uk2.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex

Excerpt:
Since you can't escape '{', this syntax will only be recognised when
the $ is immediately following the {. (Use "{\$" to get a literal
"{$").

Does that help?

HTH,
John W

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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread intra_test

Sorry tg, you missed the whole point. Read again.

The escaping works fine for me.. using the code:

$var1 = 1;
$var2 = 3;

echo "\$var1: $var2";
print "\$var1: $var2";
print ("\$var1: $var2");

All output:

$var1: 3

as expected.

Is there a way to re-define the escape character or something?  I can't think 
of why that wouldn't escape the $ properly
  


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



Re: [PHP] Re: Miserable escape string problem

2006-10-05 Thread tg-php
The escaping works fine for me.. using the code:

$var1 = 1;
$var2 = 3;

echo "\$var1: $var2";
print "\$var1: $var2";
print ("\$var1: $var2");

All output:

$var1: 3

as expected.

Is there a way to re-define the escape character or something?  I can't think 
of why that wouldn't escape the $ properly.

= = = Original message = = =

Well Kae, if you reply 3 times let me also reply you once.
What you try to suggest is a workaround. A workaround should
not be needed for such a basic thing. Ever.

The point is, \ should escape only the , just like
it does when you escape a variable like this "\$var1"
In this case, \ only escapes the $.

Even then, why does it output the \?
Try this:
=
$var1 = 1;
$var2 = 2;
print("\$var1: $var2");

=
It will output: \1: 2
Why the \? Isn't it an escape character.


If you try to get me thinking that this is normal behaviour,
let's agree to disagree.

PS: I'd like to see an insider comment on this, eventually
explain the thought behind this implementation.



Kae Verens wrote:
> because $var1 is a valid syntactical construct?
> 
> try this instead:
>  ''.$var1.': '.$var2.''
>
> Kae


___
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

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



Re: [PHP] Re: OOP Hello World

2006-10-05 Thread John Wells

On 10/5/06, Martin Alterisio <[EMAIL PROTECTED]> wrote:

The kind of thinking that OOP it's just a *super* feature of a programming
language that should be used only for highly complex problems, is what I
want to eradicate. OOP doesn't stand neither as a language feature nor as
extra capabilities of a language, on the contrary, it takes some freedom
away from the programmer. I see OOP as a way of thinking and working, that
should be used in the most complex problem and the most simple problem
equally.


Err.  OOP came about exclusively as a way to manage complexity.   I'm
not so sure about making a simple problem complex just so you can
simplify it with OOP.  And it *is* only a feature of PHP.  So unlike
other languages, you actually *do* have a choice.

Of course I LOVE having the choice, which is why I LOVE PHP.  I get so
much out of POOPH every time I dive into it.


Nope, I caught your joke, and I found it amusing. Though every joke hides a
truth, as I can explain a hello world in oop laughing and being serious at
the same time.


My ex girlfriend always used that line on me.  Drove me mad.  :P

I wish we could continue this over a round of beers at the pub.  I
think we'd have fun batting this back and forth.  :)  And we won't
fill up The List's inbox in the process.

Cheers,
John W

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



RE: [PHP] Template system

2006-10-05 Thread Peter Lauri
I haven't even read all replies, but the first one caught my love :-)

 

/Peter

 

www.lauri.se   - personal web site

www.dwsasia.com   - company web site

 

  _  

From: Dave Goodchild [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 05, 2006 5:59 PM
To: Peter Lauri
Cc: PHP
Subject: Re: [PHP] Template system

 

Smarty? smarty.php.net












-- 
http://www.web-buddha.co.uk 



[PHP] Re: Miserable escape string problem

2006-10-05 Thread intra_test

Well Kae, if you reply 3 times let me also reply you once.
What you try to suggest is a workaround. A workaround should
not be needed for such a basic thing. Ever.

The point is, \ should escape only the {, just like
it does when you escape a variable like this "\$var1"
In this case, \ only escapes the $.

Even then, why does it output the \?
Try this:
=
$var1 = 1;
$var2 = 2;
print("\{$var1: $var2}");

=
It will output: \{1: 2}
Why the \? Isn't it an escape character.


If you try to get me thinking that this is normal behaviour,
let's agree to disagree.

PS: I'd like to see an insider comment on this, eventually
explain the thought behind this implementation.



Kae Verens wrote:

because {$var1} is a valid syntactical construct?

try this instead:
 '{'.$var1.': '.$var2.'}'

Kae


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



[PHP] Re: Miserable escape string problem

2006-10-05 Thread Kae Verens

[EMAIL PROTECTED] wrote:

Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.

But why in the name of [whatever, too many to list] doesn't this one 
below work?

"\{$var1: $var2}"

If \ is an escape character why does it also appear in the string output?
Why does the above \ escape {$var1 and not only the {?

Miserable.


because {$var1} is a valid syntactical construct?

try this instead:
 '{'.$var1.': '.$var2.'}'

Kae

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



[PHP] Miserable escape string problem

2006-10-05 Thread intra_test

Using this string:
"{$var1: $var2}"
of course it doesn't work as some might expect.

But why in the name of [whatever, too many to list] doesn't this one 
below work?

"\{$var1: $var2}"

If \ is an escape character why does it also appear in the string output?
Why does the above \ escape {$var1 and not only the {?

Miserable.

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



Re: [PHP] Re: OOP Hello World

2006-10-05 Thread Martin Alterisio

2006/10/5, John Wells <[EMAIL PROTECTED]>:


On 10/5/06, Martin Alterisio <[EMAIL PROTECTED]> wrote:
> PHP seems to be getting more and more object oriented, I think it's the
> right time to start questioning what have been done so far in terms of
OOP
> in PHP, because, honestly, there are too many php classes being
distributed
> out there that are a complete mess. Forget about spaghethi code, we have
to
> deal with pizza classes too.

[code]
require_once('previousEmails.php');

interface Responder {
public function respond(Salutable $receiver, $response);
public function getResponderName();
}

class WiseAssResponder implements Responder {
protected $responderName;

public function __construct($responderName) {
$this->responderName = $responderName;
}

public function getResponderName() {
return $this->responderName;
}

public function respond(Salutable $receiver, $response) {
echo "Hi " . $receiver->getSalutationName()
   . ".  Please read my response
below: \n\n";
echo $response;
echo "Kindest Regards,\n" .
$this->getResponderName();
}
}

class Martin implements Salutable {
public function getSalutationName() {
return get_class($this);
}
}

$martin = new Martin();
$johnW = new WiseAssResponder('John W');
$response=<<


I'd rather say that we have different concepts of what is simple and
flexible, and both concepts are aceptable.

I know that plenty of people on this list want to have a serious

conversation about OOP for PHP (should we just start using OOPHP as
the new acronym?  or maybe POOPH?  Or... PHOOP?!? Wait, that's not
taking thing seriously...), but I don't think a complex Hello, World
made of Saluters, Salutables, factories and abstractions is taking it
serious.  I think it's exhausting the theory and using various design
patterns for the sake of using design patterns...



It seems we've differents approaches to what is complex and what is simple
(in terms of computer systems). I think being serious about OOP is start
thinking even the simplest of problem from an OOP perspective. I just
exposed the Hello World as an example, off course it seems like using a nuke
to kill a mosquito, but here I'm not thinking about efficiency or efficacy,
it's about training the mind into the OOP methodologies and ways of
thinking. Like training your body, once the mind sees everything in terms of
object abstraction, OOP will be as natural as breathing.

The kind of thinking that OOP it's just a *super* feature of a programming
language that should be used only for highly complex problems, is what I
want to eradicate. OOP doesn't stand neither as a language feature nor as
extra capabilities of a language, on the contrary, it takes some freedom
away from the programmer. I see OOP as a way of thinking and working, that
should be used in the most complex problem and the most simple problem
equally.

But really all of this comes down to the imutable truth about

programming in PHP: there are a *million* ways to skin a cat.  When
you heard "OOP + Hello, World", you thought about people/things
greeting each other.  When I heard it, I thought about an application
outputing a string.  The guy who started that particular thread
probably thought of something totally different.  Who's to say who is
right?



Off course, no one can say which is the right way to solve a problem, and I
will not hide the fact that OOP is just a coder's whim. I'm just inviting
you over to this whim, I can assure you that it's a healthy and beneficial
whim, it's not just a Java hype. At least it's healthier whim than web2.0.

Hey, take my words as mine alone though.  Maybe I was the only one

that got my joke.  It's happened before.



Nope, I caught your joke, and I found it amusing. Though every joke hides a
truth, as I can explain a hello world in oop laughing and being serious at
the same time.

HEREDOC;


$johnW->respond($martin, $response);
exit;
[/code]



Re: [PHP] guess documentroot

2006-10-05 Thread Javier Ruiz

Perfect!

got it using the following:

/* 1 - remove the query string just in case it contains a '/' in it
  2 - like Clive said, substr() and strrpos() 'clean' the path to provide
the directories only */

$aPath = str_replace($_REQUEST['QUERY_STRING'], '',
$_SERVER['SCRIPT_NAME']);
$aPath = substr($aRuta, 0, (strrpos($aRuta, '/') + 1));

Thanks a lot guys :)



On 10/5/06, clive <[EMAIL PROTECTED]> wrote:



>
> if we have a script like
> http://localhost/mydir/myseconddir/index.php
>
> is there a way to get that it's runing on
> /mydir/myseconddir/
>
use $_SERVER['[PHP_SELF'] or $_SERVER['SCRIPT_NAME']

and then simply  use strripos() to get the last forwarsd-slash and
substr() to get the value you want.
>
>


--
Regards,

Clive




Re: [PHP] Re: OOP Hello World

2006-10-05 Thread John Wells

On 10/5/06, Martin Alterisio <[EMAIL PROTECTED]> wrote:

PHP seems to be getting more and more object oriented, I think it's the
right time to start questioning what have been done so far in terms of OOP
in PHP, because, honestly, there are too many php classes being distributed
out there that are a complete mess. Forget about spaghethi code, we have to
deal with pizza classes too.


[code]
require_once('previousEmails.php');

interface Responder {
public function respond(Salutable $receiver, $response);
public function getResponderName();
}

class WiseAssResponder implements Responder {
protected $responderName;

public function __construct($responderName) {
$this->responderName = $responderName;
}

public function getResponderName() {
return $this->responderName;
}

public function respond(Salutable $receiver, $response) {
echo "Hi " . $receiver->getSalutationName()
   . ".  Please read my response below: 
\n\n";
echo $response;
echo "Kindest Regards,\n" . $this->getResponderName();
}
}

class Martin implements Salutable {
public function getSalutationName() {
return get_class($this);
}
}

$martin = new Martin();
$johnW = new WiseAssResponder('John W');
$response=<

Re: [PHP] What Framework would you recommend?

2006-10-05 Thread Dave Goodchild

I use Code Igniter and think it's great. Very clear, fast, cuts my coding
time by about 40%. Then again, depends on what you need a framework for...


Re: [PHP] What Framework would you recommend?

2006-10-05 Thread Angelo Zanetti



Willem Herbst wrote:


I am researching 3 frameworks at present but i would just like to know
from developer who maybe have used one of then which one they would
recommend?

Symfony - http://www.symfony-project.com
Cakephp - http://cakephp.org/
Code Igniter - http://www.codeigniter.com



check this out:


http://www.phpit.net/demo/framework%20comparison/chart.php

--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] 

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



Re: [PHP] guess documentroot

2006-10-05 Thread clive




if we have a script like
http://localhost/mydir/myseconddir/index.php

is there a way to get that it's runing on
/mydir/myseconddir/


use $_SERVER['[PHP_SELF'] or $_SERVER['SCRIPT_NAME']

and then simply  use strripos() to get the last forwarsd-slash and 
substr() to get the value you want.






--
Regards,

Clive

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



Re: [PHP] guess documentroot

2006-10-05 Thread John Nichel

Javier Ruiz wrote:

Hey all!

Is it possible to get the path of a file relative to the document root of
the webserver using php?
For example...

if we have a script like
http://localhost/mydir/myseconddir/index.php

is there a way to get that it's runing on
/mydir/myseconddir/

??

something like getcwd() but webserver relative, not filesystem.



$array =  parse_url ( "http://localhost/mydir/myseconddir/index.php"; );
$array2 = pathinfo ( $array['path'] );
$path = $array2['dirname'];

--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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



Re: [PHP] Testing people

2006-10-05 Thread Ryan A
Thanks for replying guys.

Paul, Will check out the links you sent me, If its really as good as you say... 
should save me a heck of a time coding it, thanks!


Cheers!
Ryan

Paul Scott <[EMAIL PROTECTED]> wrote: 
On Thu, 2006-10-05 at 03:36 -0700, Ryan A wrote:
> Hey all,
> 
> this is a two part question but I need just one solution:
> 

Done. Go to http://avoir.uwc.ac.za/ and download Kewl.NextGen. Then
install it and use the moduleadmin to install MCQ (multiple Choice
Questions) module. It does everything (and more) that you need.

If you need help, join either (or both) the users list and the
developers list.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 



--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

-
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small 
Business.

Re: [PHP] Template system

2006-10-05 Thread Ryan A
Actually, I tried Fast Template when trying to decide on a "templating 
solution", ran into some errors from the main class file/s and didnt get any 
help on it... so dumped it.

The forums/lists for SMARTY are really good, very very helpful folks... I 
daresay as helpful and great as this php list.

No regrets in my SMARTY choice.

Cheers!


Jônata Tyska Carvalho <[EMAIL PROTECTED]> wrote: think it is the better class 
of template:

www.thewebmasters.net/php/FastTemplate.phtml





 On 10/5/06, Ryan A <[EMAIL PROTECTED]> wrote: Thats what i use... and no 
complaints so far.

Cheers,
Ryan

Dave Goodchild <[EMAIL PROTECTED]> wrote: Smarty? smarty.php.net 

>
>
>
>
>
>
>
>


--
http://www.web-buddha.co.uk



--
- The faulty interface lies between the chair and the keyboard. 
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

-
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail.
 



-- 
Jônata Tyska Carvalho
-
-- Técnico em Informática pelo Colégio Técnico Industrial (CTI)
-- Graduando em Engenharia de Computação 
Fundação Universidade Federal de Rio Grande (FURG) 


--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

-
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail.

Re: [PHP] Help on objects

2006-10-05 Thread Martin Alterisio

2006/10/5, Satyam <[EMAIL PROTECTED]>:


I've seen you already had a good answer on the errors in the code so I
won't
go on that.  As for OOP, the one design error you have is that you are
asking for an action, not an object.   You want to make SQL inserts, that
is
your purpose, and that is an action, which is solved by a statement, not
by
an object.   There is no doer.  Objects are what even your English teacher
would call objects while describing a sentence.  You are asking for a
verb,
you don't have a subject, you don't have an object.   Of course you can
wrap
an action in a class, but that is bad design.  Classes will usually have
names representing nouns, methods will be verbs, properties adjectives,
more
or less, that's OOP for English teachers.

Satyam



You're wrong, partially: an action can be an object and it's not necessarily
a bad design, take for example function objects or the program and
statements as objects in lisp-like languages. It's acceptable to make a
class that works as an abstract representation of an sql query. This kind of
classes are used very efficiently in object persistence libraries. What I
agree with you is that it's not right that this class works as the insert
action and not as a representation of the insert operation.


[PHP] guess documentroot

2006-10-05 Thread Javier Ruiz

Hey all!

Is it possible to get the path of a file relative to the document root of
the webserver using php?
For example...

if we have a script like
http://localhost/mydir/myseconddir/index.php

is there a way to get that it's runing on
/mydir/myseconddir/

??

something like getcwd() but webserver relative, not filesystem.

thanks a lot.
greetings!


Re: [PHP] Help on objects

2006-10-05 Thread Martin Alterisio

2006/10/4, Deckard <[EMAIL PROTECTED]>:


Hi,

I'm trying to lay my hands on PHP OOP, but it's not easy :(
I've read several examples in the web, but cannot transpose to may case.

I'm trying to set a class to make SQL inserts in mysql.

I have the class:
-
table = $table;
  $this->sql   = $sql;

  return(TRUE);
}


  // function that constructs the sql and inserts it into the database
  function InsertDB($sql)
   {

print($sql);
// connect to MySQL
$conn->debug=1;
$conn = &ADONewConnection('mysql');
$conn->PConnect('localhost', 'deckard', 'ble', 'wordlife');

if ($conn->Execute($sql) === false)
print 'error inserting: '.$conn->ErrorMsg().'';

return (TRUE);
   }
}


and the code that calls it:

InsertDB('$sql');

?>


but it's not working ?

Can anyone give me a hand here ?

I've read the manuals, examples, etc.

Any help would be appreciated.

Best Regards,
Deckard

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



For database interaction, give PDO a chance: http://php.net/pdo
IMO it's cleaner and more efficient than adodb.

Then, I believe what you're trying to make is a query builder. I would break
down the differente parts of an sql query and create abstractions for each
part (some can be reused on different types of queries), then have builder
create the queries abstractions from the different parts.


Re: [PHP] Re: OOP Hello World

2006-10-05 Thread Martin Alterisio

Double-checking.

Nope.

It wasn´t from the Java mailing list, they're still talking about
hibernate... they'll probably give a damn about this thing anyway, because
they're all oop gurus, what would they care about a hello world?

PHP seems to be getting more and more object oriented, I think it's the
right time to start questioning what have been done so far in terms of OOP
in PHP, because, honestly, there are too many php classes being distributed
out there that are a complete mess. Forget about spaghethi code, we have to
deal with pizza classes too.

2006/10/5, John Wells <[EMAIL PROTECTED]>:


Are you sure you're not on a Spanish *Java* mailing list?

:)

On 10/5/06, Martin Alterisio <[EMAIL PROTECTED]> wrote:
> Me... again, still boring you to death with meaningless OOP rantings.
>
> First I would like to point out that there was a design mistake in what
I
> proposed in the last mail (following afterwards): the Saluter shouldn't
be
> an abstract class, it isn't correct to base your class hierarchy on the
> ability to greet (or in the ability to do something generally speaking).
If
> it's done that way we'll have classes coexisting in the same branch of
the
> class tree, but possibly having completely different nature. Saluter
should
> be an interface:
>
>   interface class Saluter {
> public function greet(Salutable $receiver);
>   }
>
>   class FormalSaluter implements Saluter {
> public function greet(Salutable $receiver) {
>   echo "Hello " . $receiver->getSalutationName() . "\n";
> }
>   }
>
> Then, I'll try to translate what has been said in the spanish list.
>
> It has been proposed that World should be a singleton, since there is
only
> one world... but this arguable, at metaphysic level perhaps...
>
> Also an observer pattern could be used so anyone can hear the greetings.
But
> I think this should be done on the design of the greeting enviroment
> abstraction (to provide other places than standard output where the
greeting
> can be said).
>
> The saluters factory should use a factory method pattern or an abstract
> factory pattern? I think an abstract factory is not appropiate in this
case,
> the creation process is not that complex to require this kind of design
> pattern.
>
> Also I proposed that decorators could be used to add styles to the
greeting
> for outputs that allow styling (e.g.:html). In this case maybe an
abstract
> factory would be appropiate, so that decorated saluters are created for
the
> appropiate type of output, combined with a builder pattern to create the
> decorated saluters (this last part I thought it just now, I'll post it
later
> on the spanish list)
>
> Well, I think that sums it all up.
>
> 2006/9/29, Martin Alterisio <[EMAIL PROTECTED]>:
> >
> > What's up folks?
> >
> > I just wanted to tell you about a thread that's going on in the
spanish
> > php mailing list. A fellow software developer which had just started
with
> > OOP was asking for "Hello World" examples using OOP. The examples of
code he
> > had been doing was not that different from the usual Hello World
example we
> > all know and love(?), so I thought he was missing the point of what
was the
> > purpose of using OOP. This was my reply (I'll try to keep the
translation as
> > accurate as possible):
> >
> > I believe you have misunderstood what is the purpose of OOP, your
objects
> > are not proper abstractions.
> >
> > First and most important, you should define what is the problem to
solve:
> > greet the world.
> > We build an abstraction of the problem and its main components:
somebody
> > who greets and something to greet.
> > Here we're working with generalizations, since our main objective is
to
> > build reusable objects. For that purpose is useful that our "saluter"
could
> > be used to greet more than just the world.
> >
> > Therefore we'll first define what kind of interaction we expect the
> > salutation receivers to have, in the following interface:
> >
> >   interface Salutable {
> > public function getSalutationName();
> >   }
> >
> > In this interface we have all we need to properly greet any entity:
the
> > name we should use when doing the salutation.
> >
> > Then we create the object which represents the world:
> >
> >   class World implements Salutable {
> > public function getSalutationName() {
> >   return "World";
> > }
> >   }
> >
> > Now we're missing a saluter, but we're not sure which way of greeting
> > would be appropiate, so we prefer to create an abstract saluter and
leave
> > the child implementation to decide the appropiate greeting:
> >
> >   abstract class Saluter {
> > abstract public function greet(Salutable $receiver);
> >   }
> >
> > In our case we need a formal saluter as we should not disrespect the
world
> > (saying "hey! wazzup world?" could be offensive), then:
> >
> >   class FormalSaluter extends Saluter {
> > public function greet(Salutable $receiver) {
> >   echo "Hello " . $receiver->getSalutationName() . 

[PHP] What Framework would you recommend?

2006-10-05 Thread Willem Herbst

I am researching 3 frameworks at present but i would just like to know
from developer who maybe have used one of then which one they would
recommend?

Symfony - http://www.symfony-project.com
Cakephp - http://cakephp.org/
Code Igniter - http://www.codeigniter.com

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



Re: [PHP] Help on objects [with reply]

2006-10-05 Thread Dave Goodchild

Undoubtedly. He could also use the PEAR DB abstraction layer.


Re: [PHP] Help on objects [with reply]

2006-10-05 Thread benifactor
yea, thanks for the input... but do you think my solution would be better
for original poster?
- Original Message - 
From: "Dave Goodchild" <[EMAIL PROTECTED]>
To: "benifactor" <[EMAIL PROTECTED]>
Cc: "Robert Cummings" <[EMAIL PROTECTED]>; "Satyam"
<[EMAIL PROTECTED]>; "Deckard" <[EMAIL PROTECTED]>;

Sent: Thursday, October 05, 2006 4:55 AM
Subject: Re: [PHP] Help on objects [with reply]


> Re the last suggestion, ensure you keep those database details outside the
> web root (ie in a file called connect.inc for example) or if have to keep
it
> there add a .htaccess file that prevents download of *.inc files.
>
> Also, avoid use of the error suppression operator (@). You need to see
your
> errors.
>

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



Re: [PHP] Testing people

2006-10-05 Thread benifactor
how are you getting the answers? are they hard coded in html? are you
pulling them from a database? if from a database,  just order them
randomly.. mysql_query("select answers from table where question = '10'
ORDER BY RAND()" );  i think this would randomize all of the results in the
answer colum of the table. then you could use a while loop to display the
answers with radio buttons on your test page. this may not be the best
method and it will not work if your answers are html.
- Original Message - 
From: "Ryan A" <[EMAIL PROTECTED]>
To: "php php" 
Sent: Thursday, October 05, 2006 3:36 AM
Subject: [PHP] Testing people


> Hey all,
>
> this is a two part question but I need just one solution:
>
> 1. Can you recommend a good testing software where the choices are
multiple choice (cross a button or radio button)
>
> if nothing great out there... will make this myself so, on to point 2:
>
> 2. I have noticed if you are displaying 4 (a-d) choices and the answer for
question 10 (for example) is always on choice B it kind of sticks in the
head and students dont really read everything they just memorize the
location of the answer (maybe unconsciously) and click that.. i have an idea
of making the answers "jump around"
>
> for example:
> once the correct answer for question 10 is B, if you reload the page, it
would be C, reload again and its A (chosen randomly...)
>
> (real) example 2:
> What has two legs:
> a: an elephant
> b: a dog
> c: a bird
> d: a cat
>
> C is the correct answer of course... but if you reload the page:
>
>  a: a bird
> b: an elephant
>  c: a dog
> d: a cat
>
> now A is the correct answer.
>
> I thought of having a hidden text box everytime for each question... but
that can be quite easily found out... any other suggestions?
>
>
> Thanks!
> Ryan
>
>
>
>
>
>
>
>
>
>
>
>
> --
> - The faulty interface lies between the chair and the keyboard.
> - Creativity is great, but plagiarism is faster!
> - Smile, everyone loves a moron. :-)
>
> -
>  All-new Yahoo! Mail - Fire up a more powerful email and get things done
faster.

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



Re: [PHP] Help on objects [with reply]

2006-10-05 Thread Dave Goodchild

Re the last suggestion, ensure you keep those database details outside the
web root (ie in a file called connect.inc for example) or if have to keep it
there add a .htaccess file that prevents download of *.inc files.

Also, avoid use of the error suppression operator (@). You need to see your
errors.


Re: [PHP] Help on objects [with reply]

2006-10-05 Thread benifactor
i may be wrong, but your use of the class to me seems pointless... the reuse
aspect of your database connection could be done with a simple include...
maybe your need is different from what i suspect, being a beginner myself...
here is what i do, and maybe the list can tell me if it would be better or
worse for you...


in a seperate php file define your  database info...




and in the all of the files you would need this connection you would just
include that file...and call the database with the variable $l.
example:



and this could easily be made into a function to allow for multiple
databases, users passwords, ect
if nothing else, at least tell me what you think about my way of doing this.
- Original Message - 
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Satyam" <[EMAIL PROTECTED]>
Cc: "Deckard" <[EMAIL PROTECTED]>; 
Sent: Thursday, October 05, 2006 2:16 AM
Subject: Re: [PHP] Help on objects


> On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote:
> > I've seen you already had a good answer on the errors in the code so I
won't
> > go on that.  As for OOP, the one design error you have is that you are
> > asking for an action, not an object.   You want to make SQL inserts,
that is
> > your purpose, and that is an action, which is solved by a statement, not
by
> > an object.   There is no doer.  Objects are what even your English
teacher
> > would call objects while describing a sentence.  You are asking for a
verb,
> > you don't have a subject, you don't have an object.   Of course you can
wrap
> > an action in a class, but that is bad design.  Classes will usually have
> > names representing nouns, methods will be verbs, properties adjectives,
more
> > or less, that's OOP for English teachers.
>
> Properties are very often nouns in addition to adjectives. For instance
> a linked list class will undoubtedly have noun objects referring to the
> current link, the next link, etc.
>
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
>
> -- 
> 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] Help on objects

2006-10-05 Thread benifactor

- Original Message - 
From: "Robert Cummings" <[EMAIL PROTECTED]>
To: "Satyam" <[EMAIL PROTECTED]>
Cc: "Deckard" <[EMAIL PROTECTED]>; 
Sent: Thursday, October 05, 2006 2:16 AM
Subject: Re: [PHP] Help on objects


> On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote:
> > I've seen you already had a good answer on the errors in the code so I
won't
> > go on that.  As for OOP, the one design error you have is that you are
> > asking for an action, not an object.   You want to make SQL inserts,
that is
> > your purpose, and that is an action, which is solved by a statement, not
by
> > an object.   There is no doer.  Objects are what even your English
teacher
> > would call objects while describing a sentence.  You are asking for a
verb,
> > you don't have a subject, you don't have an object.   Of course you can
wrap
> > an action in a class, but that is bad design.  Classes will usually have
> > names representing nouns, methods will be verbs, properties adjectives,
more
> > or less, that's OOP for English teachers.
>
> Properties are very often nouns in addition to adjectives. For instance
> a linked list class will undoubtedly have noun objects referring to the
> current link, the next link, etc.
>
> Cheers,
> Rob.
> -- 
> ..
> | InterJinn Application Framework - http://www.interjinn.com |
> ::
> | An application and templating framework for PHP. Boasting  |
> | a powerful, scalable system for accessing system services  |
> | such as forms, properties, sessions, and caches. InterJinn |
> | also provides an extremely flexible architecture for   |
> | creating re-usable components quickly and easily.  |
> `'
>
> -- 
> 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] Testing people

2006-10-05 Thread Paul Scott

On Thu, 2006-10-05 at 03:36 -0700, Ryan A wrote:
> Hey all,
> 
> this is a two part question but I need just one solution:
> 

Done. Go to http://avoir.uwc.ac.za/ and download Kewl.NextGen. Then
install it and use the moduleadmin to install MCQ (multiple Choice
Questions) module. It does everything (and more) that you need.

If you need help, join either (or both) the users list and the
developers list.

--Paul



All Email originating from UWC is covered by disclaimer 
http://www.uwc.ac.za/portal/uwc2006/content/mail_disclaimer/index.htm 

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

[PHP] PHP mentoring

2006-10-05 Thread Dave Goodchild

Hi all. I am an intermediate php/mysql developer (1 1/2 years experience)
and wondered if anyone would consider mentoring my good self. Would not be
heavy, I am constantly working on projects and looking to improve and feel
mentoring is a great way to learn, of course after a certain level I would
repay the kindness by mentoring another.

--
http://www.web-buddha.co.uk


[PHP] Virtual Directory Support

2006-10-05 Thread NicoFr

hello,
This question was sent before but there is no good answer so :

When i see my phpinfo, Virtual Directory Support is disabled
How do I change this from disabled to enabled ?

I use php 5 and apache 2 on a linux FC5 server.

I also use a wampserver on a winxp workstation and here, it's enabled!!
I see all the configuration files. I can't see a difference!!

Please help me !! Thanks a lot.

Nico (French)
-- 
View this message in context: 
http://www.nabble.com/Virtual-Directory-Support-tf2387826.html#a6656719
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] Template system

2006-10-05 Thread Ryan A
Thats what i use... and no complaints so far.

Cheers,
Ryan

Dave Goodchild <[EMAIL PROTECTED]> wrote: Smarty? smarty.php.net

>
>
>
>
>
>
>
>


-- 
http://www.web-buddha.co.uk



--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

-
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail.

Re: [PHP] Template system

2006-10-05 Thread Dave Goodchild

Smarty? smarty.php.net













--
http://www.web-buddha.co.uk


[PHP] Template system

2006-10-05 Thread Peter Lauri
Hi group,

 

I was curious of your experience of Template systems/parsers.

 

For the moment I am using the one available on www.berrewaerts.net/dev.
However, sometimes it feels like the parsing takes to long.

 

I am looking for a fast template parser that supports nested blocks etc to
be able to build more complicated pages structures.

 

Best regards,

Peter Lauri

 

www.lauri.se   - personal web site

www.dwsasia.com   - company web site

 

 



[PHP] Testing people

2006-10-05 Thread Ryan A
Hey all,

this is a two part question but I need just one solution:

1. Can you recommend a good testing software where the choices are multiple 
choice (cross a button or radio button) 

if nothing great out there... will make this myself so, on to point 2:

2. I have noticed if you are displaying 4 (a-d) choices and the answer for 
question 10 (for example) is always on choice B it kind of sticks in the head 
and students dont really read everything they just memorize the location of the 
answer (maybe unconsciously) and click that.. i have an idea of making the 
answers "jump around"

for example:
once the correct answer for question 10 is B, if you reload the page, it would 
be C, reload again and its A (chosen randomly...)

(real) example 2:
What has two legs:
a: an elephant
b: a dog
c: a bird
d: a cat

C is the correct answer of course... but if you reload the page:

 a: a bird
b: an elephant
 c: a dog
d: a cat

now A is the correct answer.

I thought of having a hidden text box everytime for each question... but that 
can be quite easily found out... any other suggestions?


Thanks!
Ryan


 









--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

-
 All-new Yahoo! Mail - Fire up a more powerful email and get things done faster.

[PHP] confused about where to load images

2006-10-05 Thread Meline Martirossian

Hello,

I have just made my first php mini website. I have my header, footer,  
navigation and main pages.

The header, footer and navigation appear as "includes" in my main page.

When I click on my navigation links, I get a new blank browser window  
with the image on it. This is not what I want.


Can you help me with instructing the server to load the image on my  
main page and in the designated area instead of a new blank page?


http://www.squareinch.net/portfolio2.php

Thank you in advance.

 

Re: [PHP] quick question about preg_replace

2006-10-05 Thread Ivo F.A.C. Fokkema
On Thu, 05 Oct 2006 09:29:46 +0800, Penthexquadium wrote:

> On Wed, 4 Oct 2006 23:19:58 +0200, "Martin Bach Nielsen" <[EMAIL PROTECTED]> 
> wrote:
> 
>> Hi all.
>> 
>>  
>> 
>> I have written a guestbook (I know, there's a ton out there), which until
>> recently did not get any spam, so now I'm trying to remove the spam-ad by
>> using preg_replace:
>> 
>>  
>> 
>> $melding = preg_replace('/(> temporarily cut-off due to spam-suspicion.", $melding);
>> 
>>  
>> 
>> However, this only makes the problem half-solved, since I also want any text
>> before the link to be replaced with a message as stated above. The above
>> line removes anything after '> 
>> Is there any way to make the above line to include anything before the > href=// ?
>> 
>>  
>> 
>> I have tried different options, and yes, I have read the php manual on
>> preg_replace, but I might not have properly identified how to get the text
>> in front modified.
>> 
>>  
>> 
>> Thankful for any hints, tips, links, anything that helps :-)
>> 
>>  
>> 
>> Regards,
>> 
>> Martin Bach Nielsen 
>> 
> 
> If you only want to replace the line including url(s) by a message, a
> simple regular expression is enough.
> 
>  $melding = "This is a spam.\n"
>  . "This is a http://www.example.com/\";>example line.\n"
>  . "Another line.\n"
>  . "http://www.e.com/ads/show?n=123\";>123 (456)\n"
>  . "End Line.\n";
> 
> $melding = preg_replace("/.*? temporarily cut-off due to spam-suspicion.>", $melding);
> 
> echo $melding;
> ?>
> 
> The script above will output:
> 
> This is a spam.
> 
> Another line.
> 
> End Line.

If you use this code, be sure to use < in stead of < and > in stead
of > or else the spam messages won't be shown.

Otherwise, if you want the entire message changed, it's quicker to do:

if (preg_match('/(http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP jump to other page

2006-10-05 Thread Ivo F.A.C. Fokkema
On Thu, 05 Oct 2006 09:16:17 +0800, Penthexquadium wrote:

> On Thu, 5 Oct 2006 01:17:41 +0700, Groundhog <[EMAIL PROTECTED]> wrote:
> 
>> how can I jump to another page after IF..ELSE statement, for example:
>> 
>> IF (statement == TRUE)
>>{ stay on this page, index.php }
>> ELSE { jump to index2.php}
>> 
>> -- 
>> Come and Visit My Blog
>> http://ubuntu-ku.blogspot.com
>> 
>> -- 
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> if (!statement) {
> header('Location: index2.php');
> exit;
> }
> // other codes...

It's recommended (HTTP/1.1 standard requirement) to use a full absolute
path.

header('Location: http://' . $_SERVER['HTTP_HOST'] .
rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/index2.php');

Ivo

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



Re: [PHP] Help on objects

2006-10-05 Thread Robert Cummings
On Thu, 2006-10-05 at 07:04 +0200, Satyam wrote:
> I've seen you already had a good answer on the errors in the code so I won't 
> go on that.  As for OOP, the one design error you have is that you are 
> asking for an action, not an object.   You want to make SQL inserts, that is 
> your purpose, and that is an action, which is solved by a statement, not by 
> an object.   There is no doer.  Objects are what even your English teacher 
> would call objects while describing a sentence.  You are asking for a verb, 
> you don't have a subject, you don't have an object.   Of course you can wrap 
> an action in a class, but that is bad design.  Classes will usually have 
> names representing nouns, methods will be verbs, properties adjectives, more 
> or less, that's OOP for English teachers.

Properties are very often nouns in addition to adjectives. For instance
a linked list class will undoubtedly have noun objects referring to the
current link, the next link, etc.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] Вопрос.

2006-10-05 Thread Dimiter Ivanov

On 10/5/06, Nikolay Furletov <[EMAIL PROTECTED]> wrote:

Здравствуйте!
Мне сказали, что по этому адресу можно задать вопрос по использованию PHP.
Это правда?
С уважением, Николай Фурлетов.

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




/Rought translation i'm no russian/
Hello!
I've been told that on this adres(email) it is possible to ask
questions about using PHP.
Is it true?
With respect Nikolay Furletov.
/ end of translation/

Yes it is true, but i believe that the official language of this list
is English.
So use it, and your questions will be answered :)
You may also search for a russian PHP mail-list.


  1   2   >