[PHP] sort() - Where did I go wrong?

2004-07-11 Thread John Taylor-Johnston
I'm having another problem with sort();

I want to treat $rbenquiry as a string, not as a numeral.

$mydata-RB could contain 1.2 ; 1.9 ; 1.1 ; 1.0 ; 1.0.8

But if $rbenquiry =1.0, my code spits out anything that begins as though it were 
=1. It should only display 1.1 or 1.0.8.

Where did I go wrong? How can I fix it?

Thanks for any help,
John

--- snip 
$rbenquiry =1.0;

$enquiries = array();
$enquiry_list = array();

#... open $db  $ $table

while ($mydata = mysql_fetch_object($news))
{
  $mydata-RB = str_replace( ;, ;, $mydata-RB);
  $mydata-RB = str_replace(; , ;, $mydata-RB);
  $tempenquiries = explode(;, $mydata-RB);
  foreach ($tempenquiries as $singleenquiry)
  {
if ($singleenquiry  )
{
  array_push($enquiries, $singleenquiry);
  $enquiry_list[$singleenquiry][] = $mydata-id;
   }
  }
}

sort($enquiries);
#usort($enquiries, create_function('$a,$b','return strcasecmp($a,$b);'));

foreach (array_count_values ($enquiries) as $enquiry=$count)
{

 if((strtolower(substr($enquiry, 0, 1)) == $rbenquiry))
 {

  echo tr bgcolor=\#D3DCE3\;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($enquiry).\.$enquiry./a 
small[lt;--Search Entire Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
   echo/th/tr\n;

   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($enquiry_list[$enquiry] as $rbid)
   {
   $temp .= a target=\printwindow\ 
href=\print.php?id=.urlencode($rbid).\.$rbid./a, ;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}

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



[PHP] Re: sort() - Where did I go wrong?

2004-07-11 Thread John Taylor-Johnston
I'm having a similar problem here if I pass a numeral inside $searchenquiry

$searchenquiry = 1.0.1 Retrospective bibliographies and checklists / bibliographies 
et répertoires rétrospectifs;

preg_replace ('/('.$searchenquiry.')/i' , b$1/b, $mydata-RB)

error: Unknown modifier 'b' in b/www-html/new1/db/display.table.inc/b on line 
b103/b

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



[PHP] Re: sort() - Where did I go wrong?

2004-07-11 Thread John Taylor-Johnston
Ok. This is not a numeral problem? strval did not make a difference.
I have, however, solved the immediate problem with:

# if((strtolower(substr($enquiry, 0, 1)) == $rbenquiry))
if((strtolower(substr($enquiry, 0, strlen($rbenquiry))) == $rbenquiry))

However, preg_replace ('/('.$searchenquiry.')/i' , b$1/b, $mydata-RB)
still gives me:
error: Unknown modifier ...

$searchenquiry = 1.0.1 Retrospective bibliographies and checklists / bibliographies et
répertoires rétrospectifs;

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



Re: [PHP] mail problem

2004-07-11 Thread Justin Patrin
You should also be using $_POST instead of $HTTP_POST_VARS. $_POST is
a superglobal, so you can use it anywehere, it's shorter ;-), and it's
the official way to access post vars.

On Sun, 11 Jul 2004 08:52:54 +0800, Jason Wong [EMAIL PROTECTED] wrote:
 On Sunday 11 July 2004 08:33, Joao Gomes wrote:
 
  I am a beginner in php and I am trying to send emails from my machinne, I
  dont have any mail server installed in my computer (e.g. sendmail), btw i
  am running Windows XP, i wrote this script:
 
 [snip]
 
  and changed the php.ini to:
 
  [mail function]
  ; For Win32 only.
  SMTP = [EMAIL PROTECTED]
 
 SMTP (ie SMTP server) should be of the form: xxx.domain.tld, ie you should not
 have smtp@ in there.
 
 --
 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
 --
 /*
 Death is God's way of telling you not to be such a wise guy.
 */
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 !DSPAM:40f08d67207261637984098!
 
 


-- 
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder

paperCrane --Justin Patrin--

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



Re: [PHP] mail problem

2004-07-11 Thread Dennis Seavers

Jason, et al:

Is it not true that $HTTP_POST_VARS is more secure than $_POST, even though
the latter is a superglobal?  Doesn't the former acount for un-updated
server versions?

If it isn't, what disadvantage is there to using $HTTP_POST_VARS?  Why
should one use $_POST instead?

(P.S.: Aidan Lister, this may be a dumb question, but please don't bother
responding.)

 [Original Message]
 From: Justin Patrin [EMAIL PROTECTED]
 To: Jason Wong [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: 07/11/2004 12:29:24 AM
 Subject: Re: [PHP] mail problem

 You should also be using $_POST instead of $HTTP_POST_VARS. $_POST is
 a superglobal, so you can use it anywehere, it's shorter ;-), and it's
 the official way to access post vars.

 On Sun, 11 Jul 2004 08:52:54 +0800, Jason Wong [EMAIL PROTECTED]
wrote:
  On Sunday 11 July 2004 08:33, Joao Gomes wrote:
  
   I am a beginner in php and I am trying to send emails from my
machinne, I
   dont have any mail server installed in my computer (e.g. sendmail),
btw i
   am running Windows XP, i wrote this script:
  
  [snip]
  
   and changed the php.ini to:
  
   [mail function]
   ; For Win32 only.
   SMTP = [EMAIL PROTECTED]
  
  SMTP (ie SMTP server) should be of the form: xxx.domain.tld, ie you
should not
  have smtp@ in there.
  
  --
  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
  --
  /*
  Death is God's way of telling you not to be such a wise guy.
  */
  
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
  
  
  !DSPAM:40f08d67207261637984098!
  
  


 -- 
 DB_DataObject_FormBuilder - The database at your fingertips
 http://pear.php.net/package/DB_DataObject_FormBuilder

 paperCrane --Justin Patrin--

 -- 
 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] Re: sort() - Where did I go wrong?

2004-07-11 Thread Aidan Lister
I don't see how these questions are related, please ask each question
separately next time.

If you want to put variables in your regex's, you must use preg_quote.


John Taylor-Johnston [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Ok. This is not a numeral problem? strval did not make a difference.
 I have, however, solved the immediate problem with:

 # if((strtolower(substr($enquiry, 0, 1)) == $rbenquiry))
 if((strtolower(substr($enquiry, 0, strlen($rbenquiry))) == $rbenquiry))

 However, preg_replace ('/('.$searchenquiry.')/i' , b$1/b,
$mydata-RB)
 still gives me:
 error: Unknown modifier ...

 $searchenquiry = 1.0.1 Retrospective bibliographies and checklists /
bibliographies et
 répertoires rétrospectifs;

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



Re: [PHP] mail problem

2004-07-11 Thread Aidan Lister
 Is it not true that $HTTP_POST_VARS is more secure than $_POST, even
though
 the latter is a superglobal?  Doesn't the former acount for un-updated
 server versions?

 If it isn't, what disadvantage is there to using $HTTP_POST_VARS?  Why
 should one use $_POST instead?

No, $HTTP_xxx is not more secure.

Please read http://php.net/variables.predefined

If you're working on a server which is older than PHP4.1.0, then you'll have
to use the older $HTTP stuff.
If not, you're encouraged to use the newer superglobal form.

The $HTTP stuff is disabled by default in PHP5.

In terms of backward compatability I'd still advise you to use the newer
form, there are very few hosts that still run php4.1.0 (because it has many
dangerous bugs).

 (P.S.: Aidan Lister, this may be a dumb question, but please don't bother
 responding.)

Please, you asked a stupid question and got done for it - let's put the past
behind us.

Hope this helps.

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



Re: [PHP] usort e é together

2004-07-11 Thread Marek Kilimajer
John Taylor-Johnston wrote:
I think my problem lies in usort. I have a big honker of an array which I usort.
$ausenquiry = e;
and
$ausenquiry = e;
give a separate result.
I want to conjoin them. Possible? The same would be true for a and à.
usort distinguishes between é and e. Any way around this? I don't see any inspiration: 
http://ca2.php.net/manual/en/function.usort.php
John
---snip--
while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata-id; // use an associative array...
   }
  }
}
usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à', ), array('e', 'a'), $a);
$b = str_replace(array('é', 'à', ), array('e', 'a'), $b);
return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=$count)
{
 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {
  echo tr;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a small[lt;--Search Entire 
Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
  echo/th/tr\n;
   echo trtdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= a target=\printwindow\ 
href=\.$SCRIPT_NAME.?id=.urlencode($ausid).searchenquiry=.urlencode($author).\.$ausid./a, 
;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}
--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.
  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: sort() - Where did I go wrong?

2004-07-11 Thread Marek Kilimajer
John Taylor-Johnston wrote:
I'm having a similar problem here if I pass a numeral inside $searchenquiry
$searchenquiry = 1.0.1 Retrospective bibliographies and checklists / bibliographies et 
répertoires rétrospectifs;
preg_replace ('/('.$searchenquiry.')/i' , b$1/b, $mydata-RB)
error: Unknown modifier 'b' in b/www-html/new1/db/display.table.inc/b on line 
b103/b
the problem is the slash in $searchenquiry, use preg_quote()
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: mail problem

2004-07-11 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Joao Gomes wrote:
 [mail function]
 ; For Win32 only.
 SMTP = [EMAIL PROTECTED]

I don't think [EMAIL PROTECTED] is a valid hostname.

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Passing Variables

2004-07-11 Thread Harlequin
I'm just working on my syntax for passing a variable UserID from one page
to the next and it works a little like this so far:

On my form I have:
form action='updated.php?UserID=\$UserID\...

The URL posts:
http://...load.php?UserID=JDoe;

And when I echo the $UserID on this page I get:
Code:
?php echo for example: ['$UserID']; ?

Generates:
for example: ['\JDoe\']

Which part of my syntax is incorrect...?



-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-

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



[PHP] Re: [PHP-DB] Table locking

2004-07-11 Thread Miles Thompson
Rosen,
You've got your insertion order backwards.
Insert in table1
Grab the key with mysql_insert_id - assuming you have an autoincrement 
field as primary key on that table. Call it something like master_key.
Insert the detail records in table2, with the key you just grabbed from 
table1 (master_key) as the foreign key for those records.

Note that mysql_insert_id retrieves the last id on a per connection basis, 
so if 20 people do a near-simultaneous insert each will receive a unique key.

You do NOT need to track the number of child records in table2, the key 
will do the work. So if you want all the information for a given invoice, 
fetch its master_key:
Select master_key, invoice_no, another_field from table1 where invoice_no = 
'$invoice_no'
then after extracting that information,
Select * from table2 where table2.master_key = $master_key

Let SQL do the work, keep it simple, don't get bogged down in housekeeping.
I believe table locking is a bad idea on the web as dropped or slow 
connections, browsers closed without a logout, and a host of other reasons 
can leave a record locked and unavailable.

Regards - Miles Thompson
At 07:44 PM 7/10/2004, you wrote:
I have an orders with one main record in table1 ( client, date, e.t.c. ) and
detail description in table2  ( all materials with quant, price, e.t.c. )
and I save data  in table1 for positions (range of id - autoinc field of
records in table2) for detailed data of order . And I don't want someone
else to insert data in table2, because will be a problem with orders.
Now I insert data first in table2 and then insert main record in table1 with
the range of id's of detail order data.
Could be some solution for this ?
Thanks in advance.
Rosen
John W. Holmes [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Rosen wrote:
  I need to be sure, thath nobody else will can write on some tables until
I
  don't append obout 4-500 records in these tables.
  But until now I never used table locking in MySQL and I didn't found
  information about this ( like examples ).

 You could try a multi insert syntax such as

 INSERT INTO yourtable (a,b,c) VALUES (1,2,3),(4,5,6),(7,8,9);

 which will insert three rows into the table. Couldn't confirm in the
 manual, but this INSERT should run completely before anything else does.

 I still have to question _why_ another INSERT in the middle of your
 insertion will mess things up. Sounds like the problem is there.

  Is there a problem with locking if PHP uses same userpass for all users
in
  database ?

 No. The LOCK is on a per connection basis and is not tied to the
 username and/or password.

 --
 ---John Holmes...

 Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

 php|architect: The Magazine for PHP Professionals ­ www.phparch.com
--
PHP Database 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] Re: Passing Variables

2004-07-11 Thread Tim Van Wassenhove
In article [EMAIL PROTECTED], Harlequin wrote:
 I'm just working on my syntax for passing a variable UserID from one page
 to the next and it works a little like this so far:
 
?php echo for example: ['$UserID']; ?

As you seem to have _many_ problems, i can only advise you to read the
manual.. and read it again.. and again... http://www.php.net/manual.

You can find the answer in the section on variables, predefined
variables to be more precise.

-- 
Tim Van Wassenhove http://home.mysth.be/~timvw

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



[PHP] Re: Passing Variables

2004-07-11 Thread Harlequin
Thanks Tim. Solved the problem.

-- 
-
 Michael Mason
 Arras People
 www.arraspeople.co.uk
-
Harlequin [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I'm just working on my syntax for passing a variable UserID from one
page
 to the next and it works a little like this so far:

 On my form I have:
 form action='updated.php?UserID=\$UserID\...

 The URL posts:
 http://...load.php?UserID=JDoe;

 And when I echo the $UserID on this page I get:
 Code:
 ?php echo for example: ['$UserID']; ?

 Generates:
 for example: ['\JDoe\']

 Which part of my syntax is incorrect...?



 -- 
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

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



[PHP] displaying database results with forward and back buttons

2004-07-11 Thread Matthew Oatham
Hi,

I have a query that returns lots of rows so I want to display the results in blocks of 
25 or so on my web page and have forward and back buttons to navigate the results. Can 
someone point me in the right directions please I have tried to look around for 
something using google but cant think of a suitable search term

Thanks

Matt

Re: [PHP] displaying database results with forward and back buttons

2004-07-11 Thread Larry E . Ullman
I have a query that returns lots of rows so I want to display the 
results in blocks of 25 or so on my web page and have forward and back 
buttons to navigate the results. Can someone point me in the right 
directions please I have tried to look around for something using 
google but cant think of a suitable search term
I think pagination might be the term you're looking for. I'm pretty 
sure there's a PEAR class which will help with this or you can check 
PHPBuilder.com or Zend.com for articles on the subject.

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


[PHP] Where should I put my mysql database???

2004-07-11 Thread Levis Li
Hi friends
I am now using the college's virtual web space. I have my working directary on that 
SunOS/apache/PhP/Oracle/MySQL server. The question is that :
Can i create the Mysql database in my working directary??How?Also if
I dont want to set the password, who will be helping me?
 
Thanks!!
Levis



-
Do You Yahoo!?

100

[PHP] parse error: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
I went with this, but am getting a parse error.

usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à'), array('e', 'a'), $a);
$b = str_replace(array('é', 'à'), array('e', 'a'), $b);
return strcasecmp($a,$b);'));

Anyone see it? I've got headaches from squinting at the monitor.

Thanks,
J

Marek Kilimajer wrote:

usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à', ), array('e', 'a'), $a);
$b = str_replace(array('é', 'à', ), array('e', 'a'), $b);
return strcasecmp($a,$b);'));

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



Re: [PHP] Re: sort() - Where did I go wrong?

2004-07-11 Thread John Taylor-Johnston
Like this?

td.preg_replace ('/('.preg_quote($searchenquiry).')/i' , b$1/b, 
$mydata-JR).nbsp;/td

Still getting the unknown modifier error.


  $searchenquiry = 1.0.1 Retrospective bibliographies and checklists / 
  bibliographies et répertoires rétrospectifs;
 
  preg_replace ('/('.$searchenquiry.')/i' , b$1/b, $mydata-RB)
 
  error: Unknown modifier 'b' in b/www-html/new1/db/display.table.inc/b on line 
  b103/b
 the problem is the slash in $searchenquiry, use preg_quote()



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



[PHP] Re: mail problem

2004-07-11 Thread John Taylor-Johnston
You don't need sendmail. In php.ini you need to add something.

SMTP = [EMAIL PROTECTED] is not right? You want an address, not an email.

SMTP = smtp.uol.com.br is more likely the correct address.


Joao Gomes wrote:

 Hi,

 I am a beginner in php and I am trying to send emails from my machinne, I
 dont have any mail server installed in my computer (e.g. sendmail), btw i am
 running Windows XP, i wrote this script:
 ?
 $name=$HTTP_POST_VARS['name'];
 $email=$HTTP_POST_VARS['email'];
 $feedback=$HTTP_POST_VARS['feedback'];

 $toaddress = '[EMAIL PROTECTED]';
 $subject = 'Feedback from web site';
 $mailcontent = 'Customer name: '.$name.\n
 'Customer email: '.$email.\n
 Customer comments: \n.$feedback.\n;
 $fromaddress = 'From: [EMAIL PROTECTED]';

 mail($toaddress, $subject, $mailcontent, $fromaddress);
 ?

 and changed the php.ini to:

 [mail function]
 ; For Win32 only.
 SMTP = [EMAIL PROTECTED]
 smtp_port = 25
 ; For Win32 only.
 sendmail_from = [EMAIL PROTECTED]

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



[PHP] Re: Passing Variables

2004-07-11 Thread John Taylor-Johnston
To go back to a previous conversation, I would not put it on the action=. You are 
using METHOD=post?
I wold use input name=UserID value==\$UserID\ type=hidden or to really hide them 
use session variables so they are completely hidden. Or use a cookie (but that is not 
the most secure way).


Harlequin wrote:

 I'm just working on my syntax for passing a variable UserID from one page
 to the next and it works a little like this so far:

 On my form I have:
 form action='updated.php?UserID=\$UserID\...

 The URL posts:
 http://...load.php?UserID=JDoe;

 And when I echo the $UserID on this page I get:
 Code:
 ?php echo for example: ['$UserID']; ?

 Generates:
 for example: ['\JDoe\']

 Which part of my syntax is incorrect...?

 --
 -
  Michael Mason
  Arras People
  www.arraspeople.co.uk
 -

--
John Taylor-Johnston
-
If it's not open-source, it's Murphy's Law.

  ' ' '   Collège de Sherbrooke:
 ô¿ô   http://www.collegesherbrooke.qc.ca/languesmodernes/
   - Université de Sherbrooke:
  http://compcanlit.ca/
  819-569-2064



[PHP] Re: Where should I put my mysql database???

2004-07-11 Thread John Taylor-Johnston
In my c«ase, it was built into redhat. Installing it in a local user account? Can't do 
that, but I'm no expert. You would need root-lvel access to change variables on the 
server too, no? In php.ini for one. Ask your sysadmin for an account.

Levis li wrote:

 Hi friends
 I am now using the college's virtual web space. I have my working directary on that 
 SunOS/apache/PhP/Oracle/MySQL server. The question is that :
 Can i create the Mysql database in my working directary??How?Also if
 I dont want to set the password, who will be helping me?

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



[PHP] Re: displaying database results with forward and back buttons

2004-07-11 Thread John Taylor-Johnston
Finally something I can give back, made by my little lonesome with no help :)

 I have a query that returns lots of rows so I want to display the results in blocks 
 of 25 or so on my web page and have forward and back buttons to navigate the results.

include it first:

include(settings_limit.inc);

then set $offset and $limit in your sql

$sql = 'SELECT *,MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
AS relevancy FROM '.$table.'
WHERE MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
ORDER BY relevancy DESC
LIMIT '.$offset.','.$limit.';';

--settings_limit.inc
?php

#
## $mycounter is set by script calling settings_limit.inc 
#

#
### Set $offset  $limit 
#

if((!$offset) || ($offset  0))
{
$offset = 0;
}
$limit = 25;

#
### $nextinsert #
#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit  $mycounter)
{
  $disp = $mycounter - $new_offset;
}
if ($disp  0)
{
$nextinsert  = form ACTION=\.$SCRIPT_NAME.\ TARGET=\_top\ 
METHOD=\POST\tdNext .$disp. Requests input type=\submit\ name=\submit\ 
value=\\input type=\hidden\ name=\offset\ value=\.$new_offset.\input 
type=\hidden\ name=\table\ value=\.$table.\input type=\hidden\ name=\db\ 
value=\.$db.\;
 if($searchenquiry)
  $nextinsert  .= input type=\hidden\ name=\searchenquiry\ 
value=\.stripslashes(htmlspecialchars($searchenquiry)).\;
 if($scholarsenquiry)
  $nextinsert  .= input type=\hidden\ name=\scholarsenquiry\ 
value=\.$scholarsenquiry.\;
 if($titlesenquiry)
  $nextinsert  .= input type=\hidden\ name=\titlesenquiry\ 
value=\.$titlesenquiry.\;
 $nextinsert  .= /td/form;
}
#
### $previousinsert #
#

$new_offset2 = $offset - $limit;
if ($offset  0)  // can display previous msg
{
 $disp = $limit;
 $previousinsert  =  font face=\arial\ size=2A 
HREF=\index.html?submit=submitoffset=.$new_offset2.table=$tabledb=$db\lt;lt; 
Previous .$disp. Requests/a/font;

$previousinsert  = form ACTION=\.$SCRIPT_NAME.\ TARGET=\_top\ 
METHOD=\POST\tdinput type=\submit\  name=\submit\ value=\\ Previous 
.$disp. Requestsinput type=\hidden\ name=\offset\ 
value=\.$new_offset2.\input type=\hidden\ name=\table\ 
value=\.$table.\input type=\hidden\ name=\db\ value=\.$db.\;
 if($searchenquiry)
  $previousinsert  .= input type=\hidden\ name=\searchenquiry\ 
value=\.stripslashes(htmlspecialchars($searchenquiry)).\;
 if($scholarsenquiry)
  $previousinsert  .= input type=\hidden\ name=\scholarsenquiry\ 
value=\.$scholarsenquiry.\;
 if($titlesenquiry)
  $previousinsert  .= input type=\hidden\ name=\titlesenquiry\ 
value=\.$titlesenquiry.\;
 $previousinsert  .= /td/form;
}
#
### $lastinsert #
#

$new_offset3 = $mycounter - $limit;

if (($new_offset3  $limit) and ($offset != $mycounter - $limit))  // can display goto 
end msg
{
$lastinsert  = form ACTION=\.$SCRIPT_NAME.\ TARGET=\_top\ 
METHOD=\POST\tdGo To End input type=\submit\  name=\submit\ 
value=\|\input type=\hidden\ name=\offset\ value=\.$new_offset3.\input 
type=\hidden\ name=\table\ value=\.$table.\input type=\hidden\ name=\db\ 
value=\.$db.\;
 if($searchenquiry)
  $lastinsert  .= input type=\hidden\ name=\searchenquiry\ 
value=\.stripslashes(htmlspecialchars($searchenquiry)).\;
 if($scholarsenquiry)
  $lastinsert  .= input type=\hidden\ name=\scholarsenquiry\ 
value=\.$scholarsenquiry.\;
 if($titlesenquiry)
  $lastinsert  .= input type=\hidden\ name=\titlesenquiry\ 
value=\.$titlesenquiry.\;
 $lastinsert  .= /td/form;
}
#
### $firstinsert 
#

$new_offset4 = $mycounter - $limit;
if ($new_offset4  $limit)  // can display goto beginning msg
{
$new_offset4 = 0;
$firstinsert  = form ACTION=\.$SCRIPT_NAME.\ TARGET=\_top\ 
METHOD=\POST\tdinput type=\submit\ name=\submit\ value=\|\ Go To 
Beginninginput type=\hidden\ name=\offset\ value=\.$new_offset4.\input 
type=\hidden\ name=\table\ value=\.$table.\input type=\hidden\ name=\db\ 
value=\.$db.\;
 if($searchenquiry)
  $firstinsert .= input type=\hidden\ name=\searchenquiry\ 
value=\.stripslashes(htmlspecialchars($searchenquiry)).\;
 if($scholarsenquiry)
  $firstinsert .= input type=\hidden\ name=\scholarsenquiry\ 
value=\.$scholarsenquiry.\;
 if($titlesenquiry)
  $firstinsert .= input type=\hidden\ name=\titlesenquiry\ 

Re: [PHP] Re: sort() - Where did I go wrong?

2004-07-11 Thread Marek Kilimajer
John Taylor-Johnston wrote:
Like this?
td.preg_replace ('/('.preg_quote($searchenquiry).')/i' , b$1/b, 
$mydata-JR).nbsp;/td
Still getting the unknown modifier error.
No, like this:
preg_quote($searchenquiry, '/')
so also the delimiter - /, is quoted


$searchenquiry = 1.0.1 Retrospective bibliographies and checklists / bibliographies et 
répertoires rétrospectifs;
preg_replace ('/('.$searchenquiry.')/i' , b$1/b, $mydata-RB)
error: Unknown modifier 'b' in b/www-html/new1/db/display.table.inc/b on line b103/b
the problem is the slash in $searchenquiry, use preg_quote()


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


Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread Marek Kilimajer
I'm sorry, I used unescaped single quotes inside single quoted string, 
this is right:

usort($authors, create_function('$a,$b','
$a = str_replace(array(é, à), array(e, a), $a);
$b = str_replace(array(é, à), array(e, a), $b);
return strcasecmp($a,$b);'));
John Taylor-Johnston wrote:
I went with this, but am getting a parse error.
usort($authors, create_function('$a,$b','
$a = str_replace(array('é', 'à'), array('e', 'a'), $a);
$b = str_replace(array('é', 'à'), array('e', 'a'), $b);
return strcasecmp($a,$b);'));
Anyone see it? I've got headaches from squinting at the monitor.
Thanks,
J
Marek Kilimajer wrote:

usort($authors, create_function('$a,$b','
  $a = str_replace(array('é', 'à', ), array('e', 'a'), $a);
  $b = str_replace(array('é', 'à', ), array('e', 'a'), $b);
  return strcasecmp($a,$b);'));

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


Re: [PHP] Re: displaying database results with forward and back buttons

2004-07-11 Thread i sidhu
The main part of code i m using for Forward and Backward is,
 
 
 
if($page  1)
{
$prev = ($page - 1);
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$prevsearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\Previous/anbsp;;
}
for($i = 1; $i = $total_pages; $i++)
{
if(($page) == $i)
{
echo $inbsp;;
} else
{
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$isearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\$i/anbsp;;
}
}
// Build Next Link
if($page  $total_pages)
{
$next = ($page + 1);
echo a 
href=\.$_SERVER['PHP_SELF'].?page=$nextsearchfor=$searchforseek=$seekage1=$age1age2=$age2state=$statecountry=$country\
 TARGET=\_parent\Next/a;
}

 
Change variables accroding to u.
 
 
 
John Taylor-Johnston [EMAIL PROTECTED] wrote:
Finally something I can give back, made by my little lonesome with no help :)

 I have a query that returns lots of rows so I want to display the results in blocks 
 of 25 or so on my web page and have forward and back buttons to navigate the results.

include it first:

include(settings_limit.inc);

then set $offset and $limit in your sql

$sql = 'SELECT *,MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
AS relevancy FROM '.$table.'
WHERE MATCH (field1,field2)
AGAINST (\''.$searchenquiry.'\' IN BOOLEAN MODE)
ORDER BY relevancy DESC
LIMIT '.$offset.','.$limit.';';

--settings_limit.inc

#
## $mycounter is set by script calling settings_limit.inc 
#

#
### Set $offset  $limit 
#

if((!$offset) || ($offset  0))
{
$offset = 0;
}
$limit = 25;

#
### $nextinsert #
#
$new_offset = $offset + $limit;
$disp = $limit;
if ($new_offset + $limit  $mycounter)
{
$disp = $mycounter - $new_offset;
}
if ($disp  0)
{
$nextinsert = Next .$disp. Requests  [input] \ [input]  [input]  [input] ;
if($searchenquiry)
$nextinsert .=  [input] ;
if($scholarsenquiry)
$nextinsert .=  [input] ;
if($titlesenquiry)
$nextinsert .=  [input] ;
$nextinsert .= ;
}
#
### $previousinsert #
#

$new_offset2 = $offset - $limit;
if ($offset  0) // can display previous msg
{
$disp = $limit;
$previousinsert =   Previous .$disp. Requests;

$previousinsert =  [input]  Previous .$disp. Requests [input]  [input]  [input] ;
if($searchenquiry)
$previousinsert .=  [input] ;
if($scholarsenquiry)
$previousinsert .=  [input] ;
if($titlesenquiry)
$previousinsert .=  [input] ;
$previousinsert .= ;
}
#
### $lastinsert #
#

$new_offset3 = $mycounter - $limit;

if (($new_offset3  $limit) and ($offset != $mycounter - $limit)) // can display goto 
end msg
{
$lastinsert = Go To End  [input] |\ [input]  [input]  [input] ;
if($searchenquiry)
$lastinsert .=  [input] ;
if($scholarsenquiry)
$lastinsert .=  [input] ;
if($titlesenquiry)
$lastinsert .=  [input] ;
$lastinsert .= ;
}
#
### $firstinsert 
#

$new_offset4 = $mycounter - $limit;
if ($new_offset4  $limit) // can display goto beginning msg
{
$new_offset4 = 0;
$firstinsert =  [input]  Go To Beginning [input]  [input]  [input] ;
if($searchenquiry)
$firstinsert .=  [input] ;
if($scholarsenquiry)
$firstinsert .=  [input] ;
if($titlesenquiry)
$firstinsert .=  [input] ;
$firstinsert .= ;
}


#
### Display Inserts #
#

#
if (($previousinsert) or ($nextinsert))
#echo ;
echo ;

#if (($previousinsert) || ($nextinsert))
#echo (Sorted by id - $mycounter records found total);

if (($previousinsert) or ($nextinsert))
echo ;

if (($firstinsert) and ($offset != 0)) echo $firstinsert;

if ($previousinsert) echo $previousinsert;

if (($previousinsert)  ($nextinsert)) echo | ;

if ($nextinsert) echo $nextinsert;

if ($lastinsert) echo $lastinsert;

if (($previousinsert) or ($nextinsert))
#echo ;
echo ;

?

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

 

-
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!

Re: [PHP] MySQL/PHP Tunneling

2004-07-11 Thread Jason Wong
On Sunday 11 July 2004 13:07, Karam Chand wrote:

 Sorry. But I just didnt remember the email addy so I
 took that way :).

Can't resist picking on this one. All posts to the list should/would have the 
list address in the To: header. It's not that hard to copy paste the address 
into a *new* mail. Anyway just add the list address into your address book. 
NOW :)


 Now, many of the ISPs blokc 3306 for security reason
 and you cannot access MySQL from a 3rd party tool and
 have to use phpMyAdmin which is able to access the
 MySQL server as it is running on the same box.
 Sometimes, SSH tunneling is also not the option :)

 Most of these tools use MySQL C API() or some sort of
 wrapper for it to connnect to the server and do their
 job. Instead of connecting directly to the server
 using:

 mysql_real_connect (  ).

 They callup the above mentioned PHP file and pass the
 query as a argument. The PHP file then connects to the
 local mysql server,executes the query and returns all
 the required data as XML or a pre-determined format.
 In the client side the app again assembles this data
 and fills up MYSQL_RES* structure, the main structure
 in C API() to work with resultsets.

Just a few points I want to bring up:

1) Any monkey can run queries on your server unless you authenticate the 
connection using sessions.

2) Your data will pass through the web in clear text unless you do your own 
encryption/decryption or use SSL.

3) Adding an access layer would obviously increase the overhead.

If this is for a mission-critical application then you really are much better 
off getting yourself a dedicated server then you can do whatever tunnelling 
you want.

-- 
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
--
/*
May the forces of evil become confused on the way to your house.
-- George Carlin
*/

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



Re: [PHP] MySQL/PHP Tunneling

2004-07-11 Thread Curt Zirzow
* Thus wrote Karam Chand:
 --- Curt Zirzow [EMAIL PROTECTED] wrote:
 
 Now, many of the ISPs blokc 3306 for security reason
 and you cannot access MySQL from a 3rd party tool and
 have to use phpMyAdmin which is able to access the
 MySQL server as it is running on the same box.
 Sometimes, SSH tunneling is also not the option :)

There usually is a reason why the port 3306 port is blocked or that
mysql simply doesn't listen to outside addresses on that port.  By
trying to circumstant that will probably result in a violation of
their TOS.

And as Jason suggested, use an ISP that either supports ssh
tunneling (which is preferred and more likely to occur) or find a
ISP that allows port 3336 to the open world.

What you describe is more in the lines of Proxying, which is
probably why I was confused.  And I wouldn't suggest to anyone to
do that kind of proxying, the layers between everything can be
*very* unstable.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] storage of encrypted data

2004-07-11 Thread klaus
Hi all,

I want to store PHP-encrypted (Rijndael_256) data in MySQL.

The problem is:
If the encrypted string includes  the MySQL-query is influenced.

Therefore the question:
Is it possible to define characters   n o tto be used by the
crypto-function?

Greetings
Klaus

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



Re: [PHP] parse =?unknown-8bit?q?error=3A_?==?unknown-8bit?q?=5BPHP=5D_usort_e_&_=E9?= together

2004-07-11 Thread Curt Zirzow
* Thus wrote John Taylor-Johnston:
 I went with this, but am getting a parse error.
 
 usort($authors, create_function('$a,$b','
 $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
 $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
 return strcasecmp($a,$b);'));
 
 Anyone see it? I've got headaches from squinting at the monitor.

For Starters, you're trying to do everything in the world to one
function call.

Break it down and format it into a human readable thing.

$func_args = '$a, $b';
$func_code = '
 static $replace = array('é', 'à');
 static $with= array('e', 'a');

 $a = str_replace($replace, $with, $a);
 $b = str_replace($replace, $with, $b);

 return strcasecmp($a, $b);
';

usort($authors, create_function($func_args, $func_code));

The question does occure to me why you're using a create_function()
call instead of simply defining a function to used for usort().

Oh, and strtr() might be more of an appropriate choice:

  $translate = array('éà', 'ea');

  $a = strtr($a, $translate);
  $b = strtr($b, $translate);



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] Re: displaying database results with forward and back buttons

2004-07-11 Thread Curt Zirzow
* Thus wrote John Taylor-Johnston:
 Finally something I can give back, made by my little lonesome with no help :)

heh.. we all started somewhere.

 
  I have a query that returns lots of rows so I want to display the results in 
  blocks of 25 or so on my web page and have forward and back buttons to navigate 
  the results.
 
 include it first:

I would strongly discourage posting and scripts you have, there are
serveral reasons why it shouldn't really be done besides that we
would have 1000's of posts that say.. here is my script...

But more importantly, i'd have to go through them all pointing out
all the wrong/bad things they did :D


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



RE: [PHP] CMS solution + web sites in CVS.

2004-07-11 Thread Ed Lazor
Hey Lukasz,

I had a similar situation.  Documents are now stored in MySQL.  Authors can
log in and add or edit their own documents.  I control the look and feel of
the main site.  You can see an example by creating an account on
AtFantasy.com and logging in.  It takes advantage of modules from
Interakt.ro

-Ed



 -Original Message-
 I am currently restructuring the web site/web application development
 life cycle of my company. The new model requires the use of CVS (2
 branches) for each web site project. The issue I am facing is the
 maintenance/development of web sites utilizing CVS, while still
 providing content management functionality for the customers. I am
 currently utilizing the Macromedia Contribute software for client web
 site content management. The system however makes direct modifications
 to the live web site html/php pages, which makes it difficult to use
 while still trying to maintain the web site files in CVS.
 
 I have considering the implementation of the server wide CMS written in
 PHP, that would separate the content into a database, and also provide
 the ability to include content management functionality in custom
 developed web sites. I am currently evaluating the eZ publish 3.4
 (http://ez.no/ez_publish).
 
 I would appreciate feedback and recommendations of any other PHP user
 that has experience with the presented issue.
 
 Thanks in advance,
 
 --
 Lukasz Karapuda
 VP Application Development - newline Creations LLC
 http://www.thenewline.com/portfolio.htm
 [EMAIL PROTECTED]
 
 --
 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



Re: [PHP] Where should I put my mysql database???

2004-07-11 Thread Curt Zirzow
* Thus wrote Levis Li:
 Hi friends
 I am now using the college's virtual web space. I have my working directary on that 
 SunOS/apache/PhP/Oracle/MySQL server. The question is that :
 Can i create the Mysql database in my working directary??How?Also if
 I dont want to set the password, who will be helping me?

A couple of things:

 1. befriend the college's sysadmin
 2. Contact the mysql mailing list.



Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



Re: [PHP] storage of encrypted data

2004-07-11 Thread Curt Zirzow
* Thus wrote klaus:
 Hi all,
 
 I want to store PHP-encrypted (Rijndael_256) data in MySQL.
 
 The problem is:
 If the encrypted string includes  the MySQL-query is influenced.
 
 Therefore the question:
 Is it possible to define characters   n o tto be used by the
 crypto-function?

no.

Simply use mysql_real_escape_string() on the encrypted string.


Curt
-- 
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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



[PHP] [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Michael T. Peterson
When a user first comes to my site, the user's session id is checked and
validated. If no session id is present or the validation fails, the user is
vectored to a second page containing a login form.  When the user enters the
username and password and then clicks the submit button the info is
forwarded to a third page, a php script, validate_member_login.php, that
checks the username and password against a database.  Just for completeness,
note that the php script, validate_member_login.php, is invoked via login
form's action parameter, i.e.,

form action=validate_member_login.php ... /

The problem is that the php script, validate_member_login.php, is displayed
in the browser rather than being executed.

This is my first attempt at designing a dynamic web site so I'm sure I've
missed something really basic, but I have hardly any hair left to pull out.

Thanks, in advance,

Michael

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



Re: [PHP] [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Michal Migurski
 The problem is that the php script, validate_member_login.php, is
 displayed in the browser rather than being executed.

Are you running an Apache server? If so, be sure you have the appropriate
AddType lines in your configuration, as described in
http://www.php.net/manual/en/install.apache.php

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

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



[PHP] Re: [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Michael T. Peterson
Here is some additional info:

My other PHP scripts execute just fine, including the php script init.php
which uses header(...) to dispatch to the member_login.htm page. Recall that
the problem arises when validate_member_login.php is invoked from
member_login.htm. When validate_member_login.php is invoked directly, it
executes properly.

I'm running the most recent production release of the Apache server on
winxp. My ISP is running the same version. I've configured PHP identically
with my ISP's Apache config. I use Dreamweaver MX for development and
testing. I've not tested for this problem on my ISP's system, yet

Once again, note that the php script, validate_member_login.php is executed
properly in one case, yet is displayed in the browser in the other. Here is
the code for validate_member_login.php:

?php
include_once('../init.php');

/**
 * Variables set by member_login.htm are:
 *  username -- contains the username of the member.
 *  password -- contains the member's password.
 */
$username = trim($HTTP_POST_VARS['username']);
$password = trim($HTTP_POST_VARS['password']);

$result = authenticate_member_login( $username, $password );
if( $result == 0 ) {
 $HTTP_SESSION_VARS['session_id'] = crypt_password( $password );
 $HTTP_SESSION_VARS['username'] = $username;
 header( 'Location: '.MEMBER_HOME_PAGE );
} else {
 header( 'Location: '.MEMBER_LOGIN_PAGE );
}
?

'init.php' executes session_start(), sets a bunch of constants (e.g.,
MEMBER_HOME_PAGE, etc.), sets an error handler, and includes a bunch of
libraries. All standard stuff.

Again, any help would be appreciated.

Cheers,

Michael

Michael T. Peterson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 When a user first comes to my site, the user's session id is checked and
 validated. If no session id is present or the validation fails, the user
is
 vectored to a second page containing a login form.  When the user enters
the
 username and password and then clicks the submit button the info is
 forwarded to a third page, a php script, validate_member_login.php, that
 checks the username and password against a database.  Just for
completeness,
 note that the php script, validate_member_login.php, is invoked via login
 form's action parameter, i.e.,

 form action=validate_member_login.php ... /

 The problem is that the php script, validate_member_login.php, is
displayed
 in the browser rather than being executed.

 This is my first attempt at designing a dynamic web site so I'm sure I've
 missed something really basic, but I have hardly any hair left to pull
out.

 Thanks, in advance,

 Michael

 -- 
 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



Re: [PHP] Re: [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Miroslav Hudak (php/ml)
this all seems just fine to me, aren't you sending some Header: 
Content-type -s?
could you post that init.php script source? and is that apache server 
working well for other scripts that are called from the forms?
AND ... just to be sure,... are you calling that html which contains the 
form thru server? (like http://localhost/myform.html) ... ? because, 
when calling it directly from dreamweaver,
it could be called like direct html file (eg. 
file://c:/myhtmls/myform.html) and then the script will be called as 
file://c:/myhtmls/my_authentication_script.php instead of 
http://localhost/my_authentication_script.php

that's all what comes to my mind,
regards,
m.
Michael T. Peterson wrote:
Here is some additional info:
My other PHP scripts execute just fine, including the php script init.php
which uses header(...) to dispatch to the member_login.htm page. Recall that
the problem arises when validate_member_login.php is invoked from
member_login.htm. When validate_member_login.php is invoked directly, it
executes properly.
I'm running the most recent production release of the Apache server on
winxp. My ISP is running the same version. I've configured PHP identically
with my ISP's Apache config. I use Dreamweaver MX for development and
testing. I've not tested for this problem on my ISP's system, yet
Once again, note that the php script, validate_member_login.php is executed
properly in one case, yet is displayed in the browser in the other. Here is
the code for validate_member_login.php:
?php
include_once('../init.php');
/**
* Variables set by member_login.htm are:
*  username -- contains the username of the member.
*  password -- contains the member's password.
*/
$username = trim($HTTP_POST_VARS['username']);
$password = trim($HTTP_POST_VARS['password']);
$result = authenticate_member_login( $username, $password );
if( $result == 0 ) {
$HTTP_SESSION_VARS['session_id'] = crypt_password( $password );
$HTTP_SESSION_VARS['username'] = $username;
header( 'Location: '.MEMBER_HOME_PAGE );
} else {
header( 'Location: '.MEMBER_LOGIN_PAGE );
}
?
'init.php' executes session_start(), sets a bunch of constants (e.g.,
MEMBER_HOME_PAGE, etc.), sets an error handler, and includes a bunch of
libraries. All standard stuff.
Again, any help would be appreciated.
Cheers,
Michael
Michael T. Peterson [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

When a user first comes to my site, the user's session id is checked and
validated. If no session id is present or the validation fails, the user
   

is
 

vectored to a second page containing a login form.  When the user enters
   

the
 

username and password and then clicks the submit button the info is
forwarded to a third page, a php script, validate_member_login.php, that
checks the username and password against a database.  Just for
   

completeness,
 

note that the php script, validate_member_login.php, is invoked via login
form's action parameter, i.e.,
   form action=validate_member_login.php ... /
The problem is that the php script, validate_member_login.php, is
   

displayed
 

in the browser rather than being executed.
This is my first attempt at designing a dynamic web site so I'm sure I've
missed something really basic, but I have hardly any hair left to pull
   

out.
 

Thanks, in advance,
Michael
--
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


Re: [PHP] Re: [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Tom Rogers
Hi,

Monday, July 12, 2004, 10:28:59 AM, you wrote:
MTP Here is some additional info:

MTP My other PHP scripts execute just fine, including the php script init.php
MTP which uses header(...) to dispatch to the member_login.htm page. Recall that
MTP the problem arises when validate_member_login.php is invoked from
MTP member_login.htm. When validate_member_login.php is invoked directly, it
MTP executes properly.

MTP I'm running the most recent production release of the Apache server on
MTP winxp. My ISP is running the same version. I've configured PHP identically
MTP with my ISP's Apache config. I use Dreamweaver MX for development and
MTP testing. I've not tested for this problem on my ISP's system, yet

MTP Once again, note that the php script,
MTP validate_member_login.php is executed
MTP properly in one case, yet is displayed in the browser in the other. Here is
MTP the code for validate_member_login.php:

MTP ?php
MTP include_once('../init.php');

MTP /**
MTP  * Variables set by member_login.htm are:
MTP  *  username -- contains the username of the member.
MTP  *  password -- contains the member's password.
MTP  */
MTP $username = trim($HTTP_POST_VARS['username']);
MTP $password = trim($HTTP_POST_VARS['password']);

MTP $result = authenticate_member_login( $username, $password );
MTP if( $result == 0 ) {
MTP  $HTTP_SESSION_VARS['session_id'] = crypt_password( $password );
MTP  $HTTP_SESSION_VARS['username'] = $username;
MTP  header( 'Location: '.MEMBER_HOME_PAGE );
MTP } else {
MTP  header( 'Location: '.MEMBER_LOGIN_PAGE );
MTP }
?

MTP 'init.php' executes session_start(), sets a bunch of constants (e.g.,
MTP MEMBER_HOME_PAGE, etc.), sets an error handler, and includes a bunch of
MTP libraries. All standard stuff.

MTP Again, any help would be appreciated.

MTP Cheers,

MTP Michael


Sounds like you forgot the ?php in the include script

-- 
regards,
Tom

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



Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
Sorry. Still getting a parse error on line 40:

39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));

Can you have two arrays there? http://ca2.php.net/manual/en/function.str-replace.php

All the brackets are in the right place. Hmmm ...?

Thanks,
John

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



Re: [PHP] parse error: [PHP] usort e é together

2004-07-11 Thread Miroslav Hudak (php/ml)
Dunno the original question, but this obviously should be escaped...
So the correct code follows...
usort($authors, create_function('$a,$b','
  $a = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $a);
  $b = str_replace(array(\'é\', \'a\'), array(\'e\', \'a\'), $b);
  return strcasecmp($a,$b);'));
Regards,
m.
John Taylor-Johnston wrote:
Sorry. Still getting a parse error on line 40:
39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));
Can you have two arrays there? http://ca2.php.net/manual/en/function.str-replace.php
All the brackets are in the right place. Hmmm ...?
Thanks,
John
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é

It still sorts é and e separately, but without a parse error:

$first = array('à', 'é');
$second  = array('a', 'e');

usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));

Back to the drawing board? I tried this too:

$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');

Ideas? Thanks,
John


 Parse error on line 40:

 39 usort($authors, create_function('$a,$b','
 40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
 41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
 42  return strcasecmp($a,$b);'));

?php

if(!$ausenquiry) $ausenquiry =a;

echo trtd
Note: A star, \*\, indicates that the author uses a pseudonym.brNoter : Une 
étoile, \*\, indique que cet auteur est connu par un nom de plume.

table border=\0\ cellspacing=\0\ cellpadding=\5\\n;


##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query(select id,AUS from $table);

##
$authors = array();
$author_list = array();

while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata-id; // use an associative array...
   }
  }
}

#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));

#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));

$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');

usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));


foreach (array_count_values ($authors) as $author=$count)
{

 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {

  echo tr bgcolor=\#D3DCE3\;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a 
small[lt;--Search Entire Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
   echo/th/tr\n;

   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= a target=\printwindow\ 
href=\print.php?id=.urlencode($ausid).\.$ausid./a, ;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}

mysql_close($myconnection);
##
echo /table
/td
/tr\n;

?

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



Re: [PHP] usort e é together

2004-07-11 Thread Miroslav Hudak (php/ml)
this is slightly changed function of yours, written for better 
readability...

?php
$authors = array('élen', 'Élen', 'Elison', 'ámadeus', 'albert', 
'alfred', 'amadeus', 'elen');

function usort_callback($a, $b) {
$a = strtolower($a); $b = strtolower($b);
$a = str_replace(array('á', 'é'), array('a', 'e'), strtolower($a));
$b = str_replace(array('á', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}
usort($authors, 'usort_callback');
var_dump($authors);
?
it does diacritics safe and case-insensitive sort of authors... at least 
on my workstation... is it what you need? while i don't have your 
original problem, i just can guess... hope it helps.

m.
John Taylor-Johnston wrote:
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é
It still sorts é and e separately, but without a parse error:
$first = array('à', 'é');
$second  = array('a', 'e');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
Back to the drawing board? I tried this too:
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
Ideas? Thanks,
John

Parse error on line 40:
39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));

?php
if(!$ausenquiry) $ausenquiry =a;
echo trtd
Note: A star, \*\, indicates that the author uses a pseudonym.brNoter : Une étoile, 
\*\, indique que cet auteur est connu par un nom de plume.
table border=\0\ cellspacing=\0\ cellpadding=\5\\n;
##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select id,AUS from $table);
##
$authors = array();
$author_list = array();
while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata-id; // use an associative array...
   }
  }
}
#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=$count)
{
 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {
  echo tr bgcolor=\#D3DCE3\;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a small[lt;--Search Entire 
Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
   echo/th/tr\n;
   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= a target=\printwindow\ 
href=\print.php?id=.urlencode($ausid).\.$ausid./a, ;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}
mysql_close($myconnection);
##
echo /table
/td
/tr\n;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] usort e é together

2004-07-11 Thread Miroslav Hudak (php/ml)
Pardon me for the strtolower line, i've just forgot there... it's 4:30AM 
here in Slovakia... :/

correct listing follows...
?php
$authors = array('élen', 'Élen', 'Elison', 'ámadeus', 'albert', 
'alfred', 'amadeus', 'elen');

function usort_callback($a, $b) {
$a = str_replace(array('á', 'é'), array('a', 'e'), strtolower($a));
$b = str_replace(array('á', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}
usort($authors, 'usort_callback');
var_dump($authors);
?
regards,
m.
John Taylor-Johnston wrote:
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é
It still sorts é and e separately, but without a parse error:
$first = array('à', 'é');
$second  = array('a', 'e');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
Back to the drawing board? I tried this too:
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
Ideas? Thanks,
John

Parse error on line 40:
39 usort($authors, create_function('$a,$b','
40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
42  return strcasecmp($a,$b);'));

?php
if(!$ausenquiry) $ausenquiry =a;
echo trtd
Note: A star, \*\, indicates that the author uses a pseudonym.brNoter : Une étoile, 
\*\, indique que cet auteur est connu par un nom de plume.
table border=\0\ cellspacing=\0\ cellpadding=\5\\n;
##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);
$news = mysql_query(select id,AUS from $table);
##
$authors = array();
$author_list = array();
while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata-id; // use an associative array...
   }
  }
}
#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));
$first = array('à', 'é', 'À', 'É');
$second  = array('a', 'e', 'A', 'É');
usort($authors, create_function('$a,$b','
$a = str_replace($first, $second, $a);
$b = str_replace($first, $second, $b);
return strcasecmp($a,$b);'));
foreach (array_count_values ($authors) as $author=$count)
{
 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {
  echo tr bgcolor=\#D3DCE3\;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a small[lt;--Search Entire 
Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
   echo/th/tr\n;
   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= a target=\printwindow\ 
href=\print.php?id=.urlencode($ausid).\.$ausid./a, ;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}
mysql_close($myconnection);
##
echo /table
/td
/tr\n;
?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: [Q] Why does my php file gets displayed instead of executed

2004-07-11 Thread Michael T. Peterson
Per request, here are the two other source files that get executed prior to
the invocation of validate_member_login.php, index.php and init.php.

But first, here's a simple restatement of the problem:

(1) Direct the browser to open index.php
(2) init.php is included by index.php.
(3) index.php dispatches user to member_login.htm. User fills in username
and password fields and then presses the submit button.
(4) form action=validate_member_login.php .../ is invoked.
(5) The source code of validate_member_login.php is displayed in the browser
rather then being executed.

However, when the invocation sequence is:

(1) Direct the browser directly to member_login.htm and fill in the username
and password fields.
(2) Press submit.
(3) validate_member_login.php is executed properly.

Here's index.php.  Its purpose is to check the session variables to
determine whether the user is logged in. If not, the user is dispatched to
member_login.php via redirct using header().

Now, here are the two php files of interest, index.php and init.php. First,
index.php,

?php
include_once( 'init.php' );

/**
 * If member is already logged in, his/her username and password values will
be available to us.
 */
 if( isset( $HTTP_SESSION_VARS['session_id'] )  isset(
$HTTP_SESSION_VARS['username'] ) )
 {
$session_id = $HTTP_SESSION_VARS['session_id'];
$username = $HTTP_SESSION_VARS['username'];

$result = authenticate_session( $username, $session_id );
 if( $result != SUCCESS )
 {
  if( $result == MEMBER_NOT_REGISTERED ) {
   header( 'Location: '.MEMBER_REGISTRATION_PAGE );
  } else if( $result == PASSWORD_MISMATCH ) {
   header( 'Location: '.MEMBER_LOGIN_PAGE );
  } else {
   die( $result );
  }
 }
 header( 'Location: '.MEMBER_HOME_PAGE );
 }
 header( 'Location: '.MEMBER_LOGIN_PAGE );
?

Here is init.php, the file that index.php includes (see above). This file
just sets up the exectution environment.

?php
session_start();
/**
 * init.php
 *
 * Script that initializes the execution environment.
 */

//
// Check whether this is running on a UNIX or a Windows operating system.
// We need to know this to set the include_path separator character
// character correctly.
//
$isWindows = false;
$pathDelimiter = ':';
$operatingSystem = PHP_OS;

if( strcmp( $operatingSystem, 'WINNT' ) == 0 )
{
 $isWindows = true;
 $pathDelimiter = ';';
}

// Uncomment and use this symbol when publishing to the internet on
ipowerweb.
// Yields /home/mazamaso/public_html

$WWWROOT = $_SERVER['DOCUMENT_ROOT'];

// Set up the dev directory's environment variables.
$PROJECT_DIR   = $WWWROOT.'/northwest_steelheader';
$MEMBERS_DIR   = $PROJECT_DIR.'/members';
$SCRIPTS_DIR= $PROJECT_DIR.'/scripts';
$DB_SCRIPTS_DIR   = $SCRIPTS_DIR.'/db';
$UTILS_SCRIPTS_DIR   = $SCRIPTS_DIR.'/utils';
$SESSION_SCRIPTS_DIR = $SCRIPTS_DIR.'/security';
$GRAPHICS_DIR= $SCRIPTS_DIR.'/jpgraphics';

$MEMBER_HOME_PAGE   = $PROJECT_DIR.'/member_homepage.html';
$MEMBER_LOGIN_PAGE   = $MEMBERS_DIR.'/member_login.htm';
$MEMBER_REGISTRATION_PAGE  = $MEMBERS_DIR.'/member_registration_form.htm';
$MEMBER_LOGOUT_PAGE   = $MEMBERS_DIR.'/member_logout.php';

$INCLUDE_PATH =
'.'.$pathDelimiter.$PROJECT_DIR.$pathDelimiter.$DB_SCRIPTS_DIR.$pathDelimite
r.$UTILS_SCRIPTS_DIR.$pathDelimiter.$GRAPHICS_DIR.$pathDelimiter.$SESSION_SC
RIPTS_DIR;

//
// Establish the site's environment variables
//
define( 'PROJECT_DIR', $PROJECT_DIR );
define( 'MEMBERS_DIR', $MEMBERS_DIR );
define( 'SCRIPTS_DIR', $SCRIPTS_DIR );
define( 'DB_DIR', $DB_SCRIPTS_DIR );
define( 'UTILS_DIR', $UTILS_SCRIPTS_DIR );
define( 'SESSION_DIR', $SESSION_SCRIPTS_DIR );
define( 'DEBUG', true );
define( 'MEMBER_HOME_PAGE', $MEMBER_HOME_PAGE );
define( 'MEMBER_LOGIN_PAGE', $MEMBER_LOGIN_PAGE );
define( 'MEMBER_REGISTRATION_PAGE', $MEMBER_REGISTRATION_PAGE );
define( 'MEMBER_LOGOUT_PAGE', $MEMBER_LOGOUT_PAGE );

if( strcmp( $WWWROOT, 'c:/program files/apache group/apache/htdocs' ) == 0 )
{
 define( 'DB_NAME', '' );
 define( 'DB_ADMIN', 'a' );
 define( 'DB_PASSWORD', 'b' );
} else {
 define( 'DB_NAME', '' );
 define( 'DB_ADMIN', '' );
 define( 'DB_PASSWORD', '' );
}

ini_set( 'include_path', $INCLUDE_PATH );
ini_set( 'session.save_path', $PROJECT_DIR.'session_stats');

// These are the base includes, i.e., that apply to every php file in the
site
include_once( 'print_utils.php' );
include_once( 'mz_error_handler.php' );
include_once( 'db_utils.php' );
include_once( 'passwords.php' );
include_once( 'date_utils.php' );
include_once( 'session_control_lib.php' );

set_error_handler( 'mz_error_handler' );
assert_options( ASSERT_ACTIVE, TRUE );
assert_options( ASSERT_BAIL, TRUE );

?

snip

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



Re: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
Thanks!
What does var_dump do? (I didn't really understand the manual.)

Miroslav Hudak (php/ml) wrote:

 Pardon me for the strtolower line, i've just forgot there... it's 4:30AM
 here in Slovakia... :/

 correct listing follows...

 ?php
 $authors = array('élen', 'Élen', 'Elison', 'ámadeus', 'albert',
 'alfred', 'amadeus', 'elen');

 function usort_callback($a, $b) {
  $a = str_replace(array('á', 'é'), array('a', 'e'), strtolower($a));
  $b = str_replace(array('á', 'é'), array('a', 'e'), strtolower($b));
  return (strcmp($a, $b));
 }

 usort($authors, 'usort_callback');

 var_dump($authors);
 ?

 regards,
 m.

 John Taylor-Johnston wrote:

  http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
  http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é
 
  It still sorts é and e separately, but without a parse error:
 
  $first = array('à', 'é');
  $second  = array('a', 'e');
 
  usort($authors, create_function('$a,$b','
  $a = str_replace($first, $second, $a);
  $b = str_replace($first, $second, $b);
  return strcasecmp($a,$b);'));
 
  Back to the drawing board? I tried this too:
 
  $first = array('à', 'é', 'À', 'É');
  $second  = array('a', 'e', 'A', 'É');
 
  Ideas? Thanks,
  John
 
 
 
 Parse error on line 40:
 
 39 usort($authors, create_function('$a,$b','
 40  $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
 41  $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
 42  return strcasecmp($a,$b);'));
 
 
  ?php
 
  if(!$ausenquiry) $ausenquiry =a;
 
  echo trtd
  Note: A star, \*\, indicates that the author uses a pseudonym.brNoter : Une 
  étoile, \*\, indique que cet auteur est connu par un nom de plume.
 
  table border=\0\ cellspacing=\0\ cellpadding=\5\\n;
 
 
  ##
  $myconnection = mysql_connect($server,$user,$pass);
  mysql_select_db($db,$myconnection);
 
  $news = mysql_query(select id,AUS from $table);
 
  ##
  $authors = array();
  $author_list = array();
 
  while ($mydata = mysql_fetch_object($news))
  {
$mydata-AUS = str_replace( ;, ;, $mydata-AUS);
$mydata-AUS = str_replace(; , ;, $mydata-AUS);
$tempauthors = explode(;, $mydata-AUS);
foreach ($tempauthors as $singleauthor)
{
  if ($singleauthor  )
  {
array_push($authors, $singleauthor);
$author_list[$singleauthor][] = $mydata-id; // use an associative array...
 }
}
  }
 
  #sort($authors);
  #usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));
 
  #usort($authors, create_function('$a,$b','
  # $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
  # $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
  # return strcasecmp($a,$b);'));
 
  $first = array('à', 'é', 'À', 'É');
  $second  = array('a', 'e', 'A', 'É');
 
  usort($authors, create_function('$a,$b','
  $a = str_replace($first, $second, $a);
  $b = str_replace($first, $second, $b);
  return strcasecmp($a,$b);'));
 
 
  foreach (array_count_values ($authors) as $author=$count)
  {
 
   if((strtolower(substr($author, 0, 1)) == $ausenquiry))
   {
 
echo tr bgcolor=\#D3DCE3\;
 echo th align=\left\ colspan=\2\a 
  href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a 
  small[lt;--Search Entire Database]/small/th;
 echo th align=\right\ width=\5%\ nowrap(.$count. ;
  if($count  1)
  {echo records found/trouvés);}
  else{echo record found/trouvé);}
 echo/th/tr\n;
 
 echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
 echo td align=\left\;
 $temp = ;
 foreach ($author_list[$author] as $ausid)
 {
 $temp .= a target=\printwindow\ 
  href=\print.php?id=.urlencode($ausid).\.$ausid./a, ;
 }
 $temp = substr($temp, 0, -2);
 echo $temp/td;
 echo tdnbsp;/td;
echo /tr\n;
   }
  }
 
  mysql_close($myconnection);
  ##
  echo /table
  /td
  /tr\n;
 
  ?
 



Re: [PHP] usort e é together

2004-07-11 Thread John Taylor-Johnston
Sorry, doesn't work either.

http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=e
does not contain those that start with é:
http://compcanlit.usherbrooke.ca/new1/db/index.php?ausenquiry=é

function usort_callback($a, $b) {
  $a = str_replace(array('à', 'é'), array('a', 'e'), strtolower($a));
  $b = str_replace(array('à', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}

usort($authors, 'usort_callback');

var_dump($authors);

I'll leave var_dump in there for verification.

?php

if(!$ausenquiry) $ausenquiry =a;

echo trtd
Note: A star, \*\, indicates that the author uses a pseudonym.brNoter : Une 
étoile, \*\, indique que cet auteur est connu par un nom de plume.

table border=\0\ cellspacing=\0\ cellpadding=\5\\n;


##
$myconnection = mysql_connect($server,$user,$pass);
mysql_select_db($db,$myconnection);

$news = mysql_query(select id,AUS from $table);

##
$authors = array();
$author_list = array();

while ($mydata = mysql_fetch_object($news))
{
  $mydata-AUS = str_replace( ;, ;, $mydata-AUS);
  $mydata-AUS = str_replace(; , ;, $mydata-AUS);
  $tempauthors = explode(;, $mydata-AUS);
  foreach ($tempauthors as $singleauthor)
  {
if ($singleauthor  )
{
  array_push($authors, $singleauthor);
  $author_list[$singleauthor][] = $mydata-id; // use an associative array...
   }
  }
}

#sort($authors);
#usort($authors, create_function('$a,$b','return strcasecmp($a,$b);'));

#usort($authors, create_function('$a,$b','
# $a = str_replace(array('é', 'à'), array('e', 'a'), $a);
# $b = str_replace(array('é', 'à'), array('e', 'a'), $b);
# return strcasecmp($a,$b);'));

#$first = array('à', 'é', 'À', 'É');
#$second  = array('a', 'e', 'A', 'E');
#
#usort($authors, create_function('$a,$b','
#$a = str_replace($first, $second, $a);
#$b = str_replace($first, $second, $b);
#return strcasecmp($a,$b);'));

function usort_callback($a, $b) {
  $a = str_replace(array('à', 'é'), array('a', 'e'), strtolower($a));
  $b = str_replace(array('à', 'é'), array('a', 'e'), strtolower($b));
return (strcmp($a, $b));
}

usort($authors, 'usort_callback');

var_dump($authors);


foreach (array_count_values ($authors) as $author=$count)
{

 if((strtolower(substr($author, 0, 1)) == $ausenquiry))
 {

  echo tr bgcolor=\#D3DCE3\;
   echo th align=\left\ colspan=\2\a 
href=\.$SCRIPT_NAME.?searchenquiry=.urlencode($author).\.$author./a 
small[lt;--Search Entire Database]/small/th;
   echo th align=\right\ width=\5%\ nowrap(.$count. ;
if($count  1)
{echo records found/trouvés);}
else{echo record found/trouvé);}
   echo/th/tr\n;

   echo tr bgcolor=\#F5F5F5\tdnbsp;/td;
   echo td align=\left\;
   $temp = ;
   foreach ($author_list[$author] as $ausid)
   {
   $temp .= a target=\printwindow\ 
href=\print.php?id=.urlencode($ausid).\.$ausid./a, ;
   }
   $temp = substr($temp, 0, -2);
   echo $temp/td;
   echo tdnbsp;/td;
  echo /tr\n;
 }
}

mysql_close($myconnection);
##
echo /table
/td
/tr\n;

?

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



[PHP] installing 4.3.x and 5.x

2004-07-11 Thread Alex Duggan
Hello,

Is it possible to build php-4.3.x and php-5.0.0RC3 both as static
modules into apache-1.3?  If so, can the two version of php be installed
in the same prefix?  or should they be installed in /usr/local/php4
and /usr/local/php5?

Thanks,
Alex

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



Re: [PHP] MySQL/PHP Tunneling

2004-07-11 Thread Karam Chand
Hello,

Well, I know there are issues regarding this (security
as well as others). But tools like MySQL-Front and
DBTools are just doing that and it just happens that
the project i am working on needed something like
that, so I was just asking :)

Regards,
Karam
--- Curt Zirzow [EMAIL PROTECTED] wrote:
 * Thus wrote Karam Chand:
  --- Curt Zirzow [EMAIL PROTECTED]
 wrote:
  
  Now, many of the ISPs blokc 3306 for security
 reason
  and you cannot access MySQL from a 3rd party tool
 and
  have to use phpMyAdmin which is able to access the
  MySQL server as it is running on the same box.
  Sometimes, SSH tunneling is also not the option :)
 
 There usually is a reason why the port 3306 port is
 blocked or that
 mysql simply doesn't listen to outside addresses on
 that port.  By
 trying to circumstant that will probably result in a
 violation of
 their TOS.
 
 And as Jason suggested, use an ISP that either
 supports ssh
 tunneling (which is preferred and more likely to
 occur) or find a
 ISP that allows port 3336 to the open world.
 
 What you describe is more in the lines of Proxying,
 which is
 probably why I was confused.  And I wouldn't suggest
 to anyone to
 do that kind of proxying, the layers between
 everything can be
 *very* unstable.
 
 
 Curt
 -- 
 First, let me assure you that this is not one of
 those shady pyramid schemes
 you've been hearing about.  No, sir.  Our model is
 the trapezoid!
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 




__
Do you Yahoo!?
Yahoo! Mail - 50x more storage than other providers!
http://promotions.yahoo.com/new_mail

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



[PHP] Re: search string / query format

2004-07-11 Thread Jason Barnett
You might try checking out the Codewalkers.com previous contests.  They 
did one a while back that was for accessing google through PHP scripts. 
 I doubt any of them would have database support built-in, but it would 
give you a head start on the input fields.

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


[PHP] unset empty elements in an array

2004-07-11 Thread Justin French
Hi,
Looking for a one-liner to delete all empty elements in an array.  I 
know I can do it with a foreach loop, but I'm hoping that I've missed 
an existing function in the manual which may already do this, or a 
simple one-liner to replace the foreach.

?php
foreach($in as $k = $v) {
if(empty($v)) {
unset($in[$k]);
}
}
?
---
Justin French
http://indent.com.au
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] [PHP5RC3] echo $this-db-host not work

2004-07-11 Thread Tomasen
assume $this-db is an object. $db-host is a string localhost.

ehco $this-db-host;
// will output
localhost

but
ehco  $this-db-host ;
// whill output
Object id #2-host

is that a bug. or just have to workout by myself?

Thanks for all your good work
Tomasen

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