Monday, 16 February 2015

How To Change Ring & Vibration Settings in Yureka



Here is the solution how to make ring with vibrate in YU Yureka




If you  not found the Sound option in click Plus(+) button on the top there will show the list you just select sound it will show in the list then you can change to ring and vibrate mode it will work 100%

Wednesday, 4 February 2015

How to Install Zend Framework

How to Install Zend Framework

Detail about How to install zend framework 2 in 5 steps


1.Download the zip file using below link

https://github.com/zendframework/ZendSkeletonApplication
after downloading the zip folder extract in and copy the all folders, paste it in your project folder example path : C:\xampp\htdocs\zend

2.Download the composer exe file from this url
https://getcomposer.org/Composer-Setup.exe
and install it while instaling time if it is give the error plz
open the php.ini file form this url example :  C:\xampp\php and Uncomment the line extension=php_openssl.dll by removing the semicolon at the beginning.
Now you are good to install Composer.

3.Open command prompt and open project folder path in command prompt example : c:xampp\htdocs\zend
and paste this code and run it for updating the composer : php composer.phar self-update

4.After this it will download 100% then you paste this code and run it for install the updated composer in same command prompt like : php composer.phar install

5.Finally its installed now you can open your website link in local  like

http://localhost/zend/public/

Example Screen will show





How to install zend framework




Thursday, 20 March 2014

Send Html Email in Codeigniter / HTML Email Configuration In Codeigiter



Variables load from config Folder autoload File Helper

Example : $autoload['helper'] = array('text','html','email');



//IMP to add this below 2 line for sending html email configuration



                $email_setting = array('mailtype' => 'html');

                $this->email->initialize($email_setting);

                //IMP


                $this->email->to('admin@gmail.com');

                $this->email->from('admin@gmail.com');

                $emailmsg = "Message : Hi This is Test Mail";

                $emailmsg.= "<table width='50%' border='0'>
    <tr><td>Name : </td>
    <td>Stive Jobs </td>
   </tr>
   <tr><td>Address : </td>
   <td>#151 5th main 3rd Cross United State Of America</td>
   </tr></table>";

                $this->email->message($emailmsg);

                $this->email->send();




Send Html Email in Codeigniter / HTML Email Configuration In Codeigiter

Saturday, 30 November 2013

Login Code in PHP

In this tutorial, we create 3 php files for testing our code.

1. index.php
2. logincheck.php
3. success.php

4 Steps to create login page

1. Create table "userlist" in database "demo".
2. Create file index.php.
3. Create file logincheck.php.
4. Create file success.php.

Create file index.php.


<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form" method="post" action="logincheck.php">
<td>
<table width="100%" border="0" cellpadding="2" cellspacing="2" bgcolor="#000">
<tr>
<td colspan="3"><strong>Login Page</strong></td>
</tr>
<tr>
<td width="78">Userid / Email id</td>
<td width="6">:</td>
<td width="294"><input name="txtusername" type="text" id="txtusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="txtpassword" type="text" id="txtpassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

Creating database with table and data


CREATE TABLE `userlist` (
`id` int(4) NOT NULL auto_increment,
`username` varchar(65) NOT NULL default '',
`password` varchar(65) NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

INSERT INTO `userlist` VALUES (1, 'admin', 'admin123');


Create logincheck.php page

<?php

$host="localhost"; // Host name
$username=""; // username
$password=""; // password
$dbname="demo"; // Database name
$tblname="userlist"; // Table name

// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$dbname")or die("cannot select DB");

// username and password sent from form
$txtusername=$_POST['txtusername'];
$txtusername=$_POST['txtpassword'];

// To protect MySQL injection (more detail about MySQL injection)
$txtusername= stripslashes($txtusername);
$txtusername= stripslashes($txtusername);
$txtusername= mysql_real_escape_string($txtusername);
$txtusername= mysql_real_escape_string($txtusername);
$sql="SELECT * FROM $tblname WHERE username='$txtusername' and password='$txtusername'";
$result=mysql_query($sql);

// Counting table row
$row=mysql_num_rows($result);

// If  matched $txtusernameand $txtusername, table row must be 1 row
if($row==1){

// Register redirect to file "success.php"
session("txtusername");
session("txtusername");
header("location:success.php");
}
else {
echo "Invalid Username or Password";
}
?>

Create Success Page


<?php
session_start();
if(!session_is_registered(txtusername)){
header("location:index.php");
}
?>

<html>
<body>
Login Successful
</body>
</html>

PHP database Connection


<?php
$dbhost = 'localhost:1080';
$dbuser = 'username'; // in local root is default username
$dbpass = 'password';
$con = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $con )
{
  die('connection error : ' . mysql_error());
}
echo 'Connected successfully';
$sql = 'CREATE Database test_database';
$query= mysql_query( $sql, $conn );
if(! $query )
{
  die('Not create database: ' . mysql_error());
}
echo "Database created successfully\n";
mysql_close($conn);
?>

Mail Function in PHP

How to send mail in php

Mail Function in PHP


<html>

<body>

<?php

if (isset($_REQUEST['email']))

//if "email" is filled out, send email

  {

  //send email

  $email = $_REQUEST['email'] ;

  $subject = $_REQUEST['subject'] ;

  $message = $_REQUEST['message'] ;

  mail("someone@example.com", "Subject: $subject",

  $message, "From: $email" );

  echo "Thank you for using our mail form";

  }

else

//if "email" is not filled out, display the form

  {

  echo "<form method='post' action='mailform.php'>

  Email: <input name='email' type='text'><br>

  Subject: <input name='subject' type='text'><br>

  Message:<br>

  <textarea name='message' rows='15' cols='40'>

  </textarea><br>

  <input type='submit'>

  </form>";

  }

?>

</body>

</html>


Mail Function in PHP

Image Uploading in PHP

how to upload Image in PHP

File Name save as form.php

<html>
<head>
<script type="text/javascript">
function validate(){
var filevalue=document.getElementById("file").value;
var description=document.getElementById("description").value;
if(filevalue=="" || filevalue.length<1){
alert("Select File.");
document.getElementById("file").focus();
return false;
}
if(description=="" || description.length<1){
alert("File Description must not be blank.");
document.getElementById("description").focus();
return false;
}

return true;
}
</script>
</head>
<body >
<h2 align="center" >File Upload</h2>
<form action="file_upload.php" method="post" enctype="multipart/form-data" onSubmit="return validate()" >
<table align="center" >
<tr>
<td><label for="file">File:</label></td>
<td><input type="file" name="file" id="file" /></td>
</tr>
<tr>
<td><label >File Description:</label></td>
<td><input type="text" name="description" id="description" /></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="submit" value="Submit" /></td>
</tr>
<table>
</form>
</body>
</html>

Second File Name save as file_upload.php

?php
include("connect.php"); //database connection
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
|| ($_FILES["file"]["type"] == "image/pjpeg"))
&& ($_FILES["file"]["size"] < 1000000))
{
if ($_FILES["file"]["error"] > 0)
{
echo "File Error : " . $_FILES["file"]["error"] . "<br />";
}
else {

echo "Upload File Name: " . $_FILES["file"]["name"] . "<br />";
echo "File Type: " . $_FILES["file"]["type"] . "<br />";
echo "File Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "File Description:: ".$_POST['description']."<br />";

if (file_exists("images/".$_FILES["file"]["name"]))
{
echo "<b>".$_FILES["file"]["name"] . " already exists. </b>";
}else
{
move_uploaded_file($_FILES["file"]["tmp_name"],"images/". $_FILES["file"]["name"]);

$loc="images/".$_FILES["file"]["name"];
$qu="insert into images.img(loc) values('$loc')";
mysql_query($qu,$con);
?>
Uploaded File:<br>
<img src="images/<?php echo $_FILES["file"]["name"]; ?>" alt="Image path Invalid" >
<?php
}
}
}else
{
echo "Invalid file detail ::<br> file type ::".$_FILES["file"]["type"]." , file size::: ".$_FILES["file"]["size"];
}
?>

Database


Database name: image
Table name : img
Table fields : imgid(int primary key, auto incr) , loc(varchar)