TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 01-04-2008, 05:59 PM   #1 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default My first script ever , critisize !!

I DIDNT USE SECURITY FOR NOW
here is my first script ever
it is simple
NEWS SCRIPT or ARTICLES SCRIPT

i used php and html no ps or somehting to design it
it is a test to see if i can code a articles website
here is the link to check it => http://webtutotest.freehostia.com/news/home.php

and to enter to the admin control panel from here =>
username = 123
password = 123
http://webtutotest.freehostia.com/news/admin_cp.php

rate the programmation
any suggesions plz

u critisize me , u are my friend

Last edited by webtuto : 01-05-2008 at 12:21 PM.
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-04-2008, 06:41 PM   #2 (permalink)
The Wanderer
 
YouNeek's Avatar
 
Join Date: Jan 2008
Location: Herefordshire, United Kingdom
Posts: 9
Thanks: 1
YouNeek is on a distinguished road
Default

Hello there webtuto.

Apart from what is outputted to the front-end it is rather hard to review the script in to much depth. The lack of security is a rather large hole however in the general development as, without security, a script is a prime target for all sorts of attacks.

A few questions/advice about registration;
  1. A major flaw that often crops up in new registration scripts in the lack of user input validation - by this I mean the expectation that the user is going to put in exactly what you want them too. For instance, with the 'Email' field, what if they don't put in a real email that follows name@domain or put in something completely different altogether! It's very important to check that the input information is valid.
  2. It's always advisory to make sure your 'password' fields are set as type=password otherwise anyone looking over the shoulder knows exactly how to get in a make some havoc! Also users are much less willing to give passwords away to sites which don't hide them.
  3. It's very important to tell the user what to do and what's going on - once I registered I was sent back to the login screen; does this mean I was successful? Did the system crash? I have no idea! Make sure to update the user as to what's going on throughout.
  4. Database injections can be nasty stuff and without escaping your Db input alot you could be facing some major issues. Always make sure to addslashes() and if you don't want HTML outputting when you come to retrieve it use either strip_tags() or htmlentities() depending on the desired effect. Personally I go down the route of making a parsing class for all my Database Ins/Outs and $_GET's.

Just some small points that should hopefully help - generally it seems like a good work in progress so keep it up and if you want some further help post up some code and I'll take a look. (:
__________________
YouNeek - Bit of a nutty one!
HappySlapCulture | MadCoffeeHouse | LedburyRd | CoffeeBean
Send a message via MSN to YouNeek Send a message via Skype™ to YouNeek
YouNeek is offline  
Reply With Quote
The Following 2 Users Say Thank You to YouNeek For This Useful Post:
webtuto (01-04-2008), Wildhoney (01-11-2008)
Old 01-04-2008, 07:20 PM   #3 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

Your redirects didn't work for me unfortunately - when I tried to register I got a webpage (http://webtutotest.freehostia.com/news/reg2.php) with the following on it:

Code:
<meta http-equiv='refresh' content='0;url=login.php'
Using IE7.

Alan
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following User Says Thank You to Alan @ CIT For This Useful Post:
webtuto (01-04-2008)
Old 01-04-2008, 10:09 PM   #4 (permalink)
The Acquainted
Inquisitive 
 
WinSrev's Avatar
 
Join Date: Sep 2007
Posts: 133
Thanks: 6
WinSrev is on a distinguished road
Default

You might wanna make an index file:
Index of /news
Send a message via ICQ to WinSrev
WinSrev is offline  
Reply With Quote
The Following User Says Thank You to WinSrev For This Useful Post:
webtuto (01-04-2008)
Old 01-04-2008, 11:24 PM   #5 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

about ur suggestions youneek ,

1 - i didnt pay attention to security in this script and about email i dont know how to do what u said

2-yeah will i just forgot it is fixed now

3-yes im gonna use them later when i finish everything in that script

thanks dude for the help and critisize
------------------------------------------------
Alan @ CIT
will it works for me and others maybe !!! i didnt get that problem well im using firefox
------------------------------------------------
WinSrev
well yes :d
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-09-2008, 02:22 PM   #6 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

Sorry i havnt looked at your script fully yet, i will do when i get sum time.

I think there is an option witin IE7 to enable META REFRESH this could explain why it wasnt working for Alan. I believe it can be enabled/disabled in the Internet Security settings. I havnt got IE7 atm as i am on linux so i cant test this thoery, failing that its most likly to be another 'random feature' of IE7.

Why not use:

PHP Code:
header('Location: login.php'); 
instead of using the refresh, or did you want to have a short delay before the redirect?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 01-09-2008, 02:27 PM   #7 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

i didnt use header bcz when i use it , it gaves me an error :s
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 01-09-2008, 07:30 PM   #8 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

if its the classic 'headers already sent' error,then use an output buffer like so:

PHP Code:
ob_start(); //start the output buffer put at start of page

//do sum stuff

header('Location: login.php');

ob_flush(); //or ob_end_flush() if you want to close the buffer aswell as flush it 
Just remember that inorder for anything to get back to the browser you must call:
ob_flush(); so that the buffer is flushed to the browser.

That should stop that error as it keeps all output in a temp 'buffer' so that when you flush it everything get sent at the same time thus solving the 'Headers already sent' error.

Hope that helps
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)

Last edited by sketchMedia : 01-09-2008 at 07:31 PM. Reason: damn this new laptop keyboard
sketchMedia is offline  
Reply With Quote
The Following User Says Thank You to sketchMedia For This Useful Post:
webtuto (01-09-2008)
Old 01-09-2008, 07:43 PM   #9 (permalink)
The Addict
 
webtuto's Avatar
 
Join Date: Dec 2007
Location: morocco
Posts: 221
Thanks: 19
webtuto is on a distinguished road
Default

thanks im gonna remember that in my next projects thanks :d
Send a message via MSN to webtuto Send a message via Yahoo to webtuto Send a message via Skype™ to webtuto
webtuto is offline  
Reply With Quote
Old 02-20-2008, 10:54 PM   #10 (permalink)
The Wanderer
 
Join Date: Feb 2008
Posts: 9
Thanks: 1
NathanH is on a distinguished road
Default

I had the 'header already sent' error message several times on my pages. I found that if I wrote my includes/requires after the "header('Location....') then it worked.

For example, I had:
<?php
require("config.php");
require("userheader.php");
requrie("usernav.php");

*some more code*

header('Location: home1.php');
?>

If I put the 2nd and 3rd requires at the end of the php code (after the whole script) then I didn't receive any errors. That's what I found anyway :)

Last edited by NathanH : 02-20-2008 at 10:55 PM. Reason: I like cookies.
NathanH is offline  
Reply With Quote
Old 02-21-2008, 10:56 AM   #11 (permalink)
The Wanderer
 
Join Date: Feb 2008
Posts: 10
Thanks: 0
Pete is on a distinguished road
Default

yeah, php.net on headers says you cant have output of anykind on the site and then a header, i belive this includes white space. So to get it to work your statment has to be one of the first things you do without using echo, print or just plain html.
Pete is offline  
Reply With Quote
Old 02-21-2008, 01:06 PM   #12 (permalink)
Nor
The Addict
 
Join Date: Nov 2007
Posts: 282
Thanks: 61
Nor is on a distinguished road
Default

Quote:
Originally Posted by sketchMedia View Post
Sorry i havnt looked at your script fully yet, i will do when i get sum time.

I think there is an option witin IE7 to enable META REFRESH this could explain why it wasnt working for Alan. I believe it can be enabled/disabled in the Internet Security settings. I havnt got IE7 atm as i am on linux so i cant test this thoery, failing that its most likly to be another 'random feature' of IE7.

Why not use:

PHP Code:
header('Location: login.php'); 
instead of using the refresh, or did you want to have a short delay before the redirect?
ewlll
PHP Code:
header("refresh: 1; url=login.php"); 
:)



Quote:
I had the 'header already sent' error message several times on my pages. I found that if I wrote my includes/requires after the "header('Location....') then it worked.
OR putting
PHP Code:
ob_start(); 
at the top of your pages or in your config and include it to all your pages boom perfect ;).
__________________
PHP/XHTML Freelancer:
Cleanscript.com v3 - Programming starting at just $5 act now!
Nor is offline  
Reply With Quote
Reply



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

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 06:59 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design