RE: [PHP-DB] storing images in database

2005-01-26 Thread Gareth Heyes
 if(isset($_GET['id'])) {
  $id=$_GET['id'];
  $query = select bin_data, filetype from binary_data where id=$id;
This is a really bad example, anybody can inject your query with 
malicious sql commands.
Never trust user supplied data.

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


[PHP-DB] Re: Newbie Setup Trouble

2005-02-07 Thread Gareth Heyes
The code appears to be correct. But it sounds like a problem with the 
php/mysql
integration. Try reinstalling PHP with the correct mysql libraries. In 
phpinfo check
that mysql support is enabled. If you are not technical and would just 
like to learn
the PHP language not how to configure it etc. I would recommend you use 
a
PHP software installation package (it basically installs everything for 
you).

I think this installation kit supports windoze + Linux:-
http://www.apachefriends.org/en/xampp.html
Hope that helps,
Gareth
On 7 Feb 2005, at 14:55, [EMAIL PROTECTED] wrote:
html
headtitleTest MySQL/title/head
body
!-- mysql_up.php --
?php
$host=localhost;
$user=blablablabla;
$password=blablabla;
mysql_connect($host,$user,$password);
$sql=show status;
$result = mysql_query($sql);
if ($result == 0)
{
   echo bError  . mysql_errno() . : 
 . mysql_error() . /b;
}
else
{
?
!-- Table that displays the results --
table border=1
  trtdbVariable_name/b/tdtdbValue/b
  /td/tr
  ?php
for ($i = 0; $i  mysql_num_rows($result); $i++) {
  echo TR;
  $row_array = mysql_fetch_row($result);
  for ($j = 0; $j  mysql_num_fields($result); $j++)
  {
echo TD . $row_array[$j] . /td;
  }
  echo /tr;
}
  ?
/table
?php } ?
/body/html
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: Notice: Undefined index: op

2005-02-22 Thread Gareth Heyes
Notices have been turned on your PHP installation. This means you will 
need to declare all of your variables otherwise you will receive a 
notice. To fix your problem simply declare your POST variable before 
use.

if(isset($_POST['op'])) {
$op = $_POST['op'];
} else {
$op = ;
}
if($op != 'ds') {
etc...
I get the error message:
*Notice*: Undefined index: op
When trying to set up a form. I have looked everywhere for the 
solution. I don't understnadn how to define that index. The come it 
comes from is:

if ($_POST['op'] != 'ds') {
   $display_block = 
   form action=\$_SERVER[PHP_SELF]\ method=\POST\
   Your E-mail Address:
   input type=text name=\email\ size=40 maxlength=150/
  input type=radio name=\action\ value=\sub\ 
checked/subscribebr/
  input type=radio name=\action\ value=\unsub\ /unsubscribe
   input type=\hidden\ name=\op\ value=\ds\/
   input type=submit name=\submit\ value=\Submit Form\/
   /form;
}

I am trying to create a form which allows my users to join a mailing 
list. I conceptually understand what the problem is but cannot find 
out how to solve the problem. I cannot find out how to define 'op'. 
Please do not tell me to lower my error reporting levels. I would 
rather fix the problems. Thank you,
Joseph


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