[PHP] Re: [PHP5] Super constructor?

2004-06-14 Thread franciccio
If i'm not wrong php has only 1 level of depth for child class. That means
you can only extends from 1 level up the class.
In your example you have the class OneMore that extends down from the
"grandfather" Base. It is not a problem in C++ but should not work in php or
either javascript.

Am i wrong?

Franciccio


"Frzzman" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Hi guys, hey don't laugh at the subject, in fact I don't what to call
> it, so let's call it super constructor :D
>
> Let's see following code...
>
> class Base
> {
> __construct()
> {
> // Do something
> }
> }
>
> class One extends Base
> {
> __construct()
> {
> // Do nothing
> }
> }
>
> class OneMore extends One
> {
> __construct()
> {
> // Do things :D
> }
> }
>
> So when I create an instance of OneMore class by:
>
> $OneMoreInstance = new OneMore()
>
> The __construct() method of class OneMore will be called, not the one of
> One and Base, right?
>
> So is there any way around to make the Base class have a contructor that
> will be called everytime one of its child initialize?
>
> My problem, I want all of the classes in my object are extend from one
> base class, so they are all have some common properties and function,
> but PHP won't implicit call the contructor (that's the right way)...
> btw, in my case, this is bad, as bad as every constructor would be
called...
>
> Well, hope you understand what I'm trying to say...

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



[PHP] Re: small and big letter in WHERE statement

2004-06-14 Thread franciccio
In case u run under win32
...WHERE REGXEP BINARY fileldname=whatever..

If you run under unix, linux you don't need to do that.

Franciccio


"Qt" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Dear Sirs,
>
> When I use where statement, I see that there is no meaning small and big
> letter. Without looking small caps or big, result comes back. But I want
to
> match only small letters. How can I do that?
>
> Best REgards

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



[PHP] Re: [PHP5] Super constructor?

2004-06-14 Thread franciccio
ok thanks

"Justin Patrin" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Franciccio wrote:
>
> > If i'm not wrong php has only 1 level of depth for child class. That
means
> > you can only extends from 1 level up the class.
> > In your example you have the class OneMore that extends down from the
> > "grandfather" Base. It is not a problem in C++ but should not work in
php or
> > either javascript.
> >
> > Am i wrong?
>
> Yes, you are. You can extend as much as you want. If you couldn't, it
> wouldn't be very useful.
>
> >
> > Franciccio
> >
> >
> > "Frzzman" <[EMAIL PROTECTED]> ha scritto nel messaggio
> > news:[EMAIL PROTECTED]
> >
> >>Hi guys, hey don't laugh at the subject, in fact I don't what to call
> >>it, so let's call it super constructor :D
> >>
> >>Let's see following code...
> >>
> >>class Base
> >>{
> >>__construct()
> >>{
> >>// Do something
> >>}
> >>}
> >>
> >>class One extends Base
> >>{
> >>__construct()
> >>{
> >>// Do nothing
> >>}
> >>}
> >>
> >>class OneMore extends One
> >>{
> >>__construct()
> >>{
> >>// Do things :D
> >>}
> >>}
> >>
> >>So when I create an instance of OneMore class by:
> >>
> >>$OneMoreInstance = new OneMore()
> >>
> >>The __construct() method of class OneMore will be called, not the one of
> >>One and Base, right?
> >>
> >>So is there any way around to make the Base class have a contructor that
> >>will be called everytime one of its child initialize?
> >>
> >>My problem, I want all of the classes in my object are extend from one
> >>base class, so they are all have some common properties and function,
> >>but PHP won't implicit call the contructor (that's the right way)...
> >>btw, in my case, this is bad, as bad as every constructor would be
> >
> > called...
> >
> >>Well, hope you understand what I'm trying to say...
>
>
> -- 
> paperCrane 

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



Re: [PHP] session_start() warnings

2004-06-14 Thread franciccio
Always call the function on the first line of your page.

Bye



"Paoage" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Larry E . Ullman wrote:
> >> When I use session_start function, I receive the following warning
> >> messages:
> >>
> >> Warning: session_start(): Cannot send session cookie - headers already
> >> sent by (output started at
> >> /home/w4t3c101/public_html/ListClientInfo.php:2) in
> >> /home/w4t3c101/public_html/SessionControl.php on line 9
> >> Warning: session_start(): Cannot send session cache limiter - headers
> >> already sent (output started at
> >> /home/w4t3c101/public_html/ListClientInfo.php:2) in
> >> /home/w4t3c101/public_html/SessionControl.php on line 9
> >>
> >> Can anyone explain why it happens and how to solve the warnings.
> >> Thanks :)
> >
> >
> > Something on or about line 2 of ListClientInfo.php is sending data to
> > the Web browser. This could be HTML, plain text, or blank spaces. Get
> > rid of that and you'll get rid of the warnings.
> >
> > Larry
>
>
> Thanks, I got it. I leave a line of space before I use include directive.

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



Re: [PHP] Re: Cookie Security?

2004-06-14 Thread franciccio
I would suggest (haven't tried to write code in details) to associate a
random number in a variable each time you send a cookie (for new cookies
anyway) and store the key (randomvariable<->cookie) ina database. You should
be able to verify the user at next connection verifying the matching key.


"Michal Migurski" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> > [snip}
> > > As well as much harder for AOL subscribers (whose IP's change
per-request)
> > > to use the site.
> > [snip]
> >
> > WHAT?? Are you sure of this? AOL really breaks internet browsing this
> > much? Sorry, I can't believe this. If this was true, many things would
> > break.
>
> Not really -- HTTP is stateless, so there's really no reason for each
> request to come from the same IP. As other posters in this thread have
> pointed out, AOL uses an army of proxy servers. In the past, they've even
> cached and re-compressed images for the benefit of those on slow dialup.
>
> As you say, wacky stuff.
>
> You're on the right track, though - the way to make cookies tougher to
> crack is to associate the cookie with some other piece of user
> information. I've toyed with using an encrypted string based on the user
> agent as part of the cookie, but have never encountered a project where
> this level of care was called-for while SSL was not.
>
> -
> michal migurski- contact info and pgp key:
> sf/cahttp://mike.teczno.com/contact.html

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



Re: [PHP] Active windows

2004-06-16 Thread franciccio
Very hard (impossible) to control user activities by php-scripting. You are
talking about client-side actions while php is only server-side. You should
check for javascript client-side coding help.

Franciccio


"Curt Zirzow" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> * Thus wrote [EMAIL PROTECTED] ([EMAIL PROTECTED]):
> > I am trying to get my website to refresh when the window becomes active.
> >
> > This is needed so when a user downloads a report and the PDF is
displayed,
> > there is now a new state in the previously active window.  However, the
page
> > needs to refresh to regenerate the new page.  Any ideas on how to do
this?
> > Can one send header information to a separate window, or discern between
> > active and non active windows?
> >
> > I know this is a stretch but I thought I¹d ask
>
> yes it is a stretch.
>
> Determining  what a client is going to do on focus is practically
> impossible. Even with javascript unless you're in a closed
> environment.
>
>
> Curt
> -- 
> First, let me assure you that this is not one of those shady pyramid
schemes
> you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] how to iterate over fields names with mysql_fetch_assoc

2004-06-20 Thread franciccio
Something easier:

while ($row=mysql_fetch_assoc($result)) {
foreach ($row as $k=> $val) {
switch ($k) {
case 'artist_name':
// do sometihing here, you may want to use $val;
break;
case 'urlPath':
// do something here you may want to use $val;
break;
default:
// do default action in case none is matching case value
(default is optional)
}//end switch
}//end foreach
}//end while

You need to go through the $result anyway, remember that $result is a
"resource" type it is wath is called a "recordset" in asp, it's kind of
object you have to "manipulate" to extract information from.

Franciccio



<[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
> thanks...that is what  I  had used previously :)
>
> Another php coder had given me a hint that I could just take each
> incoming row on the fly with $row['artist_name'] without reading
> everything into an array:
>
> What I had previously was:
> while ($row = mysql_fetch_assoc($result))
> {
>$playlist[] = $row;  //read in entire array before doing anything
>   }
>
> # get row count
> $c= count($playlist);
>
> for ($x = 0; $x < $c; $x++)
> {
>foreach($playlist[$x] as $key => $val)
>{
>  switch ($key)
> {
># if key name is 'artist_name', do something
> case 'artist_name' :
>
> break;
>
># if key name is 'urlPath', do something
> case 'urlPath' :
>
> break;
> }
> }
> }
>
> is there a way to grab the info on the fly without reading the $result
> into an array ?
>
> many thanks as I am on my 3rd week with php
>
>
>
> On Jun 19, 2004, at 1:45 PM, Robin Vickery wrote:
>
> > On Sat, 19 Jun 2004 13:25:54 -0700, [EMAIL PROTECTED]
> > <[EMAIL PROTECTED]> wrote:
> >>
> >> How do I iterate over fields when I perform the below script:
> > ...
> >> If I write the below code, I only get the first field name of each
> >> row...which makes sense
> >> In this case, I get 'artist_name'
> >>
> >> while ($row = mysql_fetch_assoc($result))
> >>{
> >>$fieldName= key($row);
> >>echo 'fieldName is: '.$fieldName."\n";
> >>}
> >
> >  > while ($row = mysql_fetch_assoc($result)) {
> >foreach ($row as $fieldName => $fieldValue) {
> >   echo 'fieldName is: '.$fieldName."\n";
> >   echo 'fieldValue is: '.$fieldValue."\n";
> >}
> > }
> > ?>
> >
> > -- 
> > 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: MySql Close problem

2004-06-21 Thread franciccio
Have you tried to specify the the handler of the connection, when you first
made the connection yo had somethig like:
$handler=mysql_connect(...);
...
...
...
mysql_close($handler);


"Erik Gjertsen" <[EMAIL PROTECTED]> ha scritto nel messaggio
news:[EMAIL PROTECTED]
I have problem with mysql_close
I dont understand why.
Are ther someone that have any proposal?

Thank for any help
Erik Gjertsen

Here is the code


$query = "SELECT usrid FROM users WHERE username";
 $result = @mysql_query ($query); //Run the query
  if (mysql_num_rows($result) == 0) { // Make the query
  $query = "INSERT INTO users (username, name, email, password,
registration_date) VALUES
  ('$username', '$name', '$email', '$password', NOW() )";
  $result = @mysql_query ($query);
   if ($result) { // IF it ran OK

// Send an email, if desired
echo 'You have been registered!';
include("./footer.inc");
exit();
   } else { // If it did not ron OK.
$message = 'You cout not be registered due to a system error. We
apologize for any inconvenience';
   }
  } else {
  $message = 'That username is alredy taken.';
  }
 mysql_close();


 } else {
  $message = 'Please try again.';
 }
} // End of the main   submit conditional.

 // Print the error message if ther is one
 if (isset($message)) {
  echo '', $message, '';
 )

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



[PHP] Re: Concatenate PHP code into a string

2004-06-28 Thread franciccio
$query="INSERT"+" ";
for ($i=0;$i ha scritto nel messaggio
news:[EMAIL PROTECTED]
> Dear List,
> How can I include a dynamically generated array:
> e.g. for($i=0; $i   { $cols[$i]= mysql_field_name($fields,$i); }
>
> into a MySQL insert query of the type:
> $sql= "INSERT cols[0],cols[1],cols[2], ..., comment
> INTO mytable SET
> cols[0]= '$cols[0]',
> cols[1]= '$cols[1]',
> cols[2]= '$cols[2]',
> cols[...]= '$cols[...]',
> comment= '$comment'";
>
> The number of $cols is different for each table.
> Thanks in advance for any help
>
> Alberto Brea

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