php-general Digest 26 Jan 2009 11:38:43 -0000 Issue 5923
Topics (messages 287124 through 287138):
Re: Dirty Button
287124 by: tedd
Re: Captha Image Matching the Session Value.
287125 by: Petar Dzhambazov
287126 by: Petar Dzhambazov
287131 by: Richard Lynch
Re: New PHP User with a simple question
287127 by: Kevin Waterson
287128 by: Jim Lucas
287130 by: Richard Lynch
287134 by: Micah Gersten
Re: best practice wrt multi-lingual websites, gettext() etc.
287129 by: Phpster
287132 by: Richard Lynch
287135 by: Per Jessen
Re: Multiple queries in PHP
287133 by: Richard Lynch
287136 by: Edmund Hertle
287138 by: Per Jessen
Re: New PHP User with a simple question OT
287137 by: Carlos Medina
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 3:41 PM -0600 1/25/09, Micah Gersten wrote:
tedd wrote:
At 7:02 PM +0000 1/25/09, Ashley Sheridan wrote:
Tedd, what about having it reset if you then go back and select the
original option without submitting, i.e. you originally selected and
submitted on A, then selected B, then selected A again?
That's a good idea.
Now I just have to figure out how to make it all-encompassing enough
to handle one, or more, selection-control and compare current values
with the values that were previously selected.
Oh, the holes we dig for ourselves. :-)
Cheers,
tedd
What about an onChange javascript function that checks all the boxes
that need input. Call it whenever any of the inputs change and in the
onSubmit for the form, check it again.
I currently use onClick for the select control and that works well
enough. It's not the trigger that's the issue.
If I decide to do that, then I have to loop through all the tag ID's,
get the current values, and check them against what was presented.
This just requires some thinking and I'm about all thought-out for
the moment -- the end of another 12 hour day.
Thanks for your input.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Hey guys sorry to interrupt but, the problem is rather obvious if you try
and put the <img src='captcha.php' /> - which is the captcha image it self -
anywhere in the script you are effectively overwriting the session
variable - since you are initializing the form file session in the very
beginning of the form file, and then calling the captcha file which over
writes the session file, but that does not automatically update in the form
file so there you get the old value. If you make the check if the text is
correct after the submit of the form, it should be correct. I hope I have
made myself clear enough.
Petar
"Stephen Alistoun" <stephenalist...@gmail.com> написа в съобщението
news:21651258.p...@talk.nabble.com...
Hey Ash,
Is I have but the Session Value is one before the Captha Image Value.
Regards,
Stephen
--
View this message in context:
http://www.nabble.com/Captha-Image-Matching-the-Session-Value.-tp21650616p21651258.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Hey guys sorry to interrupt but, the problem is rather obvious if you try
and put the <img src='captcha.php' /> - which is the captcha image it self -
anywhere in the script you are effectively overwriting the session
variable - since you are initializing the form file session in the very
beginning of the form file, and then calling the captcha file which over
writes the session file, but that does not automatically update in the form
file so there you get the old value. If you make the check if the text is
correct after the submit of the form, it should be correct. I hope I have
made myself clear enough.
Petar
"Stephen Alistoun" <stephenalist...@gmail.com> написа в съобщението
news:21651258.p...@talk.nabble.com...
Hey Ash,
Is I have but the Session Value is one before the Captha Image Value.
Regards,
Stephen
--
View this message in context:
http://www.nabble.com/Captha-Image-Matching-the-Session-Value.-tp21650616p21651258.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Configure your browser to prompt you for cookies.
That will make sure you are doing the session bit the way you think
you are.
Then add some error_log statements when you set or read the secret word.
You'll soon figure out exactly how/why your session has the OLD secret
word in it.
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch
--- End Message ---
--- Begin Message ---
> > Sorry, I am also new to the etiquette of these mail lists.
Hope this will get you started,
http://www.phpro.org/tutorials/Introduction-to-PHP-templating.html
Kevin
http://phpro.org
--- End Message ---
--- Begin Message ---
Christopher W wrote:
At least I hope it is simple...
I am trying to get an HTML menu link to set a variable's value. For
example, when a user clicks the "Home" button on my page it would cause
$page = "home"; or clicking the "About Us" button will set $page="about_us";
etc.
I think this should be fairly simple but being completely new to php I just
cannot seem to get it right.
Any help would be greatly appreciate.
Thank you in advance.
Christopher,
Rather then criticizing you, I would like to point you in the direction that you describe in your
responses to the others that are.
So, it sounds to me like you do not want to reload/change pages just to change the content of the
current page.
With PHP alone you cannot load new content without reloading the entire page, or involving one of
the other methods listed below.
I would say that you have two avenues to get this done.
The first using a meld of AJAX & PHP
http://nodstrum.com/2007/02/27/ajaxcontentload/
http://www.dhtmlgoodies.com/scripts/ajax-dynamic-articles/ajax-dynamic-articles.html
http://www.dhtmlgoodies.com/scripts/ajax-dynamic-content/ajax-dynamic-content.html
The second is with Javascript and/or CSS
http://www.devarticles.com/c/a/HTML/Preloading-HTML-Content-with-CSS/
http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm
Hope these help.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
You may or may not find this worth reading:
http://richardlynch.blogspot.com/2007/07/php-in-html.html
Bottom line is that what you are trying to do can't be done in PHP.
You'll have to resort to Javascript and DIV tags with display: none;
switching to display: block;
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch
--- End Message ---
--- Begin Message ---
Paul M Foster wrote:
> <snip>
> In case this has yet to be answered to your satisfaction...
>
> Your page will *have* to reload when the user presses the button, but
> the majority of content can look the same, except for the content you
> want to change.
> </snip>
>
This is absolutely not true. You can make the button call a PHP script
with AJAX and just update the textbox.
Check out:
http://xajaxproject.org
Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com
--- End Message ---
--- Begin Message ---
Dunno if it's a best practice, but I store all the translations in the
db for easy manipulation and extraction to a file for others to
translate. That obviously involves both import and export utilities.
At work we to the translation in real time thru a render page that
combined the data for the form as well as the labels and buttons.
Personally I disagree with this approach and feel that caching out the
page to either HTML or XML is quicker and cleaner. But that's just me.
A number of pup apps take the approach of storing the label
translations in variables inside language folders ( phpmyadmin has
this ). That is also not a bad approach but is slightly slower and I
can't help but feeling that serving up a static page created by code
is a better solution. It will be heavier on the management side, but
my experience is that this mgmt activity drops off quickly after the
first week or two of that form being in production.
Nth
Bastien
Sent from my iPod
On Jan 25, 2009, at 14:56, Per Jessen <p...@computer.org> wrote:
I am writing a small(ish) site which will eventually need to be
available in several different languages. This needs to more or less
transparent to the user, so I am using Apaches content negotiation
features, which is working very well.
The issues arise once I start looking at PHP and Javascript code. I
use
JS for client side input (pre-)validation and increased usability, and
error messages and such will obviously need to be language-sensitive.
The same goes for the PHP code.
With PHP, I've got gettext() for this sort of job, with javascript and
some DHTML, I don't seem to have many options.
One of my key concerns is - for the translation, I need to be able to
wrap everything up and ship it off to a translator, perhaps via elance
or similar.
Does anyone have any best practice suggestions or comments in general?
/Per Jessen, Zürich
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I can't help with the bits you are asking about, but I can give this
advice:
Don't rely solely on the Apache/browser content-negotiation, please.
This one time...
I was in Paris.
I was at an Internet Cafe.
I couldn't change browser settings.
Some sites that I knew were available in English showed me only
French, and no way to change it.
Despite my using a computer with a French keyboard, my French language
skills remained somewhere around the "Bonjour. Parlez-vous Englias?"
level.
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch
--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
> I can't help with the bits you are asking about, but I can give this
> advice:
>
> Don't rely solely on the Apache/browser content-negotiation, please.
>
Don't worry, the site already has a user-override option.
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
PHP/MySQL and the various functionality such as @var are all
per-connection expressly so that you CAN do this type of stuff.
I'd be pretty shocked if you had any problems.
--
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch
--- End Message ---
--- Begin Message ---
2009/1/25 Ashley Sheridan <a...@ashleysheridan.co.uk>
> On Sun, 2009-01-25 at 15:07 -0600, Shawn McKenzie wrote:
> > Ashley Sheridan wrote:
> > > Hi all,
> > >
> > > I've run into a bit of a problem. I put together a query using mysql
> > > variables in the form set @m:= 0; with the select that uses it directly
> > > after. For any wondering, the select was using it as an incremental
> > > value which can't be hard coded, as the value will depend on the
> > > ordering of the results of the query itself.
> > >
> > > The problem seems to be that while phpMyAdmin would execute this double
> > > query perfectly well, php using mysql_query() was having problems, as
> > > apparently it can't actually run multiple queries.
> > >
> > > Now the full query looks something like this:
> > >
> > >
> > > mysql_query("SELECT @m:=0;");
> > >
> > > $query = "SELECT * FROM(
> > > SELECT profiles.id, ROUND(AVG(rated.score)) AS `rating`,
> > > COUNT(rated.score) AS `total`, @m:=...@m+1 AS rank FROM `rated` LEFT JOIN
> > > `profiles` ON (profiles.id = rated.profile_id) GROUP BY
> rated.profile_id
> > > ORDER BY rating DESC, total DESC) AS ranking WHERE ranking.id=$id";
> > > $result = mysql_query($query);
> > >
> > >
> > > which seems to be working OK so far, but does anyone know of any
> > > potential pitfalls I might face when doing something like this?
> > >
> > > Thanks,
> > >
> > >
> > > Ash
> > > www.ashleysheridan.co.uk
> > >
> >
> > Might try the mysqli extension. mysqli_multi_query()
> >
> > --
> > Thanks!
> > -Shawn
> > http://www.spidean.com
> >
> Unfortunately, I think the server this is going on to doesn't have that
> extension :(
>
>
> Ash
> www.ashleysheridan.co.uk
>
This extension does not have to be installed. If your server is running
php5, then this extension is installed
-eddy
--- End Message ---
--- Begin Message ---
Ashley Sheridan wrote:
> I've run into a bit of a problem. I put together a query using mysql
> variables in the form set @m:= 0; with the select that uses it
> directly after. For any wondering, the select was using it as an
> incremental value which can't be hard coded, as the value will depend
> on the ordering of the results of the query itself.
>
> The problem seems to be that while phpMyAdmin would execute this
> double query perfectly well, php using mysql_query() was having
> problems, as apparently it can't actually run multiple queries.
I don't know about the PHP mysql_query(), but the MySQL C API works fine
with multiple queries, it just has to be specifically enabled - the
default is one query per call.
However, it looks like the multiple query option is not supported by
PHP:
http://php.net/manual/en/mysqli.real-connect.php
"For security reasons the MULTI_STATEMENT flag is not supported in PHP.
If you want to execute multiple queries use the mysqli_multi_query()
function."
/Per Jessen, Zürich
--- End Message ---
--- Begin Message ---
tedd schrieb:
At 11:56 AM +0100 1/25/09, Carlos Medina wrote:
Hi Ashley,
yes this is the right answer. The "Problem" is not a PHP Question but
a programming question. To be clear: i think, the "Problem" can you
solve, if you get two or tree books or tutorials about the programming
language. You should *try* to solve the problem self and then to post
a question in a list or forum. I think this is the "normal" way.
To the code i think this is very bad php code. You will get more XXS
and other exploits with this code. Please tell me what is your site
and i show you
Regards
Carlos Medina
Carlos:
Whoa dude -- this list IS for people to ask questions and from what the
OP asked it WAS a php question.
I totally agree with Ashley and your response is not common for this list.
As to the OP's code being "bad" or whatever, he is asking for help. If
you want to show him where his code is "bad", then be my guest -- but to
tell him to go buy a book and come back to this list after he has reads
it is not something you can dictate -- you have no control over this list.
I suggest -- if you want to help, then do so. If not, then you go read a
book.
Cheers,
tedd
Tedd:
Ok boss. Thank you. I will do.
--- End Message ---