diff --git a/may18/arthmeticOp.php b/may18/arthmeticOp.php new file mode 100644 index 0000000..e802a1a --- /dev/null +++ b/may18/arthmeticOp.php @@ -0,0 +1,27 @@ +"; +print("Difference is ".diff($num1, $num2)); +echo "
"; +print("Product is ".pro($num1, $num2)); +echo "
"; +print("Division of ".$num1. " and " .$num2. " is ".div($num1, $num2)); +?> \ No newline at end of file diff --git a/may18/evenOdd.php b/may18/evenOdd.php new file mode 100644 index 0000000..60e91d3 --- /dev/null +++ b/may18/evenOdd.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/may18/fibNum.php b/may18/fibNum.php new file mode 100644 index 0000000..79d47d0 --- /dev/null +++ b/may18/fibNum.php @@ -0,0 +1,10 @@ + \ No newline at end of file diff --git a/may18/fibSeries.php b/may18/fibSeries.php new file mode 100644 index 0000000..d3abb12 --- /dev/null +++ b/may18/fibSeries.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/may18/hello_world.php b/may18/hello_world.php new file mode 100755 index 0000000..1c969c7 --- /dev/null +++ b/may18/hello_world.php @@ -0,0 +1,9 @@ + + + + + + diff --git a/may18/mulTable.php b/may18/mulTable.php new file mode 100644 index 0000000..8d2be7e --- /dev/null +++ b/may18/mulTable.php @@ -0,0 +1,5 @@ +"; +?> \ No newline at end of file diff --git a/may18/pattern.php b/may18/pattern.php new file mode 100644 index 0000000..0069637 --- /dev/null +++ b/may18/pattern.php @@ -0,0 +1,8 @@ +"; +} +?> \ No newline at end of file diff --git a/may18/primeCheck.php b/may18/primeCheck.php new file mode 100644 index 0000000..e907e69 --- /dev/null +++ b/may18/primeCheck.php @@ -0,0 +1,12 @@ + diff --git a/may18/primeSeries.php b/may18/primeSeries.php new file mode 100644 index 0000000..b7c4306 --- /dev/null +++ b/may18/primeSeries.php @@ -0,0 +1,15 @@ +"); + for($i=1; $i<=$n; $i++) + { + $fact=0; + for($j=1; $j<=$n; $j++) + { + if($i%$j==0) + $fact++; + } + if($fact==2) + echo "$i
"; + } +?> \ No newline at end of file diff --git a/may18/reverseStr.php b/may18/reverseStr.php new file mode 100644 index 0000000..877dc0f --- /dev/null +++ b/may18/reverseStr.php @@ -0,0 +1,12 @@ +=0; $i--){ + $restr.=$str[$i]; + } + return $restr; + } + + $strEx = "smart commerce"; + echo (reverse($strEx)); +?> \ No newline at end of file diff --git a/may18/sum.php b/may18/sum.php new file mode 100644 index 0000000..9465be5 --- /dev/null +++ b/may18/sum.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/may21/armstrongNum.php b/may21/armstrongNum.php new file mode 100644 index 0000000..8ae0adc --- /dev/null +++ b/may21/armstrongNum.php @@ -0,0 +1,15 @@ +0){ + $rem = $num%10; + $sum = $sum + ($rem * $rem * $rem); + $num/=10; + } + if($sum == $temp) + echo "$temp is Armstrong number"; + else + echo "$temp is not armstrong number" +?> \ No newline at end of file diff --git a/may21/arrayDemo.php b/may21/arrayDemo.php new file mode 100644 index 0000000..62afc49 --- /dev/null +++ b/may21/arrayDemo.php @@ -0,0 +1,7 @@ +"; + foreach ($cities as $city) { + echo "$city
"; + } +?> \ No newline at end of file diff --git a/may21/factorial.php b/may21/factorial.php new file mode 100644 index 0000000..4b090c3 --- /dev/null +++ b/may21/factorial.php @@ -0,0 +1,10 @@ +0){ + $fact *= $num; + $num--; +} +echo "Factorial of $n1 is $fact"; +?> \ No newline at end of file diff --git a/may21/leapYear.php b/may21/leapYear.php new file mode 100644 index 0000000..45e15c8 --- /dev/null +++ b/may21/leapYear.php @@ -0,0 +1,25 @@ + + + + leap year + + +
+ + +
+ + + \ No newline at end of file diff --git a/may21/minMax.php b/may21/minMax.php new file mode 100644 index 0000000..0c5c409 --- /dev/null +++ b/may21/minMax.php @@ -0,0 +1,20 @@ + $arr[$i]) + $min = $arr[$i]; + return $min; + } + function max1($arr){ + $max = $arr[0]; + for($i=1; $i"; + echo "Largest number is ". max1($numarr) . "
"; +?> \ No newline at end of file diff --git a/may21/pattern1.php b/may21/pattern1.php new file mode 100644 index 0000000..4a6ad57 --- /dev/null +++ b/may21/pattern1.php @@ -0,0 +1,7 @@ +0; $i--){ + for($j=$i; $j>0; $j--) + echo "* "; + echo "
"; + } +?> \ No newline at end of file diff --git a/may21/patternAlpha.php b/may21/patternAlpha.php new file mode 100644 index 0000000..cc97260 --- /dev/null +++ b/may21/patternAlpha.php @@ -0,0 +1,9 @@ + "; + } + ?> \ No newline at end of file diff --git a/may21/searchNum.php b/may21/searchNum.php new file mode 100644 index 0000000..4fe087b --- /dev/null +++ b/may21/searchNum.php @@ -0,0 +1,18 @@ + \ No newline at end of file diff --git a/may21/switchDemo.php b/may21/switchDemo.php new file mode 100644 index 0000000..3f973e4 --- /dev/null +++ b/may21/switchDemo.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/may21/userInput.php b/may21/userInput.php new file mode 100644 index 0000000..7c6b8f1 --- /dev/null +++ b/may21/userInput.php @@ -0,0 +1,16 @@ + + + + User Name + + +
+ + +
+ + + \ No newline at end of file diff --git a/may22/arrayDemo.php b/may22/arrayDemo.php new file mode 100644 index 0000000..1ec1477 --- /dev/null +++ b/may22/arrayDemo.php @@ -0,0 +1,26 @@ +"ABC", "2"=>"EFG", "3"=>"CDE", "4"=>"GHI", "5"=>"IJK"); + asort($x); + echo "Array listed on ascending order of values
"; + foreach ($x as $arr_key => $arr_value) { + echo "Key: ".$arr_key." and value: ".$arr_value."
"; + } + $x = array("1"=>"ABC", "2"=>"EFG", "3"=>"CDE", "4"=>"GHI", "5"=>"IJK"); +ksort($x); +echo "
Array listed on ascending order of keys
"; +foreach ($x as $arr_key => $arr_value) { + echo "Key: ".$arr_key." and value: ".$arr_value."
"; + } + $x = array("1"=>"ABC", "2"=>"EFG", "3"=>"CDE", "4"=>"GHI", "5"=>"IJK"); + arsort($x); + echo "
Array listed on descending order of values
"; + foreach ($x as $arr_key => $arr_value) { + echo "Key: ".$arr_key." and value: ".$arr_value."
"; + } + $x = array("1"=>"ABC", "2"=>"EFG", "3"=>"CDE", "4"=>"GHI", "5"=>"IJK"); + krsort($x); +echo "
Array listed on descending order of keys
"; +foreach ($x as $arr_key => $arr_value) { + echo "Key: ".$arr_key." and value: ".$arr_value."
"; + } +?> \ No newline at end of file diff --git a/may22/disList.php b/may22/disList.php new file mode 100644 index 0000000..094c741 --- /dev/null +++ b/may22/disList.php @@ -0,0 +1,10 @@ +
    "; + foreach ($colors as $color) { + echo "
  1. $color
  2. "; + } + echo "
"; + +?> \ No newline at end of file diff --git a/may22/disTable.php b/may22/disTable.php new file mode 100644 index 0000000..9b4e649 --- /dev/null +++ b/may22/disTable.php @@ -0,0 +1,8 @@ + + itemsPrice + ABC150 + DEF700 + XYZ450 + " +?> \ No newline at end of file diff --git a/may22/emailValidation.php b/may22/emailValidation.php new file mode 100644 index 0000000..6bae53c --- /dev/null +++ b/may22/emailValidation.php @@ -0,0 +1,21 @@ + + + + email validation + + +
+ + +
+$email is not valid"; +} +?> + + \ No newline at end of file diff --git a/may22/exeDelay.php b/may22/exeDelay.php new file mode 100644 index 0000000..80f817b --- /dev/null +++ b/may22/exeDelay.php @@ -0,0 +1,5 @@ +"; +sleep(20); +echo date('h:i:s'); +?> \ No newline at end of file diff --git a/may22/fileMod.php b/may22/fileMod.php new file mode 100644 index 0000000..4a91120 --- /dev/null +++ b/may22/fileMod.php @@ -0,0 +1,7 @@ +$file_name contains $lines lines of code" +?> \ No newline at end of file diff --git a/may22/findVer.php b/may22/findVer.php new file mode 100644 index 0000000..c225d8e --- /dev/null +++ b/may22/findVer.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/may22/info.php b/may22/info.php new file mode 100644 index 0000000..7e0385b --- /dev/null +++ b/may22/info.php @@ -0,0 +1,32 @@ +
Your User agent is : ". $_SERVER[HTTP_USER_AGENT]; + + //file name + $filename = basename($_SERVER['PHP_SELF']); +echo "

Current file name is " . $filename ; + +//http or https.? +if(!empty(_SERVER['HTTPS'])) + echo "

https is enabled"; +else + echo "

http is enabled"; + +//URL +$url = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; +echo "

URL: $url"; + +//Current user +echo "

Current User is " .get_current_user(); +?> \ No newline at end of file diff --git a/may22/patternReplace.php b/may22/patternReplace.php new file mode 100644 index 0000000..99b6bb6 --- /dev/null +++ b/may22/patternReplace.php @@ -0,0 +1,6 @@ +\1', $name); + echo $name; +?> \ No newline at end of file diff --git a/may22/redirecting.php b/may22/redirecting.php new file mode 100644 index 0000000..a53f776 --- /dev/null +++ b/may22/redirecting.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/may22/swap2num.php b/may22/swap2num.php new file mode 100644 index 0000000..452cd2a --- /dev/null +++ b/may22/swap2num.php @@ -0,0 +1,12 @@ +"; +swap($a, $b); +?> \ No newline at end of file diff --git a/may23/armStrong.php b/may23/armStrong.php new file mode 100644 index 0000000..1c42f60 --- /dev/null +++ b/may23/armStrong.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/may23/checkChar.php b/may23/checkChar.php new file mode 100644 index 0000000..df93d82 --- /dev/null +++ b/may23/checkChar.php @@ -0,0 +1,15 @@ += ord("A") && ord($str[$i]) <= ord("Z")) + return "$str may contains upper case also"; + else + return "$str contains only lower case"; + } + } + + echo checkLower("mysuru") . "
"; + echo checkLower("Mangalore"). "
"; + echo checkLower("mumbai"); +?> diff --git a/may23/countDigits.php b/may23/countDigits.php new file mode 100644 index 0000000..69d5c53 --- /dev/null +++ b/may23/countDigits.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/may23/fact.php b/may23/fact.php new file mode 100644 index 0000000..30c896f --- /dev/null +++ b/may23/fact.php @@ -0,0 +1,11 @@ + diff --git a/may23/powerOf.php b/may23/powerOf.php new file mode 100644 index 0000000..c633c28 --- /dev/null +++ b/may23/powerOf.php @@ -0,0 +1,11 @@ + \ No newline at end of file diff --git a/may23/prime.php b/may23/prime.php new file mode 100644 index 0000000..d190caa --- /dev/null +++ b/may23/prime.php @@ -0,0 +1,17 @@ + diff --git a/may23/primeCopy.php b/may23/primeCopy.php new file mode 100644 index 0000000..c531a12 --- /dev/null +++ b/may23/primeCopy.php @@ -0,0 +1,19 @@ + $n) + return true; + return isPrime($n, $i + 1); +} + +$n = 17; + if (isPrime($n)) + echo "$n is prime number"; + else + echo "$n is not prime"; + +?> diff --git a/may23/randomNum.php b/may23/randomNum.php new file mode 100644 index 0000000..5274f47 --- /dev/null +++ b/may23/randomNum.php @@ -0,0 +1,8 @@ +"; + foreach ($n as $val) { + echo $val. " "; + } +?> \ No newline at end of file diff --git a/may23/reverseStr.php b/may23/reverseStr.php new file mode 100644 index 0000000..6a27aa3 --- /dev/null +++ b/may23/reverseStr.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/may23/sumOf.php b/may23/sumOf.php new file mode 100644 index 0000000..e92b0da --- /dev/null +++ b/may23/sumOf.php @@ -0,0 +1,11 @@ + diff --git a/may24/dateFun.php b/may24/dateFun.php new file mode 100644 index 0000000..4538f3f --- /dev/null +++ b/may24/dateFun.php @@ -0,0 +1,7 @@ +Today is "; + echo date('d-m-Y'); + echo "
Time is ".date('h:i:s a'); +?> \ No newline at end of file diff --git a/may24/dict.php b/may24/dict.php new file mode 100644 index 0000000..56e2f2d --- /dev/null +++ b/may24/dict.php @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/may24/dict.txt b/may24/dict.txt new file mode 100644 index 0000000..17ff328 --- /dev/null +++ b/may24/dict.txt @@ -0,0 +1,6 @@ +AAS = Alive and smiling +ADN = Any day now +AEAP = As early as possible +AFAIK = As far as I know +AFK = Away from keyboard +AKA = Also known as \ No newline at end of file diff --git a/may24/fileInfo.php b/may24/fileInfo.php new file mode 100644 index 0000000..765d65a --- /dev/null +++ b/may24/fileInfo.php @@ -0,0 +1,5 @@ +Directory Name: ".dirname("/may24/fileInfo.php"); + echo "
File name is ".basename("fileInfo.php"); +?> \ No newline at end of file diff --git a/may24/filewrite.txt b/may24/filewrite.txt new file mode 100755 index 0000000..e69de29 diff --git a/may24/links.php b/may24/links.php new file mode 100644 index 0000000..76bc423 --- /dev/null +++ b/may24/links.php @@ -0,0 +1,7 @@ +"; + echo "Link"; + include "linksPage.txt"; + echo "Link1"; + echo ""; +?> \ No newline at end of file diff --git a/may24/linksPage.txt b/may24/linksPage.txt new file mode 100644 index 0000000..7c36939 --- /dev/null +++ b/may24/linksPage.txt @@ -0,0 +1,9 @@ + + + + +New Section + + + + \ No newline at end of file diff --git a/may24/shuffleStr.php b/may24/shuffleStr.php new file mode 100644 index 0000000..56e2c9f --- /dev/null +++ b/may24/shuffleStr.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/may24/strOp.php b/may24/strOp.php new file mode 100644 index 0000000..b92f6e0 --- /dev/null +++ b/may24/strOp.php @@ -0,0 +1,10 @@ +$n ASCII character is ". chr($n); + $city1 = "Mysuru"; + echo "
$city and $city1 contains ".similar_text($city, $city1, $perc). " simmiliar characters and that's $perc %"; + $word = "A BC DEF"; + echo "
". str_word_count($word); +?> \ No newline at end of file diff --git a/may24/strPalidrme.php b/may24/strPalidrme.php new file mode 100644 index 0000000..4c1d1a4 --- /dev/null +++ b/may24/strPalidrme.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/may24/userDataCheck.php b/may24/userDataCheck.php new file mode 100644 index 0000000..3e989f0 --- /dev/null +++ b/may24/userDataCheck.php @@ -0,0 +1,21 @@ + + + + security + + + +
+
+ +
+ + + + + diff --git a/may24/writeToFile.php b/may24/writeToFile.php new file mode 100644 index 0000000..a24b225 --- /dev/null +++ b/may24/writeToFile.php @@ -0,0 +1,26 @@ + + + + File operations + can't open file"); + fwrite($handle, $str); + fclose($handle); + echo "Content added to the file"; + + } + ?> + + +
+
+ +
+ + \ No newline at end of file diff --git a/may25/DBconnection.php b/may25/DBconnection.php new file mode 100644 index 0000000..2925949 --- /dev/null +++ b/may25/DBconnection.php @@ -0,0 +1,13 @@ +"; +$db = "drupaldb"; +//$db_connect = mysqli_select_db($db_handle, $db); +$db_found = mysqli_select_db( $db_handle, $db ); +if($db_found) + echo "Data base found"; +else + echo "Data base not found"; +mysqli_close($db_handle); +?> \ No newline at end of file diff --git a/may25/InsertDb.php b/may25/InsertDb.php new file mode 100644 index 0000000..07fe121 --- /dev/null +++ b/may25/InsertDb.php @@ -0,0 +1,21 @@ + \ No newline at end of file diff --git a/may25/classDemo.php b/may25/classDemo.php new file mode 100644 index 0000000..b04d16d --- /dev/null +++ b/may25/classDemo.php @@ -0,0 +1,20 @@ +"; + $class_demo -> a(); +?> \ No newline at end of file diff --git a/may25/config.php b/may25/config.php new file mode 100644 index 0000000..7ebc522 --- /dev/null +++ b/may25/config.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/may25/readDb.php b/may25/readDb.php new file mode 100644 index 0000000..3d3f9dd --- /dev/null +++ b/may25/readDb.php @@ -0,0 +1,24 @@ +"; + while ($field = mysqli_fetch_assoc($q_res)) { + echo $field['first_name'] ." "; + echo $field['second_name']." "; + echo $field['email']." "; + echo $field['contact_num']." "; + echo $field['password']" "; + echo "
"; + } + } + else + echo "Database doesnot exists"; + mysqli_close($db_handle); + ?> + + diff --git a/may25/registration.php b/may25/registration.php new file mode 100644 index 0000000..fb5849f --- /dev/null +++ b/may25/registration.php @@ -0,0 +1,85 @@ + + + + HTML table + + + + + + + + + + + + + +
+
+
+
+
+
+
+

Registration

+ +
+

+

+

+

+

+

+ + + + + +
+
+
+
+
+
+ + + \ No newline at end of file