php-general Digest 30 Jun 2003 14:34:21 -0000 Issue 2148

Topics (messages 153356 through 153411):

Re: A simpler question involving http_user_agent
        153356 by: Mike Migurski
        153357 by: - Edwin -

Re: File Uploads!
        153358 by: Tom Rogers
        153382 by: Jason Wong
        153392 by: Catalin Trifu

Re: php.net's custom 404 scripts
        153359 by: - Edwin -
        153361 by: David Otton
        153374 by: olinux

Re: Japanese text not displaying correctly.
        153360 by: - Edwin -

Re: Full Text Search of M$ Office Documents
        153362 by: - Edwin -

Passing form value into another form value?
        153363 by: Miranda, Joel Louie M
        153364 by: Tom Rogers
        153367 by: Miranda, Joel Louie M
        153368 by: Leif K-Brooks
        153369 by: Miranda, Joel Louie M
        153379 by: Miranda, Joel Louie M

Re: PHPSESSID Length?
        153365 by: Jason Sheets

Re: Close Connection to Browser
        153366 by: Jason Sheets

Re: PHP5 with MySQL on windows
        153370 by: John Coggeshall

Help needed
        153371 by: Nirmala  P
        153372 by: Nirmala  P
        153373 by: Haseeb
        153388 by: Nirmala  P
        153389 by: Pete Morganic
        153393 by: Nirmala  P
        153394 by: Pete Morganic

Licenses -- was Re: [PHP][PHP-DEV][PHP-QA] PHP 5.0.0 Beta 1
        153375 by: Joel Rees

Re: [PEAR-DEV] Re: [PHP] PHP 5.0.0 Beta 1
        153376 by: Roman Neuhauser

UPS
        153377 by: Daryl Meese

Curl
        153378 by: Daryl Meese
        153410 by: Daryl Meese

Using Different Fonts on Web Via generated Image
        153380 by: Miranda, Joel Louie M
        153381 by: Sævar Öfjörð

which GD
        153383 by: Andrew McCombe
        153384 by: - Edwin -

PHP Sessions and Cookies
        153385 by: Matt MacLeod

How do I use $HTTP_*_VARS[]
        153386 by: Ivan Carey
        153387 by: Catalin Trifu

please help
        153390 by: Nabil
        153391 by: Shivanischal A

preg_match?
        153395 by: Brian S. Drexler

[NEW] XML-PHP Forums
        153396 by: sterling.bumblebury.com

Re: preg_match? [SOLVED]
        153397 by: Brian S. Drexler
        153398 by: Adam Voigt

Re: time calcs
        153399 by: Wendell Brown

Else If/Elseif
        153400 by: Stevie Peele
        153401 by: Mario Oberrauch
        153402 by: Reuben D. Budiardja
        153403 by: Tularis
        153404 by: Brian V Bonini
        153406 by: Reuben D. Budiardja

Forms
        153405 by: Simon Chappell
        153407 by: Petre Agenbag

Re: IsSet() and $_SESSION
        153408 by: John Manko
        153409 by: Ford, Mike               [LSS]

Re: web site security: how to hide login info for  mysql-connection
        153411 by: Mark

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 ---
>Would anyone happen to know what http_user_agent would be if the user is
>visitng from an internet enabled cell phone (e.g. sprint pcs phone or
>similar)?

It may or may not be one of these:
http://www.thewirelessfaq.com/useragents.asp



---------------------------------------------------------------------
michal migurski- contact info and pgp key:
sf/ca            http://mike.teczno.com/contact.html


--- End Message ---
--- Begin Message ---
"Brian J. Celenza" <[EMAIL PROTECTED]> wrote:

> Would anyone happen to know what http_user_agent would be if the user is
> visitng from an internet enabled cell phone (e.g. sprint pcs phone or
> similar)?

Try Google or the archives. Maybe this will help:

  http://marc.theaimsgroup.com/?l=php-general&m=104394135908378&w=2

Or, better yet, try the cellphone's (company's) site--they should have some info on 
what http_user_agent strings their cellphones are using (mine does)...

- E -


__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


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

Monday, June 30, 2003, 4:14:02 AM, you wrote:
JW> On Sunday 29 June 2003 20:40, Tom Rogers wrote:

>> Maybe you have to wind up the post_max_size in php.ini and then control
>> with MAX_FILE_SIZE in the form for the error to show up in the $_FILES
>> array....

JW> "MAX_FILE_SIZE in the form" is client-side, for the benefit of the browser. 
JW> *IF* the browser supports it then IT would stop the upload of files larger 
JW> than MAX_FILE_SIZE.

JW> -- 
Jason Wong ->> Gremlins Associates -> www.gremlins.biz
JW> Open Source Software Systems Integrators
JW> * Web Design & Hosting * Internet & Intranet Applications Development *
JW> ------------------------------------------
JW> Search the list archives before you post
JW> http://marc.theaimsgroup.com/?l=php-general
JW> ------------------------------------------
JW> /*
JW> The early bird gets the coffee left over from the night before.
JW> */

php also checks for MAX_FILE_SIZE as you can see in rfc1867.c


while (!cancel_upload && (blen = multipart_buffer_read(mbuff, buff, sizeof(buff) 
TSRMLS_CC)))
{
        if (total_bytes > PG(upload_max_filesize)) {
                sapi_module.sapi_error(E_WARNING, "upload_max_filesize of %ld bytes 
exceeded - file [%s=%s] not saved", PG(upload_max_filesize), param, filename);
                cancel_upload = UPLOAD_ERROR_A;
        } else if (max_file_size && (total_bytes > max_file_size)) {
                sapi_module.sapi_error(E_WARNING, "MAX_FILE_SIZE of %ld bytes exceeded 
- file [%s=%s] not saved", max_file_size, param, filename);
                cancel_upload = UPLOAD_ERROR_B;
        } else if (blen > 0) {
                wlen = fwrite(buff, 1, blen, fp);

                if (wlen < blen) {
                        sapi_module.sapi_error(E_WARNING, "Only %d bytes were written, 
expected to write %ld", wlen, blen);
                        cancel_upload = UPLOAD_ERROR_C;
                } else {
                        total_bytes += wlen;
                }
        } 
}

So I set max post to something huge then control it on a form by form
basis,, which seems to work fine and fills in the error bit for me if
it is too big

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
On Monday 30 June 2003 07:06, Catalin Trifu wrote:

>     I used MAX_FILE_SIZE too in the form which
> uploads the file (the input field is before the file field)
> and I am using IE6 for testing and still the file pass through to
> the server.

> > *IF* the browser supports it then IT would stop the upload of files
> > larger than MAX_FILE_SIZE.

It would only work IF the browser supported it. The fact that it didn't work 
(ie didn't prevent the upload) would suggest that IE doesn't support it?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
zeal, n.:
        Quality seen in new graduates -- if you're quick.
*/


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

    In case someone is interested I found the workaround.
    1. IE6 does not take into consideration MAX_FILE_SIZE,
so one can not rely on it on client side.
    2. If the uploaded file exceeds the post_max_size, the PHP
engine (4.3.1 in my case) does not give you any error in the PHP
script which handles the upload, nor does it take into consideration
MAX_FILE_SIZE. It simply logs the error as shown and does
not even parse the post data anymore.
    So, the workaround is to make the post_max_size large enough
so that it fits, like 100MB and the PHP will take into consideration
the MAX_FILE_SIZE, discard the upload and give you the
$_FILES['userfile']['error'] = UPLOAD_ERR_FORM_SIZE
    I for one consider this a flaw in the engine.
    Anyway, hope this helps,

Catalin

"Catalin Trifu" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>         Hi,
>
>     This is the error I get in the log file:
> [error] PHP Warning:  POST Content-Length of 11184886 bytes exceeds the
> limit of 8388608 bytes in Unknown on line 0
>
>     This is absolutely correct. The problem is
> this error does not reach my PHP script and I
> have no idea how can I tell my user he posted
> a file which exceds the size.
>     The $_FILES is empty, same for $HTTP_...
>     Any idea is appreciated.
>
> Cheers,
> Catalin
>
>



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

Justin French <[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I used to have a bookmark for how php.net's custom 404/redirect/search
> script worked, but I can't find it now, and can't see it on php.net... has
> anyone got a link?
> 
> Not sure if it was on zend.com or php.net.
> 

Not sure what exactly you're looking for but...

You can try triggering a 404 then click on the "show source" at the 
bottom-right-hand-side of the page...

- E -


__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message ---
On Mon, 30 Jun 2003 11:26:50 +1000, you wrote:

>I used to have a bookmark for how php.net's custom 404/redirect/search
>script worked, but I can't find it now, and can't see it on php.net... has
>anyone got a link?

I guess you're looking for Apache's ErrorDocument directive. It's in the
manual.


--- End Message ---
--- Begin Message ---
here's a couple:

Custom Error 404 Documents with PHP
http://www.phpfreaks.com/tutorials/21/0.php

Creating Custom PHP 404 Error Pages
http://www.phpbeginner.com/columns/ray/404/1

depending what you are doing this might help too ...
Building Dynamic Pages With Search Engines in Mind
http://www.phpbuilder.com/columns/tim20000526.php3

olinux


--- Justin French <[EMAIL PROTECTED]> wrote:
> Hi all,
> 
> I used to have a bookmark for how php.net's custom
> 404/redirect/search
> script worked, but I can't find it now, and can't
> see it on php.net... has
> anyone got a link?
> 
> Not sure if it was on zend.com or php.net.
> 
> 
> TIA
> Justin
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--- End Message ---
--- Begin Message ---
On Fri, 27 Jun 2003 18:12:29 -0700
"Dennis Browne" <[EMAIL PROTECTED]> wrote:

> E-,
> 
> Thanks for the reply ... echoing just the Japanese characters displays just fine 
> with both Netscape 4.7+ and IE 5+.
> 
> 
> With the include (both saved as utf8) is where the problem occurs. I have seen posts 
> about the BOM of the include file getting in the way. I do not know a work around 
> though.
> 
> 
> Any ideas?
> 

Try changing the internal encoding to utf-8. (in php.ini, that is. Not sure how it'll 
work though...) I'm using euc-jp and I just use mb_convert_encoding() when necessary...

- E -

...[snip]...
__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


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

"Feroze Md. Arif" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I am looking for a solution that will allow full text search of M$Office
> files (Word, Powerpoint, EXCEL), PDF, HTML and Text files.
> 
> I am working on a project that involves uploading of the above files to a
> server. After uploading, the Users should be able to search for key words or
> phrases in the file.  The search should throw up a list like the ones we get
> on Google.
> 
> Should I use Open Source Search Engines such as HTDig, Swish or Namazu?  Can
> these be integrated into a PHP application?  I would appreciate it very much
> if someone could provide me with some information on this.
> 

Not sure about the others but I believe Namazu has all the extensions you need. 
Besides, there's a Namazu module that you can use in php. Infos I know are all in 
Japanese though...

- E -

__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message ---
Im a beginner and was hoping if you could help me on passing a value into a
form and into another form? Im not sure what do you call that sequence but I
hope you could get me into a howto section to do that or give me something
nice.

Thanks


--
Louie

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

Monday, June 30, 2003, 2:41:59 PM, you wrote:
MJLM> Im a beginner and was hoping if you could help me on passing a value into a
MJLM> form and into another form? Im not sure what do you call that sequence but I
MJLM> hope you could get me into a howto section to do that or give me something
MJLM> nice.

MJLM> Thanks


MJLM> --
MJLM> Louie

Take the value from the first form and pass it in the second using a
hidden field..


//from first form

$value = $_post['value']

//second form

<form action......>
<input type="hidden" name="value" value="<?php echo $value?>">
.
.
.
</form>

-- 
regards,
Tom


--- End Message ---
--- Begin Message ---
This is what I have made, im not sure if its correct.

---
<form action"" method="GET" name="">
enter name: <input type="text" name="name"><br>
enter email: <input type="text" name="email">
<?php
$value_name = $_post['name']
$value_email = $_post['email']
?>
<br><br>
<input type="submit" value="Collect Data">
</form>
---



--
Louie

-----Original Message-----
From: Tom Rogers [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 30, 2003 12:43 PM
To: Miranda, Joel Louie M
Cc: '[EMAIL PROTECTED]'
Subject: Re: [PHP] Passing form value into another form value?


Hi,

Monday, June 30, 2003, 2:41:59 PM, you wrote:
MJLM> Im a beginner and was hoping if you could help me on passing a 
MJLM> value into a form and into another form? Im not sure what do you 
MJLM> call that sequence but I hope you could get me into a howto 
MJLM> section to do that or give me something nice.

MJLM> Thanks


MJLM> --
MJLM> Louie

Take the value from the first form and pass it in the second using a hidden
field..


//from first form

$value = $_post['value']

//second form

<form action......>
<input type="hidden" name="value" value="<?php echo $value?>"> . . . </form>

-- 
regards,
Tom

--- End Message ---
--- Begin Message --- Miranda, Joel Louie M wrote:

This is what I have made, im not sure if its correct.

---
<form action"" method="GET" name="">
enter name: <input type="text" name="name"><br>
enter email: <input type="text" name="email">
<?php
$value_name = $_post['name']
$value_email = $_post['email']
?>
<br><br>
<input type="submit" value="Collect Data">
</form>
---

Believe it or not, creating a variable called $value_* isn't going to magically set an input box's value. Did you even read the example?!

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.



--- End Message ---
--- Begin Message ---
Dude,

As far as my first email is concerned im a newbie, so please bear w/ me if
you want to.


--
Louie

-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 30, 2003 1:32 PM
To: Miranda, Joel Louie M
Cc: 'Tom Rogers'; '[EMAIL PROTECTED]'
Subject: Re: [PHP] Passing form value into another form value?


Miranda, Joel Louie M wrote:

>This is what I have made, im not sure if its correct.
>
>---
><form action"" method="GET" name="">
>enter name: <input type="text" name="name"><br>
>enter email: <input type="text" name="email">
><?php
>$value_name = $_post['name']
>$value_email = $_post['email']
>?>
><br><br>
><input type="submit" value="Collect Data">
></form>
>---
>
Believe it or not, creating a variable called $value_* isn't going to 
magically set an input box's value.  Did you even read the example?!

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized
attempt to decrypt it will be prosecuted to the full extent of the law.



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

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

My script is working now. I tried a different approach


--
Louie

-----Original Message-----
From: Miranda, Joel Louie M 
Sent: Monday, June 30, 2003 1:49 PM
To: 'Leif K-Brooks'
Cc: 'Tom Rogers'; '[EMAIL PROTECTED]'
Subject: RE: [PHP] Passing form value into another form value?


Dude,

As far as my first email is concerned im a newbie, so please bear w/ me if
you want to.


--
Louie

-----Original Message-----
From: Leif K-Brooks [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 30, 2003 1:32 PM
To: Miranda, Joel Louie M
Cc: 'Tom Rogers'; '[EMAIL PROTECTED]'
Subject: Re: [PHP] Passing form value into another form value?


Miranda, Joel Louie M wrote:

>This is what I have made, im not sure if its correct.
>
>---
><form action"" method="GET" name="">
>enter name: <input type="text" name="name"><br>
>enter email: <input type="text" name="email">
><?php
>$value_name = $_post['name']
>$value_email = $_post['email']
>?>
><br><br>
><input type="submit" value="Collect Data">
></form>
>---
>
Believe it or not, creating a variable called $value_* isn't going to 
magically set an input box's value.  Did you even read the example?!

-- 
The above message is encrypted with double rot13 encoding.  Any unauthorized
attempt to decrypt it will be prosecuted to the full extent of the law.



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

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

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

Take a look at session_id, you can use it to get or set the session id.

Using some of my random generation functions I juse 72 to 96 character session ids for my more secure PHP applications. Remember if you want it to remain secure you need to pass it through SSL, longer keys do no good if someone is packet sniffing.

Jason

Henrik Hudson wrote:

Hey List-

I'm trying to figure out how to make the PHPSESSID cookie be longer then 32 characters?

One can set the entropy file and entropy length, but if my understanding of entropy is correct then that just helps randomize the 32 chars and not not actually make a string that much longer or shorter.

Can't seem to find anything in the archives or Google.

Then again, is a 32-length string sufficient for protecting a browser session length of "session"?

Thanks.

Henrik


--- End Message ---
--- Begin Message --- Take a look at register_shutdown_function, it sounds like it might do what you want just be aware that you obviously can't display output once the connection is closed because no one is listening .

void register_shutdown_function ( callback function)


Registers the function named by function to be executed when script processing is complete. If the function function does not exist (undefined), an error of level E_WARNING is generated.



Thomas Weber wrote:


Hi,

is it possible to close the connection to the client/browser without calling
exit?
I have an input-script for a chat-system, wich gives a Status 204 No Content
to the client after submit, wich works great. The problem is, that sometimes
the script needs some time to finish after sending the 204 and keeps the
connection over this time, wich couses Internet Explorer and sometimes even
Mozilla to crash if too much connections to the script are active.

Thanks,
Thomas 'Neo' Weber
---
[EMAIL PROTECTED]
[EMAIL PROTECTED]




--- End Message ---
--- Begin Message ---
On Sun, 2003-06-29 at 14:19, [EMAIL PROTECTED] wrote:
> However, MySQL support is no longer there. There doesn't seem to by any dll
> for mysql in the extensions subdirectory. 

http://bugs.php.net/bug.php?id=24389

This issue has been addressed and is now available in the snap build of
PHP5.0 available at http://snaps.php.net/ 

John
-- 
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org                 http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-


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

I am new to PHP world.

Could any body tell me how to call any function(written in PHP) from Java script.
Actually my PHP function return a string value which i need to access in my java script code.


Thanks in Advance..

Nirmala
___________________________________________________
Click below to experience Sooraj Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik Roshan,
Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com


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

I am new to PHP world.

Could any body tell me how to call any function(written in PHP) from Java script.
Actually my PHP function return a string value which i need to access in my java script code.


Thanks in Advance..

Nirmala
___________________________________________________
Click below to experience Sooraj Barjatya's latest offering
'Main Prem Ki Diwani Hoon' starring Hrithik Roshan,
Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com


--- End Message ---
--- Begin Message ---
hi,
here is how you do it
<?
    $strJavaScriptValue="Hello";
?>
<script language="JavaScript">
    alert('<? echo $strJavaScriptValue?>');
</script>

this will alert "Hello!". i think you get the point.
Haseeb

----- Original Message ----- 
From: "Nirmala P" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2003 10:45 AM
Subject: [PHP] Help needed


> Hi All,
> 
> I am new to  PHP world.
> 
> Could any body tell me how to call any function(written in PHP) 
>  from  Java script.
> Actually my PHP function return a string value  which i need to 
> access in my java script code.
> 
> Thanks in Advance..
> 
> Nirmala
> ___________________________________________________
> Click below to experience Sooraj Barjatya's latest offering
> 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan,
> Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Hi list,
This time i am pasting my code could any body tell where wrong I am ?


<?
  function LangItem($field,$lang)
  {
   $db = mysql_connect("localhost", "root");
   /*Check For Connection to local host*/

if(!$db) echo("Connect to localhost mysql database failed");

if(!mysql_select_db("eshop",$db)) echo ("Selection of eshop failed on MySQL database");

$Sql = "SELECT " . $field ." FROM language where LangCode = "."'".$lang."'";

$result = mysql_query($Sql,$db);

   if($result)
   {

     $myrow = mysql_fetch_array($result);
     $value = $myrow[$field];
   }
   else echo ("<h1> No Record Found</h1>");
   return($value);
  }
?>

<script language="JavaScript">
  FieldName = "Material";
  LangName = "E";
  alert(<? LangItem(FieldName,LangName)?>);
</script>


Loking for help.. Nirmala ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com


--- End Message ---
--- Begin Message --- Nirmala P wrote:

Hi list, This time i am pasting my code could any body tell where wrong I am ?

<?
  function LangItem($field,$lang)
  {
   $db = mysql_connect("localhost", "root");
   /*Check For Connection to local host*/

if(!$db) echo("Connect to localhost mysql database failed");

if(!mysql_select_db("eshop",$db)) echo ("Selection of eshop failed on MySQL database");

$Sql = "SELECT " . $field ." FROM language where LangCode = "."'".$lang."'";

$result = mysql_query($Sql,$db);

   if($result)
   {

     $myrow = mysql_fetch_array($result);
     $value = $myrow[$field];
        //******** return valus
        return($value);

}
else echo ("<h1> No Record Found</h1>");
}
?>


<script language="JavaScript">
  FieldName = "Material";
  LangName = "E";
//******** included in quotes and php tag

alert('<?php LangItem(FieldName,LangName)?>');

</script>


Loking for help.. Nirmala ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com



--- End Message ---
--- Begin Message --- Hi Pete Morganic ,
Thanks for reply. But the code is not solving my problem. May be I did not epress my problem clearly.
Actually I wanted to store the returned value so that I can write it on page like
{ test = <?php LangItem(FieldName,LangName)?>');
document.write(test);
}
and moreover the value I am passing is "material" and "E" is not getting parsed to PHP function. PHP function input for $field and $lang will be FieldName and LangName only.


looking for help
regards
Nirmala P.


On Mon, 30 Jun 2003 Pete Morganic wrote :
Nirmala P wrote:

Hi list,
This time i am pasting my code could any body tell where wrong I am ?


<?
  function LangItem($field,$lang)
  {
   $db = mysql_connect("localhost", "root");
   /*Check For Connection to local host*/

if(!$db) echo("Connect to localhost mysql database failed");

if(!mysql_select_db("eshop",$db)) echo ("Selection of eshop failed on MySQL database");

$Sql = "SELECT " . $field ." FROM language where LangCode = "."'".$lang."'";

$result = mysql_query($Sql,$db);

   if($result)
   {

     $myrow = mysql_fetch_array($result);
     $value = $myrow[$field];
//******** return valus
return($value);

   }
   else echo ("<h1> No Record Found</h1>");
     }
?>

<script language="JavaScript">
  FieldName = "Material";
  LangName = "E";
//******** included in quotes and php tag

alert('<?php LangItem(FieldName,LangName)?>');

</script>


Loking for help.. Nirmala ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com



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


___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com


--- End Message ---
--- Begin Message --- Where does thejavascript fit ?


Nirmala P wrote:
Hi Pete Morganic ,
Thanks for reply. But the code is not solving my problem. May be I did not epress my problem clearly.
Actually I wanted to store the returned value so that I can write it on page like
{ test = <?php LangItem(FieldName,LangName)?>');
document.write(test);
}
and moreover the value I am passing is "material" and "E" is not getting parsed to PHP function. PHP function input for $field and $lang will be FieldName and LangName only.


looking for help
regards
Nirmala P.


On Mon, 30 Jun 2003 Pete Morganic wrote :


Nirmala P wrote:


Hi list, This time i am pasting my code could any body tell where wrong I am ?

<?
  function LangItem($field,$lang)
  {
   $db = mysql_connect("localhost", "root");
   /*Check For Connection to local host*/

if(!$db) echo("Connect to localhost mysql database failed");

if(!mysql_select_db("eshop",$db)) echo ("Selection of eshop failed on MySQL database");

$Sql = "SELECT " . $field ." FROM language where LangCode = "."'".$lang."'";

$result = mysql_query($Sql,$db);

   if($result)
   {

     $myrow = mysql_fetch_array($result);
     $value = $myrow[$field];

//******** return valus return($value);

   }
   else echo ("<h1> No Record Found</h1>");
     }
?>

<script language="JavaScript">
  FieldName = "Material";
  LangName = "E";

//******** included in quotes and php tag


alert('<?php LangItem(FieldName,LangName)?>');


</script>


Loking for help.. Nirmala ___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com



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


___________________________________________________ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan & Kareena Kapoor http://www.mpkdh.com



--- End Message ---
--- Begin Message ---
> Hello,
> 
> On 06/29/2003 04:16 PM, Sascha Schumann wrote:
> >>>>  - Due to issues surrounding the MySQL 4.0 license, the MySQL libraries
> >>>>    are no longer bundled with PHP.  For more information on these
> >>>>    licensing changes please see the MySQL licensing policy [1]
> >>>>
> >>>>[1] http://www.mysql.com/products/licensing.html
> >>>
> >>>I read the licensing information in the above link, but I'm curious what
> >>>exactly in it necessitated the need to unbundle MySQL? Anyone have a
> >>>quick answer?
> > 
> > 
> >     Note that the bundled library code was removed due to being
> >     unmaintained.  The old bundled library code was in the public
> >     domain and thus not subject to the GPL.  Only the MySQL 4
> >     library is GPLed; the MySQL 3 library is not.
> > 
> >     It is unfortunate that some people try to confuse the public
> >     about this topic.

Well, in this particular case, the confusion may not be incorrect. (So
to speak.)

> Many people think that all Open Source software has a GPL license. I 
> guess it is that old Lenine say, if you repeat the same lie many times, 
> it becomes the truth, that today is known as propaganda. Credits for 
> this "Open Source lie" should go to RMS.

I'd lay the blame elsewhere. 

Stallman's writings are fairly direct and concise. He has helped clarify
the semantics of "free", and he has contrasted the sort of freedom he
expounds with other concepts of freedom and openness. Whether you agree
with him or not, his arguments and ideas are useful in both intellectual
and business senses.

You don't have to agree with people to learn from them, and you don't
even have to agree with people to let them do their work, in general.

The FUD comes from other sources.

> Anyway, MySQL 3 library seems to work perfectly to connect to MySQL 4 
> servers. What are MySQL 4 client library advantages?

It's the maintenance issue.

> Anyone thought of keep the bundle of MySQL 3 library? Was there a 
> problem, or is this unbundling initiative a sort of protest to make 
> MySQL AB reconsider MySQL 4 client library licensing?

There was a long thread (more than one, in fact) on this subject on the
postgresql list(s), which referenced a thread on the php-dev list:

    http://marc.theaimsgroup.com/?l=postgresql-general&m=105631920423234&w=2
    http://marc.theaimsgroup.com/?l=php-dev&m=105621207500778&w=2

Of course, the issue of the license the driver falls under is mostly one
of convenience, at least for the application programmer and end-user, I
think. It doesn't really alter the legal status of most projects using
MySQL and PHP (when the parts are assembled correctly), nor does it
alter the moral/enlightened-self-interest obligations to pass some of
the action back to the producers of free/open tools that help one make
money.

For MySQL AB, it will likely mean taking a slip in market share, since
they lose their "favored" status in the PHP community. From what I've
seen, Monty's a fairly sharp guy. For all I know, this may be a
deliberate move to level the playing field and let the free/open source
community get a broader view of some of the alternatives to the DB
software sold by the primary source of the FUD.

(my JPY 2)

-- 
Joel Rees, programmer, Kansai Systems Group
Altech Corporation (Alpsgiken), Osaka, Japan
http://www.alpsgiken.co.jp


--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2003-06-29 14:53:40 -0400:
> On Sun, 2003-06-29 at 14:19, Sterling Hughes wrote:
> >
> >   - Due to issues surrounding the MySQL 4.0 license, the MySQL libraries
> >     are no longer bundled with PHP.  For more information on these
> >     licensing changes please see the MySQL licensing policy [1]
> >
> > [1] http://www.mysql.com/products/licensing.html
> 
> I read the licensing information in the above link, but I'm curious what
> exactly in it necessitated the need to unbundle MySQL? Anyone have a
> quick answer?

    "1. Free use for those who are 100% GPL"

        IOW, it's not free for PHP

    "2. Free use for those who never copy, modify or distribute"

        IOW, it's not free for PHP

    3. GPL would infect the whole PHP tree

        http://www.gnu.org/copyleft/gpl.html

-- 
If you cc me or remove the list(s) completely I'll most likely ignore
your message.    see http://www.eyrie.org./~eagle/faqs/questions.html

--- End Message ---
--- Begin Message ---
If anybody has implemented UPS's shipping registration software using PHP &
Curl and found away around the error "the xml document is poorly formed"
when it was not please let me know how.

Sorry for the lack of detail but UPS is FULL OF Lawyers and I don't want to
violate the license agreement.

Another question, are there any characters that would break the
CurlOPT_POSTFIELDS operation.  I think some characters in the input they are
requesting back may be causing the failure.

Thanks,

Daryl


--- End Message ---
--- Begin Message ---
Is there any good way to see exactly what Curl is sending as a request?

Daryl

--- End Message ---
--- Begin Message ---
Well, I have printed the variable but, I thinks some character in my post
may be messing things up.  So, while I know the variable I need to see if
that is actually what is sent.

Daryl

-----Original Message-----
From: Suhas Pharkute [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 8:29 AM
To: Daryl Meese
Subject: Re: [PHP] Curl


You can form the url forst in a variable echo it for testing
and then u can send variable to curl
Suhas

----- Original Message -----
From: "Daryl Meese" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2003 1:32 AM
Subject: [PHP] Curl


> Is there any good way to see exactly what Curl is sending as a request?
>
> Daryl
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Can I generate an image using a different font? For example my font will be
Anonymous and we all know that on the client side if you don't have the
anonymous font it will display another font. But can we generate an image
using that font via php?

Thanks



--
Louie

--- End Message ---
--- Begin Message ---
Try this:
http://is2.php.net/manual/en/function.imagettftext.php


-----Original Message-----
From: Miranda, Joel Louie M [mailto:[EMAIL PROTECTED] 
Sent: 30. júní 2003 07:41
To: '[EMAIL PROTECTED]'
Subject: [PHP] Using Different Fonts on Web Via generated Image

Hello,

Can I generate an image using a different font? For example my font will
be
Anonymous and we all know that on the client side if you don't have the
anonymous font it will display another font. But can we generate an
image
using that font via php?

Thanks



--
Louie

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



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

My hosting company has disabled phpinfo().  How can I find out which version
of GD they have installed?



Regards
Andrew McCombe



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

"Andrew McCombe" <[EMAIL PROTECTED]> wrote:

> Hi
> 
> My hosting company has disabled phpinfo().  How can I find out which version
> of GD they have installed?
> 

http://www.php.net/manual/en/function.gd-info.php ?

Or, you could just ask them ;)

- E -


__________________________________________________
Do You Yahoo!?
Yahoo! BB is Broadband by Yahoo!
http://bb.yahoo.co.jp/


--- End Message ---
--- Begin Message --- Guys/Gals,
I've built a registration page on a site that stores a unique id for a user when they register. That id is then stored in a database and set as a session variable and as a cookie and is used to register personal user preferences.


The reason I use both is that I don't really want to make people log in everytime they revisit the site. I use the session so that people who have cookies turned off can still benefit from the personalisation. The cookie is used so that when a user revisits the site, they don't have to log in again.

I then have a script that I call in every page that checks for the session variable and the cookie. I have been testing the script using

echo $_SESSION['usr']; and
echo $_COOKIE['usr'];

and I get correct values for both. Unfortunately if I then close the browser, reopen it and visit the site, both the cookie and the session produce no values. Obviously, the session value should be blank, but the cookie should produce a value.

This is my 'global' cookie/session checker script:

<?php
session_start();

// CHECK IF SESSION EXISTS.
if (!isset($_SESSION['usr'])) {
// IF NO, THEN CHECK FOR COOKIE
if (isset($_COOKIE['usr'])) {
// IF 'YES' THEN START SESSION
$_SESSION['usr'] = $_COOKIE['usr'];
}
// IF 'YES' THEN QUIT }
else {
// IF THE SESSION EXISTS, MAKE SURE [EMAIL PROTECTED] VALUE MATCHES THAT OF THE COOKIE
setcookie("usr", $_SESSION['usr'], mktime(21,00,0,12,31,2014),"/","bigbarn0.kbnet.net", 0);
// END
}


?>

If anyone can point out an error, please do!

Thanks,
Matt


--- End Message ---
--- Begin Message ---
Hello,
I would like to be able to use $HTTP_*_VARS[].

When I was using  PHP 4.0.4PL1 I had no provlems sending form variables or
any other type of variables such as url variables from one page to another.
Now with PHP 4.2.3 I am unable to send variables from one page to another
unless I turn on register_globals.

How do I use $HTTP_*_VARS[] without a lot of recoding of all pages or do I
simply leave register_globals on.
Or is ther another way?

Thankyou,
Ivan


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

    I presume in the previous version you used register_globals=On
the trick is that you will have to chenge most of the scripts now.
    Now that you have moved to 4.2.3 version,
you should use the $_SERVER, $_REQUEST, $_POST, etc...
variables instead of $HTTP_*_VARS
    Btw. It's agood idea to leave register_globals off.

Cheers,
Catalin

"Ivan Carey" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hello,
> I would like to be able to use $HTTP_*_VARS[].
>
> When I was using  PHP 4.0.4PL1 I had no provlems sending form variables or
> any other type of variables such as url variables from one page to
another.
> Now with PHP 4.2.3 I am unable to send variables from one page to another
> unless I turn on register_globals.
>
> How do I use $HTTP_*_VARS[] without a lot of recoding of all pages or do I
> simply leave register_globals on.
> Or is ther another way?
>
> Thankyou,
> Ivan
>



--- End Message ---
--- Begin Message ---
I have a form like:

<select size="1" name="area">
.
.
while($row = mysql_fetch_array($result))
{
?>
<option value=<?=$row['area']?>><?=$row['area']?></option>
<?
.
.

1- if the fetched is only one word, i have no problem BUT
2- When i have $row=['area']  ecual to "happy day"  that came form MySQL (as
two word with a space).
3- I have a problem when submit the form , if i echo $_POST['area']  in the
action file .. i got only "happy"  without "day"

Please help me , because i m going to pull my hair off...

Nabil



--- End Message ---
--- Begin Message ---
<option value=<?=$row['area']?>><?=$row['area']?></option>

is the culprit. instead use

<option value="<?=$row['area']?>><?=$row['area']?>"</option>

what u missed were the double quotes around the value. u HAVE TO do that for
values with space in between .

regards,
-shiva




"Nabil" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I have a form like:
>
> <select size="1" name="area">
> .
> .
> while($row = mysql_fetch_array($result))
> {
> ?>
> <option value=<?=$row['area']?>><?=$row['area']?></option>
> <?
> .
> .
>
> 1- if the fetched is only one word, i have no problem BUT
> 2- When i have $row=['area']  ecual to "happy day"  that came form MySQL
(as
> two word with a space).
> 3- I have a problem when submit the form , if i echo $_POST['area']  in
the
> action file .. i got only "happy"  without "day"
>
> Please help me , because i m going to pull my hair off...
>
> Nabil
>
>



--- End Message ---
--- Begin Message ---
Ok, here is my problem.  I have a Postscript file that looks something like
this:

%!PS-Adobe-3.0
%%Title: Q-111BSD
%%Creator: Windows NT 4.0
%%CreationDate: 8:31 6/30/2003
%%Pages: (atend) .....

And I want to get the Q-111BSD into a variable but I can't figure out how to
keep it from grabbing the next line as well.  Does anyone have any idea how
I can do this?  Thanks in advance!

Brian


--- End Message ---
--- Begin Message ---
New forum, dedicated to XML/PHP, from the PHP/XML based site xmlmania.com
(main site currently in development).

Completely new, join NOW!

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

--- End Message ---
--- Begin Message ---
Sorry.  Must be Monday or something :-)

preg_match('/%%Title:(.*?)%%/i',$contents,$matches);



-----Original Message-----
From: Brian S. Drexler [mailto:[EMAIL PROTECTED]
Sent: Monday, June 30, 2003 8:35 AM
To: [EMAIL PROTECTED]
Subject: [PHP] preg_match?


Ok, here is my problem.  I have a Postscript file that looks something like
this:

%!PS-Adobe-3.0
%%Title: Q-111BSD
%%Creator: Windows NT 4.0
%%CreationDate: 8:31 6/30/2003
%%Pages: (atend) .....

And I want to get the Q-111BSD into a variable but I can't figure out how to
keep it from grabbing the next line as well.  Does anyone have any idea how
I can do this?  Thanks in advance!

Brian


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


--- End Message ---
--- Begin Message ---
Sounds like someone has a case of the Monday's.


On Mon, 2003-06-30 at 08:40, Brian S. Drexler wrote:
> Sorry.  Must be Monday or something :-)
> 
> preg_match('/%%Title:(.*?)%%/i',$contents,$matches);
> 
> 
> 
> -----Original Message-----
> From: Brian S. Drexler [mailto:[EMAIL PROTECTED]
> Sent: Monday, June 30, 2003 8:35 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP] preg_match?
> 
> 
> Ok, here is my problem.  I have a Postscript file that looks something like
> this:
> 
> %!PS-Adobe-3.0
> %%Title: Q-111BSD
> %%Creator: Windows NT 4.0
> %%CreationDate: 8:31 6/30/2003
> %%Pages: (atend) .....
> 
> And I want to get the Q-111BSD into a variable but I can't figure out how to
> keep it from grabbing the next line as well.  Does anyone have any idea how
> I can do this?  Thanks in advance!
> 
> Brian
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
-- 
Adam Voigt ([EMAIL PROTECTED])
Linux/Unix Network Administrator
The Cryptocomm Group


--- End Message ---
--- Begin Message ---
On Mon, 30 Jun 2003 07:31:59 -0500, Wendell Brown wrote:

>On Sun, 29 Jun 2003 15:19:56 -0400, Larry R. Sieting wrote:
>
>>I want to output the difference as a difference expressed in time 
>>format:  10:05:23 - 09:45:32 = 00:39:51
>
>Try this:
>
><?PHP
>
>    $tot_time = ($data['end_time'] - $data['start_time']);
>
>    echo strftime( "%H:%M:%S", $end_time ) . " - ";
>    echo strftime( "%H:%M:%S", $start_time ) . " = ";
>    echo gmstrftime( "%H:%M:%S", $tot_time );
>
>?>

Errrr.... I used the wrong variables in the previous message.  I also
assumed that the start and end times are actually TIME and not strings
(which appears to be the case since you are subtracting one from the
other).  If the start and end AREN'T time types you would have to
convert them first.  You should be able to use 'strtotime' or mktime to
convert them to time type.

Also, the gmstrtime used above would limit the time to 24 hours.  If
there is a possibility that the difference in time might be more than
24 hours you can do something like this:

  printf( "%d days %s",  (int)($tot_time / 86400),   gmstrftime(
"%H:%M:%S", $tot_time ) );

So, here is what I probably should have posted:

<?PHP

    $tot_time = ($data['end_time'] - $data['start_time']);

    echo strftime( "%H:%M:%S", $data['end_time'] ) . " - ";
    echo strftime( "%H:%M:%S", $data['start_time'] ) . " = ";
    printf( "%d days %s",  (int)($tot_time / 86400),   
        gmstrftime( "%H:%M:%S", $tot_time ) );

?>



--- End Message ---
--- Begin Message --- What is the difference between "else if" and "elseif"?


Thanks


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



--- End Message ---
--- Begin Message ---
> What is the difference between "else if" and "elseif"?
> 
> 
> Thanks

quote of http://www.php.net/manual/en/control-structures.elseif.php

"In PHP, you can also write 'else if' (in two words) and the behavior
would be identical to the one of 'elseif' (in a single word). The
syntactic meaning is slightly different (if you're familiar with C, this
is the same behavior) but the bottom line is that both would result in
exactly the same behavior."

therefore: a space :o)

-- 
Mario Oberrauch

-----------------------------------------------------------
CREATO - creative online systems - Spindler KEG
Hafenstrasse 47 - 51, 4020 Linz, Austria
Tel:      +43 (0) 732/9015 5940
Fax:      +43 (0) 732/9015 5949
Email:    [EMAIL PROTECTED]
-----------------------------------------------------------


--- End Message ---
--- Begin Message ---
On Monday 30 June 2003 09:30 am, Stevie Peele wrote:
> What is the difference between "else if" and "elseif"?

none

-RDB

--- End Message ---
--- Begin Message --- Stevie Peele wrote:
What is the difference between "else if" and "elseif"?


Thanks


_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail


else if shouldn't be used, use elseif, and the difference is non-existant


--- End Message ---
--- Begin Message ---
On Mon, 2003-06-30 at 09:30, Stevie Peele wrote:
> What is the difference between "else if" and "elseif"?
> 
> 

chr(32).. bwahahahah!!! Sorry. couldn't resist....


--- End Message ---
--- Begin Message ---
On Monday 30 June 2003 09:41 am, Tularis wrote:
> Stevie Peele wrote:
> > What is the difference between "else if" and "elseif"?
> >
> >
> > Thanks
> >
> > _________________________________________________________________
> > STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
> > http://join.msn.com/?page=features/junkmail
>
> else if shouldn't be used, use elseif, and the difference is non-existant

why not? If there's no difference, there is no difference. Meaning you can use 
one or the other. It's user preference. 

RDB


--- End Message ---
--- Begin Message ---
Hi can anyone help me with this?

I have been failing to get any forms working with PHP now I have run out of 
ideas? Having bought 3 books the latest one being php & mysql for 
dummies(which might be appropriate for me) I am still failing at this hurdle.

the following script is a classic example taken straight out of the book, I 
get round the $PHP_SELF problem ok but then all the script does is loop back 
to itself? 

<!-- Program Name:  mysql_send.php
     Description: PHP program that sends an SQL query to the
                  MySQL server and displays the results.
-->
<html>
<head>
<title>SQL Query Sender</title>
</head>
<body>
<?php
 $user="root";
 $host="localhost";
 $password="";

 /* Section that executes query */
 if (@$form == "yes")
 {
   mysql_connect($host,$user,$password);
   mysql_select_db($database);
   $query = stripSlashes($query) ;
   $result = mysql_query($query);
   echo "Database Selected: <b>$database</b><br>
          Query: <b>$query</b>
          <h3>Results</h3>
          <hr>";
   if ($result == 0)
      echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");

   elseif (@mysql_num_rows($result) == 0)
      echo("<b>Query completed. No results returned.</b><br>");
   else
   {
     echo "<table border='1'>
           <thead>
            <tr>";
             for ($i = 0; $i < mysql_num_fields($result); $i++) 
             {
                 echo("<th>" . mysql_field_name($result,$i) . "</th>");
             }
     echo " </tr>
           </thead>
           <tbody>";
             for ($i = 0; $i < mysql_num_rows($result); $i++)
             {
                echo "<tr>";
                $row = mysql_fetch_row($result);
                for ($j = 0; $j < mysql_num_fields($result); $j++)
                {
                  echo("<td>" . $row[$j] . "</td>");
                }
                echo "</tr>";
             }
             echo "</tbody>
                  </table>";
   }
   echo "<hr><br>
         <form action=$PHP_SELF method=post>
          <input type=hidden name=query value=\"$query\">
          <input type=hidden name=database value=$database>
          <input type=submit name=\"queryButton\" value=\"New Query\">
          <input type=submit name=\"queryButton\" value=\"Edit Query\">
         </form>";
   unset($form);
   exit();
 }

 /* Section that requests user input of query */
 @$query = stripSlashes($query);
 if (@$queryButton != "Edit Query")
 {
   $database = " ";
   $query = " ";
 }
?>

<form action=<?php echo $PHP_SELF ?>?form=yes method="post">
 <table>
  <tr>
   <td align="right"><b>Type in database name</b></td>
   <td>
     <input type=text name="database" value=<?php echo $database ?> >
   </td>
  </tr>
  <tr>
   <td align="right" valign="top"><b>Type in SQL query</b></td>
         <td><textarea name="query" cols="60" rows="10"><?php echo $query 
?></textarea>
   </td>
  </tr>
  <tr>
   <td colspan="2" align="center"><input type="submit" value="Submit 
Query"></td>
  </tr>
 </table>
</form>
 
</body>
</html>

Any ideas would be greatly appreciated as I am floundering badly!

Simon


--- End Message ---
--- Begin Message ---
Have you checked register_globals = on/off in your php.ini?
If register_globals=off, then you must access your POST variables by:

$_POST['whatever'];

and your get (the stuff you put at the end of your URL's):

$_GET['whatever'];


On Mon, 2003-06-30 at 15:48, Simon Chappell wrote:
> Hi can anyone help me with this?
> 
> I have been failing to get any forms working with PHP now I have run out of 
> ideas? Having bought 3 books the latest one being php & mysql for 
> dummies(which might be appropriate for me) I am still failing at this hurdle.
> 
> the following script is a classic example taken straight out of the book, I 
> get round the $PHP_SELF problem ok but then all the script does is loop back 
> to itself? 
> 
> <!-- Program Name:  mysql_send.php
>      Description: PHP program that sends an SQL query to the
>                   MySQL server and displays the results.
> -->
> <html>
> <head>
> <title>SQL Query Sender</title>
> </head>
> <body>
> <?php
>  $user="root";
>  $host="localhost";
>  $password="";
> 
>  /* Section that executes query */
>  if (@$form == "yes")
>  {
>    mysql_connect($host,$user,$password);
>    mysql_select_db($database);
>    $query = stripSlashes($query) ;
>    $result = mysql_query($query);
>    echo "Database Selected: <b>$database</b><br>
>           Query: <b>$query</b>
>           <h3>Results</h3>
>           <hr>";
>    if ($result == 0)
>       echo("<b>Error " . mysql_errno() . ": " . mysql_error() . "</b>");
> 
>    elseif (@mysql_num_rows($result) == 0)
>       echo("<b>Query completed. No results returned.</b><br>");
>    else
>    {
>      echo "<table border='1'>
>            <thead>
>             <tr>";
>              for ($i = 0; $i < mysql_num_fields($result); $i++) 
>              {
>                  echo("<th>" . mysql_field_name($result,$i) . "</th>");
>              }
>      echo " </tr>
>            </thead>
>            <tbody>";
>              for ($i = 0; $i < mysql_num_rows($result); $i++)
>              {
>                 echo "<tr>";
>                 $row = mysql_fetch_row($result);
>                 for ($j = 0; $j < mysql_num_fields($result); $j++)
>                 {
>                   echo("<td>" . $row[$j] . "</td>");
>                 }
>                 echo "</tr>";
>              }
>              echo "</tbody>
>                   </table>";
>    }
>    echo "<hr><br>
>          <form action=$PHP_SELF method=post>
>           <input type=hidden name=query value=\"$query\">
>           <input type=hidden name=database value=$database>
>           <input type=submit name=\"queryButton\" value=\"New Query\">
>           <input type=submit name=\"queryButton\" value=\"Edit Query\">
>          </form>";
>    unset($form);
>    exit();
>  }
> 
>  /* Section that requests user input of query */
>  @$query = stripSlashes($query);
>  if (@$queryButton != "Edit Query")
>  {
>    $database = " ";
>    $query = " ";
>  }
> ?>
> 
> <form action=<?php echo $PHP_SELF ?>?form=yes method="post">
>  <table>
>   <tr>
>    <td align="right"><b>Type in database name</b></td>
>    <td>
>      <input type=text name="database" value=<?php echo $database ?> >
>    </td>
>   </tr>
>   <tr>
>    <td align="right" valign="top"><b>Type in SQL query</b></td>
>        <td><textarea name="query" cols="60" rows="10"><?php echo $query 
> ?></textarea>
>    </td>
>   </tr>
>   <tr>
>    <td colspan="2" align="center"><input type="submit" value="Submit 
> Query"></td>
>   </tr>
>  </table>
> </form>
>  
> </body>
> </html>
> 
> Any ideas would be greatly appreciated as I am floundering badly!
> 
> Simon
> 


--- End Message ---
--- Begin Message --- None of these worked for me. ok, if you look at the code, the part where "echo $_SESSION['uid'];" is actually works.
I get a print out of the variable. if i call session_start() before anything, set variables in $_SESSION, and check it on another page, the session variables do not exist. in fact, the session isnt even started, cause I get an "Undefined variable _SESSION". so, it looks like the session is not spamming page requests. Do I have to call session_start() on every page to read the $_SESSION variables set in another?



Shivanischal A wrote:


John,

I can think of 3 problems...
1. I'm not sure, but try inserting a 'session_start()' in file.php
2. in ur validateadminlogin() method, the mysql_close() never seems to get
called.
3. try $_SESSION['uid'] . use ' instead of ". " seema to cause problems in
some cases.

best of luck,
-shiva

----- Original Message -----
From: "John Manko" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Monday, June 30, 2003 6:49 AM
Subject: IsSet() and $_SESSION




I'm having a problem with the value that isset returns on $_SESSION
variables.  For some reason, even if $_SESSION['uid'] is set, isset
returns FALSE.  Here is the code:

------ file1.php -----------
include "file2.php";

if (!isset($_SESSION["uid"])) {
// This first time $_SESSION["uid"] is check, we should
// end up in here.  However, ValidAdminLogin (next test)
// will set $_SESSION["uid"] so next time we will not
// get here.
if ( !ValidAdminLogin($_POST["adminid"],$_POST["adminpass"]))
forceadminlogin();

} elseif ( !ValidAdminSession() )
forceadminlogin();


// this is done to show that $_SESSION["uid"] is being set // but isset still returns false echo $_SESSION["uid"];

------ file2.php -----------
function ValidAdminLogin($user, $pass){

global $_SESSION;

if (The_MYSQL_Stuff_Is_NOT_OK) return false;
else
{
     session_start();

 $_SESSION["logged"] = true;
 $_SESSION["username"] = $user;
 $_SESSION["adminlogin"] = true;
 $_SESSION["fname"] = $fname;
 $_SESSION["lname"] = $lname;
 $_SESSION["email"] = $email;
 $_SESSION["uid"] = session_id();

      return true;
}

mysql_close();

}







DISCLAIMER: This email is bound by the terms and conditions described at http://www.subexgroup.com/mail-disclaimer.htm








--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: John Manko [mailto:[EMAIL PROTECTED]
> Sent: 30 June 2003 15:14
> To: [EMAIL PROTECTED]
> Subject: [PHP] Re: IsSet() and $_SESSION
> 
> 
> None of these worked for me.  ok, if you look at the code, the part 
> where "echo $_SESSION['uid'];" is actually works.
> I get a print out of the variable.  if i call session_start() before 
> anything, set variables in $_SESSION, and check it on another 
> page, the 
> session variables do not exist.  in fact, the session isnt 
> even started, 
> cause I get an "Undefined variable _SESSION".  so, it looks like the 
> session is not spamming page requests.  Do I have to call 
> session_start() on every page to read the $_SESSION variables set in 
> another?

Yes.  Every page that needs access to the session variables must call session_start(). 
 That's what it means on http://www.php.net/session-start when it says "creates a 
session or resumes the current one".

In practice, this means every page, as even if you don't access any session variables 
you may still need the session ID in order to pass it along to the next page (even if 
only implicitly via session.use_trans_sid).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

--- End Message ---
--- Begin Message ---
How do you handle storing the login info then? Do you encrypt the
file and decrypt it on the fly? Where would you store the key? I'm in
the process of setting up a new application, and I've always used the
"login info outside the webroot" method but if there's something more
I can do, I'd like to know...


--- Jaap van Ganswijk <[EMAIL PROTECTED]> wrote:
> At 2003-06-29 17:21 +0100, Avvio - Frank wrote:
> >basically you need to append to your include_path and you can
> probably
> >create a local .htaccess file and set an include path in there
> (look up
> >php_value syntax for .htaccess)
> >
> >otherwise start your script with a customised version of the
> following:
> >
> >ini_set("include_path",ini_get("include_path").":".
> "/your/path/here/");
> >
> >then include/require as normal
> 
> I think you can also use an include statement
> like this:
> include "../../php/include/file.inc";
> 
> The same mechanism can also be used for data
> files that also shouldn't be in the WWW accessible
> directory tree, I think. (But I'm not an expert.)
> 
> I always try to write my programs very portable
> and I have found that using "../application_data/file.txt"
> isn't a problem, but using "../../xxx/application_data/file.txt"
> is usually a problem, because you don't want to
> hardcode the name of the directory above the current
> directory (in this case 'xxx'). Sometimes however
> you have to go two levels up to go out of the
> WWW-acessable directory three.
> 
> By the way, I think it's unwise to keep the MySQL
> login data uncoded on the Unix system, because
> other users or the system managers could read it.
> Generally these files have to be readable by Apache
> and therefore other users on the system can often
> also read them.
> 
> Greetings,
> Jaap
> 
> 
> >----- Original Message ----- 
> >From: "anders thoresson" <[EMAIL PROTECTED]>
> >To: <[EMAIL PROTECTED]>
> >Sent: Sunday, June 29, 2003 4:33 PM
> >Subject: Re: [PHP] web site security: how to hide login info for
> >mysql-connection
> >
> >
> >> > Be aware that wherever you store the settings folder, your
> php.ini
> >should
> >> > have that path in it's include_directories setting, and the
> webserver
> >> > must
> >> > have read permissions for that file.
> >>
> >>  I don't have access to php.ini on my ISP's web server. Is there
> a way for
> >> a user to make their own set ow include_directories?
> >>
> >> -- 
> >> anders thoresson
> >>
> >> -- 
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >>
> >
> >
> >
> >-- 
> >PHP General Mailing List (http://www.php.net/)
> >To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


=====
Mark Weinstock
[EMAIL PROTECTED]
***************************************
You can't demand something as a "right" unless you are willing to fight to death to 
defend everyone else's right to the same thing.
***************************************

__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com

--- End Message ---

Reply via email to