[PHP-DB] suggestion about php ocilogon() oracle OCI FUNCTION

2003-10-27 Thread kss
I'm using php/oracle9.2 .
i cant' login into oracle db using ocilogon() as SYS user.
so, i examed oci8.c source.

above 9i , in order to login as SYS user
5th parameter of OCISessionBegin must be  OCI_SYSDBA(not  OCI_DEFAULT);

-
oci8.c
-
2315:   CALL_OCI_RETURN(OCI(error), OCISessionBegin(
2316:   svchp,
2317:   OCI(pError),
2318:   session-pSession,
2319:   (ub4) OCI_CRED_RDBMS,
2320:   (ub4) OCI_DEFAULT)); === 
OCI_DEFAULT|OCI_SYSDBA|OCI_SYSOPER

// OCI_SYSDBA -- in this mode, the user is authenticated for SYSDBA
// access.
// OCI_SYSOPER -- in this mode, the user is authenticated
// for SYSOPER access.
---

my suggestion !!

PHP ocilogon specification
resource ocilogon ( string username, string password [, string db] )
== new 4th parameter!
resource ocilogon ( string username, string password [, string 
db],sesson_mode=OCI_DEFAUL)
   
   --

ocilogon(SYS,change_on_install,mydb, OCI_SYSOPER );
   ---
is it possible ?( i'm poor at C programming).
sorry for my rudness  poor english.

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



[PHP-DB] Re: PHP + FIREBIRD + INTERNET INFORMATION SERVER

2003-10-27 Thread thejavo
Hi, after all, thank you, I was starting to think that I'm the only one
trying to do something with Firebird ;), but, the thing is that, I got no
error message at all, only the ring of a tone. And the strangest of all is
that the things works fine and suddenly stop working. I've tried it in three
different PC's and got the same result every time. Before the error there's
nothing more to do except re-install the pc. Now I'm trying to put an Apache
Web Server, but I never use it before so there are many things to read
first. If you've got any other Idea I'll be right here, :)).


Dave Dash [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 What does it show?

 It seems strange that Firebird *and* PHP somehow caused a problem, but
somet
 higns you can try are this.  Output the php file into an HTML (use another
 browser perhaps, or wget) and then see if you can view the idnividual HTML
 file.

 -dd

 Thejavo [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Sorry to bother again, but a few days ago I wrote this message:
 
I don't know if anybody tried PHP with Firebird, but I've got a really
curious problem. I've installed PHP 4.3.3 and work with Firebird 1.5
RC6
  and
MS - IIS without any problems, but suddenly, and with no other advice
or
error messages than the ring of a bell my PHP pages stop to work. I
  tried
everything but nothing seems to solve the problem.
 
  I don't know if there's someone working with PHP and Firebird, but I
tried
  this
  in multiples machines and in each case I got the same result. If there's
  somebody
  who can give me a clue about where to start looking for this problem
I'll
  really
  apreciate it. Thanks.

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



[PHP-DB] Re: PHP + FIREBIRD + INTERNET INFORMATION SERVER

2003-10-27 Thread thejavo
Hi, after all, thank you, I was starting to think that I'm the only one
trying to do something with Firebird ;), but, the thing is that, I got no
error message at all, only the ring of a tone. And the strangest of all is
that the things works fine and suddenly stop working. I've tried it in three
different PC's and got the same result every time. Before the error there's
nothing more to do except re-install the pc. Now I'm trying to put an Apache
Web Server, but I never use it before so there are many things to read
first. If you've got any other Idea I'll be right here, :)).


Dave Dash [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 What does it show?

 It seems strange that Firebird *and* PHP somehow caused a problem, but
somet
 higns you can try are this.  Output the php file into an HTML (use another
 browser perhaps, or wget) and then see if you can view the idnividual HTML
 file.

 -dd

 Thejavo [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
  Sorry to bother again, but a few days ago I wrote this message:
 
I don't know if anybody tried PHP with Firebird, but I've got a really
curious problem. I've installed PHP 4.3.3 and work with Firebird 1.5
RC6
  and
MS - IIS without any problems, but suddenly, and with no other advice
or
error messages than the ring of a bell my PHP pages stop to work. I
  tried
everything but nothing seems to solve the problem.
 
  I don't know if there's someone working with PHP and Firebird, but I
tried
  this
  in multiples machines and in each case I got the same result. If there's
  somebody
  who can give me a clue about where to start looking for this problem
I'll
  really
  apreciate it. Thanks.

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



Re: [PHP-DB] broken PHP

2003-10-27 Thread Shadow
:-)
Shadow

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



[PHP-DB] RE: Query works but can't echo variable :'(

2003-10-27 Thread Jeremy Shovan

You are selecting it as date but trying to echo DateOfOrder
Try this:
$TheDate = mysql_query(select DATE_FORMAT(DateOfOrder, '%d, %m, %Y') as
date from Orders Where Orders.ID = '$TransID');
while($OrderDate = mysql_fetch_array($TheDate))

{
$Date = $OrderDate[date];

}

-Original Message-
From: Graeme McLaren [mailto:[EMAIL PROTECTED] 
Sent: Sunday, October 26, 2003 4:22 PM
To: [EMAIL PROTECTED]
Subject: Query works but can't echo variable :'(

Hey everyone, the following query and code works fine but I can't
understand
why I can't echo the $Date variable.  I guess it doesn't work fine then
:(

Any ideas ?

G :)

$TheDate = mysql_query(select DATE_FORMAT(DateOfOrder, '%d, %m, %Y') as
date from Orders Where Orders.ID = '$TransID');

while($OrderDate = mysql_fetch_array($TheDate))

{

$Date = $OrderDate[DateOfOrder];

}

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



[PHP-DB] RE: mysql field comparison to multiple variables

2003-10-27 Thread Jeremy Shovan
Try this

WHERE date_field != $date_1 OR date_field != $date_2 OR date_field !=
$date_3

-Original Message-
From: Mike Baerwolf [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 24, 2003 6:46 PM
To: [EMAIL PROTECTED]
Subject: mysql field comparison to multiple variables

Hello,

I trying to put together a sql statement that will pull records based on

  a date field.  I can't figure out how to compare the date field to 
multiple php variables. Something like this,

WHERE date_field != $date_1 OR $date_2 OR $date_3 etc. etc.

Thanks for the help.

Mike

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



[PHP-DB] redirect

2003-10-27 Thread Dan Liu
Hi all,
Has anyone used 'Module mod_rewrite URL Rewriting Engine'? 
I need to do a redirect from
http://url1/cgi-bin/mapserv?map=/dir1/county.map
to 
http://url2/cgi-bin/mapserv?map=/dir2/county.map

But it is not working. Does somebody know why?
Thanks in Advance.
Dan
 

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



Re: [PHP-DB] redirect

2003-10-27 Thread Rolf Brusletto
Dan Liu wrote:

Hi all,
Has anyone used 'Module mod_rewrite URL Rewriting Engine'? 
I need to do a redirect from
http://url1/cgi-bin/mapserv?map=/dir1/county.map
to 
http://url2/cgi-bin/mapserv?map=/dir2/county.map

But it is not working. Does somebody know why?
Thanks in Advance.
Dan
 

Dan - without seeing the rewrite code.. its sorta hard to tell why it 
wouldn't be working!!!

simply put, if your host allows you to use a .htaccess and mod_rewrite.. 
in the .htaccess

RewriteEngine On
RewriteRule /usage.html /usage/index.html
Where /usage.html is the file that was requested, and /usage/index.html 
is the file that it needs to go to.

Rolf Brusletto
www.phpExamples.net
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] redirect

2003-10-27 Thread Peter Beckman
Wrong list to ask on -- you are looking for an Apache mailing list.

http://apache.org/  read the manual page on mod_rewrite

On Mon, 27 Oct 2003, Dan Liu wrote:

 Hi all,
 Has anyone used 'Module mod_rewrite URL Rewriting Engine'?
 I need to do a redirect from
 http://url1/cgi-bin/mapserv?map=/dir1/county.map
 to
 http://url2/cgi-bin/mapserv?map=/dir2/county.map

 But it is not working. Does somebody know why?
 Thanks in Advance.
 Dan


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



---
Peter Beckman  Internet Guy
[EMAIL PROTECTED] http://www.purplecow.com/
---

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



[PHP-DB] populating select and searching to criteria

2003-10-27 Thread Shannon Doyle


Hi People,

I have a three part question here. Well actually its 3 separate
questions.

First.

How would I populate a select menu from a mysql databse with the entries
from a particular field, but only showing those that are unique, ie not
showing more than 1 of the same value.

Second.

How would I then have one of those options selected depending on what it
contained in another table?



Third.

I need to understand how the following would be achieved.

In the database there is a text field that contains a number of
'keywords' I need to be able to search through those individual keywords
and return results based on a % match from the original search. Ie if I
search for 'secretary, typing, customer relations' I need to return all
records from the database that has one or all of those words contained
in the text field and display them as a % match of that search, ie if 1
match then 33% 2, 66% and so on.

Any help on the above three would be fantastic.

Cheers,

Shannon

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



Re: [PHP-DB] populating select and searching to criteria

2003-10-27 Thread Micah Stevens

First:

Use the SQL distinct command.. it's explained here:
http://www.mysql.com/doc/en/SELECT.html
That will get you unique values. 

Then just loop through the result:

while ($d = mysql_fetch_assoc($return)) {
?option value=?=$d['value']??=$d['name']?/option
?
}

Second: 
get the value from the other table into a variable, during each iteration of 
the loop check to see if they match, if so add 'selected'.

while ($d = mysql_fetch_assoc($return)) {
?option value=?=$d['value']??
if ($other_table_value == $d['value'])
echo  selected;
??=$d['name']?/option
?
}

Third:
If you're using MySQL, check this out:
http://www.mysql.com/doc/en/Fulltext_Search.html

If you're using something else, it's more complex I think. Someone may have an 
elegant solution, but I would do something like:

// Get total number of keywords:
$numofkeywords = count(str_replace (  ,  , $keywords)); 

// Split up your search words:
$search = explode( , $keywords);
$total_matched = 0;
// loop through the array of search terms and get number of returns.
foreach ($search as $searchword) {
$total_matched   += count(str_replace($searchword, $searchword, $keywords));
}
// echo out the result in percent. (to one decimal place even!) 
echo Percent Matched: .round(($total_matched/$numofkeywords)*100), 1). %;

I'm sure there's a better way to get a word count from a string, but it's 
late.. I didn't try the above code, so I'm just guessing it works.. I think 
it's the right idea though. 

-Micah



On Mon October 27 2003 4:54 pm, Shannon Doyle wrote:
 Hi People,

 I have a three part question here. Well actually its 3 separate
 questions.

 First.

 How would I populate a select menu from a mysql databse with the entries
 from a particular field, but only showing those that are unique, ie not
 showing more than 1 of the same value.

 Second.

 How would I then have one of those options selected depending on what it
 contained in another table?



 Third.

 I need to understand how the following would be achieved.

 In the database there is a text field that contains a number of
 'keywords' I need to be able to search through those individual keywords
 and return results based on a % match from the original search. Ie if I
 search for 'secretary, typing, customer relations' I need to return all
 records from the database that has one or all of those words contained
 in the text field and display them as a % match of that search, ie if 1
 match then 33% 2, 66% and so on.

 Any help on the above three would be fantastic.

 Cheers,

 Shannon

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



Re: [PHP-DB] suggestion about php ocilogon() oracle OCI FUNCTION

2003-10-27 Thread Christopher Jones
kss wrote:

 I'm using php/oracle9.2 .
 i cant' login into oracle db using ocilogon() as SYS user.
 above 9i , in order to login as SYS user
 5th parameter of OCISessionBegin must be  OCI_SYSDBA(not  OCI_DEFAULT);
 my suggestion !!

 PHP ocilogon specification
 resource ocilogon ( string username, string password [, string db] )
 == new 4th parameter!
 resource ocilogon ( string username, string password [, string 
db],sesson_mode=OCI_DEFAUL)
 --
 ocilogon(SYS,change_on_install,mydb, OCI_SYSOPER );



It could be very useful to allow AS SYSDBA or AS SYSOPER connections.

However the suggested solution opens up a potential security hole.

If OCI_SYSDBA is used, then one authentication method used by Oracle
is to look at the group privileges of the OS user.  If the user is in
dba group on Linux, or ORA_DBA (or ORA_SID_DBA) on Windows, then
the authentication succeeds and you can login.  The username and
password fields are ignored - they may be bogus.  (There are a lot of
other cases where this authentication won't succeed, such as if the DB
is on a remote machine, but it is the security hole case that is
interesting and feasible.)
If Apache is started as the Oracle software owner it may inherit the
dba privileges.  Since Oracle installs its own Apache I would expect
some Apache instances to be in this position.  If the suggested oci8.c
code change is made, then PHP scripts will not need a valid username
or password to connect with the powerful AS SYSDBA privileges.  A
weakly coded script, perhaps using eval(), could be vulnerable to
remote attack on the database.
The scenario may be convoluted, but it is not particularly obscure and
could be expected to happen to a small number of users - when they
least expect it.
Any solution must balance the need for usability (being able to
connect AS SYSDBA) with security (stopping unauthorized users
connecting AS SYSDBA).
Some potential solutions:

  - Detect if the effective user that the PHP script is executing as
is in a privileged group and disallow AS SYSDBA/SYSOPER
connections or require another authentication method.  This is not
doable.  It is not feasible (i.e. not easy, portable, accurate) to
find out what the privileged group(s) used by Oracle are.
  - Make sure Apache is not started with a privileged group.  Even if
feasible this relies on education and user knowledge, so will only
be partially effective.  It also prevents even nice users from
connecting / AS SYSDBA and would require an Oracle password file
to be set up for access to local DBs.
  - Implement the suggested change to oci8.c and add yet another
configuration parameter to php.ini
oracle.allow_privileged_logon = Off

By default the parameter would prevent AS SYSDBA or AS SYSOPER
being used.  The code in oci8.c would need to check this
parameter.
This solution puts the security choice in the hands of the
installer.  It gives a convenient place to document and explain
the issue.
Chris

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


[PHP-DB] Apache cores when using PHP with Oracle support

2003-10-27 Thread John Mullins
Has anyone come across this behavior?  We've built php 4.3.2 with
Oracle support (both --with-oracle and --with-oci8), but when I
try to start up Apache with the ORACLE_HOME env variable set to
the Oracle home location, it core dumps with this error:
Dump file /info/root/www/bin/kg_?_15533.trc
KG Platform
ORACLE_HOME = /usr/usc/oracle/9.0.1
System name:SunOS
Node name:  cwis.usc.edu
Release:5.8
Version:Generic_108528-19
Machine:sun4u
*** 2003.10.27.18.37.20.722
KGP-00600: internal error code, arguments: [kgupticon1], [], [], [], [], 
[], [], []
- Call Stack Trace -
NOTE: PLT+offset is used to represent that the
  function being called is offset bytes from
  the _PROCEDURE_LINKAGE_TABLE_.
calling  call entryargument values in 
hex
location type point(? means dubious 
value)
   

FD5DB754 CALL PLT+18684  FFBEA7B0 ? 33 ? 
 ?
   0 ? 0 ? 0 ?
and so on...

It does work on other servers that we are using, both with
Solaris 8 and Solaris 9.  Help?
--
John Mullins www:http://www.usc.edu/~mullins
University of Southern Californiae-mail: [EMAIL PROTECTED]
Information Services Divisionphone:  (213) 740-2870
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Apache cores when using PHP with Oracle support

2003-10-27 Thread Christopher Jones


John Mullins wrote:

Has anyone come across this behavior?  We've built php 4.3.2 with
Oracle support (both --with-oracle and --with-oci8), but when I
try to start up Apache with the ORACLE_HOME env variable set to
the Oracle home location, it core dumps with this error:

KGP-00600: internal error code, arguments: [kgupticon1], [], [], [], [], 
[], [], []

It does work on other servers that we are using, both with
Solaris 8 and Solaris 9.  Help?
Sounds like a linking problem.  Was Oracle installed/relinked cleanly?
Or maybe it's a symptom of a 64-32bit linking issue: 
http://bugs.php.net/bug.php?id=25980
Chris

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


RE: [PHP-DB] populating select and searching to criteria

2003-10-27 Thread Shannon Doyle


Thanks Micah,


while ($d = mysql_fetch_assoc($return)) {
?option value=?=$d['value']??=$d['name']?/option - I get
a parse error on this line.

while ($d = mysql_fetch_assoc($return)) {
?option value=?=$d['value']??
if ($other_table_value == $d['value'])
echo  selected;
??=$d['name']?/option
?
} 

Ok cool, I am assuming that this will be OK once I work out the parse
error on the above option.

 Third:
 If you're using MySQL, check this out: 
 http://www.mysql.com/doc/en/Fulltext_Search.html

 If you're using something else, it's more complex I think. Someone may

 have an
 elegant solution, but I would do something like:

// Get total number of keywords:
$numofkeywords = count(str_replace (  ,  , $keywords)); 

// Split up your search words:
$search = explode( , $keywords);
$total_matched = 0;
// loop through the array of search terms and get number of returns.
foreach ($search as $searchword) {
$total_matched   += count(str_replace($searchword, $searchword,
$keywords));
}
// echo out the result in percent. (to one decimal place even!) 
echo Percent Matched: .round(($total_matched/$numofkeywords)*100),
1). %;


This only partly resolves my problem, I am not looking for a word count,
I am looking to return those records that have one or more of the
keywords in them, and display a percentage result next to each record
that matches.

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



Re: [PHP-DB] populating select and searching to criteria

2003-10-27 Thread Micah Stevens

This may be a dumb comment, but those variable don't make any sense, you'll 
have to replace them with stuff that relates to the query and the database. 

-Micah

On Mon October 27 2003 8:34 pm, Shannon Doyle wrote:
 Thanks Micah,


 while ($d = mysql_fetch_assoc($return)) {
 ?option value=?=$d['value']??=$d['name']?/option - I get
 a parse error on this line.

 while ($d = mysql_fetch_assoc($return)) {
 ?option value=?=$d['value']??
 if ($other_table_value == $d['value'])
   echo  selected;
 ??=$d['name']?/option
 ?
 }

 Ok cool, I am assuming that this will be OK once I work out the parse
 error on the above option.

  Third:
  If you're using MySQL, check this out:
  http://www.mysql.com/doc/en/Fulltext_Search.html
 
  If you're using something else, it's more complex I think. Someone may
 
  have an
  elegant solution, but I would do something like:

 // Get total number of keywords:
 $numofkeywords = count(str_replace (  ,  , $keywords));

 // Split up your search words:
 $search = explode( , $keywords);
 $total_matched = 0;
 // loop through the array of search terms and get number of returns.
 foreach ($search as $searchword) {
   $total_matched   += count(str_replace($searchword, $searchword,
 $keywords));
 }
 // echo out the result in percent. (to one decimal place even!)
 echo Percent Matched: .round(($total_matched/$numofkeywords)*100),
 1). %;


 This only partly resolves my problem, I am not looking for a word count,
 I am looking to return those records that have one or more of the
 keywords in them, and display a percentage result next to each record
 that matches.

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