[PHP] select from db

2004-06-04 Thread BigMark
Hi i have a football tipping database and i need to extract certain records
from a users 'selections' table
table name 'Selections'

(rows)  RoundGameName Winner   Points
  data eg  1 1mark Hawthorn   4
(if  team is a winner then 4 points added)

   1 2mark Geelong 0


What i want to do is show all the above rows of a particular user and round,
ie:  all of user 'mark' round 1 details which includes games 1-8, the team
names he picked, and the points for a win.

p.s. is there a way of totaling the points as well

mark

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



Re: [PHP] Bulk table updates

2004-06-04 Thread Robert Sossomon
I use a separate page to do the addition of information to my DB
currently, the whole set of information is being re-written as I type
this, but where I am stuck is getting the whole thing to be parsed through
then just one line.

The code I currently use is as follows:
SNIP CODE
!-- modifycart.php --


$get_Quote = select st.id, st.sel_item_id, st.sel_item_desc,
st.sel_item_price, st.sel_item_qty, st.sel_item_comment from
store_shoppertrack as st left join items as si on si.id = st.sel_item_id
where session_id = '$PHPSESSID' order by $vsort;

$get_Quote_res = mysql_query($get_Quote) or die(mysql_error());

while ($row = MYSQL_FETCH_ROW($get_Quote_res))
$number = mysql_numrows($get_Quote_res);


if (mysql_num_rows($get_Quote_res)  1)
 { //print message
  $display_block = PYou have no items in your Quote. Please a
href=\seestore.php\continue to shop/a!/P;
 }
else
 { //get info and build Quote display

 while ($i  $number)
  {
   $id = mysql_result($get_Quote_res,$i,'id');
   $item_title = mysql_result($get_Quote_res,$i,'sel_item_id');
   $item_desc = mysql_result($get_Quote_res,$i,'sel_item_desc');
   $item_price = mysql_result($get_Quote_res,$i,'sel_item_price');
   $item_qty = mysql_result($get_Quote_res,$i,'sel_item_qty');
   $item_comment = mysql_result($get_Quote_res,$i,'sel_item_comment');


   if ($item_title ==  )
   {
$display_block .= trtdComment:/tdtd colspan=2 align=centerform
method=post action=\replacecart.php\input type=\hidden\
name=\sel_item_id\ value=\$item_title\input type=\text\ size=75
name=\sel_item_desc\ value=\$item_desc\input type=\hidden\
name=\sel_item_qty\ value=\1\input type=\hidden\ name=\SESSID\
value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
value=\$id\\ninput type=\hidden\ name=\url\
value=\$_SERVER[PHP_SELF]?view_code=$view_code\input type=\hidden\
name=\sel_item_price\ value=\0\/tdtdselect
name=\color\option value=\aqua\aqua/optionoption
value=\black\black/optionoption value=\blue\blue/optionoption
value=\fuchsia\fuchsia/optionoption
value=\gray\gray/optionoption value=\green\green/optionoption
value=\lime\lime/optionoption
value=\maroon\maroon/optionoption
value=\navy\navy/optionoption value=\olive\olive/optionoption
value=\purple\purple/optionoption value=\red\red/optionoption
value=\silver\silver/optionoption
value=\teal\teal/optionoption value=\white\white/optionoption
value=\yellow\yellow/option/select\n/tdtdCurrently:
$item_comment/tdtdinput type=\submit\ name=\submit\
value=\Modify\/form/td/tr\n;   }
   else
   {
$display_block .= \ntrtdform method=post
action=\replacecart.php\\n;
$display_block .= $item_title/tdtdinput type=text size=4
name=\sel_item_qty\ value=\$item_qty\\n;
$display_block .= /tdtdinput type=\text\ size=75
name=\sel_item_desc\ value=\$item_desc\;
$display_block .= input type=\hidden\ name=\SESSID\
value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
value=\$id\\ninput type=\hidden\ name=\sel_item_id\
value=\$item_title\\n;
$display_block .= input type=\hidden\ name=\url\
value=\$_SERVER[PHP_SELF]?view_code=$view_code\\n/tdtd;
$display_block .= input type=\text\ name=\sel_item_price\ size=\5\
value=\$item_price\\n/tdtd\ninput type=\text\ name=\comment\
value=\$item_comment\/tdtd\n;
$display_block .= input type=\submit\ name=\submit\
value=\Modify\/form/td\n;

   }
   $i++;
   }

!-- End Modify Cart --

!-- Replacecart.php --

   $addtocart = replace into store_shoppertrack
values('$_POST[id]','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]','$_POST[sel_item_price]','$_POST[sel_item_desc]','$comment',
now(),'','','','');

   mysql_query($addtocart);

!-- End Replace Cart --

End Snip CODE

I have a test set of data and stuff set up on my server:
http://lonewolf.homelinux.net/quoter

There are some errors in not getting to other tables, but they are
irrelevant for seeing what is there.  The data in the table is of course
bogus data, but you should see what I am getting at.

Thanks,
Robert


 Use a SELECT query to get the values (SELECT * FROM table) and a table
 that has form input fields in the cells.  The values for the form fields
 would be based on the array you get from the SELECT query.  The form could
 be something like form action=?=$PHP_SELF ? method=post.  In the
 script, before the body, you would have an if statement to check whether
 the submit button for the form is set; if it is set, it will run an INSERT
 INTO query:

 if (isset ($submit)) {
 $query = INSERT INTO . . . ;
 $query_result = @mysql_query ($query);
 }

 If the form is submitted, then the values in all the form fields
 (including any changes) will go into the database.  If it's not submitted,
 the current values will be displayed in the tabled-embedded form.
 Actually, I think if the form is submitted, it will redisplay with the new
 values as defaults.

 Hopefully this will work, or lead you in the right direction.



 -Original Message-
 From: Robert Sossomon [EMAIL PROTECTED]
 Sent: Jun 3, 2004 6:23 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] 

Re: [PHP] select from db

2004-06-04 Thread Robert Sossomon
!SNIP
 table name 'Selections'

 (rows)  RoundGameName Winner   Points
   data eg  1 1mark Hawthorn   4
 (if  team is a winner then 4 points added)

1 2mark Geelong 0

! End Snip

Assuming you have them submit a form to get here:
?php
//somefilename

//Access your Database
include db.php;

//Name from previous form, or you can use from authentication,
//whichever, just mod the code to reflect where getting it from
$name = $_POST[name];

//query and results
$query = select * from Selections where Name='$name';
$result = mysql_query($query);

/* Determine the number of records returned */
while ($row = MYSQL_FETCH_ROW($result))
$number = mysql_numrows($result);

/* Start printing to make it look good */
print table cellspacing=\0\ cellpadding=\5\ border=\1\;
print
trthRound/ththGame/ththName/ththWinner/ththPoints/th/tr;

$total_points=0;
/* Iterate through to make it clean */
while ($i  $number)
{
 $item_1 = mysql_result($result, $i,Round);
 $item_2 = mysql_result($result, $i,Game);
 $item_3 = mysql_result($result, $i,Name);
 $item_4 = mysql_result($result, $i,Winner);
 $item_5 = mysql_result($result, $i,Points);

/* This makes it print out in 2 separate color, depending on rows. */
 if ($i%2 == 0)
 {
  print tr
bgcolor=\#ee\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$item_4/tdtd$item_5/td/tr\n;
 }
 else
 {
 print tr
bgcolor=\#ff\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$item_4/tdtd$item_5/td/tr\n;
 }
/* Increase record count and total_points to date */
 $i++;
 $total_points += $item_5;
}
/* close everything up */
 print trth colspan=5Total Points Earned: $total_points/th/tr;
 print /table;
}

?

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



Re: [PHP] select from db

2004-06-04 Thread Dennis Seavers
When you run this script, or one like it, does it work?  You seem to be
missing a number of brackets.  For example, you have:

while ($row = MYSQL_FETCH_ROW($result))

instead of 

while ($row = MYSQL_FETCH_ROW($result)) {

or

while ($row = MYSQL_FETCH_ROW($result))
{

 [Original Message]
 From: Robert Sossomon [EMAIL PROTECTED]
 To: BigMark [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: 06/03/2004 11:44:58 PM
 Subject: Re: [PHP] select from db

 !SNIP
  table name 'Selections'
 
  (rows)  RoundGameName Winner   Points
data eg  1 1mark Hawthorn   4
  (if  team is a winner then 4 points added)
 
 1 2mark Geelong 0
 
 ! End Snip

 Assuming you have them submit a form to get here:
 ?php
 //somefilename

 //Access your Database
 include db.php;

 //Name from previous form, or you can use from authentication,
 //whichever, just mod the code to reflect where getting it from
 $name = $_POST[name];

 //query and results
 $query = select * from Selections where Name='$name';
 $result = mysql_query($query);

 /* Determine the number of records returned */
 while ($row = MYSQL_FETCH_ROW($result))
 $number = mysql_numrows($result);

 /* Start printing to make it look good */
 print table cellspacing=\0\ cellpadding=\5\ border=\1\;
 print

trthRound/ththGame/ththName/ththWinner/ththPoints/th
/tr;

 $total_points=0;
 /* Iterate through to make it clean */
 while ($i  $number)
 {
  $item_1 = mysql_result($result, $i,Round);
  $item_2 = mysql_result($result, $i,Game);
  $item_3 = mysql_result($result, $i,Name);
  $item_4 = mysql_result($result, $i,Winner);
  $item_5 = mysql_result($result, $i,Points);

 /* This makes it print out in 2 separate color, depending on rows. */
  if ($i%2 == 0)
  {
   print tr

bgcolor=\#ee\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$ite
m_4/tdtd$item_5/td/tr\n;
  }
  else
  {
  print tr

bgcolor=\#ff\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$ite
m_4/tdtd$item_5/td/tr\n;
  }
 /* Increase record count and total_points to date */
  $i++;
  $total_points += $item_5;
 }
 /* close everything up */
  print trth colspan=5Total Points Earned: $total_points/th/tr;
  print /table;
 }

 ?

 -- 
 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] select from db

2004-06-04 Thread Dennis Seavers
I think I misread your script.

I took the line

print table cellspacing=\0\ cellpadding=\5\ border=\1\;

to be part of the while loop, meaning there would be two statements.  I'm
not accustomed to seeing scripts that use functions without brackets, even
when their not required.

Sorry for the confusion.


 [Original Message]
 From: Dennis Seavers [EMAIL PROTECTED]
 To: Robert Sossomon [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Date: 06/04/2004 12:00:39 AM
 Subject: Re: [PHP] select from db

 When you run this script, or one like it, does it work?  You seem to be
 missing a number of brackets.  For example, you have:

 while ($row = MYSQL_FETCH_ROW($result))

 instead of 

 while ($row = MYSQL_FETCH_ROW($result)) {

 or

 while ($row = MYSQL_FETCH_ROW($result))
 {

  [Original Message]
  From: Robert Sossomon [EMAIL PROTECTED]
  To: BigMark [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Date: 06/03/2004 11:44:58 PM
  Subject: Re: [PHP] select from db
 
  !SNIP
   table name 'Selections'
  
   (rows)  RoundGameName Winner   Points
 data eg  1 1mark Hawthorn   4
   (if  team is a winner then 4 points added)
  
  1 2mark Geelong   
0
  
  ! End Snip
 
  Assuming you have them submit a form to get here:
  ?php
  //somefilename
 
  //Access your Database
  include db.php;
 
  //Name from previous form, or you can use from authentication,
  //whichever, just mod the code to reflect where getting it from
  $name = $_POST[name];
 
  //query and results
  $query = select * from Selections where Name='$name';
  $result = mysql_query($query);
 
  /* Determine the number of records returned */
  while ($row = MYSQL_FETCH_ROW($result))
  $number = mysql_numrows($result);
 
  /* Start printing to make it look good */
  print table cellspacing=\0\ cellpadding=\5\ border=\1\;
  print
 

trthRound/ththGame/ththName/ththWinner/ththPoints/th
 /tr;
 
  $total_points=0;
  /* Iterate through to make it clean */
  while ($i  $number)
  {
   $item_1 = mysql_result($result, $i,Round);
   $item_2 = mysql_result($result, $i,Game);
   $item_3 = mysql_result($result, $i,Name);
   $item_4 = mysql_result($result, $i,Winner);
   $item_5 = mysql_result($result, $i,Points);
 
  /* This makes it print out in 2 separate color, depending on rows. */
   if ($i%2 == 0)
   {
print tr
 

bgcolor=\#ee\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$ite
 m_4/tdtd$item_5/td/tr\n;
   }
   else
   {
   print tr
 

bgcolor=\#ff\td$item_1/tdtd$item_2/tdtd$item_3/tdtd$ite
 m_4/tdtd$item_5/td/tr\n;
   }
  /* Increase record count and total_points to date */
   $i++;
   $total_points += $item_5;
  }
  /* close everything up */
   print trth colspan=5Total Points Earned: $total_points/th/tr;
   print /table;
  }
 
  ?
 
  -- 
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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

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



RE: [PHP] Best way to sort?

2004-06-04 Thread Angelo Zanetti
what is the 2? in the order by statement mean?
thanks

-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort?


The best way is:

SELECT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC


- Original Message -
From: Daniel Clark [EMAIL PROTECTED]
To: Brian Dunning [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 10:30 AM
Subject: Re: [PHP] Best way to sort?


 SELECT DISTINCT person_name, count(*)
 FROM table_name
 GROUP BY person_name
 ORDER BY 2 DESC

  I'm not sure if this is a complex SQL query or a PHP array sorting
  thing, but what's the best way to take this data:
 
 Tom
 Greg
 Brian
 Tom
 Brian
 Tom
 
  And return the following results, sorted by number of records:
 
 Tom - 3
 Brian - 2
 Greg - 1
 
  Any thoughts?
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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

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


Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] Bulk table updates

2004-06-04 Thread Dennis Seavers
Maybe I don't understand what you're trying to accomplish -- and I'm not
sure what you meant by parsed through then just one line -- but the
application you have at the link would work if you set the default values
of the form elements to the data currently in your table.  Even if you have
a separate page for entering data, you can have the same script handle both
the data viewing and updating.

Hope that helps (but I'm guessing it won't)


 [Original Message]
 From: Robert Sossomon [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Date: 06/03/2004 11:23:31 PM
 Subject: Re: [PHP] Bulk table updates

 I use a separate page to do the addition of information to my DB
 currently, the whole set of information is being re-written as I type
 this, but where I am stuck is getting the whole thing to be parsed through
 then just one line.

 The code I currently use is as follows:
 SNIP CODE
 !-- modifycart.php --


 $get_Quote = select st.id, st.sel_item_id, st.sel_item_desc,
 st.sel_item_price, st.sel_item_qty, st.sel_item_comment from
 store_shoppertrack as st left join items as si on si.id = st.sel_item_id
 where session_id = '$PHPSESSID' order by $vsort;

 $get_Quote_res = mysql_query($get_Quote) or die(mysql_error());

 while ($row = MYSQL_FETCH_ROW($get_Quote_res))
 $number = mysql_numrows($get_Quote_res);


 if (mysql_num_rows($get_Quote_res)  1)
  { //print message
   $display_block = PYou have no items in your Quote. Please a
 href=\seestore.php\continue to shop/a!/P;
  }
 else
  { //get info and build Quote display

  while ($i  $number)
   {
$id = mysql_result($get_Quote_res,$i,'id');
$item_title = mysql_result($get_Quote_res,$i,'sel_item_id');
$item_desc = mysql_result($get_Quote_res,$i,'sel_item_desc');
$item_price = mysql_result($get_Quote_res,$i,'sel_item_price');
$item_qty = mysql_result($get_Quote_res,$i,'sel_item_qty');
$item_comment = mysql_result($get_Quote_res,$i,'sel_item_comment');


if ($item_title ==  )
{
 $display_block .= trtdComment:/tdtd colspan=2 align=centerform
 method=post action=\replacecart.php\input type=\hidden\
 name=\sel_item_id\ value=\$item_title\input type=\text\ size=75
 name=\sel_item_desc\ value=\$item_desc\input type=\hidden\
 name=\sel_item_qty\ value=\1\input type=\hidden\ name=\SESSID\
 value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
 value=\$id\\ninput type=\hidden\ name=\url\
 value=\$_SERVER[PHP_SELF]?view_code=$view_code\input type=\hidden\
 name=\sel_item_price\ value=\0\/tdtdselect
 name=\color\option value=\aqua\aqua/optionoption
 value=\black\black/optionoption value=\blue\blue/optionoption
 value=\fuchsia\fuchsia/optionoption
 value=\gray\gray/optionoption value=\green\green/optionoption
 value=\lime\lime/optionoption
 value=\maroon\maroon/optionoption
 value=\navy\navy/optionoption value=\olive\olive/optionoption
 value=\purple\purple/optionoption value=\red\red/optionoption
 value=\silver\silver/optionoption
 value=\teal\teal/optionoption value=\white\white/optionoption
 value=\yellow\yellow/option/select\n/tdtdCurrently:
 $item_comment/tdtdinput type=\submit\ name=\submit\
 value=\Modify\/form/td/tr\n;   }
else
{
 $display_block .= \ntrtdform method=post
 action=\replacecart.php\\n;
 $display_block .= $item_title/tdtdinput type=text size=4
 name=\sel_item_qty\ value=\$item_qty\\n;
 $display_block .= /tdtdinput type=\text\ size=75
 name=\sel_item_desc\ value=\$item_desc\;
 $display_block .= input type=\hidden\ name=\SESSID\
 value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
 value=\$id\\ninput type=\hidden\ name=\sel_item_id\
 value=\$item_title\\n;
 $display_block .= input type=\hidden\ name=\url\
 value=\$_SERVER[PHP_SELF]?view_code=$view_code\\n/tdtd;
 $display_block .= input type=\text\ name=\sel_item_price\ size=\5\
 value=\$item_price\\n/tdtd\ninput type=\text\ name=\comment\
 value=\$item_comment\/tdtd\n;
 $display_block .= input type=\submit\ name=\submit\
 value=\Modify\/form/td\n;

}
$i++;
}

 !-- End Modify Cart --

 !-- Replacecart.php --

$addtocart = replace into store_shoppertrack

values('$_POST[id]','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_
qty]','$_POST[sel_item_price]','$_POST[sel_item_desc]','$comment',
 now(),'','','','');

mysql_query($addtocart);

 !-- End Replace Cart --

 End Snip CODE

 I have a test set of data and stuff set up on my server:
 http://lonewolf.homelinux.net/quoter

 There are some errors in not getting to other tables, but they are
 irrelevant for seeing what is there.  The data in the table is of course
 bogus data, but you should see what I am getting at.

 Thanks,
 Robert


  Use a SELECT query to get the values (SELECT * FROM table) and a table
  that has form input fields in the cells.  The values for the form fields
  would be based on the array you get from the SELECT query.  The form
could
  be something like form action=?=$PHP_SELF ? method=post.  In the
  script, before the body, you would have an if statement to check whether
  the 

Re: [PHP] Class Syntax Help or Globals issue

2004-06-04 Thread Bob Pillford
Thanks very much!
Marek Kilimajer wrote:
bob pilly wrote:
Hi All
I am new to classes and are trying to work out whether
they will make my coding experience easier. I have
written the following test class which is trying to
take three variables from a mssql query and add them
as variables in a new class. This isnt working as i
keep getting an error that says ;
Warning: Missing argument 1 for app() in
/var/www/htdocs/temp3.php on line 13
Warning: Missing argument 2 for app() in
/var/www/htdocs/temp3.php on line 13
Warning: Missing argument 3 for app() in
/var/www/htdocs/temp3.php on line 13
the code .
//a basic class to store basic appointment details in
class App {
var $name;
var $the_date;
var $result;
//add values to the variables
This is the function's constructor, it's called when you create a 
class instance using new operator:

function App($app1name,$appdate,$appresult){
$this-name=$app1name;
$this-the_date=$appdate;
$this-result=$appresult;
}
}
$query=select app1name,appdate,appresult from
appresult where appdate  'jun 01 2004';
$qresult=mssql_query($query,$numero);//get the number
of rows returned
$numrow=mssql_num_rows($qresult);
if($row=mssql_fetch_array($qresult)){
$i=0;
do{
$j=$i;

So instead of:
$j= new App;

$j-App($row[app1name],$row['appdate'],$row['appresult']);

you have to suply the arguments to the contructor this way:
$j= new App($row[app1name],$row['appdate'],$row['appresult']);
}
while($row=mssql_fetch_array($qresult));
}
?
Is there a syntax problem with the way im trying to
pass the value of the $row array cells into the class
function?
I have looked at the online manual for classes but
find it a bit confusing on how to input and extract
variables data in classes. Any help or pointing in the
direction of some good docs would be greatly
appreciated!
thanks for any help in advance.

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


[PHP] sessions

2004-06-04 Thread BigMark
why is this not working. I am using instead of a form ($name =
$_POST[name];)
and linking to it from a users logged in page.

$FirstName = $_SESSION['first_name'];
$LastName = $_SESSION['last_name'];
$name = $FirstName , $LastName;

Mark

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



Re: [PHP] sessions

2004-06-04 Thread Enda Nagle - Lists
Mark,

You need to do this:
$name =  . $FirstName .  ,  . $LastName . ;

Regards

Enda
--




On 05/06/2004 01:22, BigMark [EMAIL PROTECTED] wrote:

 why is this not working. I am using instead of a form ($name =
 $_POST[name];)
 and linking to it from a users logged in page.
 
 $FirstName = $_SESSION['first_name'];
 $LastName = $_SESSION['last_name'];
 $name = $FirstName , $LastName;
 
 Mark




Re: [PHP] sessions

2004-06-04 Thread James Kaufman
On Fri, Jun 04, 2004 at 04:22:57PM -0800, BigMark wrote:
 why is this not working. I am using instead of a form ($name =
 $_POST[name];)
 and linking to it from a users logged in page.
 
 $FirstName = $_SESSION['first_name'];
 $LastName = $_SESSION['last_name'];
 $name = $FirstName , $LastName;
 
 Mark
 

Have you started the session? Each page needs a session_start() call before
accessing session variables. That is,

session_start();
$FirstName = $_SESSION['first_name'];
$LastName = $_SESSION['last_name'];
$name = $FirstName , $LastName;

-- 
Jim Kaufman
Linux Evangelist
public key 0x6D802619
http://www.linuxforbusiness.net

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



Re: [PHP] Bulk table updates

2004-06-04 Thread Marek Kilimajer
Robert Sossomon wrote:
I use a separate page to do the addition of information to my DB
currently, the whole set of information is being re-written as I type
this, but where I am stuck is getting the whole thing to be parsed through
then just one line.
The code I currently use is as follows:
SNIP CODE
!-- modifycart.php --
$get_Quote = select st.id, st.sel_item_id, st.sel_item_desc,
st.sel_item_price, st.sel_item_qty, st.sel_item_comment from
store_shoppertrack as st left join items as si on si.id = st.sel_item_id
where session_id = '$PHPSESSID' order by $vsort;
$get_Quote_res = mysql_query($get_Quote) or die(mysql_error());
while ($row = MYSQL_FETCH_ROW($get_Quote_res))
$number = mysql_numrows($get_Quote_res);
if (mysql_num_rows($get_Quote_res)  1)
 { //print message
  $display_block = PYou have no items in your Quote. Please a
href=\seestore.php\continue to shop/a!/P;
 }
else
 { //get info and build Quote display
 while ($i  $number)
  {
   $id = mysql_result($get_Quote_res,$i,'id');
   $item_title = mysql_result($get_Quote_res,$i,'sel_item_id');
   $item_desc = mysql_result($get_Quote_res,$i,'sel_item_desc');
   $item_price = mysql_result($get_Quote_res,$i,'sel_item_price');
   $item_qty = mysql_result($get_Quote_res,$i,'sel_item_qty');
   $item_comment = mysql_result($get_Quote_res,$i,'sel_item_comment');
   if ($item_title ==  )
   {
$display_block .= trtdComment:/tdtd colspan=2 align=centerform
method=post action=\replacecart.php\input type=\hidden\
name=\sel_item_id\ value=\$item_title\
You can remove sel_item_id hidden field
input type=\text\ size=75
name=\sel_item_desc\ value=\$item_desc\
And rename all other fields to field_name[$id].
Then in replacecart.php loop one of the fields (other then checkboxes if 
you use them), the array index will give you the id:

foreach($_POST['sel_item_desc'] as $id = $dummy) {
update table set
sel_item_desc = '$_POST[sel_item_desc][$id]',
sel_item_qty = '$_POST[sel_item_qty][$id]',
...
where id = '$id'
}
input type=\hidden\
name=\sel_item_qty\ value=\1\input type=\hidden\ name=\SESSID\
value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
value=\$id\\ninput type=\hidden\ name=\url\
value=\$_SERVER[PHP_SELF]?view_code=$view_code\input type=\hidden\
name=\sel_item_price\ value=\0\/tdtdselect
name=\color\option value=\aqua\aqua/optionoption
value=\black\black/optionoption value=\blue\blue/optionoption
value=\fuchsia\fuchsia/optionoption
value=\gray\gray/optionoption value=\green\green/optionoption
value=\lime\lime/optionoption
value=\maroon\maroon/optionoption
value=\navy\navy/optionoption value=\olive\olive/optionoption
value=\purple\purple/optionoption value=\red\red/optionoption
value=\silver\silver/optionoption
value=\teal\teal/optionoption value=\white\white/optionoption
value=\yellow\yellow/option/select\n/tdtdCurrently:
$item_comment/tdtdinput type=\submit\ name=\submit\
value=\Modify\/form/td/tr\n;   }
   else
   {
$display_block .= \ntrtdform method=post
action=\replacecart.php\\n;
$display_block .= $item_title/tdtdinput type=text size=4
name=\sel_item_qty\ value=\$item_qty\\n;
$display_block .= /tdtdinput type=\text\ size=75
name=\sel_item_desc\ value=\$item_desc\;
$display_block .= input type=\hidden\ name=\SESSID\
value=\$PHPSESSID\\ninput type=\hidden\ name=\id\
value=\$id\\ninput type=\hidden\ name=\sel_item_id\
value=\$item_title\\n;
$display_block .= input type=\hidden\ name=\url\
value=\$_SERVER[PHP_SELF]?view_code=$view_code\\n/tdtd;
$display_block .= input type=\text\ name=\sel_item_price\ size=\5\
value=\$item_price\\n/tdtd\ninput type=\text\ name=\comment\
value=\$item_comment\/tdtd\n;
$display_block .= input type=\submit\ name=\submit\
value=\Modify\/form/td\n;
   }
   $i++;
   }
!-- End Modify Cart --
!-- Replacecart.php --
   $addtocart = replace into store_shoppertrack
values('$_POST[id]','$_POST[SESSID]','$_POST[sel_item_id]','$_POST[sel_item_qty]','$_POST[sel_item_price]','$_POST[sel_item_desc]','$comment',
now(),'','','','');
   mysql_query($addtocart);
!-- End Replace Cart --
End Snip CODE
I have a test set of data and stuff set up on my server:
http://lonewolf.homelinux.net/quoter
There are some errors in not getting to other tables, but they are
irrelevant for seeing what is there.  The data in the table is of course
bogus data, but you should see what I am getting at.
Thanks,
Robert

Use a SELECT query to get the values (SELECT * FROM table) and a table
that has form input fields in the cells.  The values for the form fields
would be based on the array you get from the SELECT query.  The form could
be something like form action=?=$PHP_SELF ? method=post.  In the
script, before the body, you would have an if statement to check whether
the submit button for the form is set; if it is set, it will run an INSERT
INTO query:
if (isset ($submit)) {
   $query = INSERT INTO . . . ;
   $query_result = @mysql_query ($query);
}
If the form is submitted, then the values in all the 

[PHP] php-cgi+suexec and fastcgi

2004-06-04 Thread Adrian Teasdale
Hi there

we need to run php under another user account as we are setting up a
link with it to Qmail.  Our plan is to use:

php-cgi+suexec for this. fastcgi may be an alternative and we are just
wondering if there is anything bad about using fastcgi for this?

Any help appreciated

Thanks

Ade

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



[PHP] php-cgi+suexec and fastcgi

2004-06-04 Thread Adrian Teasdale
Hi there

we need to run php under another user account as we are setting up a
link with it to Qmail.  Our plan is to use:

php-cgi+suexec for this. fastcgi may be an alternative and we are just 
php-cgi+wondering if there is anything bad about using fastcgi for this?

Any help appreciated

Thanks

Ade

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



[PHP] ## Getting into Netscape.com Inbox

2004-06-04 Thread jack bauer
Hi,

i'm trying to access my netscape.com inbox with php,
so i started to decode the ssl session and got all sent packets
in plaintext, not really hard. but know i have to deal with encrypted
cookies and i have no clue what i have to do. i found no help
while i crawled the web for hours.

an example:

Cookie:
MC_MS_LDC=1 activationde 1 1086246633 0 1086245744 0;
MC_NPID=mc-sr12.websys.aol.com/9738;
MC_SESSION0=%2FO7gI0OrZnCyKU9ZmWBsOA%3D%3D-diAxLjAga2lkIDIwMDQwNjAyMDEwMDAxM
TE1OQ%3D%3D-nrVhh6NyA2ucnTGoqHuGR%2FW8HXEp74Oo%2FBWpqzwyvOvf77IyX6CWZ0YIHJyg
TZzKxaQ4181tOTlZwZI11OGY1TfbIX1JRDLS3LL2xDtnIaXYf7V8yDXTeA%3D%3D;
C_SITE_ACT=yiBeRJ8fvFTwAFG+ZefJmA==-yI/TFXODOR4TuSu2hocH7bDa744fsOwU+92Ub3mW
tfBUOnWuJkVCJ34mEq9zmEsz5mto1KN24NA=;
MC_SITE_ACT=yiBeRJ8fvFTwAFG+ZefJmA==-yI/TFXODOR7m9s106Mf3qlzvgDhdyOqWVpA43Kx
7G1H3uij9bZQ7iXEb3BgZsRJwqoPSTd1IzJ4=;
MC_SITEID=nscpenusmail;
MC_SSTATE=mach5%3d1;
MC_AUTHLEV=2

i tried to use rawurldecode() and base64_decode and i got only one small
part in plaintext:

diAxLjAga2lkIDIwMDQwNjAyMDEwMDAxMTE1OQ%3D%3D
v 1.0 kid 200406020100011159


someone in here that have a clue what should i do next?

regards

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



[PHP] error when running commands via exec() in CLI-mode

2004-06-04 Thread Alberto Mucignat
I do this:
?php
$cmd = 'rsync -Razv file.php [EMAIL PROTECTED]::zone';
@exec($cms, $log, $ret);
?
when an rsync error occure, if I run this script by a web server I get 
no output (errors go correctly into $log and $ret), while running the 
script in a console environment I get errors in the standard output even 
if I suppress them with @.

anyone knows a workaround? is this a bug?
bye, alberto.
--
Imagination is more important than knowledge
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] MySQL PHP

2004-06-04 Thread Nunners
I've just installed Fedora Core 2, including I believe both PHP  MySQL..
However whenever I try and run something that connects to MySQL, it comes up
with the following:

 

cannot load MySQL extension,

please check PHP Configuration.

 

Does this mean anything to anyone?

 

I've checked loads of things, like MySQL is running, etc etc But without
luck..

 

Cheers

Nunners



RE: [PHP] help needed with tiger tree hashes

2004-06-04 Thread Thijs Lensselink
check: http://www.cs.technion.ac.il/~biham/Reports/Tiger/testresults.html
The results you posted seem to be right.

Carl S. in 't Veld wrote on vrijdag 4 juni 2004 0:52:

 I am trying to generate tiger tree hashes the same way as
 directconnect does, but I am failing.
 
 I checked the output from php with the reference vectors from
 http://www.cs.technion.ac.il/~biham...ssie-format.dat
 and they appear to be different!
 
 echo bin2hex(mhash(MHASH_TIGER, 'abc')).br/\n;
 outputs
 f258c1e88414ab2a527ab541ffc5b8bf935f7b951c132951
 instead of
 2AAB1484E8C158F2BFB8C5FF41B57A525129131C957B5F93
 
 and, for example,
 echo bin2hex(mhash(MHASH_TIGER, 'message digest')).br/\n;
 outputs
 951a2078cbf881d91c441e754830cf0df6295aa51aca7f51
 instead of
 D981F8CB78201A950DCF3048751E441C517FCA1AA55A29F6
 
 What am I doing wrong here?

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



RE: [PHP] Best way to sort?

2004-06-04 Thread Daniel Clark
Order by the 2nd column

what is the 2? in the order by statement mean?
thanks

-Original Message-
From: Raúl Castro [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 03, 2004 6:20 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] Best way to sort?


The best way is:

SELECT person_name, count(*)
FROM table_name
GROUP BY person_name
ORDER BY 2 DESC




RE: [PHP] MySQL PHP

2004-06-04 Thread Thijs Lensselink
Looks like the mysql module for php is not loaded.
Is extension=mysql.so included in the php.ini.

Nunners wrote on vrijdag 4 juni 2004 14:07:

 I've just installed Fedora Core 2, including I believe both PHP 
 MySQL.. However whenever I try and run something that connects to
 MySQL, it comes up with the following:
 
 
 
 cannot load MySQL extension,
 
 please check PHP Configuration.
 
 
 
 Does this mean anything to anyone?
 
 
 
 I've checked loads of things, like MySQL is running, etc etc But
 without luck..
 
 
 
 Cheers
 
 Nunners

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



Re: [PHP] sessions

2004-06-04 Thread Daniel Clark
Did you have session_start() on this page before accessing the session variables?

Could also do:

$name = $_SESSION['first_name'] , $_SESSION['last_name'] ;

why is this not working. I am using instead of a form ($name =
$_POST[name];)
and linking to it from a users logged in page.

$FirstName = $_SESSION['first_name'];
$LastName = $_SESSION['last_name'];
$name = $FirstName , $LastName;

Mark

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





RE: [PHP] MySQL PHP

2004-06-04 Thread Robert Sossomon
Run: rpm -q php-mysql

From the command line as root and see if it is there, if not go out and
download the fedora rpm with that in the title, since that would be the
missing piece.

HTH,
Robert

-Original Message-
From: Nunners [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 04, 2004 8:07 AM
To: [EMAIL PROTECTED]
Subject: [PHP] MySQL  PHP


I've just installed Fedora Core 2, including I believe both PHP 
MySQL.. However whenever I try and run something that connects to MySQL,
it comes up with the following:

 

cannot load MySQL extension,

please check PHP Configuration.

 

Does this mean anything to anyone?

 

I've checked loads of things, like MySQL is running, etc etc But without
luck..

 

Cheers

Nunners

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



Re: [PHP] PHP Debugger 4 Linux?

2004-06-04 Thread Marco Schuler
Am Fr, 2004-06-04 um 00.14 schrieb Nick Wilson:
 Hi everyone, 
 
 Can anyone recommend a good debugger for *nix?

Zend Studio

 Many thx!
 -- 
 Nick W

-- 
Regards
 Marco

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



Re: [PHP] PHP Debugger 4 Linux?

2004-06-04 Thread Yann Larrivee
Xdebug, is free and works on unix and windows and it is a PHP extension.

www.xdebug.org

Yann

On Fri, 2004-06-04 at 09:51, Marco Schuler wrote:
 Am Fr, 2004-06-04 um 00.14 schrieb Nick Wilson:
  Hi everyone, 
  
  Can anyone recommend a good debugger for *nix?
 
 Zend Studio
 
  Many thx!
  -- 
  Nick W
 
 -- 
 Regards
  Marco

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



[PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Hi, all --

I am working up a CGI script to take advantage of Apache's suEXEC so that
the web server can manipulate files as the site owner.  I have already
managed a simple

  $f = fopen(/path/to/docroot/testfile,'w') ;
  fwrite($f,hi!\n) ;
  fclose($f) ;

and know that it works as intended, but now I seem completely unable to
get any $_POST (or even $_GET) data into the script.  I suspect, from
reading the manual and noting the warnings, that any GET data will be
ignored, and that's fine, but I know that I can provide that without even
messing about with a form that I might somehow be screwing up, so I
thought I'd try it...

My code is as simple as

  #!/usr/local/bin/php
  ?php
print Content-type: text/html\n\n ;
print _POST IS . ; print_r($_POST) ; print .br\n ;
print _GET IS . ; print_r($_GET) ; print .br\n ;
print Enter your password:br\n ;
print form method='post'\n ;
print input type='password' name='pass'\n ;
print br\ninput type='submit' value='ENTER'\n ;
print /form\n ;
exit ;
  ?

but I only get

  _POST IS .Array ( ) .
  _GET IS .Array ( ) .
  Enter your password:
  
  ENTER

even after submitting.  Switching to

  form method='get'

doesn't help anything.

So how on earth does one get data into a CGI PHP script?


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpi7TjlJ0mJ7.pgp
Description: PGP signature


[PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread Aaron Gould
Has anyone here had recent success compiling PHP with mnoGoSearch?
I'm trying to get PHP 4.3.7 and mnoGoSearch 3.1.21 to work together, but 
it's just not working.  mnoGoSearch configures and installs fine (in 
/usr/local/mnogosearch), and PHP configures fine.  But during PHP's 
make, I get all sorts of errors at the end of the compilation:

/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
definition of `mysql_port'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x8): multiple 
definition of `mysql_unix_port'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x8): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0xc): multiple 
definition of `net_buffer_length'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0xc): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x10): multiple 
definition of `max_allowed_packet'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x10): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x14): multiple 
definition of `net_read_timeout'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x14): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x18): multiple 
definition of `net_write_timeout'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x18): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x0): In function 
`mysql_server_init':
: multiple definition of `mysql_server_init'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x0): first defined here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x16c0): In function 
`mysql_once_init':
: multiple definition of `mysql_once_init'
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x16c0): first defined 
here
/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.text+0x10): In function 
`mysql_server_end':
...
(and many more lines like this, substituting mysql_server_end with 
other mysql-related items).

It certainly seems MySQL related.  Any ideas?
Here's my PHP configure line:
./configure --prefix=/usr/local/apache
--with-apxs=/usr/local/apache/bin/apxs --enable-trans-sid
--enable-inline-optimization --with-gettext --enable-ftp --with-zlib
--with-pspell --with-curl --with-imap --with-kerberos --with-xml
--with-mcrypt --with-mnogosearch=/usr/local/mnogosearch
--with-mysql=/usr
Thanks,
--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] php as CGI and $_POST

2004-06-04 Thread Curt Zirzow
* Thus wrote David T-G ([EMAIL PROTECTED]):
 
 and know that it works as intended, but now I seem completely unable to
 get any $_POST (or even $_GET) data into the script.  I suspect, from
 reading the manual and noting the warnings, that any GET data will be
 ignored, and that's fine, but I know that I can provide that without even
 messing about with a form that I might somehow be screwing up, so I
 thought I'd try it...
 
 My code is as simple as
 
   #!/usr/local/bin/php

What does '/usr/local/bin/php -v' show?


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread Curt Zirzow
* Thus wrote Aaron Gould ([EMAIL PROTECTED]):
 /usr/local/mnogosearch), and PHP configures fine.  But during PHP's 
 make, I get all sorts of errors at the end of the compilation:
 
 /usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
 definition of `mysql_port'

Just a guess but mnogosearch have mysql compiled staticly in its
library?


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



[PHP] script location

2004-06-04 Thread Gabe
Does anyone know of a simple/efficient way to determine the path to a 
script on the URL?

For instance:
http://www.nowhere.com/test/whatever/testing.php
All I want out of that URL is this:
/test/whatever/
I didn't see an element in one of the super global variables that would 
provide me this information.  Any ideas?

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


Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread Aaron Gould
Curt Zirzow wrote:
* Thus wrote Aaron Gould ([EMAIL PROTECTED]):
/usr/local/mnogosearch), and PHP configures fine.  But during PHP's 
make, I get all sorts of errors at the end of the compilation:

/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
definition of `mysql_port'

Just a guess but mnogosearch have mysql compiled staticly in its
library?
Curt
That just occurred to me as well, although it's just a guess for me as 
well.  Upon checking mnoGoSearch's configuration help, it appears the 
default is static.  I'll see if I can get it working as shared...

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] script location

2004-06-04 Thread Matt Matijevich
[snip]
http://www.nowhere.com/test/whatever/testing.php 

All I want out of that URL is this:

/test/whatever/
[/snip]

http://php.net/dirname 

I think that will do it

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



Re: [PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%  My code is as simple as
%  
%#!/usr/local/bin/php
% 
% What does '/usr/local/bin/php -v' show?

Doesn't seem to scary to me:

  bash-2.05a$ /usr/local/bin/php -v
  PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
  Copyright (c) 1997-2003 The PHP Group
  Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies


% 
% 
% Curt


TIA  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgp1qcksBNrfz.pgp
Description: PGP signature


RE: [PHP] script location

2004-06-04 Thread James Harrell
See the parse_url() function.

-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED]
Sent: Friday, June 04, 2004 9:57 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] script location


[snip]
http://www.nowhere.com/test/whatever/testing.php 

All I want out of that URL is this:

/test/whatever/
[/snip]

http://php.net/dirname 

I think that will do it

-- 
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] script location

2004-06-04 Thread David T-G
Gabe --

...and then Gabe said...
% 
% Does anyone know of a simple/efficient way to determine the path to a 
% script on the URL?

Gee, it sounds like you want the dirname() of the SCRIPT_URL.  You're on
the right track :-)


HTH  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpVpgXKhM7hi.pgp
Description: PGP signature


RE: [PHP] Current URL

2004-06-04 Thread Stephen Craton
Also, on a Windows machiene, it returns something like c:\htdocs\subsite.
Already tried it, but thanks. :-)

I'll be going with your GLOBAL variable suggestion, it seems so obvious now.
Thanks for the help! :-)

 
Thanks,
Stephen Craton
http://www.melchior.us

-Original Message-
From: Robert Cummings [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 04, 2004 12:59 AM
To: Aidan Lister
Cc: PHP-General
Subject: Re: [PHP] Current URL

On Fri, 2004-06-04 at 01:38, Aidan Lister wrote:
 Hi,
 
 You could use $_SERVER['DOCUMENT_ROOT']
 

That doesn't work... as the OP mentioned, the URLs might need to refer
locally within a subsite built as a subdirectory within the document root.

Cheers,
Rob.


 
 Robert Cummings [EMAIL PROTECTED] wrote in message 
 news:[EMAIL PROTECTED]
  On Thu, 2004-06-03 at 23:15, Stephen Craton wrote:
   I've wondered for quite some time, and search just as long it 
   seems
 like,
   for a way to get the current URL directory. For example, let's say 
   you
 were
   at www.example.com/files. The script is executing in this 
   directory, and it's calling an include script from the base 
   (www.example.com or maybe
 even
   www.example.com/includes). In this included file are some links 
   and
 maybe
   some images. These images and links are set up to be called from 
   the
 base
   directory, so basically all the links inside the file say 
   something like images/bob.gif or something of that nature.
  
   How could you dynamicaly change this in relation to where the 
   included script is? If I were to include it in that files in 
   /files, it would
 look
   for the images in /files/images/bob.gif which would not be there. 
   One solution I have thought of is just putting the / at the 
   beginning
 (/images/)
   but that wouldn't be the safest solution if the script were 
   running in a subfolder to begind with (like the entire site is in
 www.example.com/site1).
  
   I hope you understand what I'm trying to say. Any ideas?
 
  In a configuration file shared by the project's scripts have a 
  constant or global variable like follows:
 
  $GLOBALS['imageBase'] = '/site1/';
 
  Now wherever in your site you use an image you can use this value to 
  prepend the image path.
 
  Cheers,
  Blobbie.
  --
  ..
  | InterJinn Application Framework - http://www.interjinn.com |
  ::
  | An application and templating framework for PHP. Boasting  | a 
  | powerful, scalable system for accessing system services  | such as 
  | forms, properties, sessions, and caches. InterJinn |
  | also provides an extremely flexible architecture for   |
  | creating re-usable components quickly and easily.  |
  `'
 
 --
 PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: 
 http://www.php.net/unsub.php
 
 
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  | a 
| powerful, scalable system for accessing system services  | such as 
| forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

--
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] php as CGI and $_POST

2004-06-04 Thread Peter Risdon
David T-G wrote:
Curt, et al --
...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%  My code is as simple as
%  
%#!/usr/local/bin/php
% 
% What does '/usr/local/bin/php -v' show?

Doesn't seem to scary to me:
 bash-2.05a$ /usr/local/bin/php -v
 PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
 

You probably need the cgi version - not the command line one you 
actually have.

Peter.
 Copyright (c) 1997-2003 The PHP Group
 Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies
% 
% 
% Curt

TIA  HAND
:-D
 

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


Re: [PHP] php as CGI and $_POST

2004-06-04 Thread Curt Zirzow
* Thus wrote David T-G ([EMAIL PROTECTED]):
 Curt, et al --
 
 ...and then Curt Zirzow said...
 % 
 % * Thus wrote David T-G ([EMAIL PROTECTED]):
 %  
 %  My code is as simple as
 %  
 %#!/usr/local/bin/php
 % 
 % What does '/usr/local/bin/php -v' show?
 
 Doesn't seem to scary to me:
 
   bash-2.05a$ /usr/local/bin/php -v
   PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)

that cli should be cgi.

I'm assuming you compiled php with something like:
   configure --with-apxs=/yada/apxs [other options]

What you need to do is recompile php with configure like:
   configure --[other options]

Then make will build a cgi binary in sapi/cgi/php, relative to your build
directory.  If you want both versions (cgi and cli) you'll have to
manually place the cgi version of php somewhere else than
/usr/local/bin or name it something php_cgi. And then reference
that file in you php script.




Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] script location

2004-06-04 Thread Gabe
Thanks Matt and James... very helpful!
James Harrell wrote:
See the parse_url() function.

-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED]
Sent: Friday, June 04, 2004 9:57 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] script location
[snip]
http://www.nowhere.com/test/whatever/testing.php 

All I want out of that URL is this:
/test/whatever/
[/snip]
http://php.net/dirname 

I think that will do it
--
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] php as CGI and $_POST

2004-06-04 Thread David T-G
Peter --

...and then Peter Risdon said...
% 
% David T-G wrote:
% 
%  bash-2.05a$ /usr/local/bin/php -v
%  PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
% 
% You probably need the cgi version - not the command line one you 
% actually have.

Ooohhh...  Ouch.  So there are *three* possible PHP compiles:
module, CGI, and CLI?

OK.  To save us the cost of rebuilding at this host, is there any way to
pass args to the CLI version of the script running as a CGI?


Thanks  HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgphoH93CTsi6.pgp
Description: PGP signature


Re: [PHP] script location

2004-06-04 Thread Gabe
Knowing the functions is half the battle.  :-)
David T-G wrote:
Gabe --
...and then Gabe said...
% 
% Does anyone know of a simple/efficient way to determine the path to a 
% script on the URL?

Gee, it sounds like you want the dirname() of the SCRIPT_URL.  You're on
the right track :-)
HTH  HAND
:-D
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread Aaron Gould
Curt Zirzow wrote:
* Thus wrote Aaron Gould ([EMAIL PROTECTED]):
/usr/local/mnogosearch), and PHP configures fine.  But during PHP's 
make, I get all sorts of errors at the end of the compilation:

/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
definition of `mysql_port'

Just a guess but mnogosearch have mysql compiled staticly in its
library?
I tried configuring both mnoGoSearch and PHP with shared libs and it 
still did not work together (same errors).

I just tried mnoGoSearch withouth the MySQL support and it did work.  I 
suppose at least that will work well enough to let me know what 
mnoGoSearch is all about.

I wonder if mnoGoSearch does not truly support MySQL 4.x (I'm on 
4.0.18).  They've only tested with 3.21, 3.22 and 3.23.

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Best way to sort?

2004-06-04 Thread Raúl Castro
yes, Is the column number on select statement. You could use alias too:

SELECT person_name, count(*) count
FROM table_name
GROUP BY person_name
ORDER BY count DESC




- Original Message -
From: Angelo Zanetti [EMAIL PROTECTED]
To: Raúl Castro [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, June 04, 2004 2:20 AM
Subject: RE: [PHP] Best way to sort?


 what is the 2? in the order by statement mean?
 thanks

 -Original Message-
 From: Raúl Castro [mailto:[EMAIL PROTECTED]
 Sent: Thursday, June 03, 2004 6:20 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] Best way to sort?


 The best way is:

 SELECT person_name, count(*)
 FROM table_name
 GROUP BY person_name
 ORDER BY 2 DESC


 - Original Message -
 From: Daniel Clark [EMAIL PROTECTED]
 To: Brian Dunning [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, June 03, 2004 10:30 AM
 Subject: Re: [PHP] Best way to sort?


  SELECT DISTINCT person_name, count(*)
  FROM table_name
  GROUP BY person_name
  ORDER BY 2 DESC
 
   I'm not sure if this is a complex SQL query or a PHP array sorting
   thing, but what's the best way to take this data:
  
  Tom
  Greg
  Brian
  Tom
  Brian
  Tom
  
   And return the following results, sorted by number of records:
  
  Tom - 3
  Brian - 2
  Greg - 1
  
   Any thoughts?
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php

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

 
 Disclaimer
 This e-mail transmission contains confidential information,
 which is the property of the sender.
 The information in this e-mail or attachments thereto is
 intended for the attention and use only of the addressee.
 Should you have received this e-mail in error, please delete
 and destroy it and any attachments thereto immediately.
 Under no circumstances will the Cape Technikon or the sender
 of this e-mail be liable to any party for any direct, indirect,
 special or other consequential damages for any use of this e-mail.
 For the detailed e-mail disclaimer please refer to
 http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

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



Re: [PHP] script location

2004-06-04 Thread Curt Zirzow
* Thus wrote David T-G ([EMAIL PROTECTED]):
 Gabe --
 
 ...and then Gabe said...
 % 
 % Does anyone know of a simple/efficient way to determine the path to a 
 % script on the URL?
 
 Gee, it sounds like you want the dirname() of the SCRIPT_URL.  You're on
 the right track :-)

Or dirname() of $_SERVER['REQUEST_URI'] in case SCRIPT_URL isn't
available.


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] php as CGI and $_POST

2004-06-04 Thread Curt Zirzow
* Thus wrote David T-G ([EMAIL PROTECTED]):
 Peter --
 
 ...and then Peter Risdon said...
 % 
 % David T-G wrote:
 % 
 %  bash-2.05a$ /usr/local/bin/php -v
 %  PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
 % 
 % You probably need the cgi version - not the command line one you 
 % actually have.
 
 Ooohhh...  Ouch.  So there are *three* possible PHP compiles:
 module, CGI, and CLI?
 
 OK.  To save us the cost of rebuilding at this host, is there any way to
 pass args to the CLI version of the script running as a CGI?

You might have getenv('QUERY_STRING') for GET data and *possibly* to
get the POST data you can do something like:

$fp = fopen('php://stdin', 'r');
while (!feof($fp) ) $buf .= fgets($fp, 1024);
fclose($fp);

Then of course you're going to have to parse the query_string and
post data in order to get the variable names and values..

parse_str(getenv('QUERY_STRING'), $_GET);


Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

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



Re: [PHP] script location

2004-06-04 Thread John W. Holmes
From: Gabe [EMAIL PROTECTED]

 Knowing the functions is half the battle.  :-)

GI JOE!!!

---John Holmes

http://www.ebaumsworld.com/gijoe.html

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



Re: [PHP] php as CGI and $_POST

2004-06-04 Thread David T-G
Curt, et al --

...and then Curt Zirzow said...
% 
% * Thus wrote David T-G ([EMAIL PROTECTED]):
%  
%bash-2.05a$ /usr/local/bin/php -v
%PHP 4.3.4 (cli) (built: Jan  6 2004 15:27:52)
% 
% that cli should be cgi.
% 
% I'm assuming you compiled php with something like:
%configure --with-apxs=/yada/apxs [other options]

Yep.  And with CLI enabled, too.


% 
% What you need to do is recompile php with configure like:
%configure --[other options]

Gotcha.  Thanks for the pointers.


% 
% Then make will build a cgi binary in sapi/cgi/php, relative to your build
% directory.  If you want both versions (cgi and cli) you'll have to
% manually place the cgi version of php somewhere else than
% /usr/local/bin or name it something php_cgi. And then reference
% that file in you php script.

I found where our support crew had built the current version not quite
six months ago, and that a lovely buildme file with our approximately 8
billion --with* params in it, so I just copied the tree, pulled apxs out,
rebuilt, and copied the CGI php somewhere as you suggest.  And now I have
post data; yippee :-)

Thanks also for your other response.  Finding the build tree was
definitely the easier route :-)


HAND

:-D
-- 
David T-G
[EMAIL PROTECTED]
http://justpickone.org/davidtg/  Shpx gur Pbzzhavpngvbaf Qrprapl Npg!



pgpJXoqkHNGmw.pgp
Description: PGP signature


Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread John Nichel
Aaron Gould wrote:
Curt Zirzow wrote:
* Thus wrote Aaron Gould ([EMAIL PROTECTED]):
/usr/local/mnogosearch), and PHP configures fine.  But during PHP's 
make, I get all sorts of errors at the end of the compilation:

/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
definition of `mysql_port'

Just a guess but mnogosearch have mysql compiled staticly in its
library?

I tried configuring both mnoGoSearch and PHP with shared libs and it 
still did not work together (same errors).

I just tried mnoGoSearch withouth the MySQL support and it did work.  I 
suppose at least that will work well enough to let me know what 
mnoGoSearch is all about.

I wonder if mnoGoSearch does not truly support MySQL 4.x (I'm on 
4.0.18).  They've only tested with 3.21, 3.22 and 3.23.

I had the same problem.  We're running mnoGoSearch just fine on our 
production box using MySQL 3.x, but on one of our development machines, 
we're running MySQL 4.x.  mnoGoSearch configured/compiled/installed fine 
on that box, but php barfed on compile.  We then reinstalled 
mnoGoSearch, configuring it with --with-built-in, and then PHP built fine.

--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] script location

2004-06-04 Thread Ben Ramsey
Well, then... let me win the whole battle for you:
$path = $_SERVER['REQUEST_URI'];
$path = dirname($path);
echo $path;
You can use REQUEST_URI, SCRIPT_NAME, or PHP_SELF.
Now you know, and knowing is . . .  ;-)

John W. Holmes wrote:
From: Gabe [EMAIL PROTECTED]
Knowing the functions is half the battle.  :-)
GI JOE!!!
---John Holmes
http://www.ebaumsworld.com/gijoe.html
--
Regards,
 Ben Ramsey
 http://benramsey.com
---
http://www.phpcommunity.org/
Open Source, Open Community
Visit for more information or to join the movement.
---
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread Aaron Gould
John Nichel wrote:
Aaron Gould wrote:
Curt Zirzow wrote:
* Thus wrote Aaron Gould ([EMAIL PROTECTED]):
/usr/local/mnogosearch), and PHP configures fine.  But during 
PHP's make, I get all sorts of errors at the end of the compilation:

/usr/lib/mysql/libmysqlclient.a(libmysql.o)(.data+0x4): multiple 
definition of `mysql_port'
Just a guess but mnogosearch have mysql compiled staticly in its
library?
I tried configuring both mnoGoSearch and PHP with shared libs and it 
still did not work together (same errors).

I just tried mnoGoSearch withouth the MySQL support and it did work.  
I suppose at least that will work well enough to let me know what 
mnoGoSearch is all about.

I wonder if mnoGoSearch does not truly support MySQL 4.x (I'm on 
4.0.18).  They've only tested with 3.21, 3.22 and 3.23.

I had the same problem.  We're running mnoGoSearch just fine on our 
production box using MySQL 3.x, but on one of our development machines, 
we're running MySQL 4.x.  mnoGoSearch configured/compiled/installed fine 
on that box, but php barfed on compile.  We then reinstalled 
mnoGoSearch, configuring it with --with-built-in, and then PHP built fine.
Good to know it's not just my machine, thanks!  I've just run a few 
tests and it seems mnoGoSearch will fill our need.  Hopefully they'll 
soon have MySQL 4.x supported though!

--
Aaron Gould
Parts Canada - Web Developer
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Mapping solutions

2004-06-04 Thread René Fournier
I'm looking for a good mapping solution for a PHP project I'm working 
on, and wondered if any of you would be able to recommend one.

Basically, I would like to be able to pass this Map Module several 
values: Latitude, longitude, map scale (e.g., 5KM x 5KM), and map 
resolution (500 pixels x 500 pixels), and have it return a GIF or JPEG 
which I can then send to the user's browser. (Additionally, it would be 
useful if I could pass more than one set of latitude/longitude values 
and have the map software display multiple points on the same map.)

It seems unlikely that I could get my Host Provider to let me run 
third-party software like this on their servers, so I would probably 
have to install it on my ownwhich would likely end up being a Mac OS X 
box.

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


Re: [PHP] Asuming query without the ?

2004-06-04 Thread Robert Winter
I can't make it work.  Because I'm new to .htaccess I tried some examples
from apache.org:

1) Contents of .htaccess in http://mysite.com/path
RewriteEngine On
RewriteRule   ^oldstuff\.html$  newstuff.html

THIS EXAMPLE WORK, but the next one doesn't, nor the rule you told me:

2)
RewriteEngine On
RewriteRule ^localpath(.*)$http://www.google.com$1

Thanks again!


Marek Kilimajer [EMAIL PROTECTED] escribió en el mensaje
news:[EMAIL PROTECTED]
 Robert Winter wrote:
  Where and how do I set this? I'm to Unix and PHP.
 

 in .htaccess file

 
 RewriteRule ^/path/([0-9]+)$/path/index.php?code=$1
 
 

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



Re: [PHP] script location

2004-06-04 Thread Daniel Clark
I use of realpath()

 Does anyone know of a simple/efficient way to determine the path to a
 script on the URL?

 For instance:

 http://www.nowhere.com/test/whatever/testing.php

 All I want out of that URL is this:

 /test/whatever/

 I didn't see an element in one of the super global variables that would
 provide me this information.  Any ideas?

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



[PHP] HTTP_REFERER

2004-06-04 Thread Steve Douville
I think I'm having a major brain fart here. Is there a $HTTP_REFERER
anymore? It doesn't show up as a server variable or anything at all in
phpinfo()... using php 4.3.4

Ideas?

TIA,
Steve


Re: [PHP] HTTP_REFERER

2004-06-04 Thread John Nichel
Steve Douville wrote:
I think I'm having a major brain fart here. Is there a $HTTP_REFERER
anymore? It doesn't show up as a server variable or anything at all in
phpinfo()... using php 4.3.4
Ideas?
TIA,
Steve
It has to be set to show up.
--
John C. Nichel
KegWorks.com
716.856.9675
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Re: HTTP_REFERER

2004-06-04 Thread Stephen Lake
No...it shows up in the auto global varaible $_SERVER['HTTP_REFERER']

Steve Douville [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 I think I'm having a major brain fart here. Is there a $HTTP_REFERER
 anymore? It doesn't show up as a server variable or anything at all in
 phpinfo()... using php 4.3.4

 Ideas?

 TIA,
 Steve


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



Re: [PHP] HTTP_REFERER

2004-06-04 Thread Steve Douville
lmao -- uh huh

Problem was that I was using a javascript redirect and of course, that
doesn't send any value. Found that out just a minute ago. New the stupid
variable existed...

Think I'll grab the info in js and then redirect it to the php page as part
of the query string.

Thanks,
Steve

- Original Message - 
From: John Nichel [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, June 04, 2004 2:51 PM
Subject: Re: [PHP] HTTP_REFERER


 Steve Douville wrote:
  I think I'm having a major brain fart here. Is there a $HTTP_REFERER
  anymore? It doesn't show up as a server variable or anything at all in
  phpinfo()... using php 4.3.4
  
  Ideas?
  
  TIA,
  Steve
  
 
 It has to be set to show up.
 
 -- 
 John C. Nichel
 KegWorks.com
 716.856.9675
 [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



[PHP] PHP and Apache Authentication

2004-06-04 Thread Glenn MacGregor
Hi All,
I am trying to protect portions of my website. I am using pache 2.x and 
php4.X. I don't want to use apache authentication within the Directory 
directive because I can't utilize sessions if I do that. So I want to 
use PHP to authenticate from a postgresql database.

This works fine on the pages I have put it on, the problem is I want it 
on all pages in a given directory but I don't want to edit every page in 
that directory. Is there a way to configure apache to include something 
in every response?

Example:
http://test/v1/v1.php
v1.php:
...
include(../auth.inc)
...
This file is protected.
http://test/v1/v1-test.php
v1-test.php doesn't contain the include above, but I still want to 
protect it.

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


Re: [PHP] PHP and Apache Authentication

2004-06-04 Thread Matt Matijevich
[snip]
Is there a way to configure apache to include something 
in every response?
[/snip]

I think you could use a autoprepend in your php.ini file

http://www.php.net/reserved.variables 

there is a mention of it on the user comments on this page

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



[PHP] Error Downloading files using FOpen

2004-06-04 Thread Gerald Winkler
 I have a weird problem, maybe one of you can help me figure it out. I have
a server (that is a test box..but that's a different issue) running PHP
4.3.1 RC (I believe. I didn't install it and they laid off the guy who
did..) and it's giving me a weird error.

When you go to download a file off a page it corrupts the download. The code
for the fopen is specifying a binary d/l and not ASCII so it shouldn't be
doing this. However, it is and I can't figure out why.

I've run it through two browsers and even took the php pages off the
production site and literally replaced the files on the test box. Same
errors. When I directly link to the file, it of course works.

I thought I had ruled out the code (and it still seems to be ruled out)
because the exact same procedure works on the production box. One of the
guys who worked here before he quit two weeks ago mentioned something about
having to change the max upload size in the php.ini file becaue of issues
with large .zip files. However this is not an upload issue so I don't think
it's the problem. I changed it anyways (to varying levels) and it still
didn't work.

Oh, the original files are good. I know becase you can go across the network
and open them and they look fine.

Anyone have any ideas? I'm getting nowhere fast.

Oh, it was originally tested using some .xls files, but a few .txt files I
created as a test were altered in the d/l as well...

It's a local file, it has permission to open it, the size is 20,480 bytes
and the size of the dowloaded file comes out at 20,480 bytes, so they match.

The Apache server is 2.0.43.

  Code:

  // Verify current user and their permissions
 //
 $skip = FALSE;

 if( $_SESSION['userid'] ==  ) {
$errormsg = You must be logged in to download files.;
$skip = TRUE;
 }

 if( $_SESSION['providerid'] ==  ) {
$errormsg = You must be logged in to download files.;
$skip = TRUE;
 }

 // Build path
 if ( @$HTTP_GET_VARS['rfile']) {
$filepath = $_SESSION['Settings']['datapath'] .
$HTTP_GET_VARS['rfile'];
 } else {
$filepath = $_SESSION['Settings']['datapath'] .
$_SESSION['providerid'] . $HTTP_GET_VARS['file'];
 }

 if(!$skip) {
if(file_exists($filepath)) {
   // Save an audit log entry of this download

   // Output headers
   header(Cache-Control: private, must-revalidate);
   header(Pragma: private);
   header(Content-type: application/octet-stream\n);
   header(Content-Disposition: attachment;
filename=\.substr(strrchr($filepath,/),1).\\n);
   header(Content-length:
.(string)(filesize($filepath)).\n);

   $fd = fopen($filepath,'rb');

   while(!feof($fd)) {
  print fread($fd, 4096);
  flush();
   }

   fclose($fd);

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



Re: [PHP] Error Downloading files using FOpen

2004-06-04 Thread Matt Matijevich
[snip]
When you go to download a file off a page it corrupts the download.
[/snip]

not sure what the exact problem is, but have you tried other functions,
like readfile
http://www.php.net/manual/en/function.readfile.php

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



RE: [PHP] Error Downloading files using FOpen

2004-06-04 Thread Winkler, Gerald
That gives me the same junk data problems.

-Original Message-
From: Matt Matijevich [mailto:[EMAIL PROTECTED]
Sent: Friday, June 04, 2004 2:29 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] Error Downloading files using FOpen


[snip]
When you go to download a file off a page it corrupts the download.
[/snip]

not sure what the exact problem is, but have you tried other functions,
like readfile
http://www.php.net/manual/en/function.readfile.php


**
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed.  If you have received this email in error please notify
the sender by email, delete and destroy this message and its 
attachments.

**



Re: [PHP] Error Downloading files using FOpen

2004-06-04 Thread John W. Holmes
Winkler, Gerald wrote:
That gives me the same junk data problems.
Define junk data? How is it corrupting the file? try downloading a 
simple text file with a basic sentence in it. What does it look like 
after it's corrupted?

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals  www.phparch.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Compiling PHP with mnoGoSearch fails

2004-06-04 Thread raditha dissanayake
Aaron Gould wrote:
Has anyone here had recent success compiling PHP with mnoGoSearch?
Consider ASPSeek. It's a spin off from mnogo. It does have a lot of 
other benefits including faster speeds.

--
Raditha Dissanayake.
-
http://www.raditha.com/megaupload/upload.php
Sneak past the PHP file upload limits.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] table formatting

2004-06-04 Thread BigMark
This script by Rob Sossomon works great --Thanks!
however could anyone tell me if its possible to make it run horizontally. at
the moment the output is like this---

--
  Round Game Winning team Wins
  1 1 Collingwood
  1 2 Melbourne 4
  1 3 Fremantle  4
  1 4 Brisbane 4
  1 5 St Kilda
  1 6 Port Adelaide 4
  1 7 Kangaroos 4
  1 8 West Coast  4
  2 1 Richmond
  2 2 Collingwood 4
  2 3 Brisbane 4
  2 4 West Coast
  2 5 Essendon
  2 6 Fremantle
  2 7 Carlton 4
  2 8 Hawthorn

--I would like it
like this
Round  game1wingame2 win   game3 etc

   1   Collingwood   4  Melbourne 4 Fremantle 4


?php
session_start();
include(connect.php);
$Name = $_SESSION['first_name'] .   . $_SESSION['last_name'];

$sql = SELECT * FROM Selections WHERE Name = '$Name';
$result = mysql_query($sql);

/* Determine the number of records returned */
while ($row = MYSQL_FETCH_array($result))
$number = mysql_numrows($result);


/* Start printing to make it look good */
print table width=\30%\ cellspacing=\0\ cellpadding=\0\
border=\0\;
print
trthRound/ththGame/ththWinning
Team/ththWins/th/tr;

$total_points=0;
/* Iterate through to make it clean */
while ($i  $number)
{
 $item_1 = mysql_result($result, $i,Round);
 $item_2 = mysql_result($result, $i,Game);
 $item_4 = mysql_result($result, $i,Winner);
 $item_5 = mysql_result($result, $i,Points);

/* This makes it print out in 2 separate color, depending on rows. */
 if ($i%8 == 0)
 {
  print tr
bgcolor=\#99\tdcenter$item_1/center/tdtdcenter$item_2/ce
nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
/tr\n;
 }
 else
 {
 print tr
bgcolor=\#66\tdcenter$item_1/center/tdtdcenter$item_2/ce
nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
/tr\n;
 }



/* Increase record count and total_points to date */
 $i++;
 $total_points += $item_5;
}
/* close everything up */

 print trth colspan=5Total Points Earned: $total_points/th/tr;
 print /table;

?

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



RE: [PHP] table formatting

2004-06-04 Thread Dennis Seavers
Change the design of the HTML table.


 [Original Message]
 From: BigMark [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Date: 06/04/2004 8:07:51 PM
 Subject: [PHP] table formatting

 This script by Rob Sossomon works great --Thanks!
 however could anyone tell me if its possible to make it run horizontally.
at
 the moment the output is like this---

 --
   Round Game Winning team Wins
   1 1 Collingwood
   1 2 Melbourne 4
   1 3 Fremantle  4
   1 4 Brisbane 4
   1 5 St Kilda
   1 6 Port Adelaide 4
   1 7 Kangaroos 4
   1 8 West Coast  4
   2 1 Richmond
   2 2 Collingwood 4
   2 3 Brisbane 4
   2 4 West Coast
   2 5 Essendon
   2 6 Fremantle
   2 7 Carlton 4
   2 8 Hawthorn

 --I would like it
 like this
 Round  game1wingame2 win   game3 etc

1   Collingwood   4  Melbourne 4 Fremantle 4


 ?php
 session_start();
 include(connect.php);
 $Name = $_SESSION['first_name'] .   . $_SESSION['last_name'];

 $sql = SELECT * FROM Selections WHERE Name = '$Name';
 $result = mysql_query($sql);

 /* Determine the number of records returned */
 while ($row = MYSQL_FETCH_array($result))
 $number = mysql_numrows($result);


 /* Start printing to make it look good */
 print table width=\30%\ cellspacing=\0\ cellpadding=\0\
 border=\0\;
 print
 trthRound/ththGame/ththWinning
 Team/ththWins/th/tr;

 $total_points=0;
 /* Iterate through to make it clean */
 while ($i  $number)
 {
  $item_1 = mysql_result($result, $i,Round);
  $item_2 = mysql_result($result, $i,Game);
  $item_4 = mysql_result($result, $i,Winner);
  $item_5 = mysql_result($result, $i,Points);

 /* This makes it print out in 2 separate color, depending on rows. */
  if ($i%8 == 0)
  {
   print tr

bgcolor=\#99\tdcenter$item_1/center/tdtdcenter$item_2/ce

nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
 /tr\n;
  }
  else
  {
  print tr

bgcolor=\#66\tdcenter$item_1/center/tdtdcenter$item_2/ce

nter/tdtdcenter$item_4/center/tdtdcenter$item_5/center/td
 /tr\n;
  }



 /* Increase record count and total_points to date */
  $i++;
  $total_points += $item_5;
 }
 /* close everything up */

  print trth colspan=5Total Points Earned: $total_points/th/tr;
  print /table;

 ?

 -- 
 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] if/elseif/else v. switch

2004-06-04 Thread Dennis Seavers
Is there any noticeable difference (on the part of the client) between identical 
conditionals, one written as a switch, the other written as an if, elseif ... else 
conditional?  I realize that one programmer coming in behind another might prefer the 
gentler layout of a switch; but would there be any perceivable difference, 
client-side, between the options?