Wednesday, 21 November 2018

How to create JSON object in PHP

Hi all,

Use this code

<?php

$con= new mysqli('localhost','user','huppassword','databasename')or die("Could not connect to mysql".mysqli_error($con));

$qr="select * from questions";

$result = mysqli_query($con, $qr);

$data = array();

while ( $row = $result->fetch_assoc() ){
   // $data[] = json_encode($row);
   $data[]=$row;
}
    echo json_encode( $data );//this will be sent as response to the requesting device

  
?>

How to retrive the result of url without refresh



Hi All,

See the code

<?php
//echo "HUP";

$url='http://servetechnoresearch.com/test/fetchquestion.php';
$ch=curl_init($url);
$data = curl_exec($ch);
print($data);

?>

Monday, 5 November 2018

Convert to Pdf and Print

<!---sample pdf---!--->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.container {
  border: 2px solid #ccc;
  background-color: midnightblue ;
  border-radius: 150px;
  padding: 16px;
  margin: 30px 0
}
body  {
   
    background-color: black;
height: 800px;
background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}
.container::after {
  content: "";
  clear: both;
  display: table;
}


.container span {
  font-size: 30px;
  margin-right: 15px;
}

@media (max-width: 500px) {
  .container {
      text-align: center;
  }

}

</style>
</head>
<body>
<center><h1>AthiraRaj</h1></center>


<a href="admin.php"><font color=white>back</a>
<h1><font color=white>RECRUITERS ARE</h1>
<?php
$con=mysql_connect("localhost","root","");
mysql_select_db("prjt",$con);
$sq="select * from  company";
$res=mysql_query($sq,$con);
while($row=mysql_fetch_array($res))
{
?>
<form action="update_rec.php" method="POST">
<div class="container"><input type=hidden name = id value=<?php echo "$row[tcom_id]"?> >

  <p><center><span><?php echo "$row[tcom_name]"?></span><p>company contact : <?php echo "$row[tcom_cont],    company email :$row[tcom_email]"?> </p><p> <?php echo "  company details :$row[tcom_details]"?> </p>
<p>company status  : <?php echo "  $row[tcomp_status]  "?> </p>
<p><input type="submit" value="SUBMIT" name="register" class="btn" ></p>
</div>
</form>
<?php }?>



</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2canvas/0.4.1/html2canvas.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.0.272/jspdf.debug.js"></script>

<script>
         let doc = new jsPDF('p', 'pt', 'a4');
         doc.addHTML(document.body, function () {
             doc.save('result.pdf');
         });

    </script>
</html>
<!--count--->

<!-------------->

Wednesday, 5 September 2018

TCSR Organization Profile


Hi All,
Please find the Organization Profile of TCSR


                    Technology Centre for Software and Research (TCSR) is a dynamic group of highly competent IT professionals providing cost effective and cutting-edge IT solutions with integration of Data Mining/Research tools and Applications. Their focus is greater return for their client’s technology investment. They are a dynamic company where teamwork and common goals are the main driving force. Expert and timely delivery of customized solutions is what they can do best.
Technology Centre for Software and Research (TCSR) is a professional web design company, offering first-class website development services, Internet Marketing and Promotion, E-Commerce and Content Management solutions to clients. Their services include new domain name search and registration, site design and development (including photography, graphics, and writing), and ongoing maintenance of your sites. 
  • Custom Design & Layout
  • Custom HTML Programming
  • Custom Graphic Design (GUI)
  • Professional Digital Photography
  • Library of Over thousands of Professional Web Templates
  • Available JavaScript, Java, Perl, ASP, .Net, VC++, PHP, VB Programming
  • Flash & Shockwave Programming Technology
  • Online Forms & E-mail
  • Search Engine Optimization (SEO)
  • Custom Web Site Performance Statistics
  • Business Analytics
Company’s Mission Statement
Technology Centre for Software and Research (TCSR) powering is innovative, cost-effective and quality solutions in Web applications, Intelligent Systems and Software Applications.

Tuesday, 14 August 2018

Encrypt data in PHP

Hi all,

Qn) How can I encrypt data in php

Ans: We can simple encrypt the data in php using mcrypt extension.  The functions used are mcrypt_encrypt() and mcrypt_decrypt().

See the program below.

Program courtesy : Sankara Narayana Sharma, MCA III Semester Student, Sree Narayana Institute of Technology, Kollam, Kerala, India.


<html>
<body>

<?php

$input = "Apple";

$encrypted = encryptIt( $input );
$decrypted = decryptIt( $encrypted );

echo "orginal text: ".$decrypted . '<br />'."Encrypted text: " . $encrypted;

function encryptIt( $q ) {
    $cryptKey  = 'rhe';
    $qEncoded      = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), $q, MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ) );
    return( $qEncoded );
}

function decryptIt( $q ) {
    $cryptKey  = 'rhe';
    $qDecoded      = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0");
    return( $qDecoded );
}

?>
</body>


</html>