php-general Digest 14 May 2010 09:21:50 -0000 Issue 6743

Topics (messages 305156 through 305181):

Re: opening a link in a new window
        305156 by: Ashley Sheridan

Re: GD - import a PNG image and make transparant
        305157 by: Karl DeSaulniers
        305158 by: Alex Davies

Append Dom Document
        305159 by: Alice Wei
        305160 by: Nathan Nobbe
        305161 by: Alice Wei
        305165 by: Nathan Nobbe

Question about creating php files from a form
        305162 by: Kevin
        305163 by: Ashley Sheridan
        305164 by: Kevin
        305166 by: Paul M Foster

Multiple Login in a single PC should not be possible
        305167 by: Jagdeep Singh
        305168 by: Karl DeSaulniers
        305169 by: Lester Caine
        305170 by: Karl DeSaulniers
        305171 by: Tommy Pham
        305172 by: Peter Lind
        305174 by: Jagdeep Singh
        305177 by: Lester Caine
        305179 by: Karl DeSaulniers
        305181 by: Karl DeSaulniers

problem with passing-by-reference
        305173 by: Rene Veerman
        305175 by: Rene Veerman
        305176 by: Peter Lind
        305178 by: Rene Veerman

jquery password problem
        305180 by: Manolis Vlachakis

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Thu, 2010-05-13 at 17:13 -0400, David Mehler wrote:

> Hello,
> I want to open an external link in a new window, i know i can do this
> with xhtml, but only with the transitional dtd, which i'm not using. I
> was wondering if php could pull this off?
> Thanks.
> Dave.
> 


No. PHP is on the server, not the client-side. If you can't use
something like target="_blank" in your xhtml, then consider using
Javascript. It's not the ideal solution, as it won't work where
scripting is disabled or not available.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Hey tedd,
Sorry bout that.. here you go.

http://designdrumm.com/upload_images_test.zip

Karl


On May 13, 2010, at 9:06 AM, tedd wrote:

At 6:40 PM -0500 5/12/10, Karl DeSaulniers wrote:
Hi Alex,
I have a php file I made just a few months ago.
It takes a gif, jpeg or png of any size and sizes it proportionately to a specified size and then outputs a png. If the image is a transparent png or transparent gif, it will still hold the transparency. This is just a test page and it tested ok for me, but it is my first one. I also tested it on PHP 5. Dont know about compatibility to older versions.
Knowing that, here you go.

http://designdrumm.com/upload_images_test.php.zip

HTH,

Karl


Bad link.

Cheers,

tedd

--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

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


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Hi Ash,

Thanks for your suggestion. I think this is where my confusion is. I
understand how to use imagecolorallocatealpha() to for example create a 50%
transparant colour, and apply it to a new rectangle for example.

I dont understand how to "apply" it to a new source image, for example
$src = imagecreatefrompng('test.png');
// Something here (maybe  imagecolorallocatealpha()) to make this
50% transparent- either on its own, or make it 50% transparent as part of a
copy onto a new image

I had thought that imagecopymerge would help me with this, but it seems not.

I'm currently looking through Karl's example to see if I can work it out,
but if anyone can point out a super-simple way of achieving the pseudo-code
above, i'd be very grateful!

Cheers,

Alex

On Thu, May 13, 2010 at 1:34 AM, Ashley Sheridan
<a...@ashleysheridan.co.uk>wrote:

>  On Thu, 2010-05-13 at 00:12 +0100, Alex Davies wrote:
>
> Hi,
>
> I am trying to import a PNG image from disk, place it on top of a
> transparant image created in GD and output it to the browser. In the case of
> a low opacity setting, I would expect to see the background colour from the
> HTML page.
>
> If I set the opacity to 0, everything works - I end up with a transparant
> image.
>
> However, if I set it for any value >0 (even 1) instead of  a
> very-faint-image the whole thing goes black. As the opacity level goes up
> from 0, the amount of black reduces and the amount of imported image
> increases - but this is not what I want.
>
> I am using this code:
>
> <?php
> $src = imagecreatefrompng('test.png');
> $img_width  = imagesx($src);
> $img_height = imagesy($src);
>
> // Create trans image
> $dest = imagecreatetruecolor($img_width, $img_height);
> //imagesavealpha($dest, true); // This has no effect it appears
> $trans_colour = imagecolorallocatealpha($dest, 0, 255, 0, 128);
>
> // Make the background transparent
> imagecolortransparent($dest, $trans_colour);
> //imagefill($dest, 0, 0, $trans_colour); // This does not work
>
> // Merge src on top of dest, with opacity of 1 in this case
> imagecopymerge($dest, $src, 0, 0, 0, 0, $img_width, $img_height, 1);
>
> // Output and free from memory
> header('Content-Type: image/png');
> imagepng($dest);
> ?>
>
> The images that this outputs, at opacity levels 0,1 and 80 on a red and
> green background (screenshots of a HTML page) can be downloaded 
> fromhttp://www.box.net/shared/h9zn4tjgro
>
> Any help appreciated!
>
> Cheers,
>
> Alex
>
>
> How exactly are you setting the opacity for the image? The traditional way
> is to use imagecolorallocatealpha() on the source.
>
>   Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
>


-- 
Alex Davies

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the sender immediately by e-mail and delete this e-mail permanently.

--- End Message ---
--- Begin Message ---
Hi, 

  I am trying to create a news feed page that loads a number of different feeds 
depending on what options the user selects. For some reason, I could not figure 
out how to get the dom document to "append" the different xml documents that 
get created. 

Below is the code, and obviously now every time when I try to have a new item 
selected, then it displays that element's 

<?php

$q=$_GET["q"];
$q2 = explode(" ",$q);
$count = count($q2);

for($i=0;$i<$count;$i++) {

//find out which feed was selected
  switch ($q2[$i]) {
    case "Weather":
        
$xml=("http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss";);
        break;
  
    case "NFL":
      $xml = ("http://www.nfl.com/rss/rsslanding?searchString=home";);
      break;      
       
    default:   
        exit;
        break;    
   }
}

$xmlDoc = new DOMDocument();
$xmlDoc->load($xml);

//get and output "<item>" elements
$x=$xmlDoc->getElementsByTagName('item');
for ($i=0; $i<=4; $i++)
  {
  $item_title=$x->item($i)->getElementsByTagName('title')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_link=$x->item($i)->getElementsByTagName('link')
  ->item(0)->childNodes->item(0)->nodeValue;
  $item_desc=$x->item($i)->getElementsByTagName('description')
  ->item(0)->childNodes->item(0)->nodeValue;

  echo ("<p><a href='" . $item_link
  . "'>" . $item_title . "</a>");
  echo ("<br />");
  echo ($item_desc . "</p>");
  }

?> 
 

Is there such a function where I could allow my dom document here append and 
not have to create a new one every time when a new selection is made?

Thanks for your help.

Alice
                                          
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

--- End Message ---
--- Begin Message ---
On Thu, May 13, 2010 at 5:46 PM, Alice Wei <aj...@alumni.iu.edu> wrote:

>
> Hi,
>
>  I am trying to create a news feed page that loads a number of different
> feeds depending on what options the user selects. For some reason, I could
> not figure out how to get the dom document to "append" the different xml
> documents that get created.
>
> Below is the code, and obviously now every time when I try to have a new
> item selected, then it displays that element's
>
> <?php
>
> $q=$_GET["q"];
> $q2 = explode(" ",$q);
> $count = count($q2);
>
> for($i=0;$i<$count;$i++) {
>
> //find out which feed was selected
>  switch ($q2[$i]) {
>    case "Weather":
>        $xml=("
> http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss
> ");
>        break;
>
>    case "NFL":
>      $xml = ("http://www.nfl.com/rss/rsslanding?searchString=home";);
>      break;
>
>    default:
>        exit;
>        break;
>   }
> }
>
> $xmlDoc = new DOMDocument();
> $xmlDoc->load($xml);
>
> //get and output "<item>" elements
> $x=$xmlDoc->getElementsByTagName('item');
> for ($i=0; $i<=4; $i++)
>  {
>  $item_title=$x->item($i)->getElementsByTagName('title')
>  ->item(0)->childNodes->item(0)->nodeValue;
>  $item_link=$x->item($i)->getElementsByTagName('link')
>  ->item(0)->childNodes->item(0)->nodeValue;
>  $item_desc=$x->item($i)->getElementsByTagName('description')
>  ->item(0)->childNodes->item(0)->nodeValue;
>
>  echo ("<p><a href='" . $item_link
>  . "'>" . $item_title . "</a>");
>  echo ("<br />");
>  echo ($item_desc . "</p>");
>  }
>

you might have an easier time w/ SimpleXML for this task; have a look at the
examples:

http://us.php.net/manual/en/simplexml.examples-basic.php

the other thing i find strange about this code is the xml parsing assumes a
similar schema when the source urls are from seemingly totally disparate
domains, and topic .. id guess it sheer coincidence they have overlapping
schemas at all.

-nathan

--- End Message ---
--- Begin Message ---

Date: Thu, 13 May 2010 18:49:35 -0600
Subject: Re: [PHP] Append Dom Document
From: quickshif...@gmail.com
To: aj...@alumni.iu.edu
CC: php-gene...@lists.php.net



On Thu, May 13, 2010 at 5:46 PM, Alice Wei <aj...@alumni.iu.edu> wrote:



Hi,



  I am trying to create a news feed page that loads a number of different feeds 
depending on what options the user selects. For some reason, I could not figure 
out how to get the dom document to "append" the different xml documents that 
get created.




Below is the code, and obviously now every time when I try to have a new item 
selected, then it displays that element's



<?php



$q=$_GET["q"];

$q2 = explode(" ",$q);

$count = count($q2);



for($i=0;$i<$count;$i++) {



//find out which feed was selected

  switch ($q2[$i]) {

    case "Weather":

        
$xml=("http://rss.weather.com/rss/national/rss_nwf_rss.xml?cm_ven=NWF&cm_cat=rss&par=NWF_rss";);


        break;



    case "NFL":

      $xml = ("http://www.nfl.com/rss/rsslanding?searchString=home";);

      break;



    default:

        exit;

        break;

   }

}



$xmlDoc = new DOMDocument();

$xmlDoc->load($xml);



//get and output "<item>" elements

$x=$xmlDoc->getElementsByTagName('item');

for ($i=0; $i<=4; $i++)

  {

  $item_title=$x->item($i)->getElementsByTagName('title')

  ->item(0)->childNodes->item(0)->nodeValue;

  $item_link=$x->item($i)->getElementsByTagName('link')

  ->item(0)->childNodes->item(0)->nodeValue;

  $item_desc=$x->item($i)->getElementsByTagName('description')

  ->item(0)->childNodes->item(0)->nodeValue;



  echo ("<p><a href='" . $item_link

  . "'>" . $item_title . "</a>");

  echo ("<br />");

  echo ($item_desc . "</p>");

  }

you might have an easier time w/ SimpleXML for this task; have a look at the 
examples:
http://us.php.net/manual/en/simplexml.examples-basic.php

the other thing i find strange about this code is the xml parsing assumes a 
similar schema when the source urls are from seemingly totally disparate 
domains, and topic .. id guess it sheer coincidence they have overlapping 
schemas at all.

I am not sure what you mean in your second point, but I can explain the first 
one. I am using PHP to parse RSS feeds, so that is why they all look the same. 
Or, what do you mean here? I checked out your example, but my problem here is 
that I cannot get the XML Dom document to append when I make a new selection. I 
am hoping that it would create a new sub document of some sort beneath the new 
one, instead of overwriting the entire document. 

Am I making sense here?

Alice                                     
_________________________________________________________________
The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4

--- End Message ---
--- Begin Message ---
>
> I am not sure what you mean in your second point, but I can explain the
> first one. I am using PHP to parse RSS feeds, so that is why they all look
> the same.
>

wow thats hilarious, you can see how little ive worked w/ rss feeds, read
*none*


> Or, what do you mean here? I checked out your example, but my problem here
> is that I cannot get the XML Dom document to append when I make a new
> selection. I am hoping that it would create a new sub document of some sort
> beneath the new one, instead of overwriting the entire document.
>

umm, i dont see you making any modifications to the original document,
$xmlDoc in your code.  thats why i suggested simple xml, its the go-to imo
if all you need to do is traverse an existing document.  DOM is much better
if you need to edit the document.  having said that if you wanted to append
a new DOMNode to an existing one, you would use the appendChild() method.


> Am I making sense here?


no because youre not editing the DOMDocument in your code, youre just
reading a document; what is getting overwritten here?  im not entirely sure
what youre trying to accomplish.

-nathan

--- End Message ---
--- Begin Message ---
Hello All,

I am trying to figure out how to create files when a user submits a form ...
I have seen something about '*fopen*' , is that the direction I should be going?

Here is what I am trying to accomplish:

I am creating a program to keep track of recipes for my wife. I have have page set up where she can put the name of the recipe, the ingredients, and the amounts of each ingredient.
Then she clicks "Submit"

I would like a html file with the name of the recipe to be created ie *cookies.html *with a link to the cookies.html created on another page.
*
*I hope this makes sense,  and thank you all for your time...

- - Kevin

--- End Message ---
--- Begin Message ---
On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote:

> Hello All,
> 
> I am trying to figure out how to create files when a user submits a form ...
> I have seen something about '*fopen*' , is that the direction I should 
> be going?
> 
> Here is what I am trying to accomplish:
> 
> I am creating a program to keep track of recipes for my wife. I have 
> have page set up where she can put the name of the recipe, the 
> ingredients, and the amounts of each ingredient.
> Then she clicks "Submit"
> 
> I would like a html file with the name of the recipe to be created ie 
> *cookies.html  *with a link to the cookies.html created on another page.
> *
> *I hope this makes sense,  and thank you all for your time...
> 
> - - Kevin
> 


It might sound overkill, but I'd use a database for this. All the
recipes can be stored in a MySQL database, and then you can use a simple
couple of queries to produce the recipe list and the recipe pages
dynamically. This also has the advantage that it's very easy to search
the recipe list when it becomes larger, and if you ever want to change
the layout/presentation of the whole system you won't have to recreate
all the recipe pages.

The DB could have several columns labelled: id, name, ingredients,
method

So, the form page (lets assume it's called add.php) could submit to
itself which then adds the recipe to the DB with a query like:

INSERT INTO recipes(name, ingredients, method) VALUES($name,
$ingredients, $method)

This is only a very simple example which could be extended to use
another table for ingredients for a recipe. Don't forget to sanitise any
input coming from the form with mysql_real_escape_string() for inserting
it into the DB.

The list.php page could just use a simple query like:

SELECT id, name FROM recipes

And then create a link to each recipe in the form: recipe.php?recipe=id
(where id is the numerical value used in the DB) and that would then use
a query like:

SELECT * FROM recipe WHERE id=$recipe

MySQL is available on most hosting that you'll find has support for PHP,
and every Linux distribution I've seen has it too.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote:
Hello All,

I am trying to figure out how to create files when a user submits a form ...
I have seen something about '*fopen*' , is that the direction I should be going?

Here is what I am trying to accomplish:

I am creating a program to keep track of recipes for my wife. I have have page set up where she can put the name of the recipe, the ingredients, and the amounts of each ingredient.
Then she clicks "Submit"

I would like a html file with the name of the recipe to be created ie *cookies.html *with a link to the cookies.html created on another page.
*
*I hope this makes sense,  and thank you all for your time...

- - Kevin


It might sound overkill, but I'd use a database for this. All the recipes can be stored in a MySQL database, and then you can use a simple couple of queries to produce the recipe list and the recipe pages dynamically. This also has the advantage that it's very easy to search the recipe list when it becomes larger, and if you ever want to change the layout/presentation of the whole system you won't have to recreate all the recipe pages.

The DB could have several columns labelled: id, name, ingredients, method

So, the form page (lets assume it's called add.php) could submit to itself which then adds the recipe to the DB with a query like:

INSERT INTO recipes(name, ingredients, method) VALUES($name, $ingredients, $method)

This is only a very simple example which could be extended to use another table for ingredients for a recipe. Don't forget to sanitise any input coming from the form with mysql_real_escape_string() for inserting it into the DB.

The list.php page could just use a simple query like:

SELECT id, name FROM recipes

And then create a link to each recipe in the form: recipe.php?recipe=id (where id is the numerical value used in the DB) and that would then use a query like:

SELECT * FROM recipe WHERE id=$recipe

MySQL is available on most hosting that you'll find has support for PHP, and every Linux distribution I've seen has it too.

Thanks,
Ash
http://www.ashleysheridan.co.uk


Thank you Ash for the quick reply.

I was actually looking at using a database too... and I am testing out a few different ones (SQLite and MySQL)
I appreciate the extra information, it will be helpful in the future :-)

/On a side note:
I am having some issues with connecting to a SQLite database right now ... I'm getting the following error "Fatal Error: 'sqlite_open' is an unknown function"
But I'm putting that on the side right now.

/I wanted to try a different approach by just creating the recipes in individual html files for the time being.
Do happen to know how to create html files from a php form?

Thank you.



--- End Message ---
--- Begin Message ---
On Thu, May 13, 2010 at 11:53:54PM -0400, Kevin wrote:

<snip>

> /On a side note:
> I am having some issues with connecting to a SQLite database right now
> ... I'm getting the following error "Fatal Error: 'sqlite_open' is an
> unknown function"
> But I'm putting that on the side right now.

I think the docs are still screwed up. Try sqlite3_open() instead and
see if that works. Also, check phpinfo() to see if the SQLite/SQLite3
modules are loaded.

Paul

-- 
Paul M. Foster

--- End Message ---
--- Begin Message ---
Hi All!

I am looking for a solution, I want a user to do a single Login only on a PC
.

E.g. If a User has logged on my website website.com in Internet explorer,
then he cant login on same website in another browser like Firefox etc with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will
work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272

--- End Message ---
--- Begin Message ---
Hi Jagdeep,
I would make an "active users" table in your database that the username gets loaded into on successful login and in your login script also check this table before letting them log in.

Karl


On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login only on a PC
.

E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will
work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272

Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Jagdeep Singh wrote:
Hi All!

I am looking for a solution, I want a user to do a single Login only on a PC
.

E.g. If a User has logged on my website website.com in Internet explorer,
then he cant login on same website in another browser like Firefox etc with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

The browser IP address works for us quite reliably. Once logged in, you get a message saying already logged on ... and where ... but it does need a little help if the user closes the browser without logging out. One needs a facility to 'bounce' a user now and again .... however some remote users may well have 'floating' IP addresses :(

Cross browser on the same machine may be a little more problematic! How would one know that it's not just from another windows of the same browser. Browser sniffing should allow that to be included, but we've not needed to go that far yet.

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will
work for all browsers in a single machine..

Unfortunately not ...

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
Just remember to remove them from this table on log out.

Karl

Sent from losPhone

On May 14, 2010, at 2:23 AM, Karl DeSaulniers <k...@designdrumm.com> wrote:

Hi Jagdeep,
I would make an "active users" table in your database that the username gets loaded into on successful login and in your login script also check this table before letting them log in.

Karl


On May 14, 2010, at 2:18 AM, Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login only on a PC
.

E.g. If a User has logged on my website website.com in Internet explorer, then he cant login on same website in another browser like Firefox etc with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will
work for all browsers in a single machine..

I hope You will help me out


Regards

Jagdeep Singh
+91 9988009272

Karl DeSaulniers
Design Drumm
http://designdrumm.com


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


--- End Message ---
--- Begin Message ---
On Fri, May 14, 2010 at 12:29 AM, Lester Caine <les...@lsces.co.uk> wrote:
> Jagdeep Singh wrote:
>>
>> Hi All!
>>
>> I am looking for a solution, I want a user to do a single Login only on a
>> PC
>> .
>>
>> E.g. If a User has logged on my website website.com in Internet explorer,
>> then he cant login on same website in another browser like Firefox etc
>> with
>> same loginid or another.
>>
>> Can I trace MAC address of a single machine to solve this issue?
>
> The browser IP address works for us quite reliably. Once logged in, you get
> a message saying already logged on ... and where ... but it does need a
> little help if the user closes the browser without logging out. One needs a
> facility to 'bounce' a user now and again .... however some remote users may
> well have 'floating' IP addresses :(

Or in some cases, they may have multiple internet connections.  I used
to have 2, 1 cable and 1 DSL.  I used FreeBSD's PF to do 'load
balance' ;)  It works really well with any apps that do multiple
connections.

Regards,
Tommy

>
> Cross browser on the same machine may be a little more problematic! How
> would one know that it's not just from another windows of the same browser.
> Browser sniffing should allow that to be included, but we've not needed to
> go that far yet.
>
>> Or is there a concept of GLOBAL COOKIE / Cross Browser Cookie which will
>> work for all browsers in a single machine..
>
> Unfortunately not ...
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk//
> Firebird - http://www.firebirdsql.org/index.php
>

--- End Message ---
--- Begin Message ---
On 14 May 2010 09:29, Lester Caine <les...@lsces.co.uk> wrote:
> Jagdeep Singh wrote:
>>
>> Hi All!
>>
>> I am looking for a solution, I want a user to do a single Login only on a
>> PC
>> .
>>
>> E.g. If a User has logged on my website website.com in Internet explorer,
>> then he cant login on same website in another browser like Firefox etc
>> with
>> same loginid or another.
>>
>> Can I trace MAC address of a single machine to solve this issue?
>
> The browser IP address works for us quite reliably. Once logged in, you get
> a message saying already logged on ... and where ... but it does need a
> little help if the user closes the browser without logging out. One needs a
> facility to 'bounce' a user now and again .... however some remote users may
> well have 'floating' IP addresses :(
>

Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record "last accessed time" so anyone not
accessing for more than 15-20 minutes will succeed if trying to log in
again.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
Hi,

yes, I can make a databse table to record LOGIN details, But I want that No
other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from Firefox or
Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE  (On Same or Other
broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind <peter.e.l...@gmail.com> wrote:

> On 14 May 2010 09:29, Lester Caine <les...@lsces.co.uk> wrote:
> > Jagdeep Singh wrote:
> >>
> >> Hi All!
> >>
> >> I am looking for a solution, I want a user to do a single Login only on
> a
> >> PC
> >> .
> >>
> >> E.g. If a User has logged on my website website.com in Internet
> explorer,
> >> then he cant login on same website in another browser like Firefox etc
> >> with
> >> same loginid or another.
> >>
> >> Can I trace MAC address of a single machine to solve this issue?
> >
> > The browser IP address works for us quite reliably. Once logged in, you
> get
> > a message saying already logged on ... and where ... but it does need a
> > little help if the user closes the browser without logging out. One needs
> a
> > facility to 'bounce' a user now and again .... however some remote users
> may
> > well have 'floating' IP addresses :(
> >
>
> Don't rely on IP addresses staying the same for a user, it's not safe
> in any way and not needed anyway. Karls method is probably the best
> bet - just remember to record "last accessed time" so anyone not
> accessing for more than 15-20 minutes will succeed if trying to log in
> again.
>
> Regards
> Peter
>
> --
> <hype>
> WWW: http://plphp.dk / http://plind.dk
> LinkedIn: http://www.linkedin.com/in/plind
> Flickr: http://www.flickr.com/photos/fake51
> BeWelcome: Fake51
> Couchsurfing: Fake51
> </hype>
>

--- End Message ---
--- Begin Message ---
Jagdeep Singh wrote:
Hi,
yes, I can make a databse table to record LOGIN details, But I want that
No other user can login on same machine on smae or another browser.
E.g.
If user1 has logged in from IE then user2 should not login from Firefox
or Chrome etc..
I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE  (On Same or
Other broswers)

I'm doing almost exactly that on my CMS system. But we have the advantage that it is intranet, so we can cleanly identify the machines. Once a counter position is in use no one else can log in to that machine, and while loged in there a user can't login again. We can't easily add a 'timeout' since some interviews can take over an hour and the position remains locked for the whole period, but supervisor access allows a 'stuck user' to be bounced so they can log in again.

If you don't have such control over the machines, then you may need to do a little more work to build up a list of 'active machines' in parallel with the 'active user' table.

--
Lester Caine - G8HFL
-----------------------------
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

--- End Message ---
--- Begin Message ---
You lost me on that one.

You want it so that multiple users can log in, but they have to be on separate browsers?


Karl


On May 14, 2010, at 3:26 AM, Jagdeep Singh wrote:

Hi,

yes, I can make a databse table to record LOGIN details, But I want that No
other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from Firefox or
Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE (On Same or Other
broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind <peter.e.l...@gmail.com> wrote:

On 14 May 2010 09:29, Lester Caine <les...@lsces.co.uk> wrote:
Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login only on
a
PC
.

E.g. If a User has logged on my website website.com in Internet
explorer,
then he cant login on same website in another browser like Firefox etc
with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

The browser IP address works for us quite reliably. Once logged in, you
get
a message saying already logged on ... and where ... but it does need a little help if the user closes the browser without logging out. One needs
a
facility to 'bounce' a user now and again .... however some remote users
may
well have 'floating' IP addresses :(


Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record "last accessed time" so anyone not
accessing for more than 15-20 minutes will succeed if trying to log in
again.

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>


Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Hi J,
Well, if you have an active users table with a users name in it and you check when logging in to see if that users name is in that table, They can not log in again. No matter what machine or browser they are in.

As far as another user logging in on that same machine, you could match a cookie on the machine and the database that holds what browser they are using and username, an MD5 ip, etc. But someone can always delete cookies and some even know how to bounce ip addresses, so unless you have a bunch of hackers using your machines, these suggestions should work.
Unless someone else has a better suggestion.
GL,

:)

Karl


On May 14, 2010, at 4:08 AM, Jagdeep Singh wrote:

I want that only single user can login on a single machine.... If User has logged in one browser he should not login through 2nd browser...

And no other user should login on same machine in any browser

in Simple words:

MAXIMUM ONE USER SHOULD LOGIN IN ONE MACHINE.......

On Fri, May 14, 2010 at 2:23 PM, Karl DeSaulniers <k...@designdrumm.com> wrote:
You lost me on that one.

You want it so that multiple users can log in, but they have to be on separate browsers?


Karl



On May 14, 2010, at 3:26 AM, Jagdeep Singh wrote:

Hi,

yes, I can make a databse table to record LOGIN details, But I want that No
other user can login on same machine on smae or another browser.

E.g.

If user1 has logged in from IE then user2 should not login from Firefox or
Chrome etc..

I need ONLY ONE USER ACCESS AT SAME TIME ON SAME MACHINE (On Same or Other
broswers)

Regards

Jagdeep Singh

On Fri, May 14, 2010 at 1:26 PM, Peter Lind <peter.e.l...@gmail.com> wrote:

On 14 May 2010 09:29, Lester Caine <les...@lsces.co.uk> wrote:
Jagdeep Singh wrote:

Hi All!

I am looking for a solution, I want a user to do a single Login only on
a
PC
.

E.g. If a User has logged on my website website.com in Internet
explorer,
then he cant login on same website in another browser like Firefox etc
with
same loginid or another.

Can I trace MAC address of a single machine to solve this issue?

The browser IP address works for us quite reliably. Once logged in, you
get
a message saying already logged on ... and where ... but it does need a little help if the user closes the browser without logging out. One needs
a
facility to 'bounce' a user now and again .... however some remote users
may
well have 'floating' IP addresses :(


Don't rely on IP addresses staying the same for a user, it's not safe
in any way and not needed anyway. Karls method is probably the best
bet - just remember to record "last accessed time" so anyone not
accessing for more than 15-20 minutes will succeed if trying to log in
again.

Regards
Peter

--
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>


Karl DeSaulniers
Design Drumm
http://designdrumm.com


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



Karl DeSaulniers
Design Drumm
http://designdrumm.com


--- End Message ---
--- Begin Message ---
Hi.

I'm doing the 5.3-strict thing, and am removing all my
passing-by-reference muck from a script of mine.

But i've run into a problem;

I use the following construct to push new values fairly deeply inside
an array structure;

$chase = chaseToReference ($wm, $path);
$arr = result($chase);
$arr[$v] = $lid;

$path is a flat-list array of indexes in $wm that have to be traversed
to get to the right portion of $wm.
a debug-dump of $wm and $arr after running this code shows $arr
correctly updated, but $wm not. :((

here are the functions involved, any help is much appreciated.

function chaseToReference (&$array, $path) {
  if (!empty($path)) {
    if (empty($array[$path[0]])) {
                        return badResult (E_USER_WARNING, array(
                                'msg' => 'Could not walk the full tree',
                                '$path' => $path,
                                '$array (possibly partially walked)' => $array
                        ));
    } else return chaseToReference($array[$path[0]], array_slice($path, 1));
  } else {
    return goodResult($array);
  }     
}

function result(&$r) {
 return $r['result'];
}

function goodResult(&$r) {
 $r2 = array (
  'isMetaForFunc' => true,
        'result' => &$r
 );
 return $r2;
}



-- 
---------------------------------
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

http://www.facebook.com/rene7705
---------------------------------

--- End Message ---
--- Begin Message ---
changed all function-definitions to include a "&" before their name,
no change in behavior though..

On Fri, May 14, 2010 at 10:09 AM, Rene Veerman <rene7...@gmail.com> wrote:
> Hi.
>
> I'm doing the 5.3-strict thing, and am removing all my
> passing-by-reference muck from a script of mine.
>
> But i've run into a problem;
>
> I use the following construct to push new values fairly deeply inside
> an array structure;
>
> $chase = chaseToReference ($wm, $path);
> $arr = result($chase);
> $arr[$v] = $lid;
>
> $path is a flat-list array of indexes in $wm that have to be traversed
> to get to the right portion of $wm.
> a debug-dump of $wm and $arr after running this code shows $arr
> correctly updated, but $wm not. :((
>
> here are the functions involved, any help is much appreciated.
>
> function chaseToReference (&$array, $path) {
>  if (!empty($path)) {
>    if (empty($array[$path[0]])) {
>                        return badResult (E_USER_WARNING, array(
>                                'msg' => 'Could not walk the full tree',
>                                '$path' => $path,
>                                '$array (possibly partially walked)' => $array
>                        ));
>    } else return chaseToReference($array[$path[0]], array_slice($path, 1));
>  } else {
>    return goodResult($array);
>  }
> }
>
> function result(&$r) {
>  return $r['result'];
> }
>
> function goodResult(&$r) {
>  $r2 = array (
>  'isMetaForFunc' => true,
>        'result' => &$r
>  );
>  return $r2;
> }
>
>
>
> --
> ---------------------------------
> Greetings from Rene7705,
>
> My free open source webcomponents:
>  http://code.google.com/u/rene7705/
>  http://mediabeez.ws/downloads (and demos)
>
> http://www.facebook.com/rene7705
> ---------------------------------
>



-- 
---------------------------------
Greetings from Rene7705,

My free open source webcomponents:
  http://code.google.com/u/rene7705/
  http://mediabeez.ws/downloads (and demos)

http://www.facebook.com/rene7705
---------------------------------

--- End Message ---
--- Begin Message ---
On 14 May 2010 10:09, Rene Veerman <rene7...@gmail.com> wrote:
> Hi.
>
> I'm doing the 5.3-strict thing, and am removing all my
> passing-by-reference muck from a script of mine.
>
> But i've run into a problem;
>
> I use the following construct to push new values fairly deeply inside
> an array structure;
>
> $chase = chaseToReference ($wm, $path);
> $arr = result($chase);
> $arr[$v] = $lid;
>
> $path is a flat-list array of indexes in $wm that have to be traversed
> to get to the right portion of $wm.
> a debug-dump of $wm and $arr after running this code shows $arr
> correctly updated, but $wm not. :((
>
> here are the functions involved, any help is much appreciated.
>
> function chaseToReference (&$array, $path) {
>  if (!empty($path)) {
>    if (empty($array[$path[0]])) {
>                        return badResult (E_USER_WARNING, array(
>                                'msg' => 'Could not walk the full tree',
>                                '$path' => $path,
>                                '$array (possibly partially walked)' => $array
>                        ));
>    } else return chaseToReference($array[$path[0]], array_slice($path, 1));
>  } else {
>    return goodResult($array);
>  }
> }
>
> function result(&$r) {
>  return $r['result'];
> }
>
> function goodResult(&$r) {
>  $r2 = array (
>  'isMetaForFunc' => true,
>        'result' => &$r
>  );
>  return $r2;
> }
>

After a quick glance, I can't actually see any modifications to $wm in
this code.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
> On Fri, May 14, 2010 at 10:09 AM, Rene Veerman <rene7...@gmail.com> wrote:
>> Hi.
>>
>> I'm doing the 5.3-strict thing, and am removing all my
>> passing-by-reference muck from a script of mine.
>>
>> But i've run into a problem;
>>
>> I use the following construct to push new values fairly deeply inside
>> an array structure;
>>
>> $chase = chaseToReference ($wm, $path);
>> $arr = result($chase);
>> $arr[$v] = $lid;
>>
>> $path is a flat-list array of indexes in $wm that have to be traversed
>> to get to the right portion of $wm.
>> a debug-dump of $wm and $arr after running this code shows $arr
>> correctly updated, but $wm not. :((
>>
>> here are the functions involved, any help is much appreciated.
>>
>> function chaseToReference (&$array, $path) {
>>  if (!empty($path)) {
>>    if (empty($array[$path[0]])) {
>>                        return badResult (E_USER_WARNING, array(
>>                                'msg' => 'Could not walk the full tree',
>>                                '$path' => $path,
>>                                '$array (possibly partially walked)' => $array
>>                        ));
>>    } else return chaseToReference($array[$path[0]], array_slice($path, 1));
>>  } else {
>>    return goodResult($array);
>>  }
>> }
>>
>> function result(&$r) {
>>  return $r['result'];
>> }
>>
>> function goodResult(&$r) {
>>  $r2 = array (
>>  'isMetaForFunc' => true,
>>        'result' => &$r
>>  );
>>  return $r2;
>> }
>>

On Fri, May 14, 2010 at 10:39 AM, Rene Veerman <rene7...@gmail.com> wrote:
> changed all function-definitions to include a "&" before their name,
> no change in behavior though..
>

And then, change the calling code to:

$chase = &chaseToReference ($wm, $path);
$arr = &result($chase);
$arr[$v] = $lid;


and it works :))

--- End Message ---
--- Begin Message ---
I encode my password with md5 base 64 ..on the php side but
i have a problem with the POST that this function i using on my form.
after posting my data + is replaced with space

I came out with that  explanation after a lot of tries and echos in my code
files i found out that
after using numbers ,onlu on that case, in the password field the space
between the encoding was replaced with a + or / sometimes
i tried to remove the + or / but still i get the same results
any ideas


  data: "firstname="+ firstname +"& lastname="+ lastname +"& username="+
username +"& email="+ email +"& password="+ password +"& save="+ save+"&
user_type="+ user_type,

--- End Message ---

Reply via email to