php-windows Digest 22 Aug 2004 08:54:49 -0000 Issue 2368

Topics (messages 24437 through 24440):

PHP and HTML
        24437 by: Chuck
        24438 by: Gryffyn, Trevor

Re: include_path and relative vs. absolute paths
        24439 by: Wolfgang Schneider

building PHP with cygwin - dies at fopencookie ???
        24440 by: Jason Barnett

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 ---
Sorry if this was posted twice.  I don't think the first one went thru.

Hello everyone.  I have the following script that creates a listbox.  My box
appears, but I can't get any data into it.  Can someone let me know what I'm
doing wrong.

    <SELECT name="Company List" multiple size="8">
    <?php
      $db = new COM("ADODB.Connection");
      $dsn = "DRIVER=SQL Server; SERVER=D63WV941;UID=sa;PWD=sa;
DATABASE=BINDER";
      $db->Open($dsn);
      $rs = $db->Execute("SELECT * from company");
      while (!$rs->EOF)
      {
        $Name = $rs->Fields['Name']->Value;
        // This doesn't get listed.
        "<OPTION>".$Name;
        $rs->MoveNext();
      }
    ?>
    </SELECT>

I appreciate the help,
Chuck

--- End Message ---
--- Begin Message ---
I got it the first time, so guess it went through.

I don't remember if it needs to be this strict or not, but I'd do it
this way:

Echo "<OPTION value=$Name>$Name</OPTION>";

Doensn't look like you're ECHOing or otherwise outputting the OPTION tag
and I usually include a "value=" with my options.

No need to use the "." to concatenate a simple variable like that, if
the "$Name" is in the quotes, it'll get interpreted.

Hope this helps!

-TG



> -----Original Message-----
> From: Chuck [mailto:[EMAIL PROTECTED] 
> Sent: Friday, August 20, 2004 3:41 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] PHP and HTML
> 
> 
> Sorry if this was posted twice.  I don't think the first one 
> went thru.
> 
> Hello everyone.  I have the following script that creates a 
> listbox.  My box
> appears, but I can't get any data into it.  Can someone let 
> me know what I'm
> doing wrong.
> 
>     <SELECT name="Company List" multiple size="8">
>     <?php
>       $db = new COM("ADODB.Connection");
>       $dsn = "DRIVER=SQL Server; SERVER=D63WV941;UID=sa;PWD=sa;
> DATABASE=BINDER";
>       $db->Open($dsn);
>       $rs = $db->Execute("SELECT * from company");
>       while (!$rs->EOF)
>       {
>         $Name = $rs->Fields['Name']->Value;
>         // This doesn't get listed.
>         "<OPTION>".$Name;
>         $rs->MoveNext();
>       }
>     ?>
>     </SELECT>
> 
> I appreciate the help,
> Chuck
> 
> -- 
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
On Tue, 17 Aug 2004 10:42:50 -0400, Gryffyn, Trevor wrote:

Hi Trevor.
a short note ... 

>Maybe not the most elegant, but I like to keep my stuff kind of modular
>so what I've done is just create an "includes" folder in the root and
>them reference it as include("../includes/includename.inc") from the
>scripts that are all in their own folders (by project).

I usually use this method as well ... and also do the following:
(a) in all files I assign a variable $rootdir so in case a file or a
folder moves later on, I only need to adjust the variable and all
other links don't need to be changed, this variable simply sets the
parth from the file to the root (e.g. $rootdir="../../" or whatever
it is depending on the location of the file)

>This may not be the best as far as security is concerned since it's easy
>to guess at "/includes" existence and some include files might contain
>information that could be useful to a would-be hacker, but I'm working
>on an internal environment anyway so it's not so critical for me.

(b) instead of using " .inc " as ending for the include files, I use
".inc.php" so that they won't display as plain text if called up in a
browser directly. This avoids the security problem as the files are
then regarded as php files and are "interpreted" rather than just
displayed as plain text... 

>Although, thinking about it, if you have access to a folder above where
>your website lives, you could do something like this:
>
>$dir = dirname($_SERVER["PATH_TRANSLATED"]) . "/../includes/";
>include($dir ."includefile.inc");
>
>That'd give you the "c:\foldername\" full path of the currently
>executing script, then go up a level (parent folder) then back down to
>an includes folder.  Add more ".." to go further.  As long as
>permissions are proper for accessing that folder, that'd probably work.

Seems, like in this case the folder with the sensitive include info
is again inside the website folders ? If one has access to a folder
above the website root, php can access those in that location even
though a browser can't ...
Files with real sensitive information (database login, password info,
etc) into a folder "outside" (one level above) are outside the
websites root folder, a browser cannot access them directly as it
can't go outside the assigned website root, but a php script could by
using something like 
    include("../" . $rootdir . "secretinfo.inc.php");

Anyone have further ideas to improve on this ? 
Have a great weekend
Wolfgang

--- End Message ---
--- Begin Message --- Hey guys I'm back! I actually have a problem of my own - I've tried (unsuccessfully) recently to build PHP5.0.0 from source, but no dice. I've read through the install instructions, but I just can't make heads or tails of my problem. I am probably missing something simple.

The last part of my config.log shows:

configure:15051: checking for fopencookie
configure:15079: gcc -o conftest -g -O2 conftest.c 1>&5
/cygdrive/c/DOCUME~1/JASBAR~1.BL-/LOCALS~1/Temp/ccW7W621.o(.text+0x16): In function `main':
/lib/php_source/configure:15073: undefined reference to `_fopencookie'
collect2: ld returned 1 exit status
configure: failed program was:
#line 15056 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char fopencookie(); below. */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char fopencookie();


int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_fopencookie) || defined (__stub___fopencookie)
choke me
#else
fopencookie();
#endif

; return 0; }
--- End Message ---

Reply via email to