NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page my first php code!

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 06-16-2008, 07:27 PM THREAD STARTER               #1 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue

my first php code!


I created a php code! I made a guestbook. Rather than find a guestbook code and figure it out, I decided to read some tutorials and make my own. I did it and it works and I now have my own guestbook!

I'm confident in learning php now.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-16-2008, 07:31 PM   #2 (permalink)
Account Suspended
Join Date: May 2003
Posts: 2,386
Hurley4540 is a splendid one to beholdHurley4540 is a splendid one to beholdHurley4540 is a splendid one to beholdHurley4540 is a splendid one to beholdHurley4540 is a splendid one to beholdHurley4540 is a splendid one to beholdHurley4540 is a splendid one to behold
 



Nice, more than I can make
Hurley4540 is offline  
Old 06-16-2008, 07:31 PM   #3 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
where did you place it? can we see the code?
__________________
Nabaza.com - Amaia
weblord is offline  
Old 06-16-2008, 07:41 PM THREAD STARTER               #4 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by weblord
where did you place it? can we see the code?
I placed it on my homepage.
????: NamePros.com http://www.namepros.com/programming/482541-my-first-php-code.html

http://yilduz.com/contact.php#guestbook

It's not the best in the world, it's only very, very basic. I'm going to improve it eventually, but I just started reading php tutorials yesterday. I think it's good for a day of learning.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-16-2008, 07:52 PM   #5 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
looks good
__________________
Nabaza.com - Amaia
weblord is offline  
Old 06-16-2008, 07:54 PM THREAD STARTER               #6 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by weblord
looks good
Thank you!

I've been working very hard to get the html, javascript, css, php and mysql all work together. I think I'll get the hang of it soon.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-16-2008, 07:58 PM   #7 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
finally paid off.

Originally Posted by yilduz
Thank you!

I've been working very hard to get the html, javascript, css, php and mysql all work together. I think I'll get the hang of it soon.
__________________
Nabaza.com - Amaia
weblord is offline  
Old 06-16-2008, 08:34 PM   #8 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by yilduz
I placed it on my homepage.
????: NamePros.com http://www.namepros.com/showthread.php?t=482541

http://yilduz.com/contact.php#guestbook

It's not the best in the world, it's only very, very basic. I'm going to improve it eventually, but I just started reading php tutorials yesterday. I think it's good for a day of learning.
Not a bad start, but tip - www.php.net/empty

I was able to submit a blank entry
Eric is offline  
Old 06-16-2008, 08:37 PM THREAD STARTER               #9 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by SecondVersion
Not a bad start, but tip - www.php.net/empty
????: NamePros.com http://www.namepros.com/showthread.php?t=482541

I was able to submit a blank entry
Ah, thank you.

That's one of the reasons I've been posting it. I'm ALWAYS looking for more tips, help, ideas, etc...

thank you. I'll look at it and make the appropriate edits.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-16-2008, 09:29 PM   #10 (permalink)
NamePros Regular
 
wikes82's Avatar
Join Date: Sep 2006
Location: K-R.NET
Posts: 902
wikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud of
 


Save a Life Cancer
hmm, you need to filter HTML tag in input...
http://en.wikipedia.org/wiki/Cross-site_scripting

hint: http://us.php.net/strip_tags
wikes82 is offline  
Old 06-17-2008, 01:03 AM   #11 (permalink)
i love automation
 
xrvel's Avatar
Join Date: Nov 2007
Location: xrvel.com
Posts: 1,620
xrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant futurexrvel has a brilliant future
 




Who put an alert box there? I prefer htmlentities than stripping tags, btw.
__________________
xrvel is offline  
Old 06-17-2008, 01:44 AM   #12 (permalink)
NamePros Regular
 
wikes82's Avatar
Join Date: Sep 2006
Location: K-R.NET
Posts: 902
wikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud ofwikes82 has much to be proud of
 


Save a Life Cancer
Originally Posted by xrvel
Who put an alert box there?
sorry, I just can't resist ... i did it...
wikes82 is offline  
Old 06-17-2008, 02:25 AM   #13 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




Well done, it's good for a first start. I learned PHP by making an image hosting script, followed by an arcade script.
Barrucadu is offline  
Old 06-17-2008, 02:51 AM   #14 (permalink)
NamePros Regular
 
Mujahid's Avatar
Join Date: Apr 2007
Location: Pakistan
Posts: 450
Mujahid has a spectacular aura aboutMujahid has a spectacular aura about
 




I`m also learning php these days. I also know C/C++ so its becoming easy for me to learn php. I`ve left a comment on your guestbook as well.
__________________
ePaisa.PK | Earn Money Online from Pakistan
peepri | Articles,Columns, News & Information
I'm a freelance PHP WEB DEVELOPER | PM me if you need some work
Mujahid is offline  
Old 06-17-2008, 02:52 AM   #15 (permalink)
Senior Member
 
Smiler's Avatar
Join Date: Jul 2007
Posts: 1,360
Smiler is a splendid one to beholdSmiler is a splendid one to beholdSmiler is a splendid one to beholdSmiler is a splendid one to beholdSmiler is a splendid one to beholdSmiler is a splendid one to beholdSmiler is a splendid one to behold
 



Where can you get some good practice and tutorial for php coding. I know HTML but I'm hoping to learn php codes in the near future. I've been reading about php and I've learn that its a very dynamic code which is really cool IMO.
Smiler is offline  
Old 06-17-2008, 06:47 AM THREAD STARTER               #16 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by Smiler
Where can you get some good practice and tutorial for php coding. I know HTML but I'm hoping to learn php codes in the near future. I've been reading about php and I've learn that its a very dynamic code which is really cool IMO.
When I coded my guestbook, I was actually looking at several tutorials. I'd google for tutorials and look at a few, when they all did something similar and had the same bit of code, i knew that's what did it. I've noticed that many, many php tutorials are horribly non-descriptive. Most just show a working code and say what the entire thing does. Not really a tutorial, if you ask me. Maybe I'll write some when I learn a bit more.
????: NamePros.com http://www.namepros.com/showthread.php?t=482541
________________
As soon as I saw that little wazzup box pop up, I knew you guys were doing more stuff to see what I did wrong.
Thank you, though. I'll look at what you guys have shown me and learn a bit more.

Thanks for the comments and the help.

Quote:
Well done, it's good for a first start. I learned PHP by making an image hosting script, followed by an arcade script.
As soon as I get the guestbook good, project 2 is going to be a text-based game.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-17-2008, 01:57 PM THREAD STARTER               #17 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
I've been looking around those links you guys gave me. I think it's good now.

Anyone want to check it for me?
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-17-2008, 07:09 PM   #18 (permalink)
NamePros Regular
 
thebrokenbox's Avatar
Join Date: May 2008
Location: USA
Posts: 609
thebrokenbox is a jewel in the roughthebrokenbox is a jewel in the roughthebrokenbox is a jewel in the rough
 



Still has annoying javascript popups. It's a nice little script and stuff. Now work on adding anti-spam measures and that whole blank and html issues. Other then that great job. I need to get back into PHP
__________________
Learn how to make the most from Points2Shop
Sig Link Available- Only 50NP$/month. PM me.
thebrokenbox is offline  
Old 06-17-2008, 08:08 PM THREAD STARTER               #19 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by thebrokenbox
Still has annoying javascript popups. It's a nice little script and stuff. Now work on adding anti-spam measures and that whole blank and html issues. Other then that great job. I need to get back into PHP
I think I eliminated those problems. The boxes were already put there from other people. i'll get rid of them. See if you can still add that stuff.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-17-2008, 08:36 PM   #20 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Pulled this from one of my projects, try this:

PHP Code:
/**
* Strip any unsafe tags/chars/attributes from input values.
*
* @param  string  Value to be cleaned
* @param  boolean Strip \r\n ?
* @return string
*/
function sanitize($value$strip_crlf true)
{
    
// Some of what we have in the $search array may not be needed, but let's be safe.
    
$search = array(
        
'@<script[^>]*?>.*?</script>@si',
        
'@<applet[^>]*?>.*?</applet>@si',
        
'@<object[^>]*?>.*?</object>@si',
????: NamePros.com http://www.namepros.com/showthread.php?t=482541
        
'@<iframe[^>]*?>.*?</iframe>@si',
        
'@<style[^>]*?>.*?</style>@si',
        
'@<form[^>]*?>.*?</form>@si',
        
'@<[\/\!]*?[^<>]*?>@si',
        
'@&(?!(#[0-9]+|[a-z]+);)@si'
    
);

    if (
$strip_crlf)
    {
        
array_push($search'@([\r\n])[\s]+@');
    }
    
$value preg_replace($search''$value);
????: NamePros.com http://www.namepros.com/showthread.php?t=482541

    
// Make sure we get everything..
    
$value strip_tags($value);

    return 
clean($value);
}

/**
* Cleans either a string, or can clean an entire array of values:
*    clean($array);
*
* @param  mixed  Value to be cleaned
* @return mixed
*/
function clean($value)
{
    if (
is_array($value))
    {
        foreach (
$value AS $key => $val)
        {
            if (
is_string($val))
            {
                
$value["$key"] = trim(stripslashes($val));
            }
            else if (
is_array($val))
            {
                
$value["$key"] = clean($value["$key"]);
            }
        }
        return 
$value;
    }
    return 
trim(stripslashes($value));

Example:

PHP Code:
$name sanitize($_POST['name']); 
Eric is offline  
Old 06-20-2008, 10:33 AM   #21 (permalink)
Senior Member
 
-Ray-'s Avatar
Join Date: Jun 2005
Location: Pennsylvania
Posts: 1,839
-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of-Ray- has much to be proud of
 



Originally Posted by yilduz
I created a php code! I made a guestbook. Rather than find a guestbook code and figure it out, I decided to read some tutorials and make my own. I did it and it works and I now have my own guestbook!
????: NamePros.com http://www.namepros.com/showthread.php?t=482541

I'm confident in learning php now.
yep.. ive been working with php for 5 years off and on.. i dont use it extensivivly, but rather just for my little projects.
__________________
Poker News, articles, discussion
LIKE THIS

Its an iPod, a phone, and an internet communications device.
-Ray- is offline  
Old 06-25-2008, 05:26 AM   #22 (permalink)
Account Closed
Join Date: Jun 2008
Posts: 156
itnashvillecom has a spectacular aura aboutitnashvillecom has a spectacular aura about
 



Very nice, great job!!
itnashvillecom is offline  
Old 06-27-2008, 11:40 AM   #23 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Couldn't hurt to run mysql_real_escape_string() on all the input put into the database, either.
mholt is offline  
Old 06-27-2008, 08:24 PM THREAD STARTER               #24 (permalink)
Your face is regfee!
 
yilduz's Avatar
Join Date: May 2008
Location: Oregon
Posts: 1,075
yilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to beholdyilduz is a splendid one to behold
 



Animal Rescue
Originally Posted by mholt
Couldn't hurt to run mysql_real_escape_string() on all the input put into the database, either.
I'm not sure what that is, but I'll look it up. Thank you for the tip.
__________________
Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year.
My homepage | I miss my dog - Athena
yilduz is offline  
Old 06-27-2008, 11:50 PM   #25 (permalink)
DNOA Member
Join Date: May 2004
Posts: 5,040
mholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant futuremholt has a brilliant future
 


Autism Marrow Donor Program 9/11/01 :: Never Forget Multiple Sclerosis Adoption Alzheimer's Lou Gehrig's Disease (ALS)
Originally Posted by yilduz
I'm not sure what that is, but I'll look it up. Thank you for the tip.
Sure - basically, it prevents people from doing an SQL injection attack against your database.
mholt is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 01:31 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger