[PHP] printf and number_format rounding

2006-05-03 Thread Duffy, Scott E
Are printf and number_format supposed to round?

echo ($hcount-$lcount)/$hilow. ;
echo number_format(($hcount-$lcount)/$hilow,2,'.','');


0.208333 0.21 
0.145833 0.15 
0.17 0.17 
0.083 0.08
Printf (%.2f,($hcount-$lcount)/$hilow);
Does the same.

It would appear to be. If there is a function to print just to the digit
could you point me in the direction? So I would want 0.20  0.14   0.16
0.08 respectively.


Thank you,


Scott Duffy





RE: [PHP] Re: Export data with PHPMyAdmin

2006-04-21 Thread Duffy, Scott E
Use mysqldump. Quick  easy.

-Original Message-
From: William Stokes [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 21, 2006 8:56 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Export data with PHPMyAdmin

Forgot to say that the scandic fonts are ok in the tables...


William Stokes [EMAIL PROTECTED] kirjoitti 
viestissä:[EMAIL PROTECTED]
 Hello,

 I'm using PhpMyadmin 2.6.3 on operators server for DB management. I would 
 from time to time like to export the whole DB to text file and move the DB 
 to my own test server. Problem is that when I dump the whole DB to a file 
 all scandic fonts are incorrect. If I dump the data to screen they are 
 correct. Data Collation in the DB is latin1_swedish_ci.

 Since the amount of data and tables are increased dumping everything to 
 screen is not very convenient. Any ideas how to do this right?

 Thanks
 -Will 



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

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



RE: [PHP] Re: Help with query

2006-02-21 Thread Duffy, Scott E
 SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE 
 results.id_test IS NULL AND id_student=.$user

exams.id_test=results.id_test

results.id_test IS NULL

think those are preventing this from happening.

Wouldn't you want this
Results.id_student IS NULL
Since if the student didn't take the test there would not be a record for it 
and the outer join would add that. Then probably an and for id_test=$var. for a 
specific test.

GL

Scott


-Original Message-
From: Barry [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 21, 2006 7:57 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Help with query

Ing. Tomás Liendo wrote:
 Hi I need the students that didn't take an exam. The tables:
 
 exams(id_test, title, desciption, )
 
 results(id_student, id_test, date, qualification...)
 
 I'm using a version of MySQL that doesn't support NOT IN, then I tried in 
 this way:
 
 SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE 
 results.id_test IS NULL AND id_student=.$user
 
 The query doesn't return anything... What Can I do???
 
 Ahead of time, thank you very much,
 
 Tom.
Sorry last mail got lost lol.

SELECT * FROM results LEFT JOIN exams USING (id_test)
WHERE id_student =.$user;

So you get when the user has a result and applied to it.
If you dont get a result, he wouldn't have done it yet.

(theory)

Barry
-- 
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

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

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



[PHP] RE: (SCL: 5) [PHP] query problem.

2006-01-24 Thread Duffy, Scott E
Viewing in browser? If so view source.

-Original Message-
From: Angelo Zanetti [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 25, 2006 7:01 AM
To: PHP List
Subject: (SCL: 5) [PHP] query problem.

Hi guys.

I got an entry in a field called emailfrom in my table (MySQL db).

The data in that field is: Sams Bank [EMAIL PROTECTED]

I then do the following to retrieve the info, using a DB class

$recordset=$conn-Execute(SELECT * FROM wiml_history WHERE id =
$task_id);
$row=$recordset-GetArray();

$emailfrom=$row[0]['emailfrom'];

then I echo what I get out and I just get Sams Bank

It doesnt bring back the whole entry in that field,
however when I manually change the info in the field in the DB to:

Sams Bank [EMAIL PROTECTED], it retrieves it correctly.

Why does the   cause that not to be displayed? or is it retrieving it 
correctly but not showing it because of the   (which might be 
conflicting with HTML tags?

thanks in advance


-- 

Angelo Zanetti
Z Logic
www.zlogic.co.za
[c] +27 72 441 3355
[t] +27 21 469 1052
[f] +27 86 681 5885

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

2006-01-18 Thread Duffy, Scott E
Is it possible to set the key length for mcrypt with the cipher
Blowfish? Specifically to lets say 128 bits? 
mcrypt_get_key_size
returns int but is it bytes bits?

Maybe I could do with openssl?

Ideas and thoughts very welcome.

Thanks,


Scott


RE: [PHP] help me pllzzzzzz

2006-01-18 Thread Duffy, Scott E
I have a combo php javascript to do that. Trying to dig it up.

Send email to [EMAIL PROTECTED] and ill have it separated by then.

-Original Message-
From: Dan Parry [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 18, 2006 10:18 AM
To: 'John Nichel'; php-general@lists.php.net
Subject: RE: [PHP] help me pllzz

Or my sense of sailing to deadlines :)

-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: 18 January 2006 16:11
To: php-general@lists.php.net
Subject: Re: [PHP] help me pllzz

Jay Blanchard wrote:
 [snip]
i am having 2 combo box one for city  another one
 for country,when i select particular country say 
 india their corresponding cities will be displayed
 in city combobox as delhi,bangalore.,when i
 select  Australia thier cities like
 perth,brisbanewill be displayed.plz help me
 itz very urgent.
 [/snip]
 
 
 H, is everything you do urgent?

I think he and I must have the same boss.

-- 
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
[EMAIL PROTECTED]

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

__ NOD32 1.1370 (20060118) Information __

This message was checked by NOD32 antivirus system.
http://www.eset.com

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

2006-01-13 Thread Duffy, Scott E
Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to 
work but when I decrypt it with a different script I get most of it but some 
garbage. Using blowfish. So to test.
Encrypt.php
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
   $key = This is a very secret key;
   $text = Meet me at 11 o'clock behind the monument.;
   //echo strlen($text) . \n;

  $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, 
$iv);
   echo $crypttext. \n;

decrypt.php

$server = $_SERVER['SERVER_NAME'];
$url = 'http://'.$server.'/encrypt.php';
$fh = fopen($url,'r') or die (cant open: $php_errormsg);
$new_string=; 
while (! feof($fh))
{
$new_string = $new_string.rtrim(fgets($fh,4096));
}

$enc=$newstring;
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$enc=$_POST['text'];
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = This is a very secret key;
$text = Meet me at 11 o'clock behind the monument.;
//echo strlen($text) . br;

$crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv);
echo $crypttextbr;


I get from decrypt
Meet me at 11 o'clock behind the monumen3ýÚ·nÃtbr
Is it doing some padding or something? When I encrypt/decrypt same script it 
works fine.
Maybe something to do with these?
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);



Thanks,

Scott Duffy


[PHP] RE: mcrypt

2006-01-13 Thread Duffy, Scott E
Doh! Nm.

_
From: Duffy, Scott E 
Sent: Friday, January 13, 2006 11:47 AM
To: 'php-general@lists.php.net'
Subject: mcrypt

Trying to encrypt then decrypt text with php using mcrypt. The encrypt seems to 
work but when I decrypt it with a different script I get most of it but some 
garbage. Using blowfish. So to test.
Encrypt.php
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
   $key = This is a very secret key;
   $text = Meet me at 11 o'clock behind the monument.;
   //echo strlen($text) . \n;

  $crypttext = mcrypt_encrypt(MCRYPT_BLOWFISH, $key, $text, MCRYPT_MODE_ECB, 
$iv);
   echo $crypttext. \n;

decrypt.php

$server = $_SERVER['SERVER_NAME'];
$url = 'http://'.$server.'/encrypt.php';
$fh = fopen($url,'r') or die (cant open: $php_errormsg);
$new_string=; 
while (! feof($fh))
{
$new_string = $new_string.rtrim(fgets($fh,4096));
}

$enc=$newstring;
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
$enc=$_POST['text'];
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$key = This is a very secret key;
$text = Meet me at 11 o'clock behind the monument.;
//echo strlen($text) . br;

$crypttext = mcrypt_decrypt(MCRYPT_BLOWFISH, $key, $enc, MCRYPT_MODE_ECB, $iv);
echo $crypttextbr;


I get from decrypt
Meet me at 11 o'clock behind the monumen3ýÚ·n_Ãtbr
Is it doing some padding or something? When I encrypt/decrypt same script it 
works fine.
Maybe something to do with these?
   $iv_size = mcrypt_get_iv_size(MCRYPT_BLOWFISH, MCRYPT_MODE_ECB);
   $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);



Thanks,

Scott Duffy


RE: [PHP] Sending mail with php-

2006-01-11 Thread Duffy, Scott E

This is what I use to send email via php. I have sent hundreds at once.


$fromname=Cohen, Dotan;
$fromaddress=[EMAIL PROTECTED];
$subject =Subject;
$message=message body;
$from= [EMAIL PROTECTED];
   $headers  = MIME-Version: 1.0\n;
   $headers .= Content-type: text/plain; charset=iso-8859-1\n;
   $headers .= X-Priority: 3\n;
   $headers .= X-MSMail-Priority: Normal\n;
   $headers .= X-Mailer: php\n;
   $headers .= From: \.$fromname.\ .$fromaddress.\n;
   //return mail($toaddress, $subject, $message, $headers);
$toAddress='[EMAIL PROTECTED]';
mail($toAddress,$subject,$message,$headers);

good luck


Scott Duffy

-Original Message-
From: Dotan Cohen [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 11, 2006 2:49 PM
To: Sameer N Ingole
Cc: php-general@lists.php.net
Subject: Re: [PHP] Sending mail with php-

On 1/10/06, Sameer N Ingole [EMAIL PROTECTED] wrote:
 Dear Dotan,
 Dotan Cohen wrote:

 On my home Fedora Core 4 box I run Apache 2.0. Sometimes when sending
 mail with php no mail is delivered, and I find this in the logs:
 
  550-Verification failed for [EMAIL PROTECTED]
  550-unrouteable mail domain localhost.localdomain
  550 Sender verify failed
 
 You are getting this error because [EMAIL PROTECTED] cannot
 be reached from Internet and whoever you are sending mail to may have
 something called sender check. This verifies if the sender of this
mail
 is reachable. This avoids spammers to send mails using unreachable
 addresses. Also he may be checking spf-record for your From: domain on
 mail envelop.

 
 So I changed the only email address in httpd.conf to:
 ServerAdmin [EMAIL PROTECTED]
 
 What error you are getting after you change address in apache and try
 sending mail after restarting apache?

 
 But I still get the error! I did restart apache and even went so far
as to
 reboot the machine. If I cannot modify the parameter within apache,
 then where should I modify it? Within php? Within sendmail?
 


Excact same error. Actually, this was working fine until recently. I
use the script (homemade) to send out the http://lyricslist.com
monthly newsletter every month- and only this month am I having
problems. No changes made to apache, php, or sendmail except the
regular updates. Could an update have broken this?

Dotan Cohen
http://technology-sleuth.com/short_answer/what_is_hdtv.html
876

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



RE: [PHP] Newbie question: need to transfer directory contents frommy local machine to my website

2006-01-04 Thread Duffy, Scott E
I would take a look at glob.

http://us2.php.net/manual/en/function.glob.php

Scott

-Original Message-
From: Jason Pappin [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 04, 2006 10:48 AM
To: Jon Westcot; PHP General
Subject: Re: [PHP] Newbie question: need to transfer directory contents
frommy local machine to my website

Hi,

You should perhaps look at setting up a web server on your computer. PHP
as stated works server-side and if those folders/files you wish to
transfer reside in the web root, then PHP can process those files.

Perhaps look at how a web based FTP client written in PHP works for how
to copy/move/delete files in PHP. If you can't set up Apache with PHP on
Windows, try something like phpdev5 for a click and use solution.

As for your IP, it won't really matter unless you want the server to
send data back to your computer. If a static IP or hostname is in order,
then they are easy enough to set up even if you are on a dial up
connection.

Regards
Jason

Jon Westcot wrote:
 Hi all:
 
 I'm really new at PHP and will probably embarrass myself many times
 over asking questions that have been asked gazillions of times
 before, so let this serve as a blanket apology.
 
 Now, to my question.  Here's what I'm trying to do.  I have a simple
 database on my website that I wish to populate with information from
 various directories on my local computer.  The website is running
 Linux; my computer is running Windows XP.  Once the data are stored,
 I want to be able to update the information as things change on my
 local computer (not in real time, mind you, but at my request).
 
 I can set up the database access easily enough, and I know how to
 both populate and query it.  What I don't know is how to obtain the
 information from my local computer via the website.  Initially, I'd
 like to be able to specify the folder on my local computer to access
 and whether or not to process any subfolders that are found.  After
 the data have been added, I'd like the web application to be able to
 access the individual folders without having to specify them again
 (although I'd still be able to identify new folders to include in
 subsequent updates).
 
 I'm not really asking for anyone to write the code for me, but I am
 looking for suggestions for PHP functions to use to accomplish the
 inspection of my local computer's folders.  I'd also need to know
 what additional information I'd need to store in the database so that
 subsequent updates can be automated (i.e., do I need to somehow store
 my IP address?).
 
 Any help you can send my way will be greatly appreciated!  Thanks in
 advance.
 
 Sincerely,
 
 Jon
 

-- 
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] Problems with session data.

2006-01-03 Thread Duffy, Scott E
I thought I was using session data and variables correctly, but I am
having some issues. I am using it to create a login but if I have
another user on a different machine my session data gets changed to who
last logged in. I had changed so it used https but changed it back and
it still seems to be doing the same. Is there something maybe I missed
in the php.ini file? Can it not be used this way? Do I have to uses
cookies?



Any help/suggestions would be appreciated.


Scott Duffy