php-general Digest 29 Jun 2009 22:30:29 -0000 Issue 6202
Topics (messages 294708 through 294722):
Re: Best way to reinstate radio-button states from database?
294708 by: tedd
Re: guide me please
294709 by: Daniel Brown
294714 by: Yuri Yarlei
Re: Socket error
294710 by: Daniel Brown
294712 by: Luke
mail and mysql confirmation of that [double-opt in]
294711 by: Grega Leskovsek
294713 by: tedd
294715 by: Shawn McKenzie
Does something like this exist?
294716 by: Christoph Boget
294717 by: Dotan Cohen
294718 by: Ashley Sheridan
294719 by: Michael Shadle
294720 by: Christoph Boget
294721 by: Eddie Drapkin
Named pair array from variable
294722 by: Mikey Knutson
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 ---
At 7:12 PM -0400 6/28/09, Rob Gould wrote:
I have a webpage which allows people to log in and make selections
with radio buttons and hit SUBMIT and saves the data from those
radio buttons to a mySQL database.
However, I'm finding that I also need the ability to allow a user to
log back in at a later date (or even on a different computer), and
pull up that survey again,
with each of the 50-something radio-buttons back in the positions in
which they were last saved.
Surely there's a best-case-method for doing this type of thing
(saving large numbers of radio-button-group settings to mySQL and
pulling them back
again later). Any advice is greatly appreciated. Perhaps there's a
jQuery-way to retrieve all the radio-button group settings as an
array and save it and pull it back again?
Or perhaps a PHP-specific method - - - I'm fine with either.
Rob:
I don't know the best way, but this is the way I do it.
My database is relational. Each user has an unique ID as well as each
question has a unique ID and the answer to each question is the one
of several different choices (1 to whatever).
Each answer is recorded in the database as a *separate* record that
contains the user ID, question ID and their choice. A record might
look like this:
Table: answers
Fields: user_id, question_id, answer
Values: 34,115,5
That's where 34 is the user's ID, 115 is the question's ID, and 5 is
the user's choice.
Then whenever you wanted to pull out and show the user (user 34 for
example) what they picked, just select all the records that have a
user ID of 34 and sort them by question ID and show the selections
the user made.
If you have different test, then add a unique test_id field and make
the question_id non-unique. An example might be:
Table: answers
Fields: user_id, test_id, question_id, answer
Values: 34,20,11,5
That's where 34 is the user's ID, 20 is the test's ID, 11 is the
question's ID, and 5 is the user's choice.
Then you could pull out all records that have the same user ID and
test ID and show the questions and answers associated with that test
and that user.
That works for me.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
On Mon, Jun 29, 2009 at 05:40, Suresh Gupta VG<sures...@zensar.com> wrote:
> Hi List,
>
> I am newb to this PHP. I am using "AIX Version 5.3" OS and "PHP version
> 4.3.9" by default version and "Oracle Application Server 10g Release 2".
> Configured properly and I am getting the phpinfo.php on browser properly. But
> when I write my own code for php, it is just displaying the code but it is
> not running the php code.
>
> Is there any mistake in configuring the apache or else where? pls guide me.
This question is absolutely and completely out of the scope of
this list. You're using a version of PHP for which support was ended
a long time ago, and the question isn't a PHP question, but instead a
web server question.
Check with the Oracle folks to see why the setup is not working
for you. In lieu of that, check community-run forums and user-to-user
support sites specifically designed for Oracle's products.
--
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Ask me about our fully-managed servers and proactive management
clusters starting at just $200/mo.!
--- End Message ---
--- Begin Message ---
Hi,
My suggestion is you install a better version of PHP or use other type of php
server, you will use oracle db? If is not necessary, you should use mysql or
postgresql for learn php.
But this error maybe happen because you are using '<?' '?>' for php tags,
if you use '<?php' '?>' maybe this error will go away
Yuri Yarlei.
Programmer PHP, CSS, Java, PostregreSQL;
Today PHP, tomorrow Java, after the world.
Kyou wa PHP, ashita wa Java, sono ato sekai desu.
> Date: Mon, 29 Jun 2009 15:10:22 +0530
> From: sures...@zensar.com
> To: php-gene...@lists.php.net
> Subject: [PHP] guide me please
>
> Hi List,
>
> I am newb to this PHP. I am using "AIX Version 5.3" OS and "PHP version
> 4.3.9" by default version and "Oracle Application Server 10g Release 2".
> Configured properly and I am getting the phpinfo.php on browser properly. But
> when I write my own code for php, it is just displaying the code but it is
> not running the php code.
>
> Is there any mistake in configuring the apache or else where? pls guide me.
>
> With thanks and Regards,
> Suresh.G
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
_________________________________________________________________
Descubra todas as novidades do novo Internet Explorer 8
http://brasil.microsoft.com.br/IE8/mergulhe/?utm_source=MSN%3BHotmail&utm_medium=Tagline&utm_campaign=IE8
--- End Message ---
--- Begin Message ---
On Mon, Jun 29, 2009 at 02:42, Luke<l...@blog-thing.com> wrote:
> Hey guys, getting an odd error here... The code involved:
[snip!]
Luke,
Just a friendly reminder: for future reference, please don't start
a second thread on the list until the first is closed out ---
particularly if it's the same subject. Sometimes responses to
questions - particularly in the middle of a Sunday night - will take
some time, but someone will eventually reply.
--
</Daniel P. Brown>
daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Ask me about our fully-managed servers and proactive management
clusters starting at just $200/mo.!
--- End Message ---
--- Begin Message ---
2009/6/29 Daniel Brown <danbr...@php.net>
> On Mon, Jun 29, 2009 at 02:42, Luke<l...@blog-thing.com> wrote:
> > Hey guys, getting an odd error here... The code involved:
> [snip!]
>
> Luke,
>
> Just a friendly reminder: for future reference, please don't start
> a second thread on the list until the first is closed out ---
> particularly if it's the same subject. Sometimes responses to
> questions - particularly in the middle of a Sunday night - will take
> some time, but someone will eventually reply.
>
> --
> </Daniel P. Brown>
> daniel.br...@parasane.net || danbr...@php.net
> http://www.parasane.net/ || http://www.pilotpig.net/
> Ask me about our fully-managed servers and proactive management
> clusters starting at just $200/mo.!
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Ah, that wasn't impatience, I have two email addresses and was unsure which
were allowed to post to the list but apparently it's both! Sorry about that.
In relation to the question, the answer was indeed to change to
socket_create, the following code works fine:
$master_socket = socket_create(AF_INET, SOCK_STREAM,
0);
socket_bind($master_socket, '127.0.0.1',
$this->port);
socket_listen($master_socket);
socket_set_option($master_socket, SOL_SOCKET,
SO_REUSEADDR, 1);
socket_set_nonblock($master_socket);
Thanks for the help =)
--
Luke Slater
:O)
--- End Message ---
--- Begin Message ---
how is the best way to check if email address is valid: is this preg_match() OK?
preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/',
$email);
How can I make double opt-in mail system? My idea:
1.) I remember the email entered and user data and the sha1($email);
in mysql db
2.) I send email with activation link of the sha1($email);
3.) I am not clear how to proceed when the link is activated. How to
update the db and submit the necessary form to the marketing.
Thanks in advance,
--
When the sun rises I receive and when it sets I forgive ->
http://users.skavt.net/~gleskovs/
All the Love, Grega Leskov'sek
--- End Message ---
--- Begin Message ---
At 4:55 PM +0200 6/29/09, Grega Leskovsek wrote:
how is the best way to check if email address is valid: is this
preg_match() OK?
preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/',
$email);
How can I make double opt-in mail system? My idea:
1.) I remember the email entered and user data and the sha1($email);
in mysql db
2.) I send email with activation link of the sha1($email);
3.) I am not clear how to proceed when the link is activated. How to
update the db and submit the necessary form to the marketing.
Thanks in advance,
Double opt-in.
1. Have the user enter their email address via a form that let's them
know they are subscribing to a service. You might want to check for a
valid email address (many versions) and/or a CAPTCHA. additionally,
you need to check if they have already registered OR in the process
of registering.
2. After they submit their email address, then have your script
create a unique token and record it coupled with the email address in
your database.
3. Then send a confirmation email to that email address with the
token appended as a link in the email -- with instructions for the
receiver to either ignore the email (with apologies) or click the
link and be taken back to your site where your script takes the
confirmation token and checks your database for a token/email match.
If there is one, then that completes the process and you have a
confirmed double opt-in email address to use. If not, have them try
again.
Here's the script I wrote to do that:
http://www.webbytedd.com/b/sub-email/index.php
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Grega Leskovsek wrote:
> how is the best way to check if email address is valid: is this preg_match()
> OK?
> preg_match('/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/',
> $email);
filter_var($email, FILTER_VALIDATE_EMAIL)
>
> How can I make double opt-in mail system? My idea:
> 1.) I remember the email entered and user data and the sha1($email);
> in mysql db
> 2.) I send email with activation link of the sha1($email);
> 3.) I am not clear how to proceed when the link is activated. How to
> update the db and submit the necessary form to the marketing.
When the user clicks the activation link, mark the address active in the
subscribers table, or move the entry from a pending table to a
subscribers table. Then execute the email/whatever to marketing just as
you would without using double opt-in.
>
> Thanks in advance,
>
>
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
I'm wondering if there isn't something out there that crawls through
your codebase and generates a map of (any of) the following:
* What files are include in which scripts
* The relationships between defined classes (eg A extends B)
* What other classes are utilized by which classes (eg, instantiation)
I've done some looking around but haven't really been able to find
anything that does even some of this. I could write functionality
that does this but didn't want to reinvent the wheel.
thnx,
Christoph
--- End Message ---
--- Begin Message ---
> I'm wondering if there isn't something out there that crawls through
> your codebase and generates a map of (any of) the following:
>
> * What files are include in which scripts
> * The relationships between defined classes (eg A extends B)
> * What other classes are utilized by which classes (eg, instantiation)
>
> I've done some looking around but haven't really been able to find
> anything that does even some of this. I could write functionality
> that does this but didn't want to reinvent the wheel.
>
I think that you're looking for Perl!
--
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
--- End Message ---
--- Begin Message ---
On Mon, 2009-06-29 at 23:16 +0300, Dotan Cohen wrote:
> > I'm wondering if there isn't something out there that crawls through
> > your codebase and generates a map of (any of) the following:
> >
> > * What files are include in which scripts
> > * The relationships between defined classes (eg A extends B)
> > * What other classes are utilized by which classes (eg, instantiation)
> >
> > I've done some looking around but haven't really been able to find
> > anything that does even some of this. I could write functionality
> > that does this but didn't want to reinvent the wheel.
> >
>
> I think that you're looking for Perl!
>
> --
> Dotan Cohen
>
> http://what-is-what.com
> http://gibberish.co.il
>
Have you looked at PHPDoc? You'll have to comment your code fairly well
and in a specific style (which is a boon in itself) but it will produce
some fairly good documentation.
Thanks
Ash
www.ashleysheridan.co.uk
--- End Message ---
--- Begin Message ---
On Mon, Jun 29, 2009 at 1:16 PM, Dotan Cohen<dotanco...@gmail.com> wrote:
> * What files are include in which scripts
pecl.php.net/package/inclued - an awesome tool, will show you
includes/require calls to other ones, show you any redundancy (dotted
lines) etc. helps you clean up any nested and unnecessary includes or
requires. Rasmus approved(tm)
use it with graphviz and you've got visual maps of your entire
include/require structure.
> * The relationships between defined classes (eg A extends B)
> * What other classes are utilized by which classes (eg, instantiation)
doesn't phpdoc or something do this stuff? might need comments before
each function/method to make it really work well. not sure. i think
there's also something called "phpxref" as well that might work...
--- End Message ---
--- Begin Message ---
>> * What files are include in which scripts
> pecl.php.net/package/inclued - an awesome tool, will show you
> includes/require calls to other ones, show you any redundancy (dotted
> lines) etc. helps you clean up any nested and unnecessary includes or
> requires. Rasmus approved(tm)
> use it with graphviz and you've got visual maps of your entire
> include/require structure.
Ok, I'll look in to it. Thanks!
>> * The relationships between defined classes (eg A extends B)
>> * What other classes are utilized by which classes (eg, instantiation)
> doesn't phpdoc or something do this stuff? might need comments before
> each function/method to make it really work well. not sure. i think
> there's also something called "phpxref" as well that might work...
It does. But I'm looking to use this on an inherited framework that,
unfortunately, includes very little PHPDoc comments. Considering how
large the codebase is, it'd be quicker for me to write this
functionality (to at least give us something to reference) than it
would be to add the necessary comments. Granted, that's something
we'd want to eventually add anyway but it's something we could do over
time as we became much more familiar with the framework.
thnx,
Christoph
--- End Message ---
--- Begin Message ---
Have you looked at class_parents()?
http://www.php.net/manual/en/function.class-parents.php
On Mon, Jun 29, 2009 at 4:42 PM, Christoph Boget<jcbo...@yahoo.com> wrote:
>>> * What files are include in which scripts
>> pecl.php.net/package/inclued - an awesome tool, will show you
>> includes/require calls to other ones, show you any redundancy (dotted
>> lines) etc. helps you clean up any nested and unnecessary includes or
>> requires. Rasmus approved(tm)
>> use it with graphviz and you've got visual maps of your entire
>> include/require structure.
>
> Ok, I'll look in to it. Thanks!
>
>>> * The relationships between defined classes (eg A extends B)
>>> * What other classes are utilized by which classes (eg, instantiation)
>> doesn't phpdoc or something do this stuff? might need comments before
>> each function/method to make it really work well. not sure. i think
>> there's also something called "phpxref" as well that might work...
>
> It does. But I'm looking to use this on an inherited framework that,
> unfortunately, includes very little PHPDoc comments. Considering how
> large the codebase is, it'd be quicker for me to write this
> functionality (to at least give us something to reference) than it
> would be to add the necessary comments. Granted, that's something
> we'd want to eventually add anyway but it's something we could do over
> time as we became much more familiar with the framework.
>
> thnx,
> Christoph
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--- End Message ---
--- Begin Message ---
Is this even possible? I'm building a string, properly formatted, to create
a named pair or associative array. The string is fine, and when I use it
directly to create the array, all is well. When I try to use the var to
create the array, I get an empty array (I think). Huh?
Here is what I have:
$myString = "'username' => 'password' , 'mickey' => 'mouse' , 'donald' =>
'duck'";
$myArray = array($myString);
print ("array val: $myArray[username]"); // get an empty string here
--- End Message ---