[PHP] ImageCopyResized() function

2006-06-18 Thread BBC
Hi all.
is any one know how to use these functions, and what for are they:
imagecreatetruecolor();
imagecreatefromjpeg();
ImageCopyResized();
ImageDestroy();


Best regard
BBC

Re: [PHP] GET, POST, REQUEST

2006-06-18 Thread Satyam
- Original Message - 
From: Rory Browne [EMAIL PROTECTED]




Good code won't be vulnerable to register_globals either, but having
register_globals on is a security problem because there are security flaws
that can only be exploited when register_globals is enabled.



Actually, code quality cannot overcome the vulnerability of 
register_globals.  Every program will have global variables. 
register_globals=on may overwrite a valid global variable, one totally 
unrelated to user input, with a value coming from the request, and there is 
nothing good coding can do about it. The chances that an external user might 
hit the right variable name are slim (unless a disgruntled former 
programmer) but they exist.


Satyam

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



[PHP] best solution for page acess right

2006-06-18 Thread Alain Roger

Hi,

I have a web administration application which allow particular users to
store into DB some information.
Information will be later on displayed dynamically on the website.

However, among these users, some should be able just to see information,
some others just to write, and so on...

therefore i need a system how to grant access right to these users.
I know that there are several solutions for such situation, but i would like
to know your feedback on these solutions and what is for you the best one to
implement.

one that i know, i can create 3 tables in my DB : account, module and
accessright.
-in account are stored all user accounts
-in module are stored all php pages belonging to each module
-in accessright are stored a join of user's account, pages and their
relative access right to each page.

But maybe it exists a simpler solution and also good enough.

thanks a lot,

Alain


Re[2]: [PHP] GET, POST, REQUEST

2006-06-18 Thread Tom Rogers
Hi,

Sunday, June 18, 2006, 5:19:20 PM, you wrote:
S - Original Message - 
S From: Rory Browne [EMAIL PROTECTED]


 Good code won't be vulnerable to register_globals either, but having
 register_globals on is a security problem because there are security flaws
 that can only be exploited when register_globals is enabled.


S Actually, code quality cannot overcome the vulnerability of 
S register_globals.  Every program will have global variables. 
S register_globals=on may overwrite a valid global variable, one totally
S unrelated to user input, with a value coming from the request, and there is
S nothing good coding can do about it. The chances that an external user might
S hit the right variable name are slim (unless a disgruntled former 
S programmer) but they exist.

S Satyam


Just get into the habit of setting all variables to known values
before using them will take care of this problem. Set the warning
level to E_ALL and get warned when using variables that have not been
set to good values while in the development phase.

-- 
regards,
Tom

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



Re: [PHP] GET, POST, REQUEST

2006-06-18 Thread Manuel Lemos
Hello,

on 06/18/2006 04:19 AM Satyam said the following:
 Good code won't be vulnerable to register_globals either, but having
 register_globals on is a security problem because there are security
 flaws
 that can only be exploited when register_globals is enabled.

 
 Actually, code quality cannot overcome the vulnerability of
 register_globals.  Every program will have global variables.
 register_globals=on may overwrite a valid global variable, one totally
 unrelated to user input, with a value coming from the request, and there
 is nothing good coding can do about it. The chances that an external
 user might hit the right variable name are slim (unless a disgruntled
 former programmer) but they exist.

There is a big misunderstanding about this matter. Having register
globals on does not make PHP overwrite global variables. It rather may
initialize global variables with values related to the request.

There may only be a problem with scripts that assumed those global
variables would not be initialized before the start of a script. Even if
there is a problem due to a distraction of the developer, it may not
even be necessarily a security problem.

If you initialize your script global variables properly, having register
globals on will never be a problem to you. You may also read this as, if
you are a competent developer, you will not make these silly mistakes,
especially by now when we all are so over the issue and triple checked
our code bases.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] GET, POST, REQUEST

2006-06-18 Thread Satyam


- Original Message - 
From: Manuel Lemos [EMAIL PROTECTED]

To: PHP List php-general@lists.php.net
Sent: Sunday, June 18, 2006 10:12 AM
Subject: Re: [PHP] GET, POST, REQUEST



Hello,

on 06/18/2006 04:19 AM Satyam said the following:

Good code won't be vulnerable to register_globals either, but having
register_globals on is a security problem because there are security
flaws
that can only be exploited when register_globals is enabled.



Actually, code quality cannot overcome the vulnerability of
register_globals.  Every program will have global variables.
register_globals=on may overwrite a valid global variable, one totally
unrelated to user input, with a value coming from the request, and there
is nothing good coding can do about it. The chances that an external
user might hit the right variable name are slim (unless a disgruntled
former programmer) but they exist.


There is a big misunderstanding about this matter. Having register
globals on does not make PHP overwrite global variables. It rather may
initialize global variables with values related to the request.

There may only be a problem with scripts that assumed those global
variables would not be initialized before the start of a script. Even if
there is a problem due to a distraction of the developer, it may not
even be necessarily a security problem.

If you initialize your script global variables properly, having register
globals on will never be a problem to you. You may also read this as, if
you are a competent developer, you will not make these silly mistakes,
especially by now when we all are so over the issue and triple checked
our code bases.

--



Indeed, you are absolutely right, sorry I caused any confusion about this.

Satyam

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



[PHP] Want some PHP e-book

2006-06-18 Thread prolibertine

i am a newbie of php .i want get some php ebook to read.
who can send me some
thx
--
/**
* Love in AJAX  J2ME and Python
* Look at my website and my blog
* http://www.pinzui.cn
* 希望宝宝可以永远快乐,你是最棒的。
**/


Re: [PHP] ImageCopyResized() function

2006-06-18 Thread Jochem Maas
BBC wrote:
 Hi all.
 is any one know how to use these functions, and what for are they:
 imagecreatetruecolor();
 imagecreatefromjpeg();

creating image resource.

 ImageCopyResized();

copy and resize image resource.

 ImageDestroy();

destroy image resource.

RTFM: http://php.net/gd

 
 
 Best regard
 BBC

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



Re: [PHP] Want some PHP e-book

2006-06-18 Thread Jochem Maas
prolibertine wrote:
 i am a newbie of php .i want get some php ebook to read.

http://php.net/docs.php

 who can send me some
 thx

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



Re: [PHP] Want some PHP e-book

2006-06-18 Thread tedd
At 5:27 PM +0800 6/18/06, prolibertine wrote:
i am a newbie of php .i want get some php ebook to read.
who can send me some
thx

Amazon.com

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Want some PHP e-book

2006-06-18 Thread tedd
At 5:27 PM +0800 6/18/06, prolibertine wrote:
i am a newbie of php .i want get some php ebook to read.
who can send me some
thx


Sorry for other post, I misread ebook. I thought you were asking for free 
books.

In any event, you might review these links:

http://www.htmlgoodies.com/beyond/php/article.php/3472391
http://www.w3schools.com/php/default.asp
http://www.weberdev.com/ViewArticle/433
http://www.weberdev.com/Manuals/
http://www.unf.edu/~rita0001/eresources/php_tutorials/index.htm
http://www.phpit.net/article/back-to-basics-arrays/

hth's

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



[PHP] Re: best solution for page acess right

2006-06-18 Thread Jo�o C�ndido de Souza Neto
Sometimes i've been used this solution pointed out by you. I think it's a 
good way, though has more detailed way, it depends on your level care.


Alain Roger [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
 Hi,

 I have a web administration application which allow particular users to
 store into DB some information.
 Information will be later on displayed dynamically on the website.

 However, among these users, some should be able just to see information,
 some others just to write, and so on...

 therefore i need a system how to grant access right to these users.
 I know that there are several solutions for such situation, but i would 
 like
 to know your feedback on these solutions and what is for you the best one 
 to
 implement.

 one that i know, i can create 3 tables in my DB : account, module and
 accessright.
 -in account are stored all user accounts
 -in module are stored all php pages belonging to each module
 -in accessright are stored a join of user's account, pages and their
 relative access right to each page.

 But maybe it exists a simpler solution and also good enough.

 thanks a lot,

 Alain
 

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



[PHP] Mail in Spam Box

2006-06-18 Thread kartikay malhotra

Hi all!

I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
Spam box and not the Inbox :(

Am I missing a header, signature, certificate?

Thanks
KM


Re: [PHP] Mail in Spam Box

2006-06-18 Thread Rabin Vincent

On 6/18/06, kartikay malhotra [EMAIL PROTECTED] wrote:

I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
Spam box and not the Inbox :(

Am I missing a header, signature, certificate?


You're probably missing a header, but, who knows, you
haven't shown us any code.

Rabin

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



[PHP] Includes, Require, Location, Other

2006-06-18 Thread Beauford
Hi,

If I were to have something like the following, what is the best way (or
best practice) to reload the page and display the error - or is there a
better way to do this. I want to keep the site uniform and don't want errors
popping up and making a mess.

Thanks

B

-

$query = select idn, name from manager order by name;
$results = mysql_query($query) or $mysqlerror = mysql_error();
if ($mysqlerror) { 
$error = $table_error$mysqlerror;
include(season.php); - This is not what I really want and
in   some cases
it cause problems.
exit;
}   
else {  
The rest of the code
}

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



[PHP] ImageCopyResized() function

2006-06-18 Thread BBC
Hi all.
is any one know how to use these functions, and what for are they:
imagecreatetruecolor();
imagecreatefromjpeg();
ImageCopyResized();
ImageDestroy();

please tell me how to use it like this function
mail($a,$b,$c,$d);
$a = email direction where we email to;
$b = subject of email, it will show on the inbox as a title;
$c = the content of email;
$d = type 'From :' and then followed by email where we send from;

Re: [PHP] ImageCopyResized() function

2006-06-18 Thread Rabin Vincent

On 6/18/06, BBC [EMAIL PROTECTED] wrote:

is any one know how to use these functions, and what for are they:
imagecreatetruecolor();
imagecreatefromjpeg();
ImageCopyResized();
ImageDestroy();


php.net/imagecreatetruecolor
php.net/imagecreatefromjpeg
php.net/imagecopyresized
php.net/imagedestroy


please tell me how to use it like this function
mail($a,$b,$c,$d);


php.net/mail

Read the manual: php.net/manual

Rabin

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



Re: [PHP] ImageCopyResized() function

2006-06-18 Thread Robert Cummings
On Sun, 2006-06-18 at 12:02, BBC wrote:
 Hi all.
 is any one know how to use these functions, and what for are they:
 imagecreatetruecolor();
 imagecreatefromjpeg();
 ImageCopyResized();
 ImageDestroy();

I know how to use them all. I learned by reading here:

http://ca.php.net/manual/en/ref.image.php

Don't be lazy, RTFM!

 please tell me how to use it like this function
 mail($a,$b,$c,$d);
 $a = email direction where we email to;
 $b = subject of email, it will show on the inbox as a title;
 $c = the content of email;
 $d = type 'From :' and then followed by email where we send from;

Yep, just like the mail() function above, but with different parameters
that make contextual sense.

Cheers,
Rob.
-- 
..
| 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



Re: [PHP] Includes, Require, Location, Other

2006-06-18 Thread Larry Garfield
A couple of things.

1) Delay your output to the very end.  That way you can still do page 
redirects and build whole new pages depending on the errors you get.

2) Store errors in the session, then when building the page have a place 
for put any error messages here, then delete them from the session.  

3) Better yet, use PHP's set_error_handler() features to break out of the flow 
of the page completely when necessary.  You can do a lot more error checking 
that way, and it makes the code cleaner to boot.

4) Structure your code so that you can't send malformed SQL in the first 
place. :-)  If you're writing a static query, test it before it goes live 
(duh).  If it's a dynamic query, structure it in such a way that it can't not 
be valid.  (There's lots of ways do to that.  I find arrays and implode() to 
work well for me.)  At worst you'll return an empty result set, which is not 
an error but in fact a genuine situation you should be accounting for anyway.  
What you're doing below is really just a fancy version of mysql_query() or 
die, which I've always felt is very sloppy code.

On Sunday 18 June 2006 10:33, Beauford wrote:
 Hi,

 If I were to have something like the following, what is the best way (or
 best practice) to reload the page and display the error - or is there a
 better way to do this. I want to keep the site uniform and don't want
 errors popping up and making a mess.

 Thanks

 B

 -

   $query = select idn, name from manager order by name;
   $results = mysql_query($query) or $mysqlerror = mysql_error();
   if ($mysqlerror) {
   $error = $table_error$mysqlerror;
   include(season.php); - This is not what I really want and
 in some cases
 it cause problems.
   exit;
   }
   else {
   The rest of the code
   }

-- 
Larry Garfield  AIM: LOLG42
[EMAIL PROTECTED]   ICQ: 6817012

If nature has made any one thing less susceptible than all others of 
exclusive property, it is the action of the thinking power called an idea, 
which an individual may exclusively possess as long as he keeps it to 
himself; but the moment it is divulged, it forces itself into the possession 
of every one, and the receiver cannot dispossess himself of it.  -- Thomas 
Jefferson

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



[PHP] SMS with php recommendation (a bit 0T i guess)

2006-06-18 Thread Ryan A
Hey,

Right now I am using PSWIN to send SMS messages from
my php scripts, can anybody recommend a (reliable)
company that i can use instead?

We fill up on 25euros everytime on pswin, so i am
not looking for a free provider, just a reliable and
good priced one.

PSwin is good, problem is they are charging us a euro
.20 per day just for using the service, so even if we
dont send a single sms per day we are getting
charged...not good. 

Thanks,
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] SMS with php recommendation (a bit 0T i guess)

2006-06-18 Thread cajbecu
http://www.clickatell.com/brochure/products/developer_solutions.php

Ryan A wrote:
 Hey,
 
 Right now I am using PSWIN to send SMS messages from
 my php scripts, can anybody recommend a (reliable)
 company that i can use instead?
 
 We fill up on 25euros everytime on pswin, so i am
 not looking for a free provider, just a reliable and
 good priced one.
 
 PSwin is good, problem is they are charging us a euro
 .20 per day just for using the service, so even if we
 dont send a single sms per day we are getting
 charged...not good. 
 
 Thanks,
 Ryan
 
 --
 - The faulty interface lies between the chair and the keyboard.
 - Creativity is great, but plagiarism is faster!
 - Smile, everyone loves a moron. :-)
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around 
 http://mail.yahoo.com 
 

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



[PHP] Re: Want some PHP e-book

2006-06-18 Thread Stephen Lake
http://www.php.net/docs.php

You can download a CHM for Windows as well as PDF's and HTML Versions

prolibertine [EMAIL PROTECTED] wrote in message 
news:[EMAIL PROTECTED]
i am a newbie of php .i want get some php ebook to read.
 who can send me some
 thx
 -- 
 /**
 * Love in AJAX  J2ME and Python
 * Look at my website and my blog
 * http://www.pinzui.cn
 * Ï£Íû±¦±¦¿ÉÒÔÓÀÔ¶¿ìÀÖ£¬ÄãÊÇ×î°ôµÄ¡£
 **/
 

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



Re: [PHP] Mail in Spam Box

2006-06-18 Thread Travis Doherty
kartikay malhotra wrote:

 Hi all!

 I've use PHP mail to send mail to my Gmail ID. But it gets delivered
 to my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

 Thanks
 KM


Is the system you are sending from listed in any RBLs?  If you don't set
a subject line, SpamAssassin hits you hard, make sure you have a real
To:, From:, and Subject: header.  The date header also needs to be set -
with the correct time.

Spam scores come from many different sources of information - two major
sources are the message itself and the server sending the message.  If
you can send mail from this server using a normal mail client and it
does not get blocked as spam then it is probably your message.  If
sending using a normal client still gets blocked as spam in you gmail
account chances are it is the server and not your code.

Travis

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



Re: [PHP] SMS with php recommendation (a bit 0T i guess)

2006-06-18 Thread John Nichel

Ryan A wrote:

Hey,

Right now I am using PSWIN to send SMS messages from
my php scripts, can anybody recommend a (reliable)
company that i can use instead?

We fill up on 25euros everytime on pswin, so i am
not looking for a free provider, just a reliable and
good priced one.

PSwin is good, problem is they are charging us a euro
.20 per day just for using the service, so even if we
dont send a single sms per day we are getting
charged...not good. 


Thanks,
Ryan


http://www.clickatell.com/

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



[PHP] Get rid of line breaks

2006-06-18 Thread Peter Lauri
Best group member,

 

I have a variable $content that is taken from a database. It contains line
breaks and the $content will be posted with line breaks.

 

I need to use this to insert this into a JavaScript function:

 

 $output = 'writeRichText(\'rte1\', \''.$content.'\', 400, 200, true,
false);';

 

What is actually outputted is:

 

writeRichText('rte1', 'pa/p

h2b/h2', 400, 200, true, false);

 

Because it is on different lines in the HTML the javascript function will
not be called correct.

 

So can I remove all line breaks in a variable with a function call?

 

Dream: $content = stripLineBreaks($content);

 

I read the manual, but without luck.

 

Thanks in advance.



[PHP] mysql ORDER BY problem

2006-06-18 Thread Rob W.
Ok, here's what i got in my mysql db. I got a table listed with numbers as 
follows

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

These numbers I can display fine. I'm using ..

$query=SELECT * FROM db ORDER BY numbers ASC;

Right now it displays it as

1
10
11
12
.
2
22
23
25

3
4
5
6
7

Is there a way with my mysql query so that I can list the numbers in correct 
order?

Any help is appricated.

- Rob

[PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Michael Rasmussen
On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:

 
 Is there a way with my mysql query so that I can list the numbers in
 correct order?
 
In what way is this problem related to PHP?
Try a MySQL group instead.

-- 
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

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



Re: [PHP] Get rid of line breaks

2006-06-18 Thread Martin Alterisio

2006/6/18, Peter Lauri [EMAIL PROTECTED]:


Best group member,



I have a variable $content that is taken from a database. It contains line
breaks and the $content will be posted with line breaks.



I need to use this to insert this into a JavaScript function:



$output = 'writeRichText(\'rte1\', \''.$content.'\', 400, 200, true,
false);';



What is actually outputted is:



writeRichText('rte1', 'pa/p

h2b/h2', 400, 200, true, false);



Because it is on different lines in the HTML the javascript function will
not be called correct.



So can I remove all line breaks in a variable with a function call?



Dream: $content = stripLineBreaks($content);



I read the manual, but without luck.



Thanks in advance.




Check out http://php.net/addcslashes
maybe that will do the trick. If that doesn't work, you should try to
replace the line break character with the corresponding escape sequence.


Re: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Rob W.

It's not in general to mysql, it's how php and mysql is displaying it.


- Original Message - 
From: Michael Rasmussen [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, June 18, 2006 4:51 PM
Subject: [PHP] Re: mysql ORDER BY problem



On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:



Is there a way with my mysql query so that I can list the numbers in
correct order?


In what way is this problem related to PHP?
Try a MySQL group instead.

--
Hilsen/Regards
Michael Rasmussen
http://keyserver.veridis.com:11371/pks/lookup?op=getsearch=0xE3E80917

--
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] SMS with php recommendation (a bit 0T i guess)

2006-06-18 Thread Ryan A
Hey,


http://www.clickatell.com/brochure/products/developer_solutions.php

Ok, clickatell seems to be the popular choice around
here, will have a look see

In the meantime feel free to recommend any others.

Thanks for replying guys.

Cheers!
Ryan

--
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



Re: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread John Nichel

Rob W. wrote:

It's not in general to mysql, it's how php and mysql is displaying it.



That's not what you asked.  You asked how to do it with your query, 
which has nothing, nadda, zip to do with PHP.  You want MySQL to do the 
sorting, look at the MySQL manual under the select syntax, or ask on the 
MySQL list.  You want PHP to do the sorting, look at PHP's array 
functions; however, it'd be more efficient to go the MySQL route.



- Original Message - From: Michael Rasmussen [EMAIL PROTECTED]
To: php-general@lists.php.net
Sent: Sunday, June 18, 2006 4:51 PM
Subject: [PHP] Re: mysql ORDER BY problem



On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:



Is there a way with my mysql query so that I can list the numbers in
correct order?


In what way is this problem related to PHP?
Try a MySQL group instead.




--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



RE: [PHP] Re: mysql ORDER BY problem

2006-06-18 Thread Peter Lauri
Just do:

SELECT * FROM thetable ORDER BY yourfieldyouwanttoorder

If you want it in reverse order you add DESC in the end.

/Peter


-Original Message-
From: John Nichel [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 19, 2006 5:51 AM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: mysql ORDER BY problem

Rob W. wrote:
 It's not in general to mysql, it's how php and mysql is displaying it.
 

That's not what you asked.  You asked how to do it with your query, 
which has nothing, nadda, zip to do with PHP.  You want MySQL to do the 
sorting, look at the MySQL manual under the select syntax, or ask on the 
MySQL list.  You want PHP to do the sorting, look at PHP's array 
functions; however, it'd be more efficient to go the MySQL route.

 - Original Message - From: Michael Rasmussen [EMAIL PROTECTED]
 To: php-general@lists.php.net
 Sent: Sunday, June 18, 2006 4:51 PM
 Subject: [PHP] Re: mysql ORDER BY problem
 
 
 On Sun, 18 Jun 2006 15:55:14 -0500, Rob W. wrote:


 Is there a way with my mysql query so that I can list the numbers in
 correct order?

 In what way is this problem related to PHP?
 Try a MySQL group instead.



-- 
By-Tor.com
...it's all about the Rush
http://www.by-tor.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



Re: [PHP] mysql ORDER BY problem

2006-06-18 Thread Rob W.
Yeah, I got this problem fixed. The datbase was listed under [chr] instead of 
[integer].

Thanks for the help though.
  - Original Message - 
  From: Xavier Casto 
  To: Rob W. 
  Cc: php-general@lists.php.net 
  Sent: Sunday, June 18, 2006 7:30 PM
  Subject: Re: [PHP] mysql ORDER BY problem


  Rob,
  Your problem is the data type you are trying to sort. You have a few 
solutions that can be used depending on your skills, access, and intent of the 
data. As some had suggested, the problem may be best handled at the database 
level, but it all depends on what your intent is. 

  When sorting a datatype of Character (or string) 10 will always come before 
2, you would either need to convert the string to a number or left pad 
the string with 0 to get the result your are looking for. 

  Some good information for your issue can be found here:
  http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html 

  try the CAST or CONVERT functions in your query: 

  $query=SELECT * FROM db ORDER BY CONVERT(numbers, DECIMAL) ASC;



  On 6/18/06, Rob W.  [EMAIL PROTECTED] wrote:
Ok, here's what i got in my mysql db. I got a table listed with numbers as 
follows 

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

These numbers I can display fine. I'm using ..

$query=SELECT * FROM db ORDER BY numbers ASC; 

Right now it displays it as

1
10
11
12
.
2
22
23
25

3
4
5
6
7

Is there a way with my mysql query so that I can list the numbers in 
correct order?

Any help is appricated.

- Rob




[PHP] Ok next php problem

2006-06-18 Thread Rob W.
I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 8 
isnt listed, display it.

I've tried doing a 

if ($count != $data) {
  echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next entrie 
is displayed as 10 in the db. So that's my problem is to try and display only 
them numbers that are not in there. I have also tried putting the numbers in to 
an array and matching from there but it still come's up as the same as above.

- Rob


[PHP] Re: Ok next php problem

2006-06-18 Thread Jo�o C�ndido de Souza Neto
If i understood right, you want to list a sequence of numbers and follow 
some data like:

1 - data of number 1
2 - data of number 2
...

If it's right, you can do it.

$query=SELECT * FROM db ORDER BY numbers DESC limit 1;

$maxnum=$numbers;

for ($num=1;$num=$maxnum; $num++) {
$query=SELECT * FROM db where numbers=.$num;
echo $num. - .$data.br;
}



Rob W. [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]
I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like 
number 8 isnt listed, display it.

I've tried doing a

if ($count != $data) {
  echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next 
entrie is displayed as 10 in the db. So that's my problem is to try and 
display only them numbers that are not in there. I have also tried putting 
the numbers in to an array and matching from there but it still come's up as 
the same as above.

- Rob

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



Re: [PHP] Re: Ok next php problem

2006-06-18 Thread Rob W.
No, but ok here goes the whole thing and sorry if I didnt explain this to 
everyone before.


I am trying to duplicate a program that keep's track of server information, 
switch ports, apc ports ect ect...


In the one column is switchports

This lists a total of 24 or 48 or how many ever ports are on that switch.

With in there is numbers like this for example:

1
2
3
4
5
6
7
10
11
12
13
14
15

ect... Hopefully that help's so far.

As far as listing the numbers is ok, I can pull it from the db and list all 
the numbers just fine in numerical order as they are listed.


My problem is inside this script, when a new server is added, it pulls the 
information from the database and finds an empty number, which is why, 
though the whole list of 1 though 24 i need to get the information of the 
missing numbers. These missing numbers HAFT to be dynamic and can not be 
hard coded in because servers are always moved around and changed and added. 
I hope this information was helpful for those of you trying to help solve my 
problem.


- Rob

- Original Message - 
From: João Cândido de Souza Neto [EMAIL PROTECTED]

To: php-general@lists.php.net
Sent: Sunday, June 18, 2006 8:38 PM
Subject: [PHP] Re: Ok next php problem


If i understood right, you want to list a sequence of numbers and follow 
some data like:


1 - data of number 1
2 - data of number 2
...

If it's right, you can do it.

$query=SELECT * FROM db ORDER BY numbers DESC limit 1;

$maxnum=$numbers;

for ($num=1;$num=$maxnum; $num++) {
   $query=SELECT * FROM db where numbers=.$num;
   echo $num. - .$data.br;
}



Rob W. [EMAIL PROTECTED] escreveu na mensagem 
news:[EMAIL PROTECTED]

I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like 
number 8 isnt listed, display it.


I've tried doing a

if ($count != $data) {
 echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next 
entrie is displayed as 10 in the db. So that's my problem is to try and 
display only them numbers that are not in there. I have also tried putting 
the numbers in to an array and matching from there but it still come's up 
as the same as above.


- Rob

--
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] Ok next php problem

2006-06-18 Thread Chris

Rob W. wrote:

I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 8 
isnt listed, display it.


Get them both into arrays and compare:

$good_list = range(1,10);
$db_list = array(4,7,10);

$missing = array_diff($good_list, $db_list);

http://php.net/array_diff

--
Postgresql  php tutorials
http://www.designmagick.com/

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



[PHP] Re: Mail in Spam Box

2006-06-18 Thread Manuel Lemos
on 06/18/2006 12:29 PM kartikay malhotra said the following:
 I've use PHP mail to send mail to my Gmail ID. But it gets delivered to my
 Spam box and not the Inbox :(
 
 Am I missing a header, signature, certificate?

Maybe if you show how you are composing the message you are sending we
can advise.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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



Re: [PHP] Re: Ok next php problem

2006-06-18 Thread Chris

Rob W. wrote:
No, but ok here goes the whole thing and sorry if I didnt explain this 
to everyone before.


I am trying to duplicate a program that keep's track of server 
information, switch ports, apc ports ect ect...


In the one column is switchports

This lists a total of 24 or 48 or how many ever ports are on that switch.

With in there is numbers like this for example:

1
2
3
4
5
6
7
10
11
12
13
14
15

ect... Hopefully that help's so far.

As far as listing the numbers is ok, I can pull it from the db and list 
all the numbers just fine in numerical order as they are listed.


My problem is inside this script, when a new server is added, it pulls 
the information from the database and finds an empty number, which is 
why, though the whole list of 1 though 24 i need to get the information 
of the missing numbers. These missing numbers HAFT to be dynamic and can 
not be hard coded in because servers are always moved around and changed 
and added. I hope this information was helpful for those of you trying 
to help solve my problem.


My answer will help you then. You know how many you have (24 or 48), so:

$good_list = range(1, 48);
$taken_list = array();

$query = SELECT port FROM table;
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
  array_push($taken_list, $row['port']);
}

$not_taken = array_diff($good_list, $taken_list);


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Ok next php problem

2006-06-18 Thread Rob W.
Ok but my problem is is that in the process of doing that, numbers can be 
released so they pretty much haft to be dynamic. Any idea how I do it with 
that.


IE:

1
2
3
6
9
10
...

So if them numbers change, which they can, because they are assigned port 
numbers for servers, How do I make it so they are not scripted statically.



- Original Message - 
From: Chris [EMAIL PROTECTED]

To: Rob W. [EMAIL PROTECTED]
Cc: php-general@lists.php.net
Sent: Sunday, June 18, 2006 8:38 PM
Subject: Re: [PHP] Ok next php problem



Rob W. wrote:

I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like 
number 8 isnt listed, display it.


Get them both into arrays and compare:

$good_list = range(1,10);
$db_list = array(4,7,10);

$missing = array_diff($good_list, $db_list);

http://php.net/array_diff

--
Postgresql  php tutorials
http://www.designmagick.com/




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



Re: [PHP] Ok next php problem

2006-06-18 Thread tedd
At 7:21 PM -0500 6/18/06, Rob W. wrote:
I got the previous question answered, Now here's my next problem.

With the numbers displaying correctly again I got:

1
2
3
4
5
6
7
10
11
12
13
14
15
16
17
18
19
20
21
22
25

listed in that order in the database

Now i'm trying to figure out how to write a syntax saying that if like number 
8 isnt listed, display it.

I've tried doing a

if ($count != $data) {
  echo $data;
}
$count++;

But when I get to like id number 9 it dont work right because the next entrie 
is displayed as 10 in the db. So that's my problem is to try and display only 
them numbers that are not in there. I have also tried putting the numbers in 
to an array and matching from there but it still come's up as the same as 
above.

- Rob

Rob:

Why?

If you want to show the number of records in your dB, then just show them. If 
you want a counter, then add a counter but don't list the id number. Besides, 
why would you want to anyway?

tedd
-- 

http://sperling.com  http://ancientstones.com  http://earthstones.com

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



Re: [PHP] Re: Mail in Spam Box - its working now

2006-06-18 Thread kartikay malhotra

Hey!

Its working now. I replaced @mydomain with some valid mail address (gmail
address) and the mail was delivered to the Inbox. Feel free to use the code
if it helps. Attachments are allowed.

Also, it works without a subject (for gmail), but the mail address I used
now was genuine. Also genuine yahoo addresses are allowed, but not fake
ones. Pls tell me how does gmail know if the address from some remote domain
is genuine and not fake? After all, everything else is same.

Thanks Community
KM

On 6/19/06, Manuel Lemos  [EMAIL PROTECTED] wrote:


on 06/18/2006 12:29 PM kartikay malhotra said the following:
 I've use PHP mail to send mail to my Gmail ID. But it gets delivered to
my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

Maybe if you show how you are composing the message you are sending we
can advise.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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




Fwd: [PHP] Re: Mail in Spam Box - my code

2006-06-18 Thread kartikay malhotra

Oops, sent this previous mail to Manuel instead of the group... :)

Hi All!

Sure, here is what I've:


?php

 $uploaddir='/tmp/';
 $account_file = account.txt; //Substitute with a valid file on ur system
 $account_file = $uploaddir.basename($account_file);

 $file = fopen($account_file,'rb');
 $data = fread($file,filesize($account_file));
 fclose($file);

//  echo $data;

 $to =  [EMAIL PROTECTED];
 $from = [EMAIL PROTECTED];
 $message = Hi! Where are you these days?;

 $headers = From: $from;


// Generate a boundary string
 $semi_rand = md5(time());
 $mime_boundary = ==Multipart_Boundary_x{$semi_rand}x;

// Add the headers for a file attachment
 $headers .= \nMIME-Version: 1.0\n .
Content-Type: multipart/mixed;\n .
 boundary=\{$mime_boundary}\;



// Add a multipart boundary above the plain message
 $message = This is a multi-part message in MIME format.\n\n .
   --{$mime_boundary}\n .
   Content-Type: text/plain; charset=\iso-8859-1\\n .
   Content-Transfer-Encoding: 7bit\n\n .
$message . \n\n;

// Base64 encode the file data
 $data = chunk_split(base64_encode($data));


$fileatt_type=text/plain;
$fileatt_name=Hola;

// Add file attachment to the message
 $message .= --{$mime_boundary}\n .
Content-Type: {$fileatt_type};\n .
 name=\{$fileatt_name}\\n .
Content-Disposition: attachment;\n .
 filename=\{$fileatt_name}\\n .
Content-Transfer-Encoding: base64\n\n .
$data . \n\n .
--{$mime_boundary}--\n;

// echo $message;

// Send the message

$ok = @mail($to, $subject, $message, $headers);
if ($ok) {
echo pMail sent Successfully/p;
} else {
echo pMail send failed/p;
}



?

Thanks  Regards
KM

On 6/19/06, Manuel Lemos [EMAIL PROTECTED] wrote:


on 06/18/2006 12:29 PM kartikay malhotra said the following:
 I've use PHP mail to send mail to my Gmail ID. But it gets delivered to
my
 Spam box and not the Inbox :(

 Am I missing a header, signature, certificate?

Maybe if you show how you are composing the message you are sending we
can advise.

--

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

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




Re: [PHP] Ok next php problem

2006-06-18 Thread Chris

Rob W. wrote:
Ok but my problem is is that in the process of doing that, numbers can 
be released so they pretty much haft to be dynamic. Any idea how I do it 
with that.


IE:

1
2
3
6
9
10
...

So if them numbers change, which they can, because they are assigned 
port numbers for servers, How do I make it so they are not scripted 
statically.


That was an example only.

See my next reply for an example of how to get the port from the db and 
go from there.


Since we don't know your db structure, table names, field names I made 
it generic and you'll have to modify to suit your needs.


--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] Want some PHP e-book

2006-06-18 Thread Ligaya Turmelle

prolibertine wrote:

i am a newbie of php .i want get some php ebook to read.
who can send me some
thx

http://www.hudzilla.org/phpbook/

--

life is a game... so have fun.

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

[PHP] Compare data between 2 array

2006-06-18 Thread weetat

Hi all,

  I would like to say good job to this newsgroup , they are the best.

  Ok. My dilemma is that i have to compare values between 2 table which 
are exactly the same structure and fields.

  Below is rough example .

   The table are tbl_chassis and tbl_chassis_temp. Below are the fields.

   `id` int(11) NOT NULL auto_increment,
  `serial_no` varchar(100) NOT NULL default '',
  `host_name` varchar(100) NOT NULL default '',
  `chasis_model` varchar(100) NOT NULL default '',
  `chasis_flash_size` varchar(100) NOT NULL default '',
  `chasis_dram_size` varchar(100) NOT NULL default '',
  `chasis_sw_version` varchar(100) NOT NULL default '',
  `chasis_eos` date NOT NULL default '-00-00',
  `chasis_eol` date NOT NULL default '-00-00',
  `chasis_user_field_1` varchar(100) NOT NULL default '',
  `chasis_user_field_2` varchar(100) NOT NULL default '',
  `chasis_user_field_3` varchar(100) NOT NULL default '',
   `status` varchar(100) NOT NULL default '',

What i need to figure out are when the records are deleted , updated and 
insert ,i need to update status in tbl_chassis table. What i am plan to 
do is to select query in the tbl_chassis_temp table and compare the 
value from each records to the records in the tbl_chassis table.Any 
others ways to do it?


There are about 1000 records in each table.
What is the better alternative to do this ? Thanks

 - weetat

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



Re: [PHP] Compare data between 2 array

2006-06-18 Thread Chris

weetat wrote:

Hi all,

  I would like to say good job to this newsgroup , they are the best.

  Ok. My dilemma is that i have to compare values between 2 table which 
are exactly the same structure and fields.

  Below is rough example .

   The table are tbl_chassis and tbl_chassis_temp. Below are the fields.

   `id` int(11) NOT NULL auto_increment,
  `serial_no` varchar(100) NOT NULL default '',
  `host_name` varchar(100) NOT NULL default '',
  `chasis_model` varchar(100) NOT NULL default '',
  `chasis_flash_size` varchar(100) NOT NULL default '',
  `chasis_dram_size` varchar(100) NOT NULL default '',
  `chasis_sw_version` varchar(100) NOT NULL default '',
  `chasis_eos` date NOT NULL default '-00-00',
  `chasis_eol` date NOT NULL default '-00-00',
  `chasis_user_field_1` varchar(100) NOT NULL default '',
  `chasis_user_field_2` varchar(100) NOT NULL default '',
  `chasis_user_field_3` varchar(100) NOT NULL default '',
   `status` varchar(100) NOT NULL default '',

What i need to figure out are when the records are deleted , updated and 
insert ,i need to update status in tbl_chassis table. What i am plan to 
do is to select query in the tbl_chassis_temp table and compare the 
value from each records to the records in the tbl_chassis table.Any 
others ways to do it?


If you're changing the status, why not do it in both tables at the same 
time?


$query = update table1 set status=newstatus where ...;
mysql_query($query);

$query = update table2 set status=newstatus where ...;
mysql_query($query);


Another option is to change to use the INNODB engine in mysql and use 
foreign keys (note they only work properly with InnoDB tables, MyISAM 
tables don't have this capability).


See

http://dev.mysql.com/doc/refman/5.1/en/innodb.html
http://dev.mysql.com/doc/refman/5.1/en/example-foreign-keys.html
http://dev.mysql.com/doc/refman/5.1/en/ansi-diff-foreign-keys.html

--
Postgresql  php tutorials
http://www.designmagick.com/

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