[PHP] PHP 4.3.11, question about classes

2006-03-22 Thread Michael Hulse

Hi,

I am just learning about classes.

My server is running PHP 4.3.11

Example code:

class testing {
var $what;
}

$linkGenClass = new testing();
$linkGenClass-what = 'hi';
echo $linkGenClass-what;

Why does the constructor require the ()?

I have seen many examples via google that do not use ().

Should I worry about capitalizing the first letter of the class?

Can class names have underscores?

Are spaces allowed on either side of the -?

Is var $what PHP 4 and 5, whereas public $what is PHP 5?

Got any good links to class tutorials for PHP 4.3.11?

Sorry to sound like a PHP noob.

TIA,
Cheers,
Micky

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



Re: [PHP] PHP 4.3.11, question about classes

2006-03-22 Thread Michael Hulse
Hi Chris! Thanks for all the great answers, I really appreciate all of 
your help. I am browsing the link you gave me now.


I only have one question:

On Mar 22, 2006, at 4:09 AM, chris smith wrote:

You're calling a method (which is a function inside a class). You
can't call a regular function without the brackets, so methods should
be the same.


...


class testing {
var $what;
}

$linkGenClass = new testing();
$linkGenClass-what = 'hi';
echo $linkGenClass-what;


Let me see if I have this straight: class testing {} is a method, and 
$linkGenClass = new testing(); is the class...


I am pretty familiar with PHP functions... I was under the assumption 
that class testing{} was the class, and any functions inside that 
class were the methods?


An example function:

function example() {}

But, this would be considered a method?:

class method {}

Seems a bit confusing. Esp. when I construct the above method like so: 
$myClass = new method();


Hehe, I am sure that link you sent will give me some great answers, 
reading now.


I really appreciate your time/links/knowledge/help.   :)

Cheers,
Micky

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



Re: [PHP] [SOLVED] PHP 4.3.11, question about classes

2006-03-22 Thread Michael Hulse

On Mar 22, 2006, at 4:33 AM, chris smith wrote:

Sorry for the confusion :)


Not at all.  :)

I am stoked to be finally learning about OOP/classes/objects in PHP... 
the tutes you sent are very helpful.


Many thanks for you help, I really appreciate it.  ;)

Nice site btw, great info, cool design... thanks for sharing.  :D

Cheers,
Micky

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



[PHP] Function-returning array { OR } declare array at top of functions file?

2006-03-21 Thread Michael Hulse

Hi,

I just wanted to know if it is wrong, or non-standard, for me to set-up  
functions that just return an array... example:


 function vert_links_array():
function vert_links_array() {
return array(
		'1' =  
array(S_MANCOM,'start.php?page=productsamp; 
sub=mancom',S_MANCOM_TI,'mancom'),
		'2' =  
array(S_BRACLU,'start.php?page=productsamp; 
sub=braclu',S_BRACLU_TI,'braclu'),
		'3' =  
array(S_BRASHO,'start.php?page=productsamp; 
sub=brasho',S_BRASHO_TI,'brasho'),
		'4' =  
array(S_CALDIS,'start.php?page=productsamp; 
sub=caldis',S_CALDIS_TI,'caldis'),
		'5' =  
array(S_CUSMAN,'start.php?page=productsamp; 
sub=cusman',S_CUSMAN_TI,'cusman'),
		'6' =  
array(S_FRIDIS,'start.php?page=productsamp; 
sub=fridis',S_FRIDIS_TI,'fridis'),
		'7' =  
array(S_GOVMIL,'start.php?page=productsamp; 
sub=govmil',S_GOVMIL_TI,'govmil'),
		'8' =  
array(S_INDBRA,'start.php?page=productsamp; 
sub=indbra',S_INDBRA_TI,'indbra'),
		'9' =  
array(S_INDLIN,'start.php?page=productsamp; 
sub=indlin',S_INDLIN_TI,'indlin'),
		'10' =  
array(S_RAICAR,'start.php?page=productsamp; 
sub=raicar',S_RAICAR_TI,'raicar'),
		'11' =  
array(S_SAWGUI,'start.php?page=productsamp; 
sub=sawgui',S_SAWGUI_TI,'sawgui'),
		'12' =  
array(S_ASSPRO,'start.php?page=productsamp; 
sub=asspro',S_ASSPRO_TI,'asspro')

); // Add more here.
}

OR

Should I just put the above array at the top of my functions file and  
access it as a global within other functions?


Any suggestions? I am a self-taught php dude, so please don't laugh if  
this is a silly question.


Thanks.  :)
Cheers,
Micky

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



Re: [PHP] Function-returning array { OR } declare array at top of functions file?

2006-03-21 Thread Michael Hulse


On Mar 21, 2006, at 2:35 PM, Michael Hulse wrote:
Any suggestions? I am a self-taught php dude, so please don't laugh if 
this is a silly question.


You know, the more I think about, the more I think I need to learn 
about PHP classes... Seems like I would just be able to define the 
array from previous email within the a class that have all the 
functions that use that array... not sure if that makes sense... any 
good links for learning more about classes?


Thanks,
Micky

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



Re: [PHP] Function-returning array { OR } declare array at top of functions file?

2006-03-21 Thread Michael Hulse

On Mar 21, 2006, at 3:48 PM, Michael Hulse wrote:

... any good links for learning more about classes?


This seems like a good tutorial to start with:

http://www.phpfreaks.com/tutorials/48/0.php

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



Re: [PHP] not sure, what now

2006-02-25 Thread Michael Hulse

On Feb 25, 2006, at 2:22 PM, Schalk wrote:
*Warning*: main(): open_basedir restriction in effect. 
File(../inc/siteconfig.php) is not within the allowed path(s):
(/home/httpd/vhosts/sealbeachprofessionals.com/httpdocs:/tmp) in 
/home/httpd/vhosts/sealbeachprofessionals.com/httpdocs/home.php on 
line 1


Try changing all includes that look like this:

include('/folder/file.php');

... to this:

include($_SERVER['DOCUMENT_ROOT'].'/folder/file.php');

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



Re: [PHP] not sure, what now

2006-02-25 Thread Michael Hulse

To be more specific:

Based on error message you posted:

#Start from server root:
include($_SERVER['DOCUMENT_ROOT'].'/inc/siteconfig.php');

Hth,
gl, M

On Feb 25, 2006, at 7:31 PM, Michael Hulse wrote:


Try changing all includes that look like this:

include('/folder/file.php');

... to this:

include($_SERVER['DOCUMENT_ROOT'].'/folder/file.php');


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



[PHP] Page validation: Un-wanted PHP session ID added to links????

2006-02-20 Thread Michael Hulse

Hi,

I just finished a website for client - I just uploaded the site to 
their server space - when I went to go validate my pages using the W3C 
XHTML validator I get several errors due to an un-encoded ampersand in 
the link URL... For some reason, a session ID is getting added to the 
end of all my menu links:


/start.php?page=homePHPSESSID=45142bb20b8b2e800be5359b667237

Ummm, can I turn this off? I tested/built the site on my server and 
never got this problem.


I am sure it is an easy fix. Suggestions? Links?

Many thanks in advance.
Micky

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



Re: [PHP] Page validation: Un-wanted PHP session ID added to links????

2006-02-20 Thread Michael Hulse


On Feb 20, 2006, at 12:10 PM, John Nichel wrote:

It's all in the manual


Hi, thanks for pointing that out. I guess I should have RTFM first, 
then ask q's second... noob mistake, wont happen again.  :D


I guess I just do not understand why a session is even being created, I 
never started one... I guess I need to read the manual in more detail 
(doing now).


Thanks for the quick response.   :)
Micky

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



Re: [PHP] Re: Page validation: Un-wanted PHP session ID added to links????

2006-02-20 Thread Michael Hulse


On Feb 20, 2006, at 12:11 PM, David Dorward wrote:

http://www.w3.org/QA/2005/04/php-session details how to fix the problem
(without breaking the session tracking for users without cookies 
supported

and enabled).



Ah, great link. Thanks!  :)

I don't know why sessions are being stored in the first place, but at 
least I can fix the validation prob.


Cheers!
Micky

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



[PHP] Re: [SOLVED] [PHP] Page validation: Un-wanted PHP session ID added to links????

2006-02-20 Thread Michael Hulse

This did the trick:

?php ini_set('arg_separator.output','amp;'); ?

On Feb 20, 2006, at 12:37 PM, John Nichel wrote:
The server you're running the script on may have session.auto_start 
enabled


Ah, got it.  :)

Thanks all!

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



Re: [PHP] Working with a config file

2006-02-20 Thread Michael Hulse

On Feb 20, 2006, at 2:21 PM, Benjamin Adams wrote:
I want to parse this so I can only call frank or freds data and move 
id, section, years, etc to varaibles.

Can someone give me some help


Here is a function I wrote, I bet it will help you (sorry, not the most 
readable because I pulled from bigger application I wrote, hopefully 
you can translate to suit your needs):


 $ini = File to parse. e.g.[ 'rand_01.ini' ]
 You might want to change extension of your config to .ini, not 
sure if that will matter.
$images = get_ini_file($ini); // Call $get_ini_file() function, put in 
$images array.


/ function get_ini_file():
/ Reads ini file for other 
functions:

function get_ini_file($ini) {
global $PATH_TO_INI, $DEFAULT_INI_FILE;
# if no custom ini file has been specified, use the default:
$ini_file = $ini ? $PATH_TO_INI.$ini : $PATH_TO_INI.$DEFAULT_INI_FILE;
# read the config file into an array or die trying:
$parsed_ini = @parse_ini_file($ini_file, true);
if(!$parsed_ini) {
die('[ Unable to read ini file! ]');
} else { return $parsed_ini; }
}

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



Re: [PHP] Hide email addresses from spam bots

2006-02-01 Thread Michael Hulse

Well, this is Javascript, but interesting:

http://www.albionresearch.com/misc/obfuscator.php

Link description:

Sadly there are a number of 'spambots' which roam the web 'harvesting' 
email addresses to send spam to. Often you have no choice but to 
include an email address in a web page. Fortunately most of these 
spambots do not seem to have complete HTML parsers. This free Email 
Address Obfuscator generates a 'mailto:' link which will confuse naïve 
robots, but will still work in standard browsers.


Looks like the above page has some helpful links to other sites on 
subject at bottom of page.


Hth,
M

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



Re: [PHP] Retrieve output from HTML or PHP file

2006-01-29 Thread Michael Hulse
I have used output buffering[1] in the past to do what you are  
describing.


snip

# HTML to be written:
ob_start(); // Begin output buffering:
	require($_SERVER['DOCUMENT_ROOT'].$path.'/ 
'.$name_of_template.$name_of_template_ext);
	$message = ob_get_contents(); // Put contents of the above require  
into $message.

ob_end_clean(); // Clean the output buffer.

/snip

Probably better ways to do above, but maybe that will help you in some  
way.


Oh, you may also want to look into the eval() function[2].

[1] http://us2.php.net/manual/en/function.ob-start.php
[2] http://us2.php.net/manual/en/function.eval.php

Cheers, Micky
--
BCC for Privacy: http://www.cs.rutgers.edu/~watrous/bcc-for-privacy.html
My del.icio.us: http://del.icio.us/mhulse

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



Re: [PHP] Use of Ampersand in php

2006-01-22 Thread Michael Hulse

On Jan 22, 2006, at 7:04 PM, Nirmalya Lahiri wrote:

Can any one tell me, what is the use of ampersand '' in php?


This might help:

http://us2.php.net/manual/en/language.references.php

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



Re: [PHP] date(H, $datevalue) always adds an hour?

2006-01-20 Thread Michael Hulse

Hi,

On Jan 20, 2006, at 2:24 AM, Murray @ PlanetThoughtful wrote:

Can anyone help me figure out how to accommodate for this?


Not sure if this will help, but:

# Set time zone:
putenv('TZ=US/Pacific'); // I am on west-coast, my servers are on east, 
if not for this code the timestamp used in my script will reley upon 
the server time. This line of code will over-ride server time.


Maybe look-up putenv on php.net and read-up in the comments section, I 
usually find good info that way.


Gl,
Cheers,
Micky

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



Re: Re[2]: [PHP] Best way to do this: www.domain.com?page=var

2006-01-17 Thread Michael Hulse
Wow, thanks for all the great advice everyone! Very good info... all of 
your suggestions have been very helpful. I appreciate it.


• I would have never thought to just require() the page... good idea.  
:)
• Still checking out server options... waiting for info from client on 
that tip.
• Mod rewrite looks very interesting and useful, reading/learning about 
it now.
• Header and Location redirects... Glad to hear all of your thoughts 
about the pros/cons of the two. Thanks.  :)
• Also, thanks for all the snippets of code. Definitely got me thinking 
in the right direction.



Have a great new year!
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need help arranging files!

2006-01-17 Thread Michael Hulse

On Jan 17, 2006, at 7:09 AM, tedd wrote:

Worked great for me -- no problems whatsoever!


Sweet, thanks for checking... glad someone got it working. :)

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



[PHP] Best way to do this: www.domain.com?page=var

2006-01-16 Thread Michael Hulse

Hello,

What would be the best way to get a page variable like this:

www.domain.com?page=home

to show up when a user types in:

www.domain.com

My current fix is to have this:

header(Refresh: 0; URL=http://www.domain.com/start.php?page=home;);

... on a index.php page on the root.

Is there a way I can do this and avoid having a page that just does 
redirection?


Thanks for help.
Cheers,
Micky

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



Re: [PHP] Best way to do this: www.domain.com?page=var

2006-01-16 Thread Michael Hulse


On Jan 16, 2006, at 2:14 PM, [EMAIL PROTECTED] wrote:]
I think that'll do it for ya.   If you're going through an ISP, they 
still may have a way that you can set your defaults, possibly through 
.htaccess or some other Apache type prefs setting mechanism.


Good luck!


Great! Thanks for the quick response, I really appreciate it. I had a 
feeling it was a fix at the server level.  :)


Cheers,
Micky

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



Re: [PHP] Best way to do this: www.domain.com?page=var

2006-01-16 Thread Michael Hulse

On Jan 16, 2006, at 2:24 PM, Ezra Nugroho wrote:

You probably want to check mod_rewrite.
http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html


Ah, looks useful! Thanks for link, reading about it now.  :)

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



Re: [PHP] Best way to do this: www.domain.com?page=var

2006-01-16 Thread Michael Hulse

On Jan 16, 2006, at 3:27 PM, M. Sokolewicz wrote:

I'm confused...
why does everyone use a refresh??? According to me, that's not what a 
refresh is supposed to be used for (!). Why don't use a

header('Location: http://www.domain.com/start.php?page=home'); for it?
It's more in-line with RFC's


Good point... I actually should start using Location instead... seems 
to make more sense. Thanks for pointing that out.  ;)


CHeers,
Micky

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



Re: [PHP] need help arranging files!

2006-01-16 Thread Michael Hulse

On Jan 16, 2006, at 5:21 PM, Nicholas Couloute wrote:
I need to know how to arrange files alphabetically in my directory 
when I display it on the browser! I have it display the filename 
foreach that exist is there a way to arrange by alphabet?


I would read the contents of the directory into an array, then use the 
sort()[1] function.


Example code (wrote the below code so I could generate a dynamic html 
drop-down menu):


...
...
...
$the_dir = opendir($file_path);
# Loop through directory and add files to array $html:
while ($file = readdir($the_dir)) {
# Check if it's a file, and it has a valid extension:
if(eregi((\.html|\.htm|\.php|\.txt)$, $file)) {
# Add file to array $html:
$html[] = $file;
}
}
# Close the stream:
closedir($the_dir);
# Generate the drop-down menu:
if($html == null) { die(There are no files in this directory!); } // 
If no content is found, alert user.

...
...
...

From here, in your case, I would just apply one of the PHP sort 
functions on the $html var and then print/echo your results from 
there...


[1] http://us3.php.net/manual/en/function.sort.php

Hth,
Cheers,
Micky

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



Re: [PHP] need help arranging files!

2006-01-16 Thread Michael Hulse

On Jan 16, 2006, at 6:10 PM, Nicholas Couloute wrote:

I tried the script but it keeps saying it is not an array!


Hmm, I just set-it-up on my server:

http://www.ambiguism.com/php/readDirSort.php

Seems to work for me. Code:

$file_path = $_SERVER['DOCUMENT_ROOT'].'/php/test/';
$the_dir = opendir($file_path);
# Loop through directory and add files to array $html:
while ($file = readdir($the_dir)) {
# Check if it's a file, and it has a valid extension:
if(eregi((\.pdf|\.html|\.htm|\.php|\.txt)$, $file)) {
# Add file to array $html:
$html[] = $file;
}
}
# Close the stream:
closedir($the_dir);
# Generate the drop-down menu:
if($html == null) { die(There are no files in this directory!); } // 
If no content is found, alert user.

sort($html);
foreach($html as $html = $value) {
echo 'br /'.$value;
}

Keep in mind, the above code is very minimal... you could probably 
spend a bit of time making more secure/robust... I pulled it out of a 
function I use.


You might want to read-up on sorting via PHP.net (in comments section) 
for more robust user-defined functions...


Hth!
Cheers,
Micky

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



Re: [PHP] How to: Search web for specific file type?

2006-01-05 Thread Michael Hulse

On Jan 5, 2006, at 3:49 AM, Jochem Maas wrote:

good a place as any:
http://www.acmqueue.com/modules.php?name=Contentpa=showpagepid=143


Hi! Thanks for link, visiting now.  :)

I might suggest that you first google for 'how to write a search 
engine'; then do a lot of reading;


Have done... a ton of hits for website search tools... but I have yet 
to filter the results down to WWW search engine scripts/tutorials...


So far I have had only a few possible options: Google API and/or 
Microformat tags.



then curse yourself for having undertaken such a difficult task;


Lol! Yep. I realized that after I posted my question to the list. Hehe! 
Man, I wish I were a better programmer!


then try to formulate the criteria/limitations/requirements of yourt 
search engine as preciesly as possible ...


Great advice, I really appreciate the tip.  :)

and when you have a definite idea about what you want to achieve come 
back by all means and ask questions - you never we might even be able 
to help (assuming php is the technology tyou choose to implement your 
search engine

in)!


And that I will... but I think that I will leave my idea for a later 
date... if/when I ever get good enough to write such a program, or when 
I discover a script that will allow me to implement my file-specific 
search engine


ps - creating something decent that resembles a search engine is not 
easy IMHO.

good luck


I hear that. Man, I hate my limitations. Oh well, back to watching 
season 2 of the Sopranos!  ;)


Thanks for the response...

Cheers,
Micky

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



Re: [PHP] failed to open stream warning

2006-01-04 Thread Michael Hulse


On Jan 4, 2006, at 4:28 PM, zedleon wrote:

$fp = fopen(home/path/temp w+);


You only got 3 quotes in the above code...
 try this:

$fp = fopen(home/path/temp, w+);

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



Re: [PHP] Re: failed to open stream warning

2006-01-04 Thread Michael Hulse


On Jan 4, 2006, at 4:56 PM, zedleon wrote:

I just corrected the code...I had it correct but posted it in 
correctly.


$fp = fopen(home/path/temp w+);
puts($fp, $msg);
fclose($fp);

Still getting the same warning...



I think you forgot a comma this time...

$fp = fopen(home/path/temp, w+);

Other than that, do you have a file you can specify? Also, you should 
make sure your permissions are set correctly... check the parent folder 
and the file you want to open.


I am sure you have been here already, but:

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

Good luck,
Micky

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



[PHP] How to: Search web for specific file type?

2006-01-04 Thread Michael Hulse

Hello,

Just curious if anyone could give me some google 
keywords/links/suggestions/tips/comments/feedback on a good place to 
start for writing a search engine script.


I think I might have a good idea for a specific type of search engine. 
Basically it would crawl web and index links to a specific type of 
file... really simple. Obviously making the results searchable is a 
must.


Not sure where to start though.

Thanks!
Cheers,
Micky

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



Re: [PHP] Upload with process meter

2006-01-03 Thread Michael Hulse

On Jan 2, 2006, at 1:30 PM, Martin Zvarík wrote:
is it possible to upload a file and see the process of uploading 
(before the file is uploaded, there is something showing from 0% to 
100%) using PHP and Javascript ?


My main dig with using PHP[0] is that (AFAIK) there is no good way to 
give the user some feedback in terms of percentage uploaded.


I would suggest that you look-into AJAX[1] and/or Flash8[2]. F8 now has 
file upload capabilities - and both will allow for you to give the user 
feedback, letting them know (among other things) how long they have to 
wait. I am personally very impressed by F8, the example I give[2][3] is 
pretty darn cool!


(Read the comments also:)
[0] http://us2.php.net/manual/en/features.file-upload.php
[0] http://us2.php.net/manual/en/function.is-uploaded-file.php
[0] http://us2.php.net/manual/en/function.move-uploaded-file.php
(Just did a google search, these were the first I found.:)
[1] http://encodable.com/tech/ajaxupload/
[1] http://www.devpro.it/upload_progress/
[2] http://www.tink.ws/blog/filereference-example/
[3] http://snipurl.com/l8n5

Hth,
Micky

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



Re: [PHP] To copy a file from one server to another server in php

2006-01-02 Thread Michael Hulse

Hello,

On Jan 2, 2006, at 12:27 AM, suma parakala wrote:

Hi
Can anyone tell me how can we copy one file from one server to another 
server using PHP

Thanks
Suma


I use this function to grab mp3's from one server and place them on 
another (transfers 10mb files rather nicely):


function grab_mp3($in, $out) {

$remote = fopen($in, 'r');
# Remember to chmod download folder to 777:
$local = fopen('test/'.$out, 'w+');
if(!$remote) {
// handle failed request here ...
echo Oops!;
}
else {
while (!feof($remote)) {
# Use @ to supress warning messages:
@$a .= fread($remote, 8192);
}
}
fwrite($local, $a);

fclose($remote);
fclose($local);

# Bye bye.

}

You could also use cURL:

http://us3.php.net/curl

Hth,
Cheers,
Micky

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



Re: [PHP] To copy a file from one server to another server in php

2006-01-02 Thread Michael Hulse

On Jan 2, 2006, at 12:32 AM, Michael Hulse wrote:

You could also use cURL:


From the cURL manual (in a terminal window type man curl, without the 
quotes):


...
...
-o/--output file
  Write output to file instead of stdout. If you are 
using {} or
  [] to fetch multiple documents, you can use '#'  followed 
 by  a
  number  in  the file specifier. That variable will be 
replaced
  with the current string for the URL being fetched. Like 
in:


curl http://{one,two}.site.com -o file_#1.txt

  or use several variables like:

curl http://{site,host}.host[1-5].com -o #1_#2

  You may use this option as many times  as  you  have  
number  of

  URLs.

   -O/--remote-name
  Write  output to a local file named like the remote file 
we get.
  (Only the file part of the remote file is used, the path 
is  cut

  off.)

  You  may  use  this  option  as many times as you have 
number of

  URLs.
...
...

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



Re: [PHP] Pblm with streaming ..

2005-12-19 Thread Michael Hulse

On Dec 19, 2005, at 12:10 PM, ganu wrote:
... any idea how to do? I am not getting any idea/starting how to do 
it ...


Use Flash 8.

It will convert to .FLV format. Easy as cake.

Choose to make the file external. Then you can use Progressive 
download/play.


With Flash 8 it is really easy to create a kick-butt vid player. Check 
out http://video.google.com/ for example.


You can download the Flash 8 and use the free 30 day trial.

Another option would be real player... Some would say it is best to 
offer many different formats for your users to choose from.


Flash is my fav though.

Hth,
Cheers,
Micky

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



Re: [PHP] PHP programmers from hyderabad

2005-12-18 Thread Michael Hulse

On Dec 18, 2005, at 6:19 PM, Curt Zirzow wrote:

On Mon, Dec 19, 2005 at 02:58:00AM +0100, Vikram Kumar wrote:

We are looking for PHP programmers from hyderabd.

You can stop sending these messages to the list.


I am with Curt on this one. I get enough spam as it is already.

WhTF is Hyderabd anyway?

M
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Michael Hulse


On Dec 16, 2005, at 11:50 AM, Shaun wrote:
I have a script on my site for processing values sent from a contact 
form
and emailing them to the webmaster. The script has been abused by 
spammers

and my hosting company has recommended that I change the script to only
accept information posted from my own URL. Could someone tell me how 
this

can be done please?


Hello,

Maybe try using:

$_SERVER['DOCUMENT_ROOT']

Or, something similar.

http://us2.php.net/reserved.variables

Hth,
Cheers,
Micky

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



Re: [PHP] Blocking Values From an External Source

2005-12-16 Thread Michael Hulse


On Dec 16, 2005, at 12:05 PM, Michael Hulse wrote:

http://us2.php.net/reserved.variables


Check this post in the comment section of above url:

Zoic
20-Sep-2005 11:39
I just wrote up this function to secure forms on my site so that you 
can't submit a form from anywhere but your site. This is extremely 
effective in securing your forms from hacking attempts.


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



Re: [PHP] Binary Config file: Protect script(s): Powered-by logo: How to?

2005-12-16 Thread Michael Hulse


On Dec 15, 2005, at 10:15 PM, Michael Hulse wrote:

On Dec 15, 2005, at 10:09 PM, Michael Hulse wrote:
So, if you buy the gallery script, which I did (I think I spent like 
20$), the Powered by Company Name disappears.


I forgot to add:

When you buy the script, the company will send you a new replacement 
config.dat file that magically removes the Powered by Company Name 
from the bottom of the template pages.


Hello,

Wow, I did not expect to get 0 responses to my original post... Now I 
feel kinda bad for even asking.   :(


Anyway, Let me re-phrase my question: How do you protect your code?

I have heard about commercial options of obfuscating code... But I 
would love to learn about ways to do the same without paying the 
big-bucks.


If one were to read my original post, that gallery script has a great 
system of adding a Powered By link to bottom of the template pages... 
I would love to learn how to do something similar. Anyone feel like 
sharing? Links? Thoughts? Comments? Suggestions? Should I go bugger 
off?


Feel free to contact me off-list.

:)

Thanks in advance!
Cheers,
Micky

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



[PHP] Binary Config file: Protect script(s): Powered-by logo: How to?

2005-12-15 Thread Michael Hulse

Hey all,

A couple years ago, before I could write my own PHP, I used a 
semi-commercial gallery script... Long story short, this gallery script 
used a config.dat file with these contents:



?php exit(); ?
11001100
01101100
0100
10001100
1100
...
... (Picture 1,667 lines of this)
...
11101100
0100
00101100
11101100
0100


This config file controlled how a Powered by Company Name was 
displayed on the bottom of the template page.


So, if you buy the gallery script, which I did (I think I spent like 
20$), the Powered by Company Name disappears.


Since then, I have always wondered how I could do the same. I am 
definitely not a PHP guru, but I can hold my own... There have been a 
few scripts I have written for clients where I would have loved to 
implement this same technique...


Recently, I re-downloaded the script and tried to break-it-down to see 
how it works... I was able to narrow things down to a few methods, a 
template page, and a tiny bit more of PHP script... But, it is really 
hard to understand how this is done because the config.dat file is 
unreadable!


Any thoughts on how I could go about doing this?

How are they making their config files (I am assuming that they 
probably wrote a proprietary script to convert PHP code to binary 1's 
and 0's)?


Any thoughts and/or suggestions?

If anyone is curious, I can post a bit of the code. Here is a link to 
the gallery script:


http://www.stadtaus.com/en/php_scripts/gallery_script/

Does anyone else do something similar? I would love to see some code, 
and/or read more about similar techniques


Thanks all,
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Binary Config file: Protect script(s): Powered-by logo: How to?

2005-12-15 Thread Michael Hulse

On Dec 15, 2005, at 10:09 PM, Michael Hulse wrote:
So, if you buy the gallery script, which I did (I think I spent like 
20$), the Powered by Company Name disappears.


I forgot to add:

When you buy the script, the company will send you a new replacement 
config.dat file that magically removes the Powered by Company Name 
from the bottom of the template pages.


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



Re: [PHP] Re: Declaring arrays? Good practice?

2005-12-14 Thread Michael Hulse

On Dec 14, 2005, at 9:31 AM, [EMAIL PROTECTED] wrote:
I'm lazy so I don't tend to pre-define variable types although I 
should probably get into the practice when there's a security need to 
do so.


So what was the original question again?  hah


Hehehe, looks like you answered it.  :D

Thanks all for the input, it has been a very helpful read.   ;)

Cheers,
Micky

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



[PHP] Declaring arrays? Good practice?

2005-12-13 Thread Michael Hulse

Sorry if this question sounds noobish:

$foo = array(); // Declare first, good practice.
$foo = array('one', 'two', 'three');

Using above as example, is it good to always declare the array first?

I usually/always declare my arrays first, but sometimes I get a bit 
confused... for example:


function give_foo() {
$the_foo = array(); // Declare first, good practice.
$the_foo = array('one', 'two', 'three');
// Do some stuff here...
return $the_foo;
}
$foo = give_foo(); // Declare $foo also?

So, should I declare $foo as array and then give it the value of the 
function? Example:


$foo = array(); // Declare first, good practice.
$foo = give_foo();

That seems kinda redundant. Thoughts?

Sorry if this is a stupid question... I am self-taught, and I am trying 
to shake all my bad coding habits.


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



Re: [PHP] Declaring arrays? Good practice?

2005-12-13 Thread Michael Hulse

Thanks Curt and Robert! You guys really helped clear things up for me.

You guys rock!

I really appreciate all of your help.  :)
Cheers,
Micky

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



Re: [PHP] Re: IE6 not returning POST data from a textarea

2005-12-12 Thread Michael Hulse

For those interested, here is the answer...

Text pasted into a textarea [e.g., from Word] can have characters not 
defined in IE's textarea ISO-8859-1 charset.


Appearently, IE6 has a bug such that it does not send the POST value 
for the textarea name when some of these are present.  [e.g., … char 
[hex 85]] I don't know how many.


You can get it to work by right-mouse selecting Encoding UTF-8 on the 
client browser or use in the html header:

meta http-equiv=Content-Type content=text/html;charset=utf-8 


Sometimes I use BBEDIT and turn-on Show Invisibles... that usually 
catches any odd character. Then I save the file with unix line 
endings... Seems to work really well.


I am glad you got it figured out.

Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] need for $_POST[''] changed after server upgrade

2005-12-12 Thread Michael Hulse

On Dec 12, 2005, at 8:21 PM, Ray wrote:

Hello,
Thanks Matt, I appreciate your help. your solution is a lot easier 
than mine.
It's also nice to understand what was happening. I was introduced to 
PHP

after that type of globals were considered 'evil' so I hadn't seen code
written that way.
Ray
-Original Message-

Register globals is no longer ON I believe. That is why it happened.

To fix this:

Foreach($_POST as $key = $value) ${$key} = $value;

That will convert all of your post variables to local variables.


Could not you also do:

?php
if (count($_REQUEST)  0) {
while(list ($key, $val) = each ($_REQUEST)) {
$$key = $val;
}
}
?

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



Re: [PHP] need for $_POST[''] changed after server upgrade

2005-12-12 Thread Michael Hulse

On Dec 12, 2005, at 9:26 PM, [EMAIL PROTECTED] wrote:

The only problem I see with this is now you are asking php to issue a
count on the $_REQUEST array, this could take some time depending on 
your

form size.


Ah, very good point... did not think of that.  :)

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



Re: [PHP] PHP, MySQL and XML for IPodCasting

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 3:45 AM, Danny wrote:

How to proceed


I recently set-up my first Podcast... Every week I have a script that  
grabs three MP3 files from a remote server and puts them on my own  
server... Then I have another script that generates the Podcast XML.


I am using CRON jobs to do all the work for me... all I have to do is  
open iTunes and everything starts downloading automatically is  
nice.


The way I generate my XML is via output buffering and a simple  
text-file template. Here is my template (template.txt):


?xml version=1.0?
rss version=2.0
channel
titlePut your title here [{_dateCheck_}]/title
	linkLink to your site/the page that explains what this podcast is  
all about./link
	descriptionThis is the description... it will show-up in iTunes...  
yadda yadda.../description

languageen-us/language
copyrightCopyright Info/copyright
lastBuildDate{_dateLong_}/lastBuildDate
webMasterYour name here/webMaster
ttl1/ttl
item
		titleName of MP3 podcast - Hour 01, {_dateCheck_},  
{_dateSlashes_}/title
		descriptionHour 01 ({_dateSlashes_}) of this particular  
podcast./description

pubDate{_dateLong_}/pubDate
		enclosure  
url=http://www.yoursite.com/location_of_podcast_mp3/mp3_name- 
{_dateShort_}.mp3 length=10800040 type=audio/mpeg/

guid isPermaLink=false{_randNumOne_}/guid
/item
item
		titleName of MP3 podcast - Hour 02, {_dateCheck_},  
{_dateSlashes_}/title
		descriptionHour 02 ({_dateSlashes_}) of this particular  
podcast./description

pubDate{_dateLong_}/pubDate
		enclosure  
url=http://www.yoursite.com/location_of_podcast_mp3/mp3_name- 
{_dateShort_}.mp3 length=10800040 type=audio/mpeg/

guid isPermaLink=false{_randNumTwo_}/guid
/item
item
		titleName of MP3 podcast - Hour 03, {_dateCheck_},  
{_dateSlashes_}/title
		descriptionHour 03 ({_dateSlashes_}) of this particular  
podcast./description

pubDate{_dateLong_}/pubDate
		enclosure  
url=http://www.yoursite.com/location_of_podcast_mp3/mp3_name- 
{_dateShort_}.mp3 length=10800040 type=audio/mpeg/

guid isPermaLink=false{_randNumThree_}/guid
/item
/channel
/rss

Here is my PHP (pod.php):

?php

# Error checking:
if((isset($_REQUEST['pass']))  ($_REQUEST['pass'] === 'let_me_in')   
(!empty($_REQUEST['pass']))) {


# Begin date:
$date_long = date('r'); // Example output: Mon, 21 Nov 2005 05:20:18  
-0500

$date_short = date('mdy'); // Example output: 051121
$date_slashes = date('m/d/y'); // Example output: 11/21/05
$date_check = date('l');
#End date.

function randNumb() {
# Begin random # generation:
srand ((double) microtime( )*100);
$random_number = rand( );
return $random_number;
# End random # generation.
}

$rand_num_one = randNumb();
$rand_num_two = randNumb();
$rand_num_three = randNumb();


// HTML to be written:
ob_start();

readfile($_SERVER['DOCUMENT_ROOT'].'/template.txt');

$contents = ob_get_clean();
@ob_end_clean();

$contents = str_replace('{_dateLong_}',$date_long, $contents);
$contents = str_replace('{_dateSlashes_}',$date_slashes, $contents);
$contents = str_replace('{_dateShort_}',$date_short, $contents);
$contents = str_replace('{_randNumOne_}',$rand_num_one, $contents);
$contents = str_replace('{_randNumTwo_}',$rand_num_two, $contents);
$contents = str_replace('{_randNumThree_}',$rand_num_three, $contents);
$contents = str_replace('{_dateCheck_}',$date_check, $contents);

# Now open the file and write contents of template:
$fp =  
fopen($_SERVER['DOCUMENT_ROOT'].'/ 
path_to_place_where_you_store_the_xml_file/ 
xml_file_name'.$date_check.'.xml','wb'); // Open for writing only; If  
the file does not exist, attempt to create it.

fwrite($fp, $contents);
fclose($fp);

} else { echo h1Please Leave Now!/h1; }

?

I then use a cron to run the above script every week, like so:

GET http://www.your_site.com/pod.php?pass=let_me_in  /dev/null

Or, instead of using the CRON, you can just got to the script via your  
browser like so:


http://www.your_site.com/pod.php?pass=let_me_in

And the XML file will generate itself.

Please keep in mind, I quickly slapped this script together... It gets  
the job done for me... I am sure there are way better ways to do what I  
am doing... also, the XML template could be more robust (more meta-tags  
maybe?)... the PHP script could probably use something other than  
output buffering... If anyone has ideas/thoughts/suggestions for  
improvements please let me know.


HTH,
Cheers,
Micky
--
BCC for Privacy: http://www.cs.rutgers.edu/~watrous/bcc-for-privacy.html
My del.icio.us: http://del.icio.us/mhulse

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



Re: [PHP] PHP, MySQL and XML for IPodCasting

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 1:45 PM, Danny wrote:

Simply Fantastic!. Thanks a lot!


Sure thing, I am glad that I was able to help/give you some ideas.  :)

So for me the best solution I think, would be to read the MySQL Table, 
and produce the XML with a given template from a PHP Script. I will 
use Scheduled Task instead of CRON... (Sorry, working on windows ;-))


That sounds like the perfect solution!  :D

[Off topic] Could it be tested without an IPod device? I´ve been 
googling around, but I don´t know much about those devices, and 
IPodCasters simulators for PC


Great question!  :)

[Double OT:] Podcast/Podcasting, IMHO, is about the worst name the 
founders could have given this technology... To me, POD sounds like a 
proprietary APPLE technology/product - maybe only to be used with an 
iPod? When, in all actuality, Podcasts/Podcasting can be used/played by 
many different apps on many different platforms - and no need for an 
iPod! Also, it is not restricted to iPods, I think just about any 
contemporary MP3 player can import Podcasts... Well, that is my two 
cents on this OT subject.   :) [/Double OT]


To answer your question:

iPodder (PC) is probably what you are looking for:

http://www.ipodder.org/

Here is a nice tutorial on how to download streams:

http://www.jakeludington.com/archives/000406.html

I am sure that the latest/next version of Windows Media Player will 
probably let you download Podcasts... Not too sure though, I am on a 
Mac.


A few notes:

-- What is Podcasting?
Podcasting (iPod + broadcasting) is a new kind of radio for your 
computer and/or MP3 player. Podcasting allows you to save and listen to 
your favorite radio programs when and where you want.


-- How Podcasting works.
A broadcaster makes digital audio files available on the Internet. 
Listeners subscribe to these programs using podcasting software. The 
listener's computer automatically downloads the audio files, which can 
then be listened to on the computer or transferred to a portable MP3 
audio player.


-- How do you get started?
In order to receive podcasts you need a computer, an Internet 
connection, and podcasting software. To take a podcast with you, an 
iPod or any portable MP3 player is also needed. The podcasting software 
includes programs that allow your computer to automatically receive 
audio files of specified broadcast programs over the Internet. Then you 
can either listen to the programs on your computer or have them 
downloaded to your portable audio player.


Hope that helps!
Good luck,
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] how to pass an array to Java script

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 8:30 PM, Johny John wrote:

Hi,
 How to pass an array (from php )  to java script and display 
it

using javascript?...

Jasus.


Well,

FWIK, Here is how you pass a variable:

script type=text/javascript language=javascript
?php echo var picUrl = '$picUrl';\n; ?
document.write(picUrl);
/script

So, if you know how to instantiate an array in JS, just do a PHP loop 
where you pull contents out of the PHP array an put into the JS 
array... then you can do whatever you want with the array later in your 
JS script... AFAIK.


Hth,
Cheers,
Micky

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



Re: [PHP] simple-ish question but something i never knew

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 11:07 PM, matt VanDeWalle wrote:
I am wanting to forward a user on a signup or similar page (based on a 
few of their answers) and so far i have it split into  basically a 
two-step process where i have on the first part, an option list with 4 
choices, they hit continue or some such labled link, and then having 
passed all the session variables and making the decision in the next 
script it would forward them to the right page automatically, do I 
have to use meta tags to do this  or is there  some simple way e.g, 
url=http://rightpage.php?SID; of course without the 's except for in 
the actual url


Well, off the top of my head, you could have your next script do some 
checking (if/switch statement) and then use a header-redirect that 
would be based-upon one of the four user choices?


[PAGE 01] --- [NEXT SCRIPT] (what did user choose? Using $_REQUEST) 
--- header refresh --- ([URL 01] || [URL 02] || [URL 03] ||  ) 
--- [URL --]


Just point your form to the script that does the checking, and then use:

header(Refresh: 0; URL=http://www.yourDomain.com/index.php?page=$var;);

Does that make sense?

Of course, how you do the refresh all depends on how your site is 
setup...


I am sure there are better ways though...   :)

Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple-ish question but something i never knew

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 11:35 PM, Aaron Koning wrote:
I have found that using the header function doesn't actually redirect 
the
page, it pulls the content into the page that the function is called 
from
(which works good for somethings, but can get confusing with post 
variables

and such). Its been my experience that meta tags work better.


Ah, good point... would it be possible for you to give us an example?

Thanks  :)
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] simple-ish question but something i never knew

2005-12-09 Thread Michael Hulse

On Dec 9, 2005, at 11:35 PM, Aaron Koning wrote:

Its been my experience that meta tags work better.


I guess what you are saying is that this:

meta http-equiv=refresh 
content=0;url=https://www.theNewUrl/forward.html;


Is better than this:

header(Refresh: 0; URL=https://www.theNewUrl/forward.html;);

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



Re: [PHP] QUERY_STRING Variables and POST

2005-12-08 Thread Michael Hulse

On Dec 8, 2005, at 2:46 PM, Michael B Allen wrote:

I'm using the POST method but I would also like to access QUERY_STRING
parameters. Is there a convienient global array for these? If not,
what is the definitive method for accessing them?


Not sure if this script will help, but you can point your form to it 
and get back some useful info:


?php
if (count($_REQUEST)  0) {
echo 'Post '.count($_REQUEST).Variablesbr /\n;
while (list ($key, $val) = each ($_REQUEST)) {
$$key = $val;
if(is_array($$key)) {
			for($a=0;$acount($$key);$a++) echo $key.[.$a.] = 
\.$val[$a].\br /\n;

} else { print $key = \$val\br /\n; }
}
}
?

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



[PHP] Classes/Objects - Books/Links?

2005-12-06 Thread Michael Hulse

Hello,

I want to learn about classes and objects in PHP.

(IMHO) I would say that my understanding of functions is very good.

Any books that you could suggest that specifically address just 
classes/objects?


How-a-bout sites/links/tutorials on the web?

I am hoping that by learning how to use classes/objects in PHP I can 
streamline how I code.


Thanks in advance!
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸¸º¸.·´¯`·.¸¸º
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] What software do you use for writing PHP?

2005-12-06 Thread Michael Hulse

On Dec 6, 2005, at 6:38 PM, Curt Zirzow wrote:

On Tue, Dec 06, 2005 at 06:36:33PM +0100, M. Sokolewicz wrote:

Jason Petersen wrote:

On 12/6/05, Jeff McKeon [EMAIL PROTECTED] wrote:


Hey all,

Forever now I've been using Frontpage for all my web work including 
php.

I'm sure there's better software out there that is more suited to
writing and editing PHP pages.  What do you all use?




Vim is my editor of preference.  If I have to use Windows, I usually 
go

with
Homesite (because I already have a licensed copy) or Textpad 
(because it's

better than Notepad).

IDEs?  Who needs 'em ;)

Best,
Jason

same here :)
Vim on UNIX machines, and Textpad on Windows


Shot... BBEdit[1]  Dreamweaver[2] on a Mac[3] baby!

[1]http://www.barebones.com/products/bbedit/index.shtml
[2]http://www.macromedia.com/software/dreamweaver/
[3]http://www.apple.com/

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



Re: [PHP] Classes/Objects - Books/Links?

2005-12-06 Thread Michael Hulse

On Dec 6, 2005, at 6:39 PM, Chris Shiflett wrote:
Adam Trachtenberg's Upgrading to PHP 5 (O'Reilly) is a good book. It 
covers all of the new features in PHP 5 (so it's not just OOP, sorry), 
but the chapter on objects is excellent.


Hi Chris, thanks for the quick response.  :) That book sounds good to 
me... O'Reilly books always give me the most bang for my buck.


Thanks!  :)

Cheers,
Micky

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



Re: [PHP] What software do you use for writing PHP?

2005-12-06 Thread Michael Hulse

On Dec 6, 2005, at 9:25 AM, Mark Steudel wrote:
I primarily code in Dreamweaver 8. Two of my favorite features that 
were

added from MX are as follows:
1. Code folding, basically you can collapse blocks of code. If you 
have to
work with other peoples code, matching braces and code folding is an 
awesome
way of just seeing the logical flow of the code, and hide all the 
details.
DW 8 code folding is great because you can select any amount of code  
and

collapse it. The bummer about dreamweaver is that it doesn't detect
functions and add a collapse handle to it like Zend Studio, or have the
default to automatically collapse functions when you open a page like 
Zend

Studio.


Sah-wt! I have yet to upgrade. Waiting to get a new puter.  :)

Code-folding sound fricken cool!

I am pretty stoked that they finally fixed the crappy built-in ftp. 
But, can you set permissions?


I wonder if there is a plugin for DW8 that will detect functions? Me = 
googling.


M

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



[PHP] Security/$_REQUEST vars... How do you do it?

2005-12-03 Thread Michael Hulse

Hello,

This is my first time posting to the list... I hope this question is 
not too silly, I am definitely not a guru at PHP.


Anyway, in one of my latest projects, I find myself using this bit of 
code quite a bit:


if((isset($_REQUEST['sub']))  (!empty($_REQUEST['sub']))) {
... code here...
}

Can I write a function that would make my life easier? Maybe something 
like this (not tested):


 function security_check():
function security_check($x) {
$error = false;
if((isset($x))  (!empty($x))) {
$error = false;
return $error;
} else {
$error = true;
return $error;
}
}

Or, is it perfectly valid and secure to use @, like so:

@... code here...

I know that it completely depends on the what one is trying to 
accomplish in ones scripts, but any guidance and/or suggestions would 
be greatly appreciated.


Thanks, I really appreciate your time.
Cheers,
Micky
--
¸.·´¯`·.¸¸(((º`·.¸¸.·´¯`·.¸¸º
·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸.·´¯`·.¸¸º
`·.¸º¸.·´¯`·.¸¸º

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



Re: [PHP] Security/$_REQUEST vars... How do you do it?

2005-12-03 Thread Michael Hulse

Hi Comex, thanks for the quick response, I really appreciate it.  :)

On Dec 3, 2005, at 3:29 PM, comex wrote:

empty is a language construct, not a function, so that is not 
necessary.  You can just do !empty(...).


Oh, do you mean that I should do this instead:

if((isset($_REQUEST['sub']))  !empty($_REQUEST['sub'])) {


You could return false or return true, or simply return !empty($x);


Ahhh, great point!

However, that doesn't actually work ... and could cause a notice if it 
isn't; and $x will always be defined, even if set to null.


Yes, I actually just realized this via testing/experimenting...  :(

Since your variables are coming from REQUEST anyway, you could write 
it like this:

function security_check($x) {
 return !empty($_REQUEST[$x]);
}
Then, if(!security_check('sub')) { ... }


Ah, great idea, thanks! You have been very helpful, thanks.   :D

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