@ 2014-04-03T15:22:28Z <?php
$nameErr=
$surnameErr=
$emailErr=
$address1Err=
$address2Err=
$postErr=
$countyErr=
$usernameErr=
$passErr="";
if (isset($_POST['person']))
{
include 'db.php';
$customer_name=addslashes($_POST['customer_name']) ;
$customer_surname=addslashes($_POST['customer_surname']);
$customer_email=addslashes($_POST['customer_email']) ;
$address_line_1=addslashes($_POST['address_line_1']);
$address_line_2=addslashes($_POST['address_line_2']) ;
$customer_post=addslashes($_POST['customer_post']) ;
$customer_county=addslashes($_POST['customer_county']) ;
$customer_username=addslashes($_POST['customer_username']) ;
$customer_password=addslashes($_POST['customer_password']) ;
if ($_SERVER["REQUEST_METHOD"] == "POST")
if(empty($customer_name)){
$nameErr= "Please provide the customers name.";}
if(empty($customer_surname)){
$surnameErr= "Please provide the customers surname.";}
if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/",$customer_email)){
$emailErr = "Please provide a valid Email address.";
}
$customer_email = strtolower(trim($_POST["customer_email"]));
$customer_email = filter_var($customer_email, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
$results = mysql_query("SELECT customer_id FROM customers WHERE customer_email='$customer_email'");
$email_exist = mysql_num_rows($results);
if($email_exist) { $emailErr="That email is already is use.";}
if(empty($address_line_1)){
$address1Err= "Please provide a valid address.";}
if(!preg_match_all("/^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/", $customer_post))
{$postErr="please provide a valid postcode.";}
if(isset($_REQUEST['customer_county']) && $_REQUEST['customer_county'] == '0') {
$countyErr = "Please pick the county in which you inhabit.";}
if(empty($customer_username)){
$usernameErr= "please provide a valid username.";}
if(isset($_POST["customer_username"]))
{
$customer_username = strtolower(trim($_POST["customer_username"]));
$customer_username = filter_var($customer_username, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW|FILTER_FLAG_STRIP_HIGH);
$results = mysql_query("SELECT customer_id FROM customers WHERE customer_username='$customer_username'");
$username_exist = mysql_num_rows($results);
if($username_exist) { $usernameErr="That name is unavailable.";}}
if (!preg_match_all('$\S*(?=\S{6,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$', $customer_password))
{
$passErr="Please provide a valid password.";
}
if($nameErr=="" and $surnameErr=="" and $emailErr=="" and $address1Err=="" and $postErr=="" and $countyErr=="" and $usernameErr=="" and $passErr==""){
mysql_query("INSERT INTO `customers`(customer_name,customer_surname,customer_email,address_line_1,address_line_2,customer_post,customer_county,customer_username,customer_password)
VALUES ('$customer_name','$customer_surname','$customer_email','$address_line_1','$address_line_2','$customer_post','$customer_county','$customer_username',md5('$customer_password')")");
}}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta content="text/javascript"/>
<link rel="stylesheet" type="text/css" href="css/blitzer/backsty.css">
<script type="text/javascript">
window.onload=function(){
var tfrow = document.getElementById('tfhover').rows.length;
var tbRow=[];
for (var i=1;i<tfrow;i++) {
tbRow[i]=document.getElementById('tfhover').rows[i];
tbRow[i].onmouseover = function(){
this.style.backgroundColor = '#F6D4D4';
};
tbRow[i].onmouseout = function() {
this.style.backgroundColor = '#EB8686';
};
}
};
</script>
<script type="text/javascript">
function confirm_click(customer_name)
{
return confirm("Are you sure you want to delete "+ customer_name +" from the database ?");
}
function validateEmail()
{
var emailID = document.userForm.customer_email.value;
atpos = emailID.indexOf("@");
dotpos = emailID.lastIndexOf(".");
if (atpos < 1 || ( dotpos - atpos < 2 ))
{
alert("Please provide correct email ID")
document.userForm.customer_email.focus() ;
return false;
}
return( true );
}
function validatePost()
{
var postID = document.userForm.customer_post.value; regPostcode = /^([a-zA-Z]){1}([0-9][0-9]|[0-9]|[a-zA-Z][0-9][a-zA-Z]|[a-zA-Z][0-9][0-9]|[a-zA-Z][0-9]){1}([ ])([0-9][a-zA-z][a-zA-z]){1}$/;
if(regPostcode.test(postID) == false)
{
alert("Please provide the correct Postcode");
document.userForm.customer_post.focus() ;
return false;
}
return ( true ) ;
}
function validate()
{
if( document.userForm.customer_name.value == "" )
{
alert("Please provide the customer name!");
document.userForm.customer_name.focus() ;
return false;
}
if( document.userForm.customer_surname.value == "" )
{
alert( "Please provide the customer surname!" );
document.userForm.customer_surname.focus() ;
return false;
}
if( document.userForm.customer_email.value == "" )
{
alert( "Please provide the correct Email!" );
document.userForm.customer_email.focus() ;
return false;
}else{
var ret = validateEmail();
if( ret == false )
{
return false;
}
}
if( document.userForm.address_line_1.value == "")
{
alert( "Please provide the correct address" );
document.userForm.address_line_1.focus() ;
return false;
}
if( document.userForm.customer_post.value == "" )
{
alert( "Please provide the correct postcode!" );
document.userForm.customer_post.focus() ;
return false;
}else{
var ret = validatePost();
if( ret == false )
{
return false;
}
}
if( document.userForm.customer_county.value == "0" )
{
alert( "Please provide your county!" );
document.userForm.customer_username.focus() ;
return false;
}
if( document.userForm.customer_username.value == "" )
{
alert( "Please provide a valid Username!" );
document.userForm.customer_username.focus() ;
return false;
}
var passw = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$/;
if(document.userForm.customer_password.value.match(passw))
{
return true;
}
else
{
alert('Please provide a valid password which contains 6 to 20 characters which contain at least one numeric digit, one uppercase and one lowercase letter.')
return false;
}
}
</script>
</head>
<body>
<form method="LINK" ACTION="index_mod.php">
<input type="submit" class="button2" value="Admin Home" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<h1>Customer Management</h1>
</form>
<div id="content">
<table>
<form onsubmit="return(validate());" name="userForm" method="post" autocomplete="off">
<tr>
<td>Name</td>
<td><input type="text" class="textbox" name="customer_name" /></td><td> <span class="error"> <?php echo $nameErr ?></span> </td>
</tr><tr>
<td>Surname</td>
<td><input type="text" class="textbox" name="customer_surname" /></td><td> <span class="error"> <?php echo $surnameErr ?></span> </td>
</tr><tr>
<td>Email</td>
<td><input type="text" class="textbox" name="customer_email" /></td><td> <span class="error"> <?php echo $emailErr ?></span> </td>
</tr><tr>
<td>Address1</td>
<td><input type="text" class="textbox" name="address_line_1" /></td><td> <span class="error"> <?php echo $address1Err ?></span> </td>
</tr><tr>
<td>Address2</td>
<td><input type="text" class="textbox" name="address_line_2" /></td>
</tr><tr>
<td>Post code</td>
<td><input type="text" class="textbox" name="customer_post" /></td><td> <span class="error"> <?php echo $postErr ?></span> </td>
</tr><tr>
<td>County<td> <select class="textbox" name="customer_county">
<option value="0">Please select</option>
<option>Aberdeenshire</option>
<option>Anglesey</option>
<option>Angus (Forfarshire)</option>
<option>Antrim</option>
<option>Argyll</option>
<option>Armagh</option>
<option>Avon</option>
<option>Ayrshire</option>
<option>Banffshire</option>
<option>Bedfordshire</option>
<option>Berkshire</option>
<option>Berwickshire</option>
<option>Brecknockshire</option>
<option>Buckinghamshire</option>
<option>Bute</option>
<option>Caernarfonshire</option>
<option>Caithness</option>
<option>Cambridgeshire and Isle of Ely</option>
<option>Cambridgeshire</option>
<option>Cardiganshire</option>
<option>Carmarthenshire</option>
<option>Cheshire</option>
<option>City of Aberdeen</option>
<option>City of Belfast</option>
<option>City of Bristol</option>
<option>City of Dundee</option>
<option>City of Edinburgh</option>
<option>City of Glasgow</option>
<option>City of London</option>
<option>City of Londonderry</option>
<option>Clackmannanshire</option>
<option>Cleveland</option>
<option>Clwyd</option>
<option>Cornwall</option>
<option>County</option>
<option>Cromartyshire</option>
<option>Cumberland</option>
<option>Cumbria</option>
<option>Denbighshire</option>
<option>Derbyshire</option>
<option>Devon</option>
<option>Dorset</option>
<option>Down</option>
<option>Dumfriesshire</option>
<option>Dunbartonshire (Dumbarton)</option>
<option>Durham</option>
<option>Dyfed</option>
<option>East Lothian (Haddingtonshire)</option>
<option>East Suffolk</option>
<option>East Sussex</option>
<option>Essex</option>
<option>Fermanagh</option>
<option>Fife</option>
<option>Flintshire</option>
<option>Glamorgan</option>
<option>Gloucestershire</option>
<option>Greater London</option>
<option>Greater Manchester</option>
<option>Gwent</option>
<option>Gwynedd</option>
<option>Hampshire (County of Southampton)</option>
<option>Hereford and Worcester</option>
<option>Herefordshire</option>
<option>Hertfordshire</option>
<option>Humberside</option>
<option>Huntingdon and Peterborough</option>
<option>Huntingdonshire</option>
<option>Inverness-shire</option>
<option>Isle of Ely</option>
<option>Isle of Wight</option>
<option>Kent</option>
<option>Kincardineshire</option>
<option>Kinross-shire</option>
<option>Kirkcudbrightshire</option>
<option>Lanarkshire</option>
<option>Lancashire</option>
<option>Leicestershire</option>
<option>Lincolnshire, Parts of Holland</option>
<option>Lincolnshire, Parts of Kesteven</option>
<option>Lincolnshire, Parts of Lindsey</option>
<option>Lincolnshire</option>
<option>London</option>
<option>Londonderry</option>
<option>Merionethshire</option>
<option>Merseyside</option>
<option>Mid Glamorgan</option>
<option>Middlesex</option>
<option>Midlothian (County of Edinburgh)</option>
<option>Monmouthshire</option>
<option>Montgomeryshire</option>
<option>Moray (Elginshire)</option>
<option>Nairnshire</option>
<option>Norfolk</option>
<option>North Humberside</option>
<option>North Yorkshire</option>
<option>Northamptonshire</option>
<option>Northumberland</option>
<option>Nottinghamshire</option>
<option>Orkney</option>
<option>Oxfordshire</option>
<option>Peeblesshire</option>
<option>Pembrokeshire</option>
<option>Perthshire</option>
<option>Powys</option>
<option>Radnorshire</option>
<option>Renfrewshire</option>
<option>Ross and Cromarty</option>
<option>Ross-shire</option>
<option>Roxburghshire</option>
<option>Rutland</option>
<option>Selkirkshire</option>
<option>Shetland (Zetland)</option>
<option>Shropshire (Salop)</option>
<option>Soke of Peterborough</option>
<option>Somerset</option>
<option>South Glamorgan</option>
<option>South Humberside</option>
<option>South Yorkshire</option>
<option>Staffordshire</option>
<option>Stirlingshire</option>
<option>Suffolk</option>
<option>Surrey</option>
<option>Sussex</option>
<option>Sutherland</option>
<option>Tyne and Wear</option>
<option>Tyrone</option>
<option>Warwickshire</option>
<option>West Glamorgan</option>
<option>West Lothian (Linlithgowshire)</option>
<option>West Midlands</option>
<option>West Suffolk</option>
<option>West Sussex</option>
<option>West Yorkshire</option>
<option>Westmorland</option>
<option>Wigtownshire</option>
<option>Wiltshire</option>
<option>Worcestershire</option>
<option>Yorkshire, East Riding</option>
<option>Yorkshire, North Riding</option>
<option>Yorkshire, West Riding</option>
<option>Yorkshire</option>
</select><td> <span class="error"> <?php echo $countyErr ?></span> </td>
</tr><tr>
<td>Username</td>
<td><input class="textbox" type="text" name="customer_username" id="customer_username" /><span id="user-result"></span></td><td><span class="error"> <?php echo $usernameErr ?></span> </td>
</tr><tr>
<td>Password</td>
<td><input class="textbox" type="text" name="customer_password" /></td><td> <span class="error"> <?php echo $passErr ?></span> </td>
</tr><tr>
<td> </td>
<td><input type="submit" name="person" class="button1" /></td>
</tr></form>
</table>
</div>
<script type="text/javascript" src="js/jquery-1.9.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#customer_username").keyup(function (e) {
//removes spaces from username
$(this).val($(this).val().replace(/\s/g, ''))
var customer_username = $(this).val();
if(customer_username.length < 4){$("#user-result").html('');return;}
if(customer_username.length >= 4){
$("#user-result").html('<img src="imgs/ajax-loader.gif" />');
$.post('check_username.php', {'customer_username':customer_username}, function(data) {
$("#user-result").html(data);
});
}
});
});
</script>
</form>
<div id="stock">
<?php
include("db.php");
$result=mysql_query("SELECT * FROM customers");
echo "<table id='tfhover'class='tftable' border='1'>\n";
echo "<tr>\n";
echo "<th>ID</th>\n";
echo "<th>Name</th>\n";
echo "<th>Surname</th>\n";
echo "<th>Email</th>\n";
echo "<th>Adress1</th>\n";
echo "<th>Adress2</th>\n";
echo "<th>Post code</th>\n";
echo "<th>County</th>\n";
echo "<th>Username</th>\n";
echo"<tr>\n";
while($test = mysql_fetch_array($result)){$id = $test['customer_id'];
echo"<tr align='left'>\n";
echo"<td><font color='black'>" .$test['customer_id']. "</font></td>\n";
echo"<td><font color='black'>" .$test['customer_name']. "</font></td>\n";
echo"<td><font color='black'>". $test['customer_surname']. "</font></td>\n";
echo"<td><font color='black'>". $test['customer_email']. "</font></td>\n";
echo"<td><font color='black'>". $test['address_line_1']. "</font></td>\n";
echo"<td><font color='black'>". $test['address_line_2']. "</font></td>\n";
echo"<td><font color='black'>". $test['customer_post']. "</font></td>\n";
echo"<td><font color='black'>". $test['customer_county']. "</font></td>\n";
echo"<td><font color='black'>". $test['customer_username']."</font></td>\n";
echo"<td class='link'><a class='links' href ='custdata1.php?customer_id=$id'>Edit</a></td>\n";
echo"<td class=\"link\"><a onclick=\"return confirm_click('".$test['customer_name']."');\" class='links1' href='delcustdata.php?customer_id=$id'>Delete</a></td>\n";
echo "</tr>";}
echo"</table>";
mysql_close($conn);?>
</div>
</body>
</html>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 5.4.27 0.006 0.047 12.42 5.4.26 0.017 0.047 19.01 5.4.25 0.013 0.050 18.77 5.4.24 0.020 0.047 18.65 5.4.23 0.003 0.057 18.91 5.4.22 0.010 0.050 18.91 5.4.21 0.010 0.060 18.65 5.4.20 0.010 0.067 18.95 5.4.19 0.007 0.057 18.76 5.4.18 0.003 0.053 18.96 5.4.17 0.007 0.063 18.90 5.4.16 0.007 0.060 19.08 5.4.15 0.013 0.063 18.89 5.4.14 0.017 0.057 16.36 5.4.13 0.007 0.070 16.59 5.4.12 0.013 0.050 16.50 5.4.11 0.013 0.047 16.42 5.4.10 0.013 0.047 16.47 5.4.9 0.010 0.053 16.50 5.4.8 0.020 0.053 16.48 5.4.7 0.010 0.043 16.40 5.4.6 0.007 0.050 16.37 5.4.5 0.010 0.073 16.39 5.4.4 0.013 0.060 16.58 5.4.3 0.013 0.060 16.49 5.4.2 0.013 0.057 16.56 5.4.1 0.013 0.053 16.34 5.4.0 0.020 0.043 15.78 5.3.28 0.007 0.050 14.62 5.3.27 0.000 0.083 14.53 5.3.26 0.003 0.057 14.65 5.3.25 0.007 0.063 14.70 5.3.24 0.010 0.047 14.34 5.3.23 0.007 0.050 14.55 5.3.22 0.013 0.053 14.70 5.3.21 0.003 0.057 14.48 5.3.20 0.013 0.050 14.45 5.3.19 0.010 0.050 14.38 5.3.18 0.007 0.050 14.61 5.3.17 0.017 0.050 14.37 5.3.16 0.020 0.060 14.64 5.3.15 0.007 0.060 14.61 5.3.14 0.010 0.077 14.43 5.3.13 0.010 0.047 14.35 5.3.12 0.010 0.073 14.60 5.3.11 0.010 0.067 14.42 5.3.10 0.003 0.073 14.06 5.3.9 0.010 0.047 14.05 5.3.8 0.010 0.063 14.07 5.3.7 0.013 0.043 13.75 5.3.6 0.017 0.040 14.05 5.3.5 0.007 0.070 14.00 5.3.4 0.013 0.063 14.07 5.3.3 0.003 0.050 13.99 5.3.2 0.003 0.050 13.64 5.3.1 0.007 0.060 13.65 5.3.0 0.007 0.050 13.68 5.2.17 0.000 0.047 11.07 5.2.16 0.007 0.040 11.28 5.2.15 0.013 0.033 11.18 5.2.14 0.000 0.047 10.94 5.2.13 0.000 0.047 11.08 5.2.12 0.010 0.037 11.14 5.2.11 0.007 0.050 11.16 5.2.10 0.007 0.037 11.14 5.2.9 0.013 0.030 11.05 5.2.8 0.007 0.040 11.13 5.2.7 0.007 0.043 11.14 5.2.6 0.000 0.057 10.97 5.2.5 0.010 0.037 11.06 5.2.4 0.010 0.050 10.79 5.2.3 0.007 0.040 11.16 5.2.2 0.007 0.047 11.17 5.2.1 0.010 0.037 11.14 5.2.0 0.003 0.043 10.95 5.1.6 0.003 0.033 10.00 5.1.5 0.003 0.040 10.10 5.1.4 0.017 0.037 10.14 5.1.3 0.007 0.047 10.48 5.1.2 0.010 0.050 10.27 5.1.1 0.007 0.033 9.91 5.1.0 0.007 0.033 10.10 5.0.5 0.007 0.027 8.68 5.0.4 0.003 0.030 8.54 5.0.3 0.007 0.037 8.33 5.0.2 0.003 0.027 8.23 5.0.1 0.007 0.023 8.18 5.0.0 0.003 0.043 8.42 4.4.9 0.003 0.023 7.79 4.4.8 0.000 0.023 7.71 4.4.7 0.007 0.017 7.57 4.4.6 0.007 0.027 7.57 4.4.5 0.000 0.023 7.50 4.4.4 0.010 0.040 7.41 4.4.3 0.007 0.020 7.41 4.4.2 0.007 0.017 7.41 4.4.1 0.010 0.017 7.41 4.4.0 0.010 0.027 7.41 4.3.11 0.003 0.020 7.41 4.3.10 0.003 0.020 7.41 4.3.9 0.003 0.027 7.41 4.3.8 0.007 0.040 7.41 4.3.7 0.010 0.017 7.41 4.3.6 0.003 0.027 7.41 4.3.5 0.003 0.020 7.41 4.3.4 0.000 0.037 7.41 4.3.3 0.007 0.027 7.41 4.3.2 0.007 0.017 7.41 4.3.1 0.000 0.023 7.41 4.3.0 0.017 0.027 13.33
preferences:dark mode live preview
147.02 ms | 941 KiB | 8 Q