[PHP] Form security

2001-05-24 Thread phpman

Since nobody answered my last question (or any of them for that matter). Let
me rephrase it a little
different.

Other then checking the referer (to make sure the posted data came from the
right page)
 and user agent (to see if it exists), is there any other way to secure a
form from having other
forms submitting to it?

-dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Form security

2001-05-24 Thread phpman


I'm not trying to keep my script secure, I'm trying to get into another
script, using cURL.
I sent all of the POST fields, set my REFERER to be their referer page, even
set my AGENT to
be ie 5 on a Win2K box. Damn script is still not returning the right screen.
When I copy the HTML
code to my machine and run it locally (adjusting the FORM ACTION= to the
remote script url) it works.
I can even change the same form around and point it one of my scripts that
prints every POST var out, I
got them all. I checked for cookies - none.

I'm not doing this to do anything illegal. I'm trying to link with this
script...
http://wwwapps.ups.com/servlet/QCCServlet
to get shipping info (their XML integration is impossible with PHP - PHP
cannot do it). This makes
no sense to me, I can't think of anything I'm missing. I've gone through my
code for typos and
case sensitivities - even the order the POST vars are sent in is the same!

Aauuugg!

-dave

phpman [EMAIL PROTECTED] wrote in message
9ejeqp$gm7$[EMAIL PROTECTED]">news:9ejeqp$gm7$[EMAIL PROTECTED]...
 Since nobody answered my last question (or any of them for that matter).
Let
 me rephrase it a little
 different.

 Other then checking the referer (to make sure the posted data came from
the
 right page)
  and user agent (to see if it exists), is there any other way to secure a
 form from having other
 forms submitting to it?

 -dave



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] trying to mimic a form

2001-05-23 Thread phpman

hello,
  I'm trying to use cURL to mimic a browser requesting data from UPS' web
site. Here's the
link (for getting a shipping rate)...
http://wwwapps.ups.com/servlet/QCCServlet

I try to fake sending all the post vars with cURL, however it doesn't work.
Here's my code...

// declare var vals here
$o_country=US;
$o_postal=78758;
$o_city=Austin;
$d_country=US;
$d_postal=10005;
$d_city=New York;
$weight=2;
$length=12;
$width=9;
$height=4;
$value=40;

// encode some that might have spaces and stuff
$o_city=rawurlencode($o_city);
$c=rawurlencode(02);
$url = http://wwwapps.ups.com/servlet/QCCServlet;;
$post =
currencycode=USDiso_language=eniso_country=usorigcountry=$o_countryorig
postal=$o_postalorigincity=$o_citydestcountry=$d_countrydestpostal=$d_pos
taldestcity=$d_cityresidential=NOpackages=1rate_chart=RTPcontainer=$c;
$post
.=weight1=$weightweight_std1=LBSlength_std1=INheight1=$heightlength1=$
lengthlength_std1=INvalue1=$valueratesummarypackages_x=34ratesummarypack
ages_x=10;

$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, Mozilla/4.0 (compatible; MSIE 5.01;
Windows NT 5.0));
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt ($ch, CURLOPT_POST, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($ch, CURLOPT_REFERER, $url);
$results = curl_exec ($ch);
curl_close ($ch);


...yet all this does is return me to the first screen. I checked for hidden
inputs and stuff - i got them all. Anyone got any ideas?

-dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] xmlHTTP.send equiv?

2001-05-21 Thread phpman

Does anyone have info on doing this with a secure server?


Michael Conley [EMAIL PROTECTED] wrote in message
2102328FD2ECD411879E00609737BFD10BE2AD@FATBOY">news:2102328FD2ECD411879E00609737BFD10BE2AD@FATBOY...
 does anyone have info on this?

 -Original Message-
 From: Todd Kennedy [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 01, 2001 1:38 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] xmlHTTP.send equiv?


 Does anyone know of an equivilent for ASP's xmlHTTP.send command for
 PHP?

 i need to send a XML string out to an HTTP server without using user
 interaction (from the inside of a script).

 please respond via email at [EMAIL PROTECTED]

 thanks


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]








 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] HTTP socket connection

2001-05-20 Thread phpman

I've been working with curl as well. It allows a pretty easy method to
access https, however it is
limited as far as encrypting data and sending to an https server. So now i'm
experimenting with
snoopy to simulate a web client. I'm trying to link up with UPS online
tools, but the sob's only
know java. I've posted to this news group with questions pertaining to this
stuff, but nobody
seems to understand what I'm talking about. There has to something out
there, as I'm sure
somebody has to have done this before.

-dave


Tolga thorr Orhon [EMAIL PROTECTED] wrote in message
9e3no5$hld$[EMAIL PROTECTED]">news:9e3no5$hld$[EMAIL PROTECTED]...
 As far as I know you cant do that with standard socket connection as SSL
 needs more than that. One solution that I am currently using is using Curl
 extensions of PHP which is working just fine. But you may need to
recompile
 PHP with curl support. For more info:

 http://www.php.net/manual/en/ref.curl.php
 http://curl.haxx.se/

 Tolga 'thorr' Orhon

 Todd Cary [EMAIL PROTECTED] wrote in message
 [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
  For my http socket connection, I am using
 
 POST $abs_url HTTP/1.0\r\n.
 Accept-Language: en-us\r\n.
 Host: $host:$port\r\n.
 Connection: close\r\n.
 Content-type: application/x-www-form-urlencoded\r\n.
 
  which works great.
 
  What do I need to change for a SSL connection?
 
  Todd
 
  --
  Todd Cary
  Ariste Software
  [EMAIL PROTECTED]
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Has anybody linked with UPS online tools?

2001-05-17 Thread phpman

Has anyone done a XML linking with UPS online rates tool?
Please respond to me - i need help!

-dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] SSL and CURL question --

2001-05-15 Thread phpman

CURL is realy cool, lets me do easy socket stuff, especially with
ssl, which leads me to my question:

How on God's green earth do I send more then simple requests to a SSL
server? Here's my basic request...

POST /apps.here/xml/Rate HTTP/1.1
Content-Type: application/xml
Content-Length: 1074

?xml version=1.0 encoding=UTF-8?
xml stuff hereblah.../xml stuff here


the CURL code (so far)

$xml_req=this is the xml doc;
$l=strlen($xml_req);

$url=https://www.secureserver.com/apps.here/xml/Rate;;
$tmp_out=time() . .tmp.xml.out;
$fp = fopen (/public/nirvana/ . $tmp_out, w+);
fwrite($fp, $xml_req, $l);

$ch = curl_init ();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_SSLVERSION, 3);
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, POST /apps.here/xml/Rate
HTTP/1.1);
curl_setopt ($ch, CURLOPT_HTTPHEADER, Content-Type: application/xml);
curl_setopt ($ch, CURLOPT_INFILE, $fp);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
// curl_setopt ($ch, CURLOPT_VERBOSE, 1);
// curl_setopt ($ch, CURLOPT_POST, 1);

$results = curl_exec ($ch);
fclose($fp);
curl_close ($ch);



the tmp xml file displays the correct stuff. I'm totally confused and there
is basically NO curl ssl support docs anywhere.

distraut in buffalo,

dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Newbie-Continue Line of Code

2001-05-15 Thread phpman

it doesn't matter. the thing in php that separates lines (actually commands)
is the --  ;  semicolan.
In theory you could put all your code on one line.

Mike Maki [EMAIL PROTECTED] wrote in message
9dsbhr$52j$[EMAIL PROTECTED]">news:9dsbhr$52j$[EMAIL PROTECTED]...
 How do I continue a line of code to the next line? I like to keep my lines
 of code to about 60 characters in width then wrap to the next line. Is
this
 possible with lines of PHP code?

 Thanks,

 Mike



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] OpenSSL compile option

2001-05-07 Thread phpman

Anyone familiar with the new OpenSSL support to work as far as opening and
communicating via a SSL socket?
I saw info regarding it at

http://www.php.net/manual/en/ref.openssl.php

however cannot get the functions to work. i'm just clueless about how to get
it functional.

-dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] working with SSL

2001-04-17 Thread phpman

How do I establish an SSL socket connection with PHP?
I have PHP compiled in an Apache Mod_SSL server. Do I need to compile PHP
with
some sort of open_ssl option? I have --enable-sockets in the command line.
Please help!!!

-dave





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] variables empty

2001-04-17 Thread phpman

hey,

try this...

$the_path = "/home/H0RNET/ftp/" . $jaar . "/" . $vak . "/";

unlink ($the_path . $d);



""Dennis Haller"" [EMAIL PROTECTED] wrote in message
9bharm$1td$[EMAIL PROTECTED]">news:9bharm$1td$[EMAIL PROTECTED]...
 Hi all,
 I've got this problem with variables. In the code below I've got the
 variables: $jaar and $vak, if I echo them they r displayed correctly, but
if
 the function unlink is called it doesnt seem to know what $jaar and $vak
 are. If I do $the_path = "/home/H0RNET/ftp/jaar1/PRO/";  then the function
 unlink works just fine.
 Do I have to declare the 2 variables again? What is the problem here?

 Thx,
 H0RNET




 ?php
 $the_path = "/home/H0RNET/ftp/$jaar/$vak/";

 if ($d)
 {
 unlink ("$the_path$d");
 }


 $handle = dir($the_path);
 $upl = $upl."table width=\"28%\" border=\"0\"";
 while ($file = $handle-read()) {
 if (($file != ".")  ($file != "..")) {
 $con = giveup
 trtd width="13%" height="2"$file/a
 /tdtd width="87%" height="2"
 a href="$PHP_SELF?d=$file"DELETE/a/td/tr
 giveup;
 $upl = $upl."$con";
   }
 }
 $upl = $upl."/table";

 echo $upl;
 ?




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] SSL SSL SSL SSL -- READ THIS!!!!!!

2001-04-17 Thread phpman

How do I establish an SSL socket connection with PHP?
I have PHP compiled in an Apache Mod_SSL server. Do I need to compile PHP
with
some sort of open_ssl option? I have --enable-sockets in the command line.
Please help!!!

-dave









-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Stored Procedured

2001-04-17 Thread phpman

i'm not sure what you're asking. maybe this?

$result = odbc_exec($conn, "execute" . odbc_exec($conn,"execute sp_list
$quantity") . $last_name);

// I don't know much about odbc api, but that's how you execute a func in a
func


"Juan Andres" [EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 Hi i send one question

 how i can execute two or more stored procedured?

 example

 $first_procedure = odbc_exec($conn,"execute sp_list
 $quantity");

 $second_procedure = odbc_exec($conn,"execute
 sp_list_names $last_name");

 how i use values of $second_procedure

 __
 Do You Yahoo!?
 Yahoo! Auctions - buy the things you want at great prices
 http://auctions.yahoo.com/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Screen Resolutions

2001-04-17 Thread phpman

script language=javascript type="TEXT/JAVASCRIPT"
!--
widthvar = screen.width
heightvar = screen.height
// --
/script

or something like that


"Martín Marqués" [EMAIL PROTECTED] wrote in message
01041718172501.16385@bugs">news:01041718172501.16385@bugs...
 On Mié 18 Abr 2001 00:15, Michael Geier wrote:
  PHP is server side, so it has no mthodology for detecting client side
  information.

 This is half true. It is server side, but remember that the browser sends
 information about the client.
 Of course, not the resolution! ;-)

  Try javascript.

 This is a very good idea!

 Saludos... :-)

 --
 El mejor sistema operativo es aquel que te da de comer.
 Cuida tu dieta.
 -
 Martin Marques  |[EMAIL PROTECTED]
 Programador, Administrador  |   Centro de Telematica
Universidad Nacional
 del Litoral
 -

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] What's XML's Purpose??

2001-04-14 Thread phpman

hold on here,
XML and HTML have, as far as I'm concerned, nothing to do with each other.
I'm using XML to link databases
on the sites I write (with PHP) with disparate databases on other Inernet
servers. A good example would be linking
up with UPS's online rates application server. I send an XML request with
shipment info and get a response XML
file with the pricing, time to delivery, etc..

The tags just tell you what the info between them is. XML is awesome, and
will become very big in the next couple years. You can write all kinds of
business 2 business appz with it.

-dave





""Chris Anderson"" [EMAIL PROTECTED] wrote in message
000201c0c501$50264b60$0d1012d1@null">news:000201c0c501$50264b60$0d1012d1@null...
Alright I'll start this out by saying I have a subscription to "Visual Basic
Programmers Journal". Before I converted and realized that I loved PHP so
much I used ASP. Well it seems that in this magazine that XML is a hot topic
in the MS world. I know XML can be used by PHP, but is there a point? I only
know 2 things about it:
1) You can make your own tags:
mytag/mytag
2) It's supposedly good for databasing?

If its for databasing, why not just use MySQL( or a variation). Am I missing
something here?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how to get num of sessions vars?

2001-04-13 Thread phpman

I thought this would work..

$num = count($HTTP_SESSION_VARS);

..but it doesn't. I can access the session vars themselves, so I know
they're there. Help.

-Dave




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to get num of sessions vars?

2001-04-13 Thread phpman

Thanks,

another quick question. That works and I can access the variables still but
this
for ($x=0;$x$s;$x++) {
$tmp = $HTTP_SESSION_VARS[$x];
echo("ptmp=$tmp/p\n");
}

outputs

tmp=



 Why? How do I cycle through each session var and get its name and
value?


""Keyur Kalaria"" [EMAIL PROTECTED] wrote in message
006501c0c42e$ba839860$2d64a8c0@office">news:006501c0c42e$ba839860$2d64a8c0@office...
 Hey Dave,

 you can try the following:

 num = sizeof($HTTP_SESSION_VARS);


 regards
 keyur


 - Original Message -
 From: "phpman" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Friday, April 13, 2001 8:40 PM
 Subject: [PHP] how to get num of sessions vars?


  I thought this would work..
 
  $num = count($HTTP_SESSION_VARS);
 
  ..but it doesn't. I can access the session vars themselves, so I know
  they're there. Help.
 
  -Dave
 
 
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 
 


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] XML via socket connection

2001-04-13 Thread phpman

All the docs i've looked at for parsing XML takes a file as input. What's
the proceedure for
opening a socket connection and doing XML transmissions via TCP/IP. Do I
need to do
socket calls through PHP to open an XML connection (manually send all the
HTTP headers
and such?). Is there a built in function ; any place with these modules
already
written ; or should I just write them myself?

-Dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] how to get num of sessions vars?

2001-04-13 Thread phpman

nevermind

""phpman"" [EMAIL PROTECTED] wrote in message
9b78hr$uvb$[EMAIL PROTECTED]">news:9b78hr$uvb$[EMAIL PROTECTED]...
 Thanks,

 another quick question. That works and I can access the variables still
but
 this
 for ($x=0;$x$s;$x++) {
 $tmp = $HTTP_SESSION_VARS[$x];
 echo("ptmp=$tmp/p\n");
 }

 outputs

 tmp=



  Why? How do I cycle through each session var and get its name and
 value?


 ""Keyur Kalaria"" [EMAIL PROTECTED] wrote in message
 006501c0c42e$ba839860$2d64a8c0@office">news:006501c0c42e$ba839860$2d64a8c0@office...
  Hey Dave,
 
  you can try the following:
 
  num = sizeof($HTTP_SESSION_VARS);
 
 
  regards
  keyur
 
 
  - Original Message -
  From: "phpman" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Friday, April 13, 2001 8:40 PM
  Subject: [PHP] how to get num of sessions vars?
 
 
   I thought this would work..
  
   $num = count($HTTP_SESSION_VARS);
  
   ..but it doesn't. I can access the session vars themselves, so I know
   they're there. Help.
  
   -Dave
  
  
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
   To contact the list administrators, e-mail:
[EMAIL PROTECTED]
  
  
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  To contact the list administrators, e-mail: [EMAIL PROTECTED]
 



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] sort multidimensional array?

2001-03-27 Thread phpman

 Hello,

 i have this code:

while ($row = mysql_fetch_array($results)) {
$tmp = get_item_reorder_priority($row["item_sku"]);
$list[$r]["priority"] = $tmp[0];
$list[$r]["sku"] = $row["item_sku"];
$r++;
   }

   $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);

and it returns this error:
  Warning: Argument 1 to array_multisort() is expected to be an array or a
sort flag in d://www/inventory_specific.phtml on line 109

  function get_item_reorder_priority() returns an array - with $tmp[0] being
an integer 1-5
  $row["item_sku"] is simply a string.

  I'm trying to sort by priority numbers (1-5). Any help would be
appreciated.

  -dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] sort multidimensional array?

2001-03-27 Thread phpman

I'm still confused. I'm looking to sort the list[$r] part of the array based
on what value $list[$r]["priority"] is. What would the function's arguments
be?

""Stuart J. Browne"" [EMAIL PROTECTED] wrote in message
99rajk$i0v$[EMAIL PROTECTED]">news:99rajk$i0v$[EMAIL PROTECTED]...
  while ($row = mysql_fetch_array($results)) {
  $tmp = get_item_reorder_priority($row["item_sku"]);
  $list[$r]["priority"] = $tmp[0];
  $list[$r]["sku"] = $row["item_sku"];
  $r++;
 }
 
 $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);
 
  and it returns this error:
Warning: Argument 1 to array_multisort() is expected to be an array or
a
  sort flag in d://www/inventory_specific.phtml on line 109
 
function get_item_reorder_priority() returns an array - with $tmp[0]
 being
  an integer 1-5
$row["item_sku"] is simply a string.


 Umm, dunno about anybody else but it appears as if you are missing a
 dimension..

 In the array creation:

 $list[$r]["priority"]

 is used.. emphasis on the [$r] part.

 When trying to re-order, you are using just $list["priority"].  missing
the
 [$r] dimension..

 bkx



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how do i get a variable type? - not that simple

2001-03-18 Thread phpman

No guys. that doesn't work. Take this code for example...

$a="3";
echo(gettype($a));

this returns  string
i need to find it as an integer or real or float for the sql. which by the
way is MySQL.

thank you for responding, but I already know that gettype and all the other
is_*  don't work for this.



""phpman"" [EMAIL PROTECTED] wrote in message
99132e$ol8$[EMAIL PROTECTED]">news:99132e$ol8$[EMAIL PROTECTED]...
 hello all,

  let's say i have this:
 $a="varone=hello world|vartwo=2.44|varthree=100|";

 now i do this:

 $b=explode('|',$a);
 $z=count($b);
 for ($x=0;$x$z;$x++) {
 $tmp=explode('=',$b[$x]);
 

 and i want to find out if  $tmp[1] is a string or an integer (that's
really
 all I need to determine so i can put
 together an SQL statement that puts single quotes around strings and none
 around integers). Obviously
 i won't know at design time all of the variables and their values. Thank
 you.

 -dave



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] how do i get a variable type?

2001-03-17 Thread phpman

hello all,

 let's say i have this:
$a="varone=hello world|vartwo=2.44|varthree=100|";

now i do this:

$b=explode('|',$a);
$z=count($b);
for ($x=0;$x$z;$x++) {
$tmp=explode('=',$b[$x]);


and i want to find out if  $tmp[1] is a string or an integer (that's really
all I need to determine so i can put
together an SQL statement that puts single quotes around strings and none
around integers). Obviously
i won't know at design time all of the variables and their values. Thank
you.

-dave



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]