php-general Digest 22 Dec 2011 15:05:32 -0000 Issue 7621

Topics (messages 316079 through 316081):

Re: Online Form Creation
        316079 by: Tedd Sperling

Re: Unique items in an array
        316080 by: Marc Guay

Question regarding passwords/security
        316081 by: Paul M Foster

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 Dec 21, 2011, at 2:14 AM, Christopher Lee wrote:

> Hello All,
> 
> I have two forms (see attached) that I would like to recreate and enable the 
> user to complete the form online. The data would be collected in a MySQL DB.
> 
> http://ucensys.com/activities.pdf
> 
> http://ucensys.com/guidelines.pdf
> 
> You will see that the forms are in a matrix format. I am having trouble 
> figuring out the best way to create the form and ensure the data is collected 
> properly in the DB. Any suggestions would be greatly appreciated.
> 
> Best,
> 
> Christopher

I don't see a problem here.

1. Figure out how to create a HTML form (Investigate HTML tables).
2. Then write a PHP that will scrub the data and submit it to MySQL.

The length and layout of the forms are of no significance.

This is basic html/php -- try creating something and submit your work for our 
review. If you want us to write the code for you, please look elsewhere.

Cheers,

tedd

_____________________
t...@sperling.com
http://sperling.com


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

I just wanted to add a little something to this thread as I reworked
some of the code and came across an interesting tidbit.  I was trying
to merge many result sets which now had the table's primary key as the
array key, but found that when array_merge() was done, all of the
array's keys were lost, like so:

array(2) {
  [704]=>
  array(36) {
    ["contact_id"]=>
    string(3) "704"
    ["contact_first_name"]=>
    string(4) "Marc"
    ["contact_last_name"]=>
    string(4) "Guay"
  }
  [705]=>
  array(36) {
    ["contact_id"]=>
    string(3) "705"
    ["contact_first_name"]=>
    string(4) "Marc"
    ["contact_last_name"]=>
    string(5) "Guay2"
  }
}

array_merge with:

array(0) {
}

left me with:

array(2) {
  [0]=>
  array(36) {
    ["contact_id"]=>
    string(3) "704"
    ["contact_first_name"]=>
    string(4) "Marc"
    ["contact_last_name"]=>
    string(4) "Guay"
  }
  [1]=>
  array(36) {
    ["contact_id"]=>
    string(3) "705"
    ["contact_first_name"]=>
    string(4) "Marc"
    ["contact_last_name"]=>
    string(5) "Guay2"

  }
}

Pretty crummy.  Apparently what I wanted was as simple as:  $new_array
= $array1 + $array2, which I didn't even know was an option.  Thank
you php.net/manual.

Marc

--- End Message ---
--- Begin Message ---
Not sure how to ask this question... I've always eschewed consulting a
database on page loads to determine if a user is logged in, primarily
because of latency issues. For example, you could store a nonce like the
session ID in a table for a user when they log in. Then each time they
arrive at a page which needs certain permissions to access, you'd check
the table for the nonce and compare it to the actual session ID or
whatever to determine that they're properly logged in. This seems
reasonable but suffers from the lag on the database link's
query-and-response lag time. So I've always preferred some solution
where something is dragged along in a session cookie instead. Maybe
something like the hash of user login, email and user name, which
wouldn't be there unless you'd put it there on login. But this latter
scheme just seems inherently less secure than consulting the table.

Is there any concensus or overwhelming argument one way or the other?

Paul

-- 
Paul M. Foster
http://noferblatz.com
http://quillandmouse.com

--- End Message ---

Reply via email to