Wednesday, March 18, 2015
PHP web service to insert data to mysql database and retreive
<?php
mysql_connect("localhost","pfdsr","sdffsd") or die("database error");
mysql_select_db("sfdfsds");
if (!empty($_POST)) {
$Name = mysql_real_escape_string($_REQUEST['username']);
$Email = mysql_real_escape_string($_REQUEST['email']);
$Address= mysql_real_escape_string($_REQUEST['password']);
$result = mysql_query("SELECT email from student WHERE email = '$Email'");
$no_of_rows = mysql_num_rows($result);
if ($no_of_rows > 0) {
// user existed
$response["success"] = 2;
$response["message"] = "Email already registered!";
die(json_encode($response));
} else {
try {
$query2 = mysql_query("INSERT INTO student VALUES(null, '$Name', '$Email', '$Address')")or die(mysql_error());
//$result2 = mysql_query($query2);
$last_insert_id = mysql_insert_id();
$result = mysql_query("SELECT name, email, address FROM student WHERE id = '$last_insert_id' ")or die(mysql_error());
$json = array();
$row = mysql_fetch_assoc($result);
$json['student'][] = $row;
//echo json_encode($json);
$response["success"] = 1;
$response["message"] = "Login successful!";
die(json_encode($response));
}
catch (PDOException $ex) {
$response["success"] = 0;
$response["message"] = "Database Error1. Please Try Again!";
die(json_encode($response));
}
}
} else {
?>
<h1>Register</h1>
<form action="enterdata.php" method="post">
Username:<br />
<input type="text" name="username" value="" />
<br /><br />
Password:<br />
<input type="password" name="password" value="" />
<br /><br />
Email:<br />
<input type="text" name="email" value="" />
<br /><br />
<input type="submit" value="Register New User" />
</form>
<?php
}
?>
Friday, March 13, 2015
HTML Email in PHP Desing 2
<?php
$to = "sender@gmail.com";
$subject = "Testing Email From KD University ";
// ' "
$message = '
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Testing Email From IT Department KD University!</p>
<div style="color:#0000FF float:"left" ">
<img src="http://www. .com.au/app/img/nslogo.png" width="150" height="150">
</div>
<div style="color:#0000FF float:"left" ">
<table width="350" height="100" float:"left" border="0" border-color: #666 align="left" cellpadding="0" cellspacing="0" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;">
<tr>
<td height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 24px;font-weight: bold;color: #2D9348;padding-left: 5px;">Dear Student ! </td>
</tr>
<tr>
<td >Name</th>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Name'].'</td>
</tr>
<tr>
<td>Phone</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Phone'].'</td>
</tr>
<tr>
<td>Subject</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Subject'].'</td>
</tr>
<tr>
<td>Message</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;"><strong>'.$_REQUEST['Message'].'</strong> </td>
</tr>
<tr>
<td>i</td>
</tr>
</table>
</div>
<br clear="all"></Br>
<div height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;color: #330000;padding-left: 5px;">
IMPORTANT</Br>
This email and all its attachments are intended solely for the named addressee. It is private and confidential and may contain legally privileged material.
</div>
</body>
</html>
';
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <sender@gmail.com>' . "\r\n";
$headers .= 'Cc: sender@gmail.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>
$to = "sender@gmail.com";
$subject = "Testing Email From KD University ";
// ' "
$message = '
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Testing Email From IT Department KD University!</p>
<div style="color:#0000FF float:"left" ">
<img src="http://www. .com.au/app/img/nslogo.png" width="150" height="150">
</div>
<div style="color:#0000FF float:"left" ">
<table width="350" height="100" float:"left" border="0" border-color: #666 align="left" cellpadding="0" cellspacing="0" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;">
<tr>
<td height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 24px;font-weight: bold;color: #2D9348;padding-left: 5px;">Dear Student ! </td>
</tr>
<tr>
<td >Name</th>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Name'].'</td>
</tr>
<tr>
<td>Phone</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Phone'].'</td>
</tr>
<tr>
<td>Subject</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;">'.$_REQUEST['Subject'].'</td>
</tr>
<tr>
<td>Message</td>
<td height="29" style="font-family: Arial, Helvetica, sans-serif; font-size: 12px;font-weight: bold;color: #2D9348;padding-left: 5px;"><strong>'.$_REQUEST['Message'].'</strong> </td>
</tr>
<tr>
<td>i</td>
</tr>
</table>
</div>
<br clear="all"></Br>
<div height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 11px;color: #330000;padding-left: 5px;">
IMPORTANT</Br>
This email and all its attachments are intended solely for the named addressee. It is private and confidential and may contain legally privileged material.
</div>
</body>
</html>
';
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <sender@gmail.com>' . "\r\n";
$headers .= 'Cc: sender@gmail.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>
HTML Email with PHP
<?php
$to = "sender@gmail.com";
$subject = "Testing Email From ";
// ' "
$message = '
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Testing Email From</p>
<div style="color:#0000FF float:"left" ">
<img src="http://www. v .com.au/app/img/nslogo.png" width="150" height="150">
</div>
<table width="350" height="100" float:"left" border="0" border-color: #666 align="left" cellpadding="0" cellspacing="0" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;">
<tr>
<td height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 24px;font-weight: bold;color: #2D9348;padding-left: 5px;">Dear Student ! </td>
</tr>
<tr>
<th align="left">Firstname</th>
<th align="left">Lastname</th>
</tr>
<tr>
<td>Indika</td>
<td align="left">Senavirathne</td>
</tr>
<tr>
<td>Address</td>
<td><strong>Kuruvikulama</strong> </td>
</tr>
</table>
</body>
</html>
';
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <sender@gmail.com@gmail.com>' . "\r\n";
$headers .= 'Cc: sender@gmail.com@gmail.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>
$to = "sender@gmail.com";
$subject = "Testing Email From ";
// ' "
$message = '
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>Testing Email From</p>
<div style="color:#0000FF float:"left" ">
<img src="http://www. v .com.au/app/img/nslogo.png" width="150" height="150">
</div>
<table width="350" height="100" float:"left" border="0" border-color: #666 align="left" cellpadding="0" cellspacing="0" style="font-family: Arial, Helvetica, sans-serif;font-size: 12px;">
<tr>
<td height="59" colspan="2" style="font-family: Arial, Helvetica, sans-serif; font-size: 24px;font-weight: bold;color: #2D9348;padding-left: 5px;">Dear Student ! </td>
</tr>
<tr>
<th align="left">Firstname</th>
<th align="left">Lastname</th>
</tr>
<tr>
<td>Indika</td>
<td align="left">Senavirathne</td>
</tr>
<tr>
<td>Address</td>
<td><strong>Kuruvikulama</strong> </td>
</tr>
</table>
</body>
</html>
';
// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
// More headers
$headers .= 'From: <sender@gmail.com@gmail.com>' . "\r\n";
$headers .= 'Cc: sender@gmail.com@gmail.com' . "\r\n";
mail($to,$subject,$message,$headers);
?>
Wednesday, March 4, 2015
iPhone Screen SIzes
iPhone 4S
Screen Size: 3.5 Inches
Resolution: 640 x 960 (Half: 320 x 480)
iPhone 5
Screen Size: 4.0 Inches
Resolution: 640 × 1136 (Half: 320 x 568)
iPhone 5S/5C
Screen Size: 4.0 Inches
Resolution: 640 x 1136 (Half: 320 x 568)
iPhone 6
Screen Size: 4.7 Inches
Resolution: 828 x 1472 (Half: 414 x 736)
Resolution: 750 x 1334 (Half: 375 x 667)
iPhone 6 Plus
Screen Size: 5.5 Inches
Resolution: 906 x 1704 (Half: 453 x 852)
Resolution: 1242 x 2208 (1/3: 414 x 736)
The size of iPhone 6 Plus is @3x scaling. So, it is divided by 3.
So, other than 320 x 480 and 320 x 568, we have to use 375 x 667 and 414 x 736 at the Resizable iPhone Simulator.
After you build and run your project with the Resizable iPhone Simulator, you may set Width as 414, Compact and Height as 736, Regular and remember to click “Apply” like screen shot below:-
Screen Size: 3.5 Inches
Resolution: 640 x 960 (Half: 320 x 480)
iPhone 5
Screen Size: 4.0 Inches
Resolution: 640 × 1136 (Half: 320 x 568)
iPhone 5S/5C
Screen Size: 4.0 Inches
Resolution: 640 x 1136 (Half: 320 x 568)
iPhone 6
Screen Size: 4.7 Inches
Resolution: 750 x 1334 (Half: 375 x 667)
iPhone 6 Plus
Screen Size: 5.5 Inches
Resolution: 1242 x 2208 (1/3: 414 x 736)
The size of iPhone 6 Plus is @3x scaling. So, it is divided by 3.
So, other than 320 x 480 and 320 x 568, we have to use 375 x 667 and 414 x 736 at the Resizable iPhone Simulator.
After you build and run your project with the Resizable iPhone Simulator, you may set Width as 414, Compact and Height as 736, Regular and remember to click “Apply” like screen shot below:-
Adding Pods to an Xcode project
vi podfile
platform :ios, ‘8.1’ -these quartz are wrong…
pod ‘AFNetworking’
:wq
pod install
================================
platform :ios, '6.0'
pod 'AFNetworking'
pod 'MWPhotoBrowser'
================================================
mac:test789 indikasenavirathne$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Analyzing dependencies
CocoaPods 0.36.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Installing AFNetworking (2.5.1)
Generating Pods project
Integrating client project
[!] From now on use `test789.xcworkspace`.
mac:test789 indikasenavirathne$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Analyzing dependencies
CocoaPods 0.36.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Using AFNetworking (2.5.1)
Installing DACircularProgress (2.2.0)
Installing MBProgressHUD (0.9)
Installing MWPhotoBrowser (1.4.1)
Installing PSTCollectionView (1.2.3)
Installing SDWebImage (3.7.1)
Generating Pods project
Integrating client project
mac:test789 indikasenavirathne$
platform :ios, ‘8.1’ -these quartz are wrong…
pod ‘AFNetworking’
:wq
pod install
================================
platform :ios, '6.0'
pod 'AFNetworking'
pod 'MWPhotoBrowser'
================================================
mac:test789 indikasenavirathne$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Analyzing dependencies
CocoaPods 0.36.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Installing AFNetworking (2.5.1)
Generating Pods project
Integrating client project
[!] From now on use `test789.xcworkspace`.
mac:test789 indikasenavirathne$ pod install
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin14/rbconfig.rb:213: warning: Insecure world writable dir /usr/local in PATH, mode 040777
Analyzing dependencies
CocoaPods 0.36.0.rc.1 is available.
To update use: `gem install cocoapods --pre`
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Downloading dependencies
Using AFNetworking (2.5.1)
Installing DACircularProgress (2.2.0)
Installing MBProgressHUD (0.9)
Installing MWPhotoBrowser (1.4.1)
Installing PSTCollectionView (1.2.3)
Installing SDWebImage (3.7.1)
Generating Pods project
Integrating client project
mac:test789 indikasenavirathne$
Adding Pods to an Xcode project
vi podfile
platform :ios, ‘8.1’ -these quatz are wrong...
pod ‘AFNetworking’
:wq
pod install
Subscribe to:
Comments (Atom)