Beruflich Dokumente
Kultur Dokumente
More Searches
● MORE
Related Collections
● corey's greats
A LIST BY: wife cook
● My Dish
A LIST BY: Joan
● MORE
Free Membership
● Become a Member!
● Manage Newsletters
Products
● Create-A-Cookbook
● Cookbooks
● Magazines
● Shop
● Entertaining
● Specialty Foods
● Sale Items
20
PREP TIME
Min
15
COOK TIME
Min
35
READY IN
Min
SERVINGS & SCALING
Original recipe yield: 4 servings
US METRIC
4
Change
About
scaling
and
conversions
INGREDIENTS
● 2 teaspoons garlic powder, or to taste
● 1 teaspoon ground black pepper
● 1 teaspoon salt
● 1 teaspoon paprika
● 1/2 cup seasoned bread crumbs
● 1 cup all-purpose flour
● 1/2 cup milk
● 1 egg
● 4 skinless, boneless chicken breast halves - pounded thin
● 1 cup oil for frying, or as needed
● Create a Menu
DIRECTIONS
1. In a shallow dish, mix together the garlic powder, pepper, salt, paprika, bread crumbs and flour. In a
separate dish, whisk together the milk and egg.
2. Heat the oil in an electric skillet set to 350 degrees F (175 degrees C). Dip the chicken into the egg and milk,
then dredge in the dry ingredients until evenly coated.
3. Fry chicken in the hot oil for about 5 minutes per side, or until the chicken is cooked through and juices run
clear. Remove from the oil with a slotted spatula, and serve.
Editor's Note
We have determined the nutritional value of oil for frying based on a retention value of 10% after cooking. The
exact amount may vary depending on cook time and temperature, ingredient density, and the specific type of
oil used.
Wine Tip
ADVERTISE WITH US
ADVERTISEMENT
REVIEWS
MORE MEMBER REVIEWS
My chicken didn't turn out well the first time I attempted to use the recipe as
posted. I used chicken drumsticks, not breasts, and it took forever the inside of
the chicken to cook while the outside coating became rubbery. So having been
raised a good portion of my childhood in Kentucky I remembered that mamy
people boiled the chicken first (not all the way cooked) before coating and
frying. This allows for way less cooking time in the skillet and the for the coating
to be crispy, not chewy. Also, a good way to get rid of that blood that comes
from the bone while frying (if not using the boil method)...soak the chicken in
ice and water with salt for about half an hour before cooking.
Want the most tender, moist fried chicken? Try marinating the chicken for at
least 4 hours (if not all day) in buttermilk. Out of this world - great to use
buttermilk when soaking raw onions for onion rings too. In order to cut down on
the actual frying time, I generally brown my chicken and then place it on a
broiler rack and bake it for 45 minutes in a 375 oven. The broiler rack allows
alot of the fat to drip off. Line the bottom with foil and spray the rack with Pam
before placing chicken pieces on top, clean up is a breeze. I too like a bit of dill
in my chicken coating and I use ordinary flour instead of bread crumbs. I also
add a generous portion of Lawry's salt, but you can also use Lemon Pepper if
you are watching your salt intake.
Hi! This is my original recipe & my signature dish and I wanted to say that this
recipe is not meant for bone-in chicken pieces. Use boneless chicken breasts,
pounded very thin. If you must use bone-in pieces, parboil them first (but I
would not recommend this). Also, I add tablespoons of garlic pwdr, not
teaspoons. Its all 'to taste'! (:
ADVERTISE WITH US
ADVERTISEMENT
Quick Links
● My Recipe Box
● Shopping List
It's a new year. Update your profile and tell us more about you! START NOW
NUTRITION INFORMATION
Servings Per Recipe: 4
Amount Per Serving
Calories: 389
● Cholesterol: 123mg
● Sodium: 1070mg
● Protein: 32.8g
Allrecipes.com Contact Us Advertising Newsroom Jobs Licensing Shop Legal Privacy Site Map RSS Feeds Customer
Support
Magazines: Taste of Home Every Day with Rachael Ray Reader’s Digest
Introduction:
Welcome to part 2 of the Practical Programming in PHP series. Today, I will show you how you
can use php's file handling functions to create a web site hit counter. The script should be
compatible with PHP 3 and 4. I will be running the script on a server which has a variant of Unix
installed (most servers do).
Background:
The script that we will create will—when called—open a file, read the value of the file, increment
the value by one, and then write that value to the file. We're going to put the actual code inside
a function so that way you can call the script on your page with only one line of code.
Down To Work:
In order to open a file in php, we need to call the function fopen(). This will open the file, if it
exists, and return a file pointer. Don't worry too much on what a file pointer is, think of it as an
alias for the file. Instead of using the file name, you pass a file pointer to functions. Here is the
beginning of our code:
<?php
function count_hit()
First, we declared a function by using the keyword function followed by the name of our
function. Next, we used fopen() passing the name of a file in the same directory as the script
where the hits will be stored as the first parameter; we then passed r+ as the second
parameter, this tells the server that we want to open the hits.txt file for reading and writing. You
can also pass any one of the following:
r Open the file for reading, place the file pointer at the beginning of the file.
Open the file for writing, place the file pointer at the beginning of the file, create the file if
w
it doesn't exist, and set the file to zero length.
Open the file for reading and writing, place the file pointer at the beginning of the file,
w+
create the file if it doesn't exist, and set the file to zero length.
file:///G|/1000 Tutorials computer tricks and tweeks/Tutori...sun.box.sk/coding/Creating A Simple Hit Counter In PHP.html (1 of 5)1/13/2008 12:03:39 PM
Creating A Simple Hit Counter In PHP
Open for writing only; place the file pointer at the end of the file. If the file does not exist,
a
attempt to create it.
Open for reading and writing; place the file pointer at the end of the file. If the file does
a+
not exist, attempt to create it.
b Open the file in binary mode, if not needed, this will be ignored.
fopen() can take one more parameter: 1. If you pass the third parameter as 1, the file you
passed the name of in the first parameter will be searched for in the include path. The include
path is specified when php if first installed on the server, most of the time you won't have
control over it. We store the result of fopen() in a variable named $file_pointer. If the file does
not exist, fopen() will return false; we need to test for that.
if ($file_pointer == false)
return "Error: could not open the file! It may not exist!";
exit;
I used a return instead of an echo because we are in a function, and it's not always a good idea
to use echo.
Now that the file is open, we need to read from it, to do that we use the fread() function.
For fread() we pass the file pointer along with the size of the file. To get the size of the file we
use the filesize() function. Now the contents of the file are stored in a variable with the name
$hits. This next part is optional, but you should do it because you never really know what kind
of extra junk might also get read into the variable. We will use the trim() function to strip any
whitespace from the beginning and ending of the string.
$hits= trim($hits);
See that's not too bad, and well worth the effort. Now that we have read the contents of the file
into a variable and cleaned up the variable, we will increment it by 1, and write it back into the
file. Before we write to the file, we need to go back to the begining of the file so we can write
over the current count. We do this by using fseek(), thanks to Mateusz Pabis for pointing that
out.
file:///G|/1000 Tutorials computer tricks and tweeks/Tutori...sun.box.sk/coding/Creating A Simple Hit Counter In PHP.html (2 of 5)1/13/2008 12:03:39 PM
Creating A Simple Hit Counter In PHP
$hits++;
fseek($file_pointer, 0);
if ($result == false)
exit;
else {
return $hits;
We use the increment operator (++) to add one to the hit count, then we use fwrite to write to
the file. We then pass the file pointer and the hit count to fwrite(), then there is some error
checking, you don't have to include it, but it is always a good idea. Lastly, we return the value of
$hits, which holds the hit count, so that you can display the hits on a webpage by doing:
Only one more thing left to do: close the file. To do that we use fclose() and pass it the file
pointer, oh and can't forget the error checking =)
$close= fclose($file_pointer);
if ($close == false)
exit;
file:///G|/1000 Tutorials computer tricks and tweeks/Tutori...sun.box.sk/coding/Creating A Simple Hit Counter In PHP.html (3 of 5)1/13/2008 12:03:39 PM
Creating A Simple Hit Counter In PHP
<?php
function count_hit()
if ($file_pointer == false)
return "Error: could not open the file! It may not exist!";
exit;
$hits= trim($hits);
$hits++;
fseek($file_pointer, 0);
if ($result == false)
exit;
file:///G|/1000 Tutorials computer tricks and tweeks/Tutori...sun.box.sk/coding/Creating A Simple Hit Counter In PHP.html (4 of 5)1/13/2008 12:03:39 PM
Creating A Simple Hit Counter In PHP
else {
return $hits;
$close= fclose($file_pointer);
if ($close == false)
exit;
?>
Conclusion:
Well that wraps up part 2 of the Practical Programming series. I hope you learned how to
manipulate files in php. If you found any errors or have any comments please e-mail me
(spiderman@witty.com), kindly direct questions to the message board.
file:///G|/1000 Tutorials computer tricks and tweeks/Tutori...sun.box.sk/coding/Creating A Simple Hit Counter In PHP.html (5 of 5)1/13/2008 12:03:39 PM
Bare Bones IRC Bot In Perl - by b0iler
This is a short guide to creating your own perl bot which will work on irc. I will not cover all the
different modules and ways to connect to irc and issue commands. This will only cover connecting with
IO::Socket and using raw irc commands. I feel you learn the most this way and have alot of control over
what is happening.
IRC experience is helpful, but I'll take things slow enough so that an absolute beginner can understand
what is taking place. This will also help those with alittle knowledge fully understand the irc protocol.
Although I am no irc expert, after creating this bot I did learn a few tricks.
#!/usr/bin/perl
use IO::Socket;
$sock = IO::Socket::INET->new(
PeerAddr => 'irc.undernet.org',
PeerPort => 6667,
Proto => 'tcp' ) or die "could not make the connection";
You can use any irc server and any port (commonly used ports are 6667-7000), so long as they are valid.
If you have problems try to find a different server on that network. To make things easier you can make
the PeerAddr a variable which is specified by an argument from the command line. Or purhaps map out
all the servers on the network and make an arry from them, connecting to random ones and using the
best connection. There are many possibilities, each work best for certain situations. We'll stick to the
simple hard coded address and port.
Now we have a connection to the server. We still need to get connected/logged in to the ircd. Anything
we send to or recieve from the server will go through $sock. So lets see what the server is sending us
after we make a connection.
while($line = <$sock>){
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (1 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
print "$line\n";
}
We will see that the server prints out some lines. Each line will have a number representation to it. This
will really help to tell the bot when to start and end routines. The key here is the line with 'NOTICE
AUTH' in it. This is when we need to login to the irc server. To do this we send
NICK bots_nick
USER bots_ident 0 0 :bots name
With a line break after the bots_nick and a line break at the end. So in the while loop we will add
something like this:
while($line = <$sock>){
print $line;
if($line =~ /(NOTICE AUTH).*(checking ident)/i){
print $sock "NICK b0ilersbot\nUSER bot 0 0 :just a bot
\n";
last;
}
}
Now we are done with the login process. If you are having any problems try to read up on the irc
protocol and how to login to it with telnet. Raven from www.securitywriters.org has wrote a decent
tutorial on the subject, look for it.
Some servers will ask for a ping to make sure the client is active. This is only done on some servers and
is a common pitfall to many bots which don't support this kind of login proceedure. To handle this we
will check if the server wants us to ping it. The server will ask for a ping before it asks about nickserv
registration/identification, so we will stop this loop after it mentions nickserv. This is what those
numbers in the last if statment are for, the 376|422. The way to identify to nickserv is like this
this is just a simple irc command. The command is 'NICKSERV' and the arguments are 'identify
nick_password' where nick_password is the actual password for this nick. The line ends in a line break
and all irc commands are in upper case. When there is a : before something it means it is a multiple word
argument (has spaces in it). This is how we will handle the possible ping and the nickserv identification.
while($line = <$sock>){
print $line;
#use next line if the server asks for a ping
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (2 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
if($line =~ /^PING/){
print $sock "PONG :" . (split(/ :/, $line))[1];
}
if($line =~ /(376|422)/i){
print $sock "NICKSERV :identify nick_password\n";
last;
}
}
If you want to have a registration code you can find this out on your own.. or do what I do and register
the nick with a normal irc client. This way we only need the bot to identify.
When you create your bot you can customize it however you want. Most of my bots have alittle bit more
AI then this tutorial shows. This bot will be pretty strait forword and doesn't make many decisions. It
just connects and does something.
I like to make the bot sleep for a few seconds just to get the connection cought up. I am on a 56k and
things can go slow sometimes. A few times without the sleep the bot has joined channels before the
nickserv identification is complete, this can be a pain in the neck if the bot needs a usermode or other
circumstances which require the nick to be identified (such as other bots, +R channel mode, or trust
issues with users).
After it sleeps it will join the channel. You will see that the server prints out alot of information about
the channel when you join. You can save this information in variables to allow the bot to make many
decisions. Again, this is a simple bot and won't be aware of it's environment or be dynamic in anyway.
But you could for example turn on/off colors by what channel modes are set or who is in the channel
(some people really hate colors). This is the last bit of the login proccess, after this the bot can actually
do something.
sleep 3;
print $sock "JOIN #channel\n";
Notice there is no : before #channel. This is because it does not have any spaces in it. And the JOIN
command is in all caps. For a full list of commands try reading a tutorial on the IRC protocol. I don't
even cover the basics here, there are tons of useful to know commands.
Now we are joining the channel. There is nothing else to do besides read the messages users send to the
channel and respond to them. But inorder to read the messages we need to parse them so they make
sense. The format of a priv_msg is as follows:
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (3 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
I like to seperate them into the following variables to make things easier to keep track of.
$nick = nick
$hostname = ident
$type = priv_msg
$channel = #channel
$text = the line of text
So we are going to need to parse what is send from the server into useable data. This is how we'll do it.
There is only one twist here, and that is incase the server sends a ping. They do this quite often to check
and see if you are still connected. If we don't reply the the pings then we will get disconnected. When
the server sends a ping you must reply with a PONG and the same characters the ping had. So this is
how we will send it
if ($command eq 'PING'){
#while there is a line break - many different ways to
do this
while ( (index($text,"\r") >= 0) || (index
($text,"\n") >= 0) ){ chop($text); }
print $sock "PONG $text\n";
next;
}
#done with ping handling
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (4 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
ok. That was a rather large chunk of code and some parts were rather confusing. Most of it is just getting
rid of what we don't want and seperating what we do want into variables. The next bit is just for looks.
We print out what is said as if this is a normal irc client.
if($channel eq '#channel'){
print "<$nick> $text";
}
The $channel check is needed incase people priv_msg or notice you things. This can be a problem when
dealing with bots which need to be secure or can cause large headaches when things go wrong. I'll leave
dealing with multiple channels to you. But to send Notices you simply do: print $sock "NOTICE nick :
the line of text here\n"; and to send a priv_msg you do: print $sock "PRIVMSG nick :the line of text here
\n";
Now the bot structure is done. Everything required is done, the only thing left to do is custimize your bot
to have it do what you want it to do. This can be almost any sort of task imaginable. Simply parse the
$text $nick and other variables we created to have the bot make decisions on what to do.
Here is the final bot in whole. I added one bit just to prove that the bot works:
#!/usr/bin/perl
use IO::Socket;
$sock = IO::Socket::INET->new(
PeerAddr => 'irc.undernet.org',
PeerPort => 6667,
Proto => 'tcp' ) or die "could not make the connection";
while($line = <$sock>){
print $line;
if($line =~ /(NOTICE AUTH).*(checking ident)/i){
print $sock "NICK b0ilersbot\nUSER bot 0 0 :just a bot
\n";
last;
}
}
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (5 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
while($line = <$sock>){
print $line;
#use next line if the server asks for a ping
if($line =~ /^PING/){
print $sock "PONG :" . (split(/ :/, $line))[1];
}
if($line =~ /(376|422)/i){
print $sock "NICKSERV :identify nick_password\n";
last;
}
}
sleep 3;
print $sock "JOIN #channel\n";
if ($command eq 'PING'){
#while there is a line break - many different ways to
do this
while ( (index($text,"\r") >= 0) || (index
($text,"\n") >= 0) ){ chop($text); }
print $sock "PONG $text\n";
next;
}
#done with ping handling
if($channel eq '#channel'){
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (6 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
Not very complicated once you look at each part of it. But finding out things for yourself is the real fun
of creating a bot. Much trial and error is involved in perfecting the bot, adding security and function can
be alot of fun. I would like to stress the security of irc bots. They are in the most hostile environment
known to the net and one security mistake and your bot could be used to execute commands on your
box. I have found 4 irc perl bots vulnerable to remote command execution, don't let me find yours
vulnerable aswell! Read all of the perl security related tutorials at http://b0iler.eyeonsecurity.net/
tutorials/ Don't let this discurage you from coding your own bot, it's a great learning experience and as
long as you are careful you should be fairly safe. I would love to hear what kind of bots you come up
with. The bots I have created include:
quote bot - a bot which has many features that deal with irc quotes. it reads off funny/witty things
people have said while chatting in my channels. It also has some more advanced features such as listing
off all the users in the channel who have a quote and an admin feature which allows me to add quotes
while the bot is running.
quiz bot - A bot which quizes the channel users. I used this while studying for networking. This bot is
great when the channel is dead or to start up a conversation with others. I learned alot from this bot.
poker bot - A bot which plays poker. I started to make a ucker (sp?) bot, but I lost motivation when the
other people who wantted to play quit going on irc.
channel bot - A bot which enforces the channel rules. it warns, kicks, and kick bans users for breaking
the rules. it voices,half ops, and ops identified users and keeps stats of channel activity. Good for
preventing channel takeovers.
The reason for creating this text was because I remember the stress I had finding info on this subject
when I first created the bot. I have since read a few crappy papers on irc bots, but nothing which would
be very helpful.
[-----]
http://b0iler.eyeonsecurity.net - is my homepage. - Come and check out the message board some
friends and I have started, many great disscussions to be had there. http://rawt.daemon.sh/wwwboard/
I got tons of tutorials, mini-tutorials, advisories, and code written by me there. Come check out what I'm
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (7 of 8)1/13/2008 12:05:23 PM
Bare Bones IRC Bot In Perl - by b0iler
[-----]
file:///G|/1000 Tutorials computer tricks and tweeks/Tutorials - blacksun.box.sk/coding/IRC Bot In Perl.html (8 of 8)1/13/2008 12:05:23 PM