Android Login and Signup

Android Login and Sign up Complete Demo


              Download Complete Android Login and Signup Demo Project 

0

Laravel login And Signup Api service

Laravel login And Sign up API service

 

Download Complete Project for Laravel Login and Signup Api service

0

RTC Multiconnection Video and Text Chat App

Download The Full Source Code Of Video with Textchat App Create Using Rtc Multiconnection and Cordova

 

Download

0

Laravel Cheatsheet

Laravel Cheatsheet

 

Here is The link of Laravel Cheatsheet.


1

JSP Tutorial Basic Starting

JSP Tutorial Basic Starting

 

 

Creating a new projetc in Netbeans IDE

Then Select Web Application

Then Select Server to Apache Tomcat Or Tom EE Server then Next.

Now Lets Start .

Creating a Simple JSP Page That prints Hello World In Browser.

home.jsp



Now Write the codes.
<%--
    Document   : home
    Created on : Aug 13, 2017, 12:50:38 PM
    Author     : sanjeev
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>

        <% out.print("<h1>Hello World!</h1>"); %> 
    </body>
</html>



Then Click On Run Icon  then localhost running at port 8080 now open your home.jsp by /home.jsp    
And you successfully run your first jsp page like this.




Now Understanding the codes

<%@page contentType="text/html" pageEncoding="UTF-8"%>

This line define the page that we are using stand html tag in our page that browser render the html tags to display html view in our browser if we change the “text/html” to “text/plain” then browser display all the contents as plain text like this. We call this option as page header option.






Other are basic Html tags of pages now Next important line is know as scriptlet tag.  A scriptlet tag is used to execute java source code in JSP. Syntax is as follows:

<% java source code %>
Example :

        <% out.print("<h1>Hello World!</h1>"); %> 



Thanks.
4

Jquery (js) validation For 10 Digit Mobile Numbers

Jquery (js) validation For 10 Digit Mobile Numbers




After Testing All Answer not getting success . Some times input take alpha character also.
Here is the last full working code With Only number input also keeping in mind backspace button key event for user if something number is incorrect.

html : 

<input name="phone" id="phone" placeholder="Mobile Number" class="form-control" type="number" required>

Js :

<script>
$("#phone").keydown(function(event) {
k=event.which;
if((k>=96 && k<=105) || k==8)
{
     if($(this).val().length==10)
     {
         if(k==8)
         {
             return true;
         }
         else
        {
             event.preventDefault();
             return false;

         }
    }
}
else
{
     event.preventDefault();
     return false;
}

});
</script>
7

Basics Features of Object Oriented Programing Language.


Basics Features of Object Oriented Programing Language.



Features of OOP : -
1.Class
2.Object
3.Inheritance
4.Polymorphism
5.Data Hiding And Encapsuation

Class : - Class is a group of object of same of same type .Once a class has declared we can create multiple numbers of their objects. E.g potato, onion, Cabbage are the object of class vegetables.

Example of Class in JAVA: -

Class Hello //Class hello
{

}



Object : - Objects are collection of entities .Object takes space in memory . Objects are instances of class. When program is executed the object the object interacts by sending message to another . Each object contain data and code to mainpulate the data.

Example of Class and Objects : -

Class Hello //Class hello
{
void run () //Member Function
{
System.out.print(“Hello World”);
}
}
class demo
{
public static void main (String args[])
{
Hello h=new Hello(); // Creating Object of class hello
h.run(); //Calling Method of class hello
}
}

Inheritance : - Inheritance is an Approach through in which object of one class can acquired the property of parents class. Inheritance is used for resuablity of codes.

Example of Inheritance
Class employee
{
int salary=1000;
}
//Extend is used to access the feature and property of parent class

Class developer extends employee
{
int bonus=500;
public static void main(String args[])
{
developer d=new developer();
System.out.println(“Salary is : ”+d.salary);
System.out.println(“Bonus is : ”+d.bonus);
}
}

Polymorphism : - the word polymorphism means many form any operation may exhibite different behaviour in different instance . The behaviour depend on what type of operation we used.
Example :- Function Overloading,Operator Overloading.

Example of Polymorphism

class adding
{
int add(int a,int b) //method one
{
return a+b;
}
// method two same name but differen parameter
int add(int a,int b,int c)
{
return a+b+c;
}
}
class demo
{
public static void main(String args[])
{
adding abc=new adding();
System.out.println(“Sum of 10 , 20 , 30 is : ”+abc.add(10,20,30));
System.out.println(“Sum of 10 , 20 is : ”+abc.add(10,20));
}
}

Data hiding and Encapsulation : - Since wrapping up of data member and menber in a single class is known as encapsulation. Through in which data as are not access by the outside world only member function can access the data this is data hiding. And Also when we hide the complexity of program are known as abstraction . And only essential feature can access. Like when we sending sms we dont what its internal processing we only give inputs.

Example of Encapsulation

class hello
{
int a;
void geta()
{
return a;
}
void seta(String n)
{
this.a=n;
}
}
//hiding the above class and then we only calling the method dont know about the internal processing.
class calling
{
public static void main(String args[])
{
hello h=new hello();
h.seta(“Charles”);
System.out.print(“Name is ”+h.geta());
}
}
13

PHP Captcha Demo


PHP Captcha Demo

PHP captcha




Since we Know Captcha is very Important for our site to prevent our site from misuse or spamming then we will use captcha then attackers or bots not spam in our site.Lets start Creating PHP Captcha for our site.

First : form.php
Code :

<html>
<head>
<title>Check It</title></head>
<body>
<form action="val.php" method="post">
<img src="captcha.php">
</br>
Enter Image Text
<input type="text" name="cap">
</br>
<input type="submit" name="s" value="Submit">
</form>
</body>
</html>

This is simple html form where we print our captcha and input box for captcha value input then we validate its true or false.

Second : captcha.php
Code :

<?php
session_start(); //Starting Session
$code=rand(100000,999999); //Random Number
$_SESSION['code']=$code; //Storing Captcha vallue in session
$im=imagecreatetruecolor(100,40);
$bg=imagecolorallocate($im,80,60,165);
$fg=imagecolorallocate($im,50,255,255);
imagefill($im,5,5,$bg);
imagestring($im,20,30,10,$code,$fg);

//Creating Image in Png fomat

header('content-type:image/png');
imagepng($im);
imagedestroy($im);
//Destroying Image
?>

This is Captcha generating page it generates captcha in png image format and store captcha value in session then we check the session captcha value and user captcha value are same or not.

Third : val.php
Code:

<?php
session_start();
$a=$_POST['cap']; //receiving cap value from form
$b=$_SESSION['code']; //Getting Captcha Value from Session

//Comparing User Captcha value and Session Value
if(isset($a) && $a !="" && $b==$a)
{
echo "correct code enter"; //True Captcha
}
else
{
die ("wrong code entered"); //False Captcha
}
?>

In The Last Page val.php we check captcha is true or false.

Thank You
4

PHP Function To Check If String Contain Bad Words or Not


PHP Function To Check If String Contain Bad Words or Not

PHP Filter String


Here is a function Created For You To Check if string Contains Bad Word,Abusive Word or Not.

Code:-
<?php
function badword($text){
$bad = array('bad','lips','somebadword');
$rep = array('***','***','***','***');
//You Can More Bad Words in Array According To What You want filter
$text2 = str_replace($bad, $rep, $text);


if ($text != $text2)
{
return "bad";
}
else
{
return "good";
}
}

$text = "hello bad";
echo badword($text);
//Return Good Or Bad According To Text.
?>
Thanks.
2

PHP To Get Current User (Client) IP Address


PHP To Get Current User (Client) IP Address

php get user ip


Some Times We Need To Get Our Current User Ip Address Here is a PHP function We can Get the user ip easily without doing anything just call the function.

Code : -
<?php
function ip_address()
{
foreach (array('HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR') as $key){
if (array_key_exists($key, $_SERVER) === true)
{
foreach (explode(',', $_SERVER[$key]) as $ipaddress)
{
$ipaddress = trim($ipaddress); // Just to be safe

if (filter_var($ipaddress,
FILTER_VALIDATE_IP,
FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)
!== false) {

return $ipaddress;
}
}
}
}
}
echo ip_address();

Thanks.
2

Jquery selectors and basic part 1





Jquery selectors and basics part 1




In this tutorial i will show you how to use jquery selector to select element in DOM (Document Object Model which is our Html Document) and get the value of element ,text of element ,add new value or text or html element to Dom elements.

Let's Get Started.

Example 1 :  id selector
id selector is unique it select only one element in DOM . if we created multiple id element with same name then it will select only select first id element in DOM.

<html>
<head>
<script src=”js/jquery.min.js”></script>

<!--calling local jquery script →

</head>
<body>
<p>Hello</p>
<p id=”demo1”>Jquery</p>
<p id=”demo”>Here this text we will be change by using jquery selector and functions.</p>
<script>
$(document).ready(function(){


$(“#demo”).text(“This is new text “);

//Here # Represent the id and .text() method is used to set text in demo.

$(“#demo1”).html(“<span>World</span>”);

//since .text method only change text if we want to.add html elements inside selected elements then we will use .html() method.

});

//Every jquery function we will not call until our DOM is not ready (document).ready is a function we call our all function inside this .this function defines that our dom is ready now we are ready to call function inside (document).ready.

</script>
</body>
</html>


Example 2 : Class selector
Class is not unique so we can select all element having same class and change text or what we want.


<html>
<head>
<script src=”js/jquery.min.js”></script>

<!--calling local jquery script →

</head>
<body>
<p class=”mdemo”>Hello</p>
<p class=”demo”>Jquery</p>
<p class=”demo”>Here this text we will be change by using jquery selector and functions.</p>
<p class=”mdemo1”>Jquery Class also supports multiple class selector we can select multiple class in a single selector.</p>
<script>
$(document).ready(function(){


$(“.demo”).text(“This is new text “);

//Here (.) Represent the class and .text() method is used to set text in demo.

$(“.mdemo1,.mdemo”).text(“This text change by multiple class selector”);

//multiple class selector can be use by class names separated by comma (,)

});


</script>
</body>
</html>

Example 3 : Element Selector

Element selector selects all element in DOM .

<html>
<head>
<script src=”js/jquery.min.js”></script>

<!--calling local jquery script →

</head>
<body>
<p>Hello</p>
<p id=”demo1”>Jquery</p>
<p id=”demo”>Here this text we will be change by using jquery selector and functions.</p>
<h2>Jquery Multiple element selector </h2>
<span>This text all change using multiple selector</span>
<script>
$(document).ready(function(){


$(“p”).text(“This is new text added in all p tag elements “);

//Here p Represent the tag name  and .text() method is used to set text in demo.

$(“h2,span”).text(“This is multiple text selector “);

//This is multiple jquery selector where elements are separated by comma (,).

});

</script>
</body>
</html>


Example 4 : first last first-child selector

:first - select only first element in dom
:last - select only last element in dom
:first-child - select all elements of first child elements

<script src="js/jquery.min.js"></script>

<!--calling local jquery script -->
</head>

<body>

<br />


<div id="demo1">
Jquery</div>
<div id="demo">
Here this text we will be change by using jquery selector and functions.</div>
<div>

Hello i am first-child selector element

This text not change<br />


</div>
<div>

Hello i am first-child selector element again<br />


This text not change<br />


</div>
<script>

$(document).ready(function(){

$("p:first").text("This is new text added in first p tag element ");

$("p:last").text("this is text added in last p elements");

$("div:first-child").text("This is first child selector first child in div element");
//Here p Represent the tag name  and .text() method is used to set text in demo.


});

</script>
4

PHP session Tutorial


PHP SESSION Tutorial




In this tutorial i exaplain how to use session in php to get value in other page.

session is a way to get value in multiple pages without passing value from one page to another.

Let Start

Filename:- form.php
<html>
<head></head>
<body>
<form action=”show.php” method=”post”>
<label>User</label>
<br>
<input type=”text”name=”user”>
<br>
<input type=”submit” value=”submit”>
<!--here it was just an html form to transfer value to one page to other-->
</form>
</html>


Filename :-show.php
<?php
session_start();

//To use session we must start our session.session_start() is used to start our session.

$user=$_REQUEST[‘user’];
$_SESSION[‘user’]=$user;

//Set value in $_SESSION variable with key user now we get value from session in any page by session.

echo “Hello ”.$user;
echo “<br>”;
echo “<a href=’session.php’>Go To Next Page</a>


?>

Filename:- session.php
<?php
session_start();

//Again started session to get the value from session variable.

echo “Again Hello ”.$_SESSION[‘user’];

//here we accessing the session variable value which we set in show.php

echo “<a href=’destroy.php’>Do You Want To Destroy Session</a>”;

//session destroying link
?>

Filename :-destroy.php

<?php
session_start();
session_destroy();
//here we destroy session by session destroy.
?>


Thank you in next Tutorial i will share how to create a login system.
8

PHP Mysql Tutorial



PHP MySql Tutorial





In this tutorial i will share how to use mysql and php.

Lets get start.

For Cpanel
Open Mysql Database And Create A New Database And Create a New Username and Password then set the username to Database And Give all privilages.
Now Open Your Phpmyadmin from cpanel then select database and create a new table which we use to store data.

In this tutorial i will create a table name login
And Columns are
id - int - 255 - Auto increment - primary key
name - text
password - text
email - text

For xampp:

Open http://localhost/phpmyadmin
And Create a new database and create the table same as which we created in for server.

Now Lets start How to insert,select,update,delete data from database.

Create Database Connection in PHP

Filename: connect.php

<?php
$server=”localhost”;
$username=”root”;
$password=”root”;
$database=”demo”;
$con=mysql_connect($server,$username,$password);

//this function is user to connect our server mysql it takes three parameters first is your server ,second is username and third parameter is password.

$con2=mysql_select_db($database,$con);

//this function is used to select our database. it takes two parameter first parameter is database name and second is the connection which we create to connect our server.
?>



Insert Operation

<?php
include ‘connect.php’;
//inclufe function is used to to include one file into other in php

$name=”sswebtricks”;
$email=”sswebtricks@gmail.com”;
$password=”pass@123”;

$qr=mysql_query(“INSERT INTO login (name,email,password) VALUES (‘$name’,’$email’,’$password’));

//mysql_query is function to write our query it takes one parameter which is our query it returns boolean type value true or false

If($qr)
{
echo “insert sucess”;
}
else
{
echo “failed”;
}
?>


Select Operation

<?php
include ‘connect.php’;
$name=”sswebtricks”;

$qr=mysql_query(“select * from login”);
$row=mysql_fetch_array($qr);

//mysql fetch array function is used to fetch fetch all the data from.database it takes one parameter which is our query and return array value .Here we only fetch single row .

echo $row[‘email’].”<br>”;
//print the email of name

//Now we fetch multiple rows
while($row2=mysql_fetch_array($qr))
{
  echo $row2[‘email’].”<br>”;
}

?>


Update Operation

<?php
include ‘connect.php’;
$name=”sswebtricks”;
$newemail=”sksanjeev362@gmail.com”;

$qr=mysql_query(“UPDATE login SET email='$newemail' WHERE name=’$name’");

// Above is updAte query

if(mysql_affected_rows>0)
{
echo “updated”;
}
else
{
echo “failed”;
}


//mysql affected rows check how many rows will affected with our query
?>

Delete Operation

<?php
include ‘connect.php’;
$name=”sswebtricks”;

$qr=mysql_query(“delete from login where name=’$name’”);

if($qr)
{
echo “ deleted”;
}
else
{
echo “failed”;
}
?>


8

PHP , Javascript (JS) Array Basics Create And Print

 
PHP , Javascript (JS) Array Basics Create And Print 


What is Array?

Array is a special type of variable which stores multiple value in a single variable by its different index number.

Graphical Array value Storage View.


How To Declare or Create in PHP and Javascript?

In PHP – $a=array(1,2,3,4,5);
PHP Create Array by Keyword array and value inside its parenthesis seperated by comma (,).
Here We can Access value of a by using its its like if we use $a[0] we get
value equal to 1. Since Zero index value is 1.

In Javascript – var a=[1,2,3,4,5];
Javascript Creates Array By using Square Bracket and value separated by comma (,)
Here We can Access value of a by using its its like if we use a[0] we get
value equal to 1. Since Zero index value is 1.

Example 1. How to Decalare and get value of array .

IN PHP

<?php
$a = array(1,2,3,4); //Creating array

//printing values of array using simple method 1
echo "Index 0 Value is" . $a[0]."</br>";
echo "Index 1 Value is" . $a[1]."</br>";
echo "Index 2 Value is" . $a[2];

//printing values of array using for loop method 2

$count=count($a); //Here Count Function Counts The Array Of Length

for($i=0;$i<$count;$i++)
{
echo "Index ".$i." Value is" . $a[$i]."</br>";
}

//printing values of array using foreach loop method 2

foreach($a as $key => $value)
{
echo "Index ".$key." Value is" . $value."</br>";
}
?>

IN Javascript

<html>
<body>
</body>
<script>
var a = [1,2,3,4]; //Creating array

//printing values of array using simple method 1
console.log( "Index 0 Value is" +a[0]);
console.log( "Index 1 Value is" +a[1]);
console.log( "Index 2 Value is" +a[2]);

//printing values of array using for loop method 2

var count=a.length; //Here .length Function Counts The Array Of Length

for(var i=0;i<count;i++)
{
console.log( "Index "+i+" Value is" +a[i]);
}

//printing values of array using foreach loop method 2

for(var key in a)
{
console.log("Index "+key+" Value is" +a[key]);
}
</script>
</html>

Thank You
9