Posts

Showing posts with the label php

Insert Data in MySQL DB using PHP

Image
This is a simple post in php. In this post you will learn how to add data to the MySQL Database. Basically in this post, a form is used which accepts input from the user. A class DBClass is used for interactions with the database. Screenshot The Code The Config.php File <?php define("DB_NAME","sample");//Database Name define("DB_USER","root");//Database User define("DB_PASS","");//Database Password define("DB_HOST","localhost");//Database Host ?> The DBClass.php file <?php require_once 'config.php'; class DBClass { public function addData($table,$name,$phone,$email) { $con=mysqli_connect(DB_HOST,DB_USER,DB_PASS,DB_NAME); $res=mysqli_query($con,"insert into $table values ('$name','$phone','$email')"); if($res) { echo '<script>alert("Data Succesfully inserted !")</script>'; } else { echo '...

QRCode Generator In PHP

Image
This post will guide you to create your own QR code Generator. Basically we will use Google's API to generate the QR code. QR code is a machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone. Screenshots[Demo] Home page of the script showing which takes the Input. Generated QR code of the input Given The Code <div style="text-align:center;"> <form class="email" name="qrc" method="post" action="<?php $_PHP_SELF ?>" id='12'> <p align="center"><font color=#99742e><span style="font-size:12pt;"><b>Link</b></span></font></p> <input type="text" name="qrlink" autocomplete="off" placeholder="Enter The Link"><br/> <input class="send" type="submit...

Copy To Clipboard Using JavaScript With No Flash

Image
This code snippet will create a button which on clicked will open prompt on the web browser using which you can copy the given value to the function. This is a simple implementation of JavaScript Prompt(). You can now from the prompt copy the passed data simply by pressing ctrl+c from your keyboard. This code snippet can be used in php for passing dynamic data to the function which can be displayed in the prompt so that copying is easy. From the Web you can find a lot many ways to directly copy from clipboard but those use flash. This code snipped dont use any flash content ! Screenshots: This Java Script code snippet working with PHP files This Java Script code snippet working with HTML files The Code Snippet: <script> function ctc(user,pass) { window.prompt("Copy to clipboard: Ctrl+C, Enter", "username: "+user+", password: "+pass); } </script> <button name="test" value="click" onClick=ctc(...

Create a Lightweight Blogging System Using PHP and MYSQL

Image
This post will help you to create your very own lightweight blogging system. This system is completely created by using PHP and mysql. This system consists of 4 files namely admin.php, index.php, art.php and .htaccess. We will go through each files deeply. This time on we have used automatic setup system which will automatically create database and tables. In this system we have created a database article and table article . Lets see the screens of various pages: The homepage of the Blogging system showing the titles of the posts. When clicked on any post, the page of the blogging system The admin control panel of the blogging system where the admin can add new articles Lets go through various sections of this blogging system Lets create the index.php file // A function to initiate automatic setup of database and tables function setup() { echo(' <p style="color: #008000; text-align: left; font-size: 15pt;"">-Automatic setup is starte...

Create a simple chatroom system in php without databases

Image
In this post, you will be guided to create a simple chatroom system in php without any databases. This system will create a folder for each chatroom and will store data in a simple .txt file, which is later accessed from the server side to display the conversations in the chatroom. This chatroom is flexible and light weight, it automatically reloads itself in 10 seconds so that new information is fetched correctly. The complete system is based on just a single php file in which file handling is used to retrieve and store the conversations from the chatroom. Demo: The index page when you start a coversation The conversation section of the index page Lets have some look on the major sections of the code To ask details when someone visits the page for the first time if (isset($_GET['enSubmit']) && isset($_GET['uname']) && isset($_GET['rname'])){ echo'<meta http-equiv="refresh" content="10">'; ...

Create a Twitter Tweets like publishing system

Image
This post guides you to create your own Twitter. Well that's not completely true but this post will guide you to create a Twitter Tweets like publishing System. Using this system, your users can register and sign in to their profiles and can update their tweets just like in twitter. This system is just designed to show the user who tweeted and at what time. You can add extra functionalities.  The complete system is based of PHP and MYSQL and a lot of CSS styles. This system contains mainly 3 files, firstly the config.php , secondly the index.php and lastly the profile.php . After uploading the files to your web server, first edit the details of the config.php file, namely the database user,name and password. The run in on the web browser, just like http://www.xyz.com/config.php now you are just good to go. Your users can access the system by just going to your url. i.e. http://www.xyz.com/. Demo The Home Page of the system where user can login The Profile page o...

Create a simple user profile system

Image
This post guides you to create you own simple user profile system. Using this system, your users can register and sign in. The complete system is based of PHP and MYSQL.  This system contains mainly 3 files, firstly the config.php , secondly the index.php and lastly the profile.php.  After uploading the files to your web server, first edit the details of the config.php file, namely the database user,name and password . The run in on the web browser, just like http://www.xyz.com/config.php/ now you are just good to go. Your users can access the system by just going to your url. i.e. http://www.xyz.com/. Demo The Homepage of the System, showing both sign in and sign up buttons. The Profile Page of the System, Showing the username and the last login details. PHPMyAdmin panel showing the data entered in the database. Lets Create the config.php file. <?php $dbhost = 'localhost';// Database Host. $dbuser = 'sid';// Database User. $dbpas...

Create a simple password authentication for HTML page

Image
In this post, you can create a simple password authentication system using php using which you can protect you sensitive information. Basically the complete authentication system is based on a single php file. In this file, you need to store the username and the password, which you need to enter in order to login to view you secured data. The complete page is overlayed by a div which when entered the correct credentials, disappears so that you can see the secured content. Demo The Layout When The Page Is Opened. The Layout When Incorrect Credentials are Entered. The Secured Content Displayed When Correct Credentials Entered. The Content of the PHP file <html> <head> <style> #mask{ background-color: aliceblue; overflow: overlay; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 9000; } #mask_lay { position:absolute; background-color: cornsilk; top:200px; left:40%; width :200px; height:110px; z-i...