php-general Digest 10 May 2007 13:21:15 -0000 Issue 4783

Topics (messages 254706 through 254716):

Re: PhP and Java login trouble
        254706 by: Brad Sumrall

Re: Search function
        254707 by: Chris

Re: Scalable Site Architecture
        254708 by: Chris

SESSION LOST!
        254709 by: Sascha Braun

Re: Problem with mssql_query()
        254710 by: Chris

Re: [EMAIL PROTECTED]
        254711 by: Frank Arensmeier
        254712 by: Tom Rogers
        254716 by: Daniel Brown

Re: getting $_ENV variables
        254713 by: C.R.Vegelin

Re: session cookies enabled?
        254714 by: Ford, Mike

Re: Ajax?
        254715 by: Rangel Reale

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
I have a question about your suggestion.
Would it not be easier to simply carry the sessionid from the php session
validation to the javascript?
Instead of: if(document.frmlogin.txtusername.value=="")
                {
                        alert("Please Enter Username.");
                        document.frmlogin.txtusername.focus();
                        return false;

Why would I want to "re-enter the user name"?
My common sense "which maybe completely wrong" say, YOU ARE VALIDATED IN
PHPBB via issetid, now post to (document.frmlogin.userid.value=="")

This is why I am not catching your angle.

PhP makes so much more sense. This javascript integration is really giving
me a headache!

Suggestions?

Brad




-----Original Message-----
From: Chris [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 09, 2007 2:16 AM
To: Brad Sumrall
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP] PhP and Java login trouble

Brad Sumrall wrote:
> I have been hunting all around that website you referred me too looking
for
> javascripting information and can find nothing. I know a little bit of php
> but little to nothing about javascripting.

Eh? I never sent you to a website.

See this code:

        function validatelogin()
        {
                if(document.frmlogin.txtusername.value=="")
                {
                        alert("Please Enter Username.");
                        document.frmlogin.txtusername.focus();
                        return false;
                }
                if(document.frmlogin.txtpwd.value=="")
                {
                        alert("Please Enter Password.");
                        document.frmlogin.txtpwd.focus();
                        return false;
                }
                document.frmlogin.login.value="Success";
                document.frmlogin.action="operation.php?mode=login";
                return true;
        }


You need to create a *similar* function (eg 'BBValidateLogin()') to 
check different html field names.


For example:

function BBValidateLogin()
{
   var f = document.forms[0];
   alert('username is ' + f.username.value);
}

The username.value comes from this:

<input type="text" class="post"
name="username" size="25" maxlength="40" value="" />

where you have name="username"

So take the name="..." and put a .value on the end.

Rinse, repeat until you have checked all of the fields you need to.

Return true for the form to submit.

Return false for it to NOT submit.

-- 
Postgresql & php tutorials
http://www.designmagick.com/

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

--- End Message ---
--- Begin Message ---
Ryan A wrote:
Hey!

.....A little background:
We have a site that has already been made.. a couple of hundred pages displayed 
via SMARTY templates, the site's in Swedish.

The navigation and other parts except for the center is taken care of by the 
templates and other scripts... the center main text is taken from the 
database(mySql) based on $page_id...its in a MySql TEXT field and has all the 
html etc that will be displayed in the center of the page.

....End of background..

Now they want to add a "search function" to the site... a simpe textbox where a user 
enters a word or sentance and they get 20 results per page... with a "x.xx % closest to your 
query"  can anybody give me basic pointers on where to start?
Any links/software or articles too would be appreciated...

http://dev.mysql.com/doc/refman/4.1/en/fulltext-search.html

Start off with that, if they need something more complicated down the line, revisit.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
bruce wrote:
Hi..

In looking for what's required fo a site, I'm trying to find
docs/overview/mentors to talk to/etc,...

Basically, I'm considering what's required in terms of
hardware/apps/functionality for each server to be able to support a
site/system of ~100,000/day

Depends on your app and what you want to do.

If it's 95% "pull content from the database and display it" (eg a page from an article), look at creating static html files which get regenerated when the content is edited (http://pear.php.net/packages.php?catpid=3&catname=Caching)

A webserver should handle 100k hits a day of static html pretty easily.

If you're doing complicated database queries with every page hit then you're going to need a lot more database servers than http servers.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

I am developing on a large project. Its containing
a couple of ajax scripts. One day, my temporeary
folder was full, because everytime i clicked some-
where in the page, a new session file was created.

So i decided, to change to a database driven session
management. But it did not really help.

Its possible to log into the site. You can do authoring
or use the service as it should be, but after a little
time, the session is just lost.

Sometimes it takes ten minutes, sometimes just a few
mouse clicks. Its very strange.

But it never happens during the first clicks.

Maybe somebody is able to help me.

Best Regards,


Sascha Braun


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
PostgreSQL will
simply throw an error, because '8' is not no way no how an INT.  It's
a string.

Since when?

test=# create table b(b int);
CREATE TABLE
test=# insert into b(b) values ('1');
INSERT 0 1
test=# SELECT * from b;
 b
---
 1
(1 row)

test=# select * from b where b='1';
 b
---
 1
(1 row)


No idea about the OP's problem but that statement is just wrong :P

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Sorry, your question has nothing to do with PHP. Maybe try a CSS list?

http://www.google.com/search?rls=sv-se&q=css+discussion +list&ie=UTF-8&oe=UTF-8
http://www.google.com/search?rls=sv-se&q=why+ie+sucks&ie=UTF-8&oe=UTF-8
http://whyiesucks.blogspot.com/

//frank

9 maj 2007 kl. 15.13 skrev Farid Jamea:

Hello,

To me this seems to be a very strange problem.

I have a static html page (index.html) that shows correctly on both FF2 &
IE7.

I splitted the website up into different sections: (header, footer, ...). To
do this I have used:
--------------------------------------------------------------
<?php
require("header.php");
?>
Some code goes here...
<?php
require("footer.php");
?>
--------------------------------------------------------------
.... and so on.
When I test my page (now index.php), it shows perfect on Firefox, but in IE some stuff are not in their right place. I have checked the source code of
both index.html and index.php and they seem both identical to me.

Do you know why IE fails to correctly render the page?

Thanks

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


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

Wednesday, May 9, 2007, 11:13:50 PM, you wrote:
FJ> Hello,

FJ> To me this seems to be a very strange problem.

FJ> I have a static html page (index.html) that shows correctly on both FF2 &
FJ> IE7.

FJ> I splitted the website up into different sections: (header, footer, ...). To
FJ> do this I have used:
FJ> --------------------------------------------------------------
FJ> <?php
FJ> require("header.php");
?>>
FJ> Some code goes here...
FJ> <?php
FJ> require("footer.php");
?>>
FJ> --------------------------------------------------------------
FJ> .... and so on.
FJ> When I test my page (now index.php), it shows perfect on Firefox, but in IE
FJ> some stuff are not in their right place. I have checked the source code of
FJ> both index.html and index.php and they seem both identical to me.

FJ> Do you know why IE fails to correctly render the page?

FJ> Thanks 


Could be stray carriage returns in your include files, good idea to
remove any '?>" in the include files as they are not needed.

-- 
regards,
Tom

--- End Message ---
--- Begin Message ---
   Farid,

   Can you copy each .php file to a .phps extension and link us to it?
That will allow us to view the source of each page and see for ourselves.
If there's any private information (passwords, database info, etc.),
however, please DO NOT do this.  Only if it's a simple HTML-style page.

On 5/10/07, Tom Rogers <[EMAIL PROTECTED]> wrote:

Hi,

Wednesday, May 9, 2007, 11:13:50 PM, you wrote:
FJ> Hello,

FJ> To me this seems to be a very strange problem.

FJ> I have a static html page (index.html) that shows correctly on both
FF2 &
FJ> IE7.

FJ> I splitted the website up into different sections: (header, footer,
...). To
FJ> do this I have used:
FJ> --------------------------------------------------------------
FJ> <?php
FJ> require("header.php");
?>>
FJ> Some code goes here...
FJ> <?php
FJ> require("footer.php");
?>>
FJ> --------------------------------------------------------------
FJ> .... and so on.
FJ> When I test my page (now index.php), it shows perfect on Firefox, but
in IE
FJ> some stuff are not in their right place. I have checked the source
code of
FJ> both index.html and index.php and they seem both identical to me.

FJ> Do you know why IE fails to correctly render the page?

FJ> Thanks


Could be stray carriage returns in your include files, good idea to
remove any '?>" in the include files as they are not needed.

--
regards,
Tom

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




--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

--- End Message ---
--- Begin Message ---
Thanks Daniel, Greg, Richard,

I made a script with:
<?php
print_r($_ENV);
?>
and it results only into: "Array ( )" nothing else ...
So it must be caused by a "different" environment ?
All I want is to check the $_ENV['OS'] within PHP scripts.

Regards, Cor
  ----- Original Message ----- 
  From: Daniel Brown 
  To: C.R.Vegelin 
  Cc: [EMAIL PROTECTED] 
  Sent: Wednesday, May 09, 2007 5:26 PM
  Subject: Re: [PHP] getting $_ENV variables



      When I print_r($_ENV); from the CLI on 5.0.4 I get a bunch of results, no 
problem.... but no $_ENV['OS'] variable.  Further, when I check my phpinfo(); 
output, there are even fewer $_ENV variables printed than the CLI offers. 

      I'm not certain about this, Cor, but my guess is that PHP 5.x.x may have 
altered the default $_ENV output to hide some of this information --- which is 
a good thing, in my opinion, because then you won't just have some 
run-of-the-mill script kiddie checking out the details of a box for known 
security holes. 

      Of course, that doesn't necessarily stop <? passthru('uname -a')."\n"; ?> 
or checking the $_SERVER['SERVER_SIGNATURE'] variable for the OS 
information.... so perhaps this response is just one of those white-bread 
responses.  Something to chew on, but you really don't get anything from it. 



  On 5/9/07, C.R.Vegelin <[EMAIL PROTECTED]> wrote:
    Hi All,

    I get nothing when using: echo $_ENV['OS'];
    Also nothing when using: print_r($_ENV);
    However, phpinfo(); show a full list of ENV settings.
    How to get $_ENV variables ?
    I am using PHP version 5.2.0.

    TIA, Cor



  -- 
  Daniel P. Brown
  [office] (570-) 587-7080 Ext. 272
  [mobile] (570-) 766-8107 

--- End Message ---
--- Begin Message ---
On 09 May 2007 16:36, [EMAIL PROTECTED] wrote:

> Ford, Mike writes:
> 
> > > > You can also set up php.ini and use the built-in sessions with
> > > > http://php.net/session_start so that PHP will take care of this
> > > > for you.
> > > 
> > > That is what I was intending to do.  How do I find out if
> > > whether or not the session cookie was accepted using the
> > > built-in sessions? I found no function for such a test.
> > 
> > Check the SID constant after you've done session_start(). If it has
> > an empty value, the session is using cookies; otherwise, it'll have
> > a value of the form 'sessionname=sessionid', which is what is
> > appended to the URL (or inserted in forms as a hidden value) to
> > propagate the session-id.
> 
> Interesting idea.
> 
> This brings up a question.  In order to decide whether to use cookies
> or SID the built-in sessions must be testing to see if the user's
> browser will accept the session cookies.  How do they do that?

By sending it out and checking to see whether it comes back on the next page.

Assuming your setup is:

session.use_cookies = On
session.use_only_cookies = Off
session.use_trans_sid = On

Then the sequence is this:

1. The first page involving a session will *both* send the cookie *and* append 
the SID to URLs in the page.

2. So the next page request will return the SID, and if cookies are enabled 
also the cookie.

3. On starting the session for this page, PHP will first look for the cookie: 
if it's present, its value will be used and SID defined as empty; if not, the 
browser must not be accepting cookies, so the value from the URL query string 
is used and SID is defined with the matching string.

4. PHP now knows whether cookies are in use *for this request*, and *either* 
sends the cookie *or* appends the SID to URLs in the page.

5. Requests from this page will thus *either* return the cookie *or* include 
the SID as a URL get parameter.

6. Go back to 3.

Note that with this setup, you will *always* get at least one request with the 
SID in the URL.  Any site that doesn't do this has use_only_cookies turned on 
or/and use_trans_sid turned off.

 
> If they do it by the "2 page", send a cookie and see if it comes
> back to the second page method we have been talking about, then
> somehow, they are sureptiously inserting a forward to a non-
> existant page!  Right?  How do they do that?

No, see above: they simply wait for the next regular page request to come in 
and see if the cookie came with it. Nothing surreptitious or super-clever.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

--- End Message ---
--- Begin Message ---
JavaScript (and AJAX) took the fun out of programming.

Before AJAX, programming for web was easy and fast. Now its the oposite.


----- Original Message ----- From: "jekillen" <[EMAIL PROTECTED]>
To: "Emil Edeholt" <[EMAIL PROTECTED]>
Cc: "PHP List" <[EMAIL PROTECTED]>
Sent: Wednesday, May 09, 2007 10:03 PM
Subject: Re: [PHP] Ajax?



On May 9, 2007, at 8:04 AM, Emil Edeholt wrote:

Hi!

What do you guys use to develop ajax applications and do you have any good articles on the subject?

I've just about finished an ajaxish site but it wasn't fun. A lot of nesting javascript inside php calls, having to write the logic both in javascript and php and so on. The source looks ugly and was time consuming to debug.

Thanks!


Anything involving javascript development has several built in debugging facilities 1: Alert dialogs: You may find it a chore to learn how to use them effectively. But the current content of any variable can be displayed with an alert dialog. You have to pay attention to how strings are concatenated; with +, The actual
   variable name cannot be quoted.
2: Browser error reporting, in Netscape species, javascript console. Take a hint, all source code text should be formated for Unix/Linux ( line feed line endings) If you do scripting on a Classic Mac OS <= OS9, the line endings are carriage;
    and Windows uses both carriage return and line feed.
return. You will drive your self crazy cussing the console because it will not refer
    to lines containing syntax errors, but some disrelated lines.
3. View source window in browser to see exactly what the browser is getting on
    page load.
4. Forms: I have coded special forms just for the sake of development and debug of javascript apps. All globals are visible through out the script, WITH THE EXCEPTION OF SOME THAT ARE DEFINED IN SOURCED JS FILES; Opening a javascript window is in a function does not seem to register if the function is in a sourced file. 5. Patience, patience, patience, some masochism, Several large available paper back text books. No one will describe all you might need to know about issues like rollovers, DHTML, etc, Imagination and ingenuity, or the will to search and sift through others source code until you find what you are looking for, and then making it work for you. That's it, I have some suggestion that there are systems available for javascript but I
  have done without long enough to have my methods and approaches.
One more thing, php and javascript work very well together. I have even written a function to display php variable values as javascript alert dialogs. It will not function as break points for php like it does with javascript, but at least you do not have to
decipher php error smeared all over the screen.
And Ajax, even though I have not cracked that particular aspect of javascript as yet,
looks very worthwhile.
Jeff K

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




--
No virus found in this incoming message.
Checked by AVG Free Edition. Version: 7.5.467 / Virus Database: 269.6.4/790 - Release Date: 5/5/2007 10:34



--- End Message ---

Reply via email to