Re: [PHP-DB] Files stored in mysql

2005-08-17 Thread Mark Cain
Here is one way to do it.  It happens to be the way that I use for a group
of folks that have authentication levels of access to pdf.

I store all of the pdf files above the www folder.  This keeps them out of
prying eyes.  You of course could store them in a database.

the security levels for the pdf are in the name of the pdf itself.  Such as:

thomas_korea_2_General-Travel-Info.pdf

where thomas is a group of people getting access to the files.
where korea is a particular region of their responsibility
where 2 is the security level that the thomas group must have to see
this file.
where General-Travel-Info is the public or displayed name for the file.

Now here is how it works, the user logs in.  A session records his group and
his security level which is stored in a users database.  Once authentication
is done, the dir of pdf files is read and exploded on the underscores.
Every file that fits this user (group and security level) is displayed with
the public name with the hyphens replaced with spaces -- such as General
Travel Info

That data is displayed as a link which when clicked reads the real file out
to the browser such as

header(Content-Type: application/pdf);
header(Content-Disposition: inline; filename=$file_access_name);
@readfile($file_access_name);

.

This is one way to do it.  Of course you may want to read the files out of
the database in your case.

Mark Cain


- Original Message -
From: Vincent Lape [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Wednesday, August 17, 2005 12:18 PM
Subject: [PHP-DB] Files stored in mysql


 I need some advise on how to handle some pfd files. We have sales guys out
 in the field and generally need to access client reports regularly. I was
 thinking about making a dir for each rep, subdir for each client and
posting
 the pfd files there.

 After the reps auth from the login page I call an iframe depending on the
 user:
 ?php if($row_get_user['username'] ==rep1) print 'iframe id=User
 name=Userss src=repdata/rep1/dlist.php width=100% height=100%
 scrolling=AUTO frameborder=1 marginwidth=0
 marginheight=0/iframe'; ?

 ?php if($row_get_user['username'] ==rep2) print 'iframe id=User
 name=Userss src=repdata/rep2/dlist.php width=100% height=100%
 scrolling=AUTO frameborder=1 marginwidth=0
 marginheight=0/iframe'; ?

 This is going to be a pain later when we get all the guys stuff online.
The
 iframe calls dlist.php which will display all the data in a directory.

 There has got to be a better way to handle this. How would I go about
 storing the pdf files in mysql and printing all the files in a nice linked
 table do onclick of filename it will open the pfd file to read?

 Any help would be greatly appreciated.

 P.S. sorry about the read request in my last post

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



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



Re: [PHP-DB] Payment Gateways

2005-07-21 Thread Mark Cain
You need to find out from the bank a few pieces of info:
what is the url that you would use to make the transaction?
what port is the server expecting you to use?
what useragent is the server expecting?
what is the format of the request?
is your request to be a GET or POST?
is the server looking for a custom request string?
what is the separator of the custom request?

Then read the following:

http://php.net/curl


Mark Cain


- Original Message -
From: Ahmed Shams [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Wednesday, July 20, 2005 1:11 PM
Subject: [PHP-DB] Payment Gateways


 Hi all,
 I am working on a project that I haven't came across before and I would
 appreciate all the help I can get with it. Our client is requesting a
 payment gateway system where we communicate with the bank and provide
 reports and stats about the transactions. The reports part is relatively
 familiar but the communications with the bank is what is puzzeling me. I
 know the bank is providing an API but I need a similar code to work with.
If
 anyone can provide me with a similar project which I can change to our
specs
 or tell me how to start I would be extremely greatful.
 Thanks

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



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



Re: [PHP-DB] mysql check boxes

2005-06-24 Thread Mark Cain
I was confused for a moment about the use of the two checkboxes in your
request -- now I understand that you actually use the word checkbox for
two different items in your post.  1) is for the field in the table where
binary data is fetched and 2) is for an actual HTML form checkbox that is to
precede each row of data.

Your script only displays #1 -- the data from the database.  Here is what
you need to do to see the checkbox before the data in each row.

echo  input type=\checkbox\ name=\c_box\ value=\$checkbox\  $id
$checkbox $testField br;

I am assuming a couple of things with the above code -- but this should get
you to the place where you can work it out.


Mark Cain


- Original Message -
From: [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Friday, June 24, 2005 5:25 AM
Subject: [PHP-DB] mysql check boxes


Dear Friends,

I have mysql database and php script.

Script pulls all the data with their serial number in html form, from
database however, I want each field pulled to be preceeded by a check box.

I created field in table and entered array for check boxes in php script,
still check boxes aren't displayed.at the same time rest of the data with
serial
number is displayed.

--
--
Php script

--
--
?php
// open the connection
$conn = mysql_connect(localhost, cde_mail, h63);

// pick the database to use
mysql_select_db(wwwabcde_mail,$conn);

// create the SQL statement
$sql = SELECT * FROM subscriber;

// execute the SQL statement
$result = mysql_query($sql, $conn) or die(mysql_error());

//go through each row in the result set and display data
while ($newArray = mysql_fetch_array($result)) {
// give a name to the fields
$id  = $newArray['id'];
$checkbox  = $newArray['checkbox'];
$testField = $newArray['email'];
//echo the results onscreen
echo   $id $checkbox $testField br;
}
?
---
mysql table structure
---
   Field TypeAttributes   NullDefault Extra
Action
id int(11)   No   auto_increment

checkbox char(2) BINARY   No []
emailvarchar(150)  No

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



Re: [PHP-DB] Com 1

2005-06-13 Thread Mark Cain
From the manual's user supplied comments:  (Looks like this is for a windows
machine)

http://us4.php.net/fopen

   // Use this code to write directly to the COM1 serial port
   // First, you want to set the mode of the port. You need to set
   // it only once; it will remain the same until you reboot.
   // Note: the backticks on the following line will execute the
   // DOS 'mode' command from within PHP
   `mode com1: BAUD=9600 PARITY=N data=8 stop=1 xon=off`;
   $fp = fopen (COM1:, w+);
   if (!$fp) {
   echo Uh-oh. Port not opened.;
   } else {
   $e = chr(27);
   $string  = $e . A . $e . H300;
   $string .= $e . V100 . $e . XL1SATO;
   $string .= $e . Q1 . $e . Z;
   echo $string;
   fputs ($fp, $string );
   fclose ($fp);
   }


Mark Cain

- Original Message -
From: Nandar [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, June 13, 2005 11:01 PM
Subject: [PHP-DB] Com 1


Hi,.

any one to know, how to send ascci file to com1 port from php ??

thx,
nandar

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



Re: [PHP-DB] Still having a form problem

2005-05-30 Thread Mark Cain
The array that you are using quantity[] has an automatic index populated
for it:

Meaning that if you have page1 that has the following code:

FORM METHOD=POST ACTION=./page2.php
INPUT TYPE=TEXTBOX NAME=quantity[] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[] VALUE=BR
INPUT TYPE=SUBMIT
/FORM

and assuming that we ordered 1 of the first item, 2 of the second item, 3 of
the 3rd, etc

Then the array will be passed to page2 as follows

_REQUEST[quantity] Array
(
[0] = 1
[1] = 2
[2] = 3
[3] = 4
[4] = 5
)

All you need to do is explicitly specify the index of quantity[] on the
first page and use the SKU or Part Number as the index.

(I made up some part numbers to show you how to do it)

So, now your code will look like this:

FORM METHOD=POST ACTION=./page2.php
INPUT TYPE=TEXTBOX NAME=quantity[b54] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[t3fl] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[8956798] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[A-E3600] VALUE=BR
INPUT TYPE=TEXTBOX NAME=quantity[SA-8] VALUE=BR
INPUT TYPE=SUBMIT
/FORM

 Now the array that is passed to page2 looks like this:

_REQUEST[quantity] Array
(
[b54] = 1
[t3fl] = 2
[8956798] = 3
[A-E3600] = 4
[SA-8] = 5
)

 Voila! SKUs and quantities joined!

Mark Cain





- Original Message -
From: Chris Payne [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, May 30, 2005 3:07 PM
Subject: [PHP-DB] Still having a form problem


 Hi there everyone,



 I'm still having problems with my form PHP data, I lost email for a couple
 of days due to a server crash on my account so don't know if this was
 answered or not (Sorry).



 Basically, I have a form which populates 25 entries at a time from a MySQL
 DB with PHP, you can select the product you want to order by entering a
 value in the quantity box, if it was a single box it wouldn't be a
problem,
 but it's an array.



 Now again, an array for the quantity is no problem at all, as I just use



 input name=quantity[] type=text class=style8 id=quantity[]
value=
 size=5



 HOWEVER, I also need to transfer the $id (Named $id_new) from the database
 in each quantity array at the same time so I can split each array into ID
 and QUANTITY, this way I know which ID has which quantity, but this is
what
 has me stumped.



 I tried with a HIDDEN field but of course that won't work, as there's no
way
 of aligning which ID goes with which quantity, so what I guess I need to
 know, is how to amend $id_new with the quantity[] array.



 Any help would be REALLY appreciated as this is really urgent.



 Chris



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



Re: [PHP-DB] Need some help

2005-05-11 Thread Mark Cain
run the following line of code in your page.  This will help you not only
with this experience but for a long time to come in the future:

phpinfo();

BTW, I suspect that your problem is that the variable is

$_POST['ttl_price'];

and not

$_POST[$ttl_price];

You will see that in the output of phpinfo();

Mark Cain


- Original Message -
From: ReClMaples [EMAIL PROTECTED]
To: PHP php-db@lists.php.net
Sent: Wednesday, May 11, 2005 3:14 PM
Subject: [PHP-DB] Need some help


 Hello all,

I am having an issue with displaying a variable from another php
script.
 Can you help please?

 Here is the code that I'm using:

 ?php

 $item_ttlprice = $_POST[$ttl_price];
 ?
 html
 body
 Your price is: $
 ?php
 echo $item_ttlprice;
 ?
 body
 /html

 pretty simple I would think but I can't figure out what I'm doing wrong.
 The above is the new script.  Below is the script that the $ttl_price is
 coming from:

 td align=center\$ $item_price br/td
 td align=center$item_qty br/td
 td align=center\$ $total_price/td
 td align=centera
 href=\removefromcart.php?id=$id\remove/a/td
 /tr;
 $ttl_price = $ttl_price + $total_price;


 Can anyone tell me what I'm doing wrong?

 I have tried changing this part:

 ?php

 $item_ttlprice = $_POST[$ttl_price];
 ?

 to $item_ttlprice = $_GET[ttl_price];

 to $item_ttlprice = $_POST['$ttl_price'];

 nothing seems to work.


 Thanks for your help
 -Rich


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



Re: [PHP-DB] Need some help

2005-05-11 Thread Mark Cain
You could use  a form -- but since this is a db maillist -- maybe you ought
to explore that on one of the other php lists e.g. general.

Mark Cain

- Original Message -
From: ReClMaples [EMAIL PROTECTED]
To: Philip Hallstrom [EMAIL PROTECTED]
Cc: PHP php-db@lists.php.net
Sent: Wednesday, May 11, 2005 6:28 PM
Subject: RE: [PHP-DB] Need some help


 Sorry but this isn't working.  The variable $ttl_price is a calculation in
 my first script.  It stores the value of $Total_Price for all items.  I am
 trying to pass that to a new page.  It isn't a form that I'm working with,
 do I need to make it a form?  I would greatly appreciate any help you
could
 offer.

 Thanks
 -rich

 -Original Message-
 From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, May 11, 2005 4:36 PM
 To: ReClMaples
 Cc: PHP
 Subject: Re: [PHP-DB] Need some help

I am having an issue with displaying a variable from another php
script.
  Can you help please?
 
  Here is the code that I'm using:
 
  ?php
 
  $item_ttlprice = $_POST[$ttl_price];

 This should at the very least be:

 $item_ttlprice = $_POST[ttl_price];  // remove the last dolalr sign

 Also, if youre HTML form's action is GET then you should replace POST with
 GET...




  ?
  html
  body
  Your price is: $
  ?php
  echo $item_ttlprice;
  ?
  body
  /html
 
  pretty simple I would think but I can't figure out what I'm doing wrong.
  The above is the new script.  Below is the script that the $ttl_price is
  coming from:
 
  td align=center\$ $item_price br/td
 td align=center$item_qty br/td
 td align=center\$ $total_price/td
 td align=centera
  href=\removefromcart.php?id=$id\remove/a/td
 /tr;
  $ttl_price = $ttl_price + $total_price;
 
 
  Can anyone tell me what I'm doing wrong?
 
  I have tried changing this part:
 
  ?php
 
  $item_ttlprice = $_POST[$ttl_price];
  ?
 
  to $item_ttlprice = $_GET[ttl_price];
 
  to $item_ttlprice = $_POST['$ttl_price'];
 
  nothing seems to work.
 
 
  Thanks for your help
  -Rich
 

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



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



Re: [PHP-DB] URL question

2005-04-29 Thread Mark Cain
 a 404 script is the way I would handle it.

Modify what the server does when it finds a page that doesn't exist.
Currently the server issues 404 headers and displays a brain dead message
about not being able to find the page.  Change that so that the server
issues 200 headers (tricking the client which has friendly error message
enabled) and pick off the part after the .com/ and do a look up for the
item.  If found, proceed as expected, it not found display, a brain dead 404
message.

How do you modify the server?
Either modify the 404 directive in Apache or one of the other lesser
products
or
setup a .htaccess file on their domain

The .htaccess has a line that says:
ErrorDocument 404 /new.php

Which means when the page is not found display the page /new.php

Build your product look up and place it in the file new404.php

Be sure that the first line of new.php is
?header(HTTP/1.0 200 OK);

That's the header that tricks the Friendly Error Message

I wish I had come across this info as easily as you just did!

Mark Cain




- Original Message -
From: Chris Payne [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Friday, April 29, 2005 11:00 PM
Subject: [PHP-DB] URL question


 Hi there everyone,



 My client needs to be able to have their url www.blahblah.com
 http://www.blahblah.com/  pickup the product number but I can't do it
the
 way I'd want (which would be www.blahblah.com/?mls=examplenumber, instead
 they said it MUST be www.blahblah.com/examplenumber - how can I grab the
 number AFTER the .com in PHP so that I can process it with MySQL without
it
 being assigned a variable name, just the number?



 Chris



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



Re: [PHP-DB] mime-type related to extension?

2005-04-27 Thread Mark Cain
The beginning of the jpeg file in hex looks like this:

FF D8 FF

perhaps you could test for that occurrence.  Be aware that the occurrence of
FF D8 FF must be in each jpg file -- it does not mean that the occurrence of
FF D8 FF is found only in a jpg file.

http://filext.com/detaillist.php?extdetail=JPG

you could also try http://www.jpeg.org/index.html


Mark Cain


- Original Message -
From: mel list_php [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Wednesday, April 27, 2005 4:03 AM
Subject: FW: [PHP-DB] mime-type related to extension?


 Hi I sent this on 21st of april and got no answer...
 there is no way to check the real mime type of a file?
 even a file without extension?
 thanks,
 melanie


 From: mel list_php [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] mime-type related to extension?
 Date: Thu, 21 Apr 2005 13:45:45 +
 
 Hi guys!
 
 I have a basic form to upload files, my problem is about the mime type.
 I use $type= $_FILES[$file_uploaded]['type']; to check the mime-type of
the
 fila as I want to allow only .jpeg.
 I have then a test like:
 if  ($type==image/pjpeg || $type==image/jpeg)
 {
 ...
 }
 
 Upload working fine if I send red.jpg.
 However if I rename the file in red, php recognizes it as
 application/octet-stream and not jpeg.
 I'm working under linux and for me the extension is not required for a
 file, I thought the mime-type was encoded in the file itself and was
 independent of the extension.
 Any clue on that?
 Any other php function I should look at?
 The cookbook and pear both use $_FILES[ ] ['type'] so I have no idea
here.
 
 Thanks,
 Melanie
 
 _
 It's fast, it's easy and it's free. Get MSN Messenger today!
 http://www.msn.co.uk/messenger
 
 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

 _
 Want to block unwanted pop-ups? Download the free MSN Toolbar now!
 http://toolbar.msn.co.uk/

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



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



Re: [PHP-DB] SQL or array ?

2005-04-23 Thread Mark Cain
explain the phrase big array.

What is big to you might not be big to the server nor to me but then again
maybe it's bigger.  Are you talking dozens, hundreds, thousands, millions??

- Original Message -
From: Paul Reilly [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Saturday, April 23, 2005 5:05 PM
Subject: [PHP-DB] SQL or array ?



 I have a quick question about which would the best way to implement
 something in terms of performance. Using a database, or just creating
 a big array in memory?


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



Re: [PHP-DB] 'OR' logic in mySQL query

2005-04-17 Thread Mark Cain
You might want to pattern you SELECT statement in this manner:

SELECT * FROM `tablename` WHERE status = 3 OR status = 1

Notice I called the field name explicitly on each side of the OR.

Be sure to check the data type for the date field -- if it is a datetime
stamp or date stamp, it might complain with the use of like

You ought to check out:

http://dev.mysql.com/doc/mysql/en/where-optimizations.html

Mark Cain



- Original Message -
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Sunday, April 17, 2005 4:04 PM
Subject: [PHP-DB] 'OR' logic in mySQL query


 Am I able to use the OR logic in mySQL queries?

 $query = SELECT * FROM table WHERE date_received LIKE '$todays_date' OR
 '$yesterdays_date' ORDER BY prayer_request_reference ASC;

 In this above example will the  OR '$yesterdays_date'  work?

 In reality I am wanting to preview new entries to the database within the
 past 2 days

 Ron

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



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



Re: [PHP-DB] using POST data for a readfile

2005-04-11 Thread Mark Cain
Trap for the referral page in the callFile.php page.

Allow the proper referral page to pass (could be multiple pages if you
choose) but if the users modify the URL of the GET the referral page will be
blank or perhaps more precise the referrer var will be empty and
nonexistent.

Do a phpinfo and look for the var:

 _SERVER[HTTP_REFERER]

this will allow them to try to modify the url and you will know who is
attempting it  --  if you'd care to know that info.

Mark Cain



- Original Message -
From: mel list_php [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, April 11, 2005 5:59 AM
Subject: [PHP-DB] using POST data for a readfile


 Hi list,
 (mail problem you may get that one twice!)

 My problem: I protect my files by storing them out of the web root or
behind
 a htaccess.
 As I'm not using the htaccess authentication for my users, I use a
readfile
 to serve the file, basically something like:

 a href='callFile.php?id=test.pdf'File to serve/a

 and in the script callFile something like
readfile(./protectedDir/test.pdf).
 this works fine, but I just would like to use a post instead of a get, to
 avoid my users trying to modify the url.

 I tried to use a function in the callFile script, something like:

 function getFile ($fileId)   {

 readfile($fileId);

 }

 if (isset($_POST['fileId']))
 {
 $fileId=$_POST['fileId'];
 getFile($fileId);
 }

 but it doesn't work.
 I also tried to do a require_once (callFile.php) and then later on call
the
 getFile function from the first script but no more success.

 Does anybody has any idea on how to do that?

 Thanks,
 Melanie

 _
 Want to block unwanted pop-ups? Download the free MSN Toolbar now!
 http://toolbar.msn.co.uk/

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



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



Re: [PHP-DB] File retrieval

2005-04-03 Thread Mark Cain
You could read this:

http://php.net/fread

or try this -- assuming that this is a non-windows OS:

?php
// get contents of a file into a string
  $filename = /directory/pathto/data.txt;
  $handle = fopen($filename, r);
  $contents = fread($handle, filesize($filename));
  fclose($handle);
? 

Mark Cain


- Original Message - 
From: Ron Piggott [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Friday, April 01, 2005 11:43 PM
Subject: [PHP-DB] File retrieval


 If I have a file named
 
 data.txt  
 
 Is it possible to load the contents of it into a variable search as
 
 $contents
 
 idealy I would like to know if I am able to do something like
 
 $contents = data.txt;
 
 Ron
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] eregi problem

2005-04-03 Thread Mark Cain
Almost.  But since this is not horseshoes nor hand grenades...

Here is a trap for A/N characters:

if (eregi(^[a-zA-Z0-9]+$,$GP[sifre])) {

corrections to your code:

Move the carat to the outside of the bracket -- I think the carat inside the
bracket means negation (I think). You want a starting character anchor so
that your code translates to start with any of the following.

Add the plus sign after the brackets -- means one or more of the preceding
characters

Add the $ after the + sign  -- means only the preceding character can be at
the end of the line.  Without the $ as an end anchor the user would be able
to put non-A/N characters at the end of the line of A/N characters and your
code would not trap it.

Mark Cain


- Original Message -
From: [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Sunday, April 03, 2005 11:18 AM
Subject: [PHP-DB] eregi problem


 I m trying to check $GP[sifre] variable, $GP[sifre] must consist of alpha
 numeric chars only. here, how I check the variable:

 if((eregi([^a-zA-Z0-9],$GP[sifre])
 echo 'true';
 else
 echo 'false';

 It works if variable starts with alphabetic chars only.
 for example this returns 'ok'
 $GP[sifre]='blabla234243';
 but this does not work: (if variable starts with numeric chars)
 $GP[sifre]='3243242blabla';

 second one returns false, couldnt figure out the problem here. any help ?

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



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



Re: [PHP-DB] Re: Subject: Web Printing

2005-03-31 Thread Mark Cain
Let me encourage you to be open minded about the use of dynamic PDF
generation.  Don't think PDF as in storage and downloading -- think PDF in
the realm of format control.

google class.ezpdf.php

or just use this link:

http://www.google.com/search?hl=enq=class.ezpdf.phpspell=1

Mark Cain


- Original Message -
From: Ng Hwee Hwee [EMAIL PROTECTED]
To: PHP DB List php-db@lists.php.net
Sent: Thursday, March 31, 2005 9:39 PM
Subject: [PHP-DB] Re: Subject: Web Printing


 hi all,

 thanx for all your suggestions. however, the css below doesn't seem to
help
 me solve my tfoot problem. if my tbody is pretty short, the tfoot
will
 still NOT appear at the bottom of my page but it appears where my tbody
 ends (which sometimes ends in the middle of my page). what else can i do??

 by the way, i cannot use PDFs to generate my reports as suggested by many
of
 you kind souls. This is because my clients just want to click on the
Print
 Monthly Report button and i am suppose to fetch the relevant data from
 MySQL DB and print out the report.. they don't need to save them in Excel
or
 PDF. It is restricted to printing off the IE browser.

 The problem that gives me the most headache is how can I know the total
 number of pages and the current page number, by using PHP?? I really need
 this because a report can be hundreds of pages so page number is very
 important to my clients.

 Please kindly help me! thank you s much!

 Hwee

 - Original Message -
 From: Neil Smith [MVP, Digital media] [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Sent: Thursday, March 31, 2005 9:15 PM
 Subject: Subject: Web Printing


  At 10:27 31/03/2005 +, you wrote:
  Message-ID: [EMAIL PROTECTED]
  From: Ng Hwee Hwee [EMAIL PROTECTED]
  To: PHP DB List php-db@lists.php.net
  Date: Thu, 31 Mar 2005 18:24:41 +0800
  Subject: Web Printing
  
  Hi all,
  
  i know i can print out a header and footer using HTML thead and
 tfoot.
  However, the tfoot doesn't always stay at the bottom of the page. For
  example, if the the last page only have 2 records, the tfoot will
 appear
  pretty high on the page.
  
  i am wondering how can i use PHP to fix the position of my header and
 footer
 
  PHP cannot help you here, it's the wrong tool for the job (it's a
hammer
  not a screwdriver so to speak).
  You need to (*must* !!!) use CSS to position and specify the height and
  dimensions of the thead and tfoot thus :
 
 
  thead {
   display: table-header-group;
   position: absolute;
   top: 0;
   height: 36pt;
   width: 100%;
  }
 
  tfoot {
   display: table-footer-group;
   position: absolute;
   bottom: 0;
   height: 36pt;
   width: 100%;
  }
 
  These should apply *reasonably* well to position your thead and tfoot
row
  groups in the same place on each printed page (adjust as desired). You
  *cannot* use PHP to guess the height of the page areas reliably unless
  you are using a fixed pitch font such as a dot matrix line printer. And
  even then it's somewhat guesswork (I've done both).
 
  But if we're assuming that you're users have laser printers you *must*
use
  CSS to do the print layout, PHP line height guessing will not work for
 you.
 
  Cheers - Neil

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



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



Re: [PHP-DB] Working with multiple tables...

2005-03-21 Thread Mark Cain
What is the nature of the userid?  is it something assigned by one of the
systems?  or is it chosen by the user himself?  or is it a constant such as
am employee ID?

Here's how I would approach it:

query the tables for the occurrence of the userid and obtain the system name
at the same time.

with the results, build a multidimensional associative array with userid and
system name such as

$prior[$row[system_name]][$row[userid]] = grey;

Then in the code for the page loop though the systems with the userid such
as:

foreach ($prior as $system) {  // This will hit your systems one
after the other
  if ($prior[$system[$userid]]) {   // if this variable exists, it will
test as true
 $color = grey;
  } else {
 $color = black;
  };
};


That would be my starting stab at it.  I hope I understand enough of what
you're trying to do and that perhaps you understand what I am trying to do.
Let me know if this needs clarification.

Mark Cain



- Original Message -
From: NIPP, SCOTT V (SBCSI) [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, March 21, 2005 2:44 PM
Subject: [PHP-DB] Working with multiple tables...


 I am working on revising a web request app that I have already
 developed.  The app basically provides a list of system names with
 checkboxes for a user to select to request accounts on the systems.  One
 feature I am intending to add is that the app should check a separate
 database of user accounts to see if the user already has an account on
 the system.  I think I could get it to work by making a query of the
 userid for each system, but this seems quite inefficient.  I would
 rather somehow have a single query that gets a list of system names and
 also checks the user account database at the same time to determine if
 the user already has an account.  Then I would like to display ALL of
 the systems, but grey out the ones that the user already has accounts
 on.  Can someone help me figure out the best way to go about this?
 Thanks in advance.

 Scott Nipp
 Phone:  (214) 858-1289
 E-mail:  [EMAIL PROTECTED]
 Web:  http:\\ldsa.sbcld.sbc.com

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




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



Re: [PHP-DB] dynamic data manipulation in form

2005-03-18 Thread Mark Cain
You can try tinyMCE

http://moxiecode.com/downloads_tiny_mce.php

Mark Cain


- Original Message - 
From: Doug Finch [EMAIL PROTECTED]
To: phpdb-list php-db@lists.php.net
Sent: Friday, March 18, 2005 4:42 PM
Subject: [PHP-DB] dynamic data manipulation in form


 I have a script that I have written in PHP that is a basic form that 
 inputs simple text into a mysql db.  One section is just a textarea 
 value that I would like to be able to add some dynamic formatting to the 
 text being entered if the user wants.  For example, I want to give the 
 user the ability to be able to highlight the text and click on a 
 paragraph tag and it automatically insert that tag - or a bold, itallic, 
 underline, etc.  I have searched the web but came up empty-handed.  Any 
 ideas?  I don't even know where to begin.
 thanks,
 Doug
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



Re: [PHP-DB] undefined function error

2005-03-18 Thread Mark Cain
It could be possible that mySQL is not enabled in your installation of PHP.

Let the server parse a page with phpinfo() in it and read the results.  Look
for mySQL enabled.

Perhaps the reason it runs fine on another server is that the php on that
server has mysql enabled.

HTH,

Mark Cain

- Original Message -
From: Chip Wiegand [EMAIL PROTECTED]
To: PHP DB php-db@lists.php.net
Sent: Friday, March 18, 2005 4:53 PM
Subject: [PHP-DB] undefined function error


 I have a web site that connects to a mysql database using this connect
 script -

 ? $db=mysql_connect(localhost,***,***);
   mysql_select_db(simradusa,$db);
 ?

 When I access the page it gives me this error -

 Fatal error: Call to undefined function: mysql_connect() in
 /usr/local/www/data-dist/connect on line 1

 Using mysql-4.1.10a for FreeBSD-5.3 with php-4.3.9

 Any idea why I'm getting this error? (the same connect string works fine
 on a differant web server running  FreeBSD-5.2.1/php-4.3.6/mysql-3.23.49)

 Thanks,
 Chip

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



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



Re: [PHP-DB] variable and MySQL

2005-03-16 Thread Mark Cain
I think I understand your question.  Perhaps what you want is not a variable
variable -- but a variable (determined from the context).
Variables always vary depending on the situation as opposed to a constant
which - uhh -- stays constant.  Combine the variable and the constant in a
new variable first with concatenation.

$question_pointer = $xxx . _name_en;

$get_question_data[$question_pointer]

Mark Cain


- Original Message -
From: simon [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, March 14, 2005 7:14 PM
Subject: [PHP-DB] variable and MySQL


 Hi, I'm trying to make a script but have a problem ...

 How could I do this:

 I'd like to use   $get_question_data[xxx_name_en]

 where xxx would be a variable variable according to the situation where
the
 script is called... how would I do this?

 tried :

 $get_question_data[$test_name_en]
 $get_question_data[{$test}_name_en]
 ${get_question_data[$test_name_en]}

 but nothing works  any help would be appreciated.

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



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



Re: [PHP-DB] Error with Where Clause

2005-03-16 Thread Mark Cain
use backticks (read -- not single quotes, not double quotes, but backticks)
to quote your fields such as

where
 `1091vote038.state` = `109caucuses1.state`

It is possible that the code is interpreting the 109 part of your table
name as a integer.  That just might do it.

Mark Cain


- Original Message -
From: [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Monday, March 14, 2005 6:20 PM
Subject: [PHP-DB] Error with Where Clause


 I get only the table headings and text before and after the table, but not
 the table, when I add the where clause as below.  Without the where
 clause, the table does come up but (as expected) is repetitive and very
 long.  I'm using a template that I've used many times.  I've tried
 changing the $sort_field at the beginning with no success.  Any ideas as
 to a solution?

 Ken

 $get_data_query = select concat(1091vote038.fn, ' ', 1091vote038.ln),
 1091vote038.vote, 109caucuses1.party,
 1091vote038.state, 1091vote038.cd, 109caucuses1.cbc, 109caucuses1.chc,
 109caucuses1.prog, 109caucuses1.bdog,
 109caucuses1.rsc
  from 1091vote038, 109caucuses1
 where
 1091vote038.state = 109caucuses1.state
 and
 1091vote038.cd = 109caucuses1.cd
 order by $sort_field $sort_order;

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



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



Re: [PHP-DB] php and serial port

2005-03-16 Thread Mark Cain
You could try this code 

http://www.phpfreaks.com/quickcode/code/156.php

I found it by doing this search:

http://www.google.com/search?hl=enq=php+serial+port

Mark Cain


- Original Message - 
From: Rodrigo Cabeceiras [EMAIL PROTECTED]
To: php-db@lists.php.net
Sent: Tuesday, March 15, 2005 10:45 AM
Subject: [PHP-DB] php and serial port


 hi
 can php interact whit a serial port, (example com1 - modem) and 
 exchange info whit a modem(hayscommand) ?
 has any one tried ?
 
 thks
 
 
 rodrigo
 ---
 [This E-mail scanned for viruses by Declude Virus]
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 

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



[PHP-DB] file() fails to read https

2001-05-14 Thread Mark Cain

I am writing php code on a Unix server which reads a call to Micro$oft SQL statement 
via asp on an IIS server.  I am using file() to get the results.

This works beautifully:

$fcontents = file (http://www.domain.com/URLSearch.asp?Info=$info;);

The results of the query are in $fcontents.  Pretty standard php stuff.


However, when I make the same call on a secure connection (as in) , 
$fcontents = file (https://www.domain.com/URLSearch.asp?Info=$info;);

I get the following error message:

Warning: file(https://www.domain.com/URLSearch.asp?Info=$info;) - No such file or 
directory in /home/mysite/phplib/getinfo.php on line 4

The only change in the entire code is the s.

Let me see if I can answer some questions before they are asked:

Yes. I am actually getting real content on the non-secure connection.
Yes. The secure connection is really functional on the other server.  (I can actually 
cut the above address and paste it into the address bar and get the results that I am 
expecting.)

So, my question is How do I read this secure file?  No one even mentions https in 
the file() function section of php.net.

Thanks, 

Mark