Tuesday, February 24, 2015

Preventing SQL Injection using PHP


The strings in the input boxes can be sent with malicious contents to trigger an unwanted interaction with the database, so it is important to clean the input strings before 

passing them to the database engine to prevent SQL injection.

The following PHP code sample uses the inbuilt functions stripslashes and mysql_real_escape_string to ensure the values in the $_POST array can't inject SQL queries into MySQL or similar database system. 


<?php
          
     $username = "root";
     $password = "test123";
     $hostname = "localhost";

     $dbhandle = mysql_connect($hostname, $username,$password)
     or die("Could not connect");
    
     $myusername = $_POST['user'];
     $myusername = $_POST['pass'];

     //prevent my_sql injection
     $myusername = stripslashes($myusername);
     $mypassword = stripslashes($mypassword);
?>


Note:
stripslashes() is not recursive. If you want to apply this function to a multi-dimensional array, you need to use a recursive function.

Definition and Usage:
The stripslashes() function removes backslashes added by the addslashes() function.

Tip: This function can be used to clean up data retrieved from a database or from an HTML form.

Use Clock function in your site

A clock on your home page? Why, yes! I'll have one too, please. The thing at the top center of the page is what you can get here. It's a little JavaScript (not an applet) that loads into your browser, reads the time and then displays it. Pretty slick, eh? Please note that the script reads the time the browser is keeping; the time will be right in all time zones providing the viewer has his/her computer configured to give the correct time.

<html>
<head>
<script>
function startTime() {
    var today=new Date();
    var h=today.getHours();
    var m=today.getMinutes();
    var s=today.getSeconds();
    m = checkTime(m);
    s = checkTime(s);
    document.getElementById('txt').innerHTML = h+":"+m+":"+s;
    var t = setTimeout(function(){startTime()},500);
}

function checkTime(i) {
    if (i<10) {i = "0" + i};  
    return i;
}
</script>
</head>

<body onload="startTime()">

<div id="txt"></div>

</body>
</html>

Monday, February 23, 2015

Required messaging without complex

This is simple "required  messaging"  to complete the filling form process, once you forget the column to fill data, it will ask to fill the specific column in the same page. 

<html>
<head>
</head>
<body>

<?php
if(isset($_POST['submit'])){

if(empty($_POST['fname'])){
echo "First Name is Required";
}
if(empty($_POST['lname'])){
echo "Last Name is Required";
}
}

?>
<br><br><br>

<form action="post2.php" method="post">
<h1>Required Data</h1>
First Name:<font color=red>*</font> <input type="text" name="fname"><br><br>
Last Name:<font color=red>*</font><input type="text" name="lname"><br><br>
About: <textarea name="about"></textarea><br><br>

<input type="reset" name="reset">
<input type="submit" name="submit" value="Go">

</form>
</body>
</html>

Friday, February 20, 2015

10 Reasons Why Software Project Estimates Fail


Think about the web and software projects you’ve completed. How many were delivered on time and on budget? How many estimates were accurate? IT projects are notorious for over-running, and here are several reasons why it occurs…
1. The project is poorly scoped
How can you estimate time on a project when you don’t know what that project is? It’s rare to find a client who appreciates exactly how their system should work.
Almost every large project I’ve undertaken has requested “flexibility”. In other words, the client wants the system to handle anything they want at any future point in time — even though they have no idea what those features might be. Flexibility is not a requirement!
2. Development time is estimated by non-programmers
If you’re not a programmer, don’t guess at development times. A project is doomed the moment a manager writes their own fictional estimate. At best, they’ll be completely incorrect. At worst, the programmers will be tempted to prove them wrong.
3. Developer estimates are too optimistic
Developers think in terms of coding hours. Time passes quickly when you’re in the zone and it’s difficult to assess your own speed. Appreciating the speed of other developers is impossible.
Many developers are over-optimistic. They tend to forget the softer side of the development process, such as project management, collating requirements, discussions with colleagues, absences, PC problems, etc.
4. The project is not adequately dissected
Be wary if the development estimate for an individual feature exceeds a week. That chunk should be sub-divided further so the developer can analyze a complex problem in more detail.
5. Estimated time is used
Give a programmer 5 days to complete a task and it’ll take 5 days. Software development is infinitely variable and any code can be improved. If a developer takes 3 days to finish the task, they’ll spend the remaining time tweaking it or doing other activities.
Unfortunately, this results in a situation where estimates become the minimum number of development days. The actual delivery time can only get worse.
6. More developers != quicker development
A 100-day project will not be completed in 1 day by 100 developers. More people results in an exponential increase in complexity.
7. The project scope changes
This is perhaps the most irritating problem for a developer. A feature is changed or added because customer X has requested it or the CEO thinks it’s a cool thing to do.
Is the impact of that new feature documented?…
8. Estimates are fixed
Estimates should be continually assessed and updated as the system development progresses. Programmers often believe they can make up lost time — it rarely happens.
9. Testing time is forgotten
It’s impossible for a developer to adequately test their own code. They know how it should work, so they consciously or sub-consciously test in a specific way. In general, you can expect to spend another 50% of the development time on testing and debugging.
10. Estimates are taken too literally
Non-programmers rarely appreciate the complexity of software development yet few businesses plan for schedule slippages. The project often sits at the bottom of a huge unstable tower of other activities, such as literature printing, marketing, distribution, etc.
Development hold-ups can cause a costly chain reaction of delays. Unfortunately, it becomes easy to blame the programmer at the bottom of the pile. That’s doesn’t bode well for future projects — the programmer will either refuse to provide estimates or inflate them dramatically.
Have you encountered other reasons why project estimates fail?


Wednesday, February 11, 2015

Best Utilities for boost

Every one having at least a PC or laptop in your working environment  you have installed more softwares in everyday but you do not know those softwares makes your computer garbage in that case your computer works slow, therefore find out a good solution and make sure the most suitable utilities for that. "Glary Utilities" is the best one   it can under "1 Click Maintenance"

  • Registry Cleaner
  • Shortcut Fixer
  • Spyware Remover
  • Disk Repair
  • Track Eraser
  • Temporary Files Cleaner
  • Startup Manager





Download : glarysoft

Change your Desktop Environment

XWidget is a free desktop customization platform. It's light, handy with powerful visual widget editor and very smooth animation.




Download xwidget

Rrquirement:
Windows Vista
Windows 7/8/8.1

Tuesday, February 10, 2015

Sophisticated Web generation continued

The social media is a good platform for Contents creation by many end users, not only social media even a single website provide comment service to their viewers about their product or something like that. Web 2.0 basically refers to the transition from    HTML web pages to a more dynamic web that is more organized and is based on serving web applications to users. One of  the most significant differences between web2.0 and the traditional World Wide Wed(web1.0) is greater collaboration among internet users.




I mentioned previous article some features in web 2.0  which started 2004-2006 , but we are still having more pros from web 2.0 obviously  i can say, people much satisfy with using 2.0  because of it provides  more user friendly and different different kind of platforms under social media such as Blog,Facebook,Youtube,Google+,Wikis  after that  the IT revolution has been started.  Web participations is a privilege in web2.0  with compare web1.0 there was less people or some organizations had  websites but underweb2.0 there are more people having their individual websites.


Web2.0 is like an umbrella it encompassing several new technologies as will be outlined later. It  “connecting users the web in a more interactive and collaborative manner”, social interaction and  collective intelligence, and presents new opportunities for leveraging the web and engaging its users moreEffectively, web2.0 enables users to keep up with a site’s most recent content edit even without visiting the actual web page. It also lets developers create new web applications that draw on data, information or services available on the internet.


We can identify there are cons from web2.0 too many information posts by users it makes some kind of confusing among viewers. There are more fake email IDs, in some times we can not identify is it a real posts also the massive cons is hackers commit cyber crimes, it makes damages the certain site or blog.


Will be continued

Sophisticated Web generation




When we talk about the web generation it has a long path, in the world everyone like or unlike interact with the internet, it is going to end-users without living the internet, now we are in the crucial web generation which is web 2.0. But already 3.0 came as a sophisticated technology from 2.0, but people who are interact with the internet more likely with web 2.0.


There is a huge reason behind this, People already familiar with 2.0, they usually put in something over the internet, in the real world the social media make massive opportunity for their end-users, and making a pressure to them, such as ad word, Retargeting ads, Rich media, Pre-roll, Display ads typically people anticipate more user friendly technologies in the future but they are really going massively. 


In the web 2.0, generation as I said earlier Social media makes good chances to involve them, In nowadays social medias are taking a big part in the society, it is really welcome, content creation by the few web participation is a luxury software on the local machine which means those application soft wares only users can install and use it, they can not communicate each other via the certain software. Product pages are limited.


When we talk about e-commerce, It was limited for users which means end users can only collect information about their  product in other word they can not buy anything over the internet,  and there was only desktop computers so people had not familiar such as laptops, tabs, smartphones at that moment  in the web 1.0 generation (1997-2003),there was dynamic developing language such as php even though it was not need to involve in the web development, only the static markup languages was developing some attractive web pages, but anyhow it was not a matter at that time. But in web 2.0 generation,  php’s dominate was going massively up to now in some times.



Will be continued 

Monday, February 9, 2015

The concept of Socket programming

A socket is one of the most fundamental technologies of computer networking. Sockets allow applications to communicate using standard mechanisms built into network hardware and operating systems. Although network software may seem to be a relatively new "Web" phenomenon, socket technology actually has been employed for roughly two decades.


Software applications that rely on the Internet and other computer networks continue to grow in popularity. Many of today's most popular software packages -- including Web browsers, instant messaging applications and peer to peer file sharing systems -- rely on sockets.


  Socket in Python                                         

import sys
import http.server
from http.server import SimpleHTTPRequestHandler

HOST = '127.0.0.1'
ROOT = 'root/'
protocol='HTTP/1.0'
PORT = 80

socket=SimpleHTTPRequestHandler
ser__V=http.server


print ('Socket server has been created')

try:
   socket.protocol_version=protocol
   con=ser__V.HTTPServer((HOST,PORT),socket)
   print ('Socket bind complete')
   
except socket.error as msg:
    print ('Bind failed. Error Code : ' + str(msg[0]) + ' Message ' + msg[1])
    y = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sys.exit()
    
print ('Socket now listening rightknow')
con.serve_forever()

while 1:
    conn, addr = s.accept()
    print ('Connected with ' + addr[0] + ':' + str(addr[1]))
     
s.close()

Note : If you need to connect the socket with the browser you need a single HTML page and put the socket file in same folder and open browser type "localhost" port number(i defined as  70).

Eg: localhost:70