Guest User

Untitled

a guest
Nov 8th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.66 KB | None | 0 0
  1. <html>
  2. <head>
  3. <link rel="stylesheet" href="ttcss.Css">
  4. </head>
  5. <table border="1">
  6. <tr>
  7. <th>DAYS</th>
  8. <th>9:30-10:30</th>
  9. <th>10:45-11:45</th>
  10. <th>11:45-12:45</th>
  11. <th>12:45-1:45</th>
  12. <th>1:45-2:30</th>
  13. <th>2:30-3:30</th>
  14. <th>3:30-4:30</th>
  15. <th>4:30-5:30</th>
  16. </tr>
  17. <tr>
  18. <th>MONDAY</th>
  19. <td> </td>
  20. <td>AI</td>
  21. <td>WP</td>
  22. <td>ADA</td>
  23. <td rowspan="6"> BREAK</td>
  24. <td> </td>
  25. <td> </td>
  26. <td> </td>
  27. </tr>
  28. <tr>
  29. <th>TUESDAY</th>
  30. <td> </td>
  31. <td>OOAD</td>
  32. <td>CN</td>
  33. <td>AI</td>
  34. <td>WP</td>
  35. <td> </td>
  36. <td> </td>
  37. </tr>
  38. <tr>
  39. <th>WEDNESDAY</th>
  40. <td colspan="3"><center>ADA LAB</center></td>
  41. <td>OOAD</td>
  42. <td>ADA</td>
  43. <td>WP</td>
  44. <td> </td>
  45. </tr>
  46. <tr>
  47. <th>THURSDAY</th>
  48. <td colspan="3"><center>WP LAB</center></td>
  49. <td>CN</td>
  50. <td>ADA</td>
  51. <td>AI</td>
  52. <td> </td>
  53. </tr>
  54. <tr>
  55. <th>FRIDAY</th>
  56. <td> </td>
  57. <td>AI</td>
  58. <td>CN</td>
  59. <td>OOAD</td>
  60. <td colspan="3"><center>PROJECT LAB</center></td>
  61. </tr>
  62. <tr>
  63. <th>SATURDAY</th>
  64. <td>ADA</td>
  65. <td>WP</td>
  66. <td>CN</td>
  67. <td>OOAD</td>
  68. <td> </td>
  69. <td> </td>
  70. <td> </td>
  71. </tr>
  72. </table>
  73. </html>
  74.  
  75. td:hover
  76. {
  77. cursor:pointer;
  78. background:#666;
  79. color:white;
  80. }
  81. td{
  82. background-color: lightblue;
  83. color: black; }
  84. tr>th{
  85. background-color: darkblue;
  86. color: white; }
  87. table{
  88. border: 3px solid gray;
  89. padding: 13px; }
  90. th,td{
  91. padding: 10px; }
  92.  
  93.  
  94. ------------
  95. <html>
  96. <head>
  97. <title>Insert title here</title>
  98. <script type="text/javascript">
  99. function sqr() {
  100. var n=prompt("enter a positive value for n","");
  101. while(n<=0)
  102. { alert("enter positive value");
  103. n=prompt("enter positive value for n"," "); }
  104. var sq="numbers and their square \n";
  105. document.write("numbers and their square values using alert <br />");
  106. for(i=1;i<=n;i++)
  107. { sq=(sq+i+"==>"+i*i+"\n"); }
  108. alert(sq); }
  109. function fib()
  110. { var a=0; var b=1; var c,i; var str;
  111. var n=prompt("enter a number"," ");
  112. while(n<=0)
  113. { alert("enter the nos");
  114. n=prompt("enter a number"," "); }
  115. document.write("fibonacci series<br />");
  116. str=a+"\n"+b;
  117. for(i=0;i<n-2;i++)
  118. { c=a+b;
  119. str=(str+"\n"+c);
  120. a=b; b=c; }
  121. alert(str); }
  122. </script>
  123. </head>
  124. <body>
  125. <form >
  126. <h1>Click on the button to calculate the Square of a series or Fib of a number</h1>
  127. <input type="submit" name="S" value="SQUARE" onclick="sqr()">
  128. <input type="submit" name="S1" value="FIBO" onclick="fib()">
  129. </form>
  130. </body>
  131. </html>
  132. --------------------
  133. <!DOCTYPE html>
  134. <html>
  135. <head>
  136. <meta charset="ISO=8859-1">
  137. <title>insert title here</title>
  138. </head>
  139. <body>
  140. <p>sort a set of names
  141. <script>
  142. var i=0,j,temp,n
  143. var names=new Array()
  144. n=prompt("enter new name,or OK to end"," ")
  145. while(n != "")
  146. {
  147. document.write("<br>" + n)
  148. names[names.length] = n
  149. n=prompt("enter new name,or OK to end","")
  150. }
  151. document.write("<p>"+names.length+"names")
  152. for(i=0;i<names.length-1;i++)
  153. {
  154. for(j=i+1;j<names.length;j++)
  155. {
  156. if(names[i]>names[j])
  157. {
  158. temp = names[i]
  159. names[i] = names[j]
  160. names[j] = temp
  161. } } }
  162. for(i=0;i<names.length;i++)
  163. document.write("<br>"+names[i]);
  164. </script>
  165. </body>
  166. </html>
  167. ----------------
  168. <!DOCTYPE html>
  169.  
  170. <html>
  171.  
  172. <title>HTML5</title>
  173.  
  174. <meta charset="utf-8">
  175.  
  176. <style>
  177.  
  178. body { font-family:Verdana,sans-serif;font-size:0.8em; }
  179.  
  180. aside{
  181.  
  182. float:right;
  183.  
  184. height:620;
  185.  
  186. width:300;
  187.  
  188. border:1px solid;
  189.  
  190. margin:5px;margin-bottom:15px;padding:8px;
  191.  
  192. background-color:white; }
  193.  
  194. header,footer,section,article {
  195.  
  196. border:1px solid grey;
  197.  
  198. margin:5px;margin-bottom:15px;padding:8px;
  199.  
  200. background-color:white; }
  201.  
  202. header,footer {
  203.  
  204. color:white;background-color:#444;margin-bottom:5px; }
  205.  
  206. article{
  207.  
  208. width:700px; }
  209.  
  210. section {
  211.  
  212. background-color:#ddd; }
  213.  
  214. nav ul {
  215.  
  216. margin:0;padding:0; }
  217.  
  218. nav ul li {
  219.  
  220. display:inline; margin:5px; }
  221.  
  222. </style>
  223.  
  224. <body>
  225.  
  226. <header>
  227.  
  228. <h1>Monday Times</h1>
  229.  
  230. </header>
  231.  
  232. <nav>
  233.  
  234. <ul>
  235.  
  236. <li>Time Table</li>
  237.  
  238. <li>Course</li>
  239.  
  240. </ul>
  241.  
  242. </nav>
  243.  
  244. <section>
  245.  
  246. <h2>News Section</h2>
  247.  
  248. <aside>
  249.  
  250. <img src=".JPG" width=300 height="200"><br>
  251.  
  252. <br> <br>
  253.  
  254. Welcome <br> to <br> NCJ <br>
  255.  
  256. </aside>
  257.  
  258. <article>
  259.  
  260. <h2>News Article1</h2>
  261.  
  262. <p>
  263.  
  264. <table border=1>
  265.  
  266. <tr>
  267.  
  268. <th>9.30</th>
  269.  
  270. <th>10.30</th><th>11.30</th><th>12.30</th></tr>
  271.  
  272. <tr>
  273.  
  274. <th>AI</th>
  275.  
  276. <th>IT</th><th>OOAD</th><th>ADA</th></tr>
  277.  
  278. <tr>
  279.  
  280. <th>OOAD</th>
  281.  
  282. <th>IT</th><th>ADA</th><th>AI</th></tr>
  283.  
  284. <tr>
  285.  
  286. <th>IT</th>
  287.  
  288. <th>AI</th><th>OOAD</th><th>ADA</th></tr>
  289.  
  290. </table>
  291.  
  292. </p>
  293.  
  294. </article>
  295.  
  296. <article>
  297.  
  298. <h2>News Article</h2>
  299.  
  300. <p>
  301.  
  302. .BCA<br>
  303.  
  304. .B.Sc<br>
  305.  
  306. .BA<br>.B.Com<br>
  307.  
  308. </P>
  309.  
  310. <P>
  311.  
  312. M.Sc
  313.  
  314. <br>.COMPUTER SCIENCE<br>.PHYSICS<br>.MATHS<br>
  315.  
  316. </article>
  317.  
  318. </section>
  319.  
  320. <footer>
  321.  
  322. <p>&copy; 2016 National College Jayanagar. All rights reserved.</p>
  323.  
  324. </footer>
  325.  
  326. </body>
  327.  
  328. </html>
  329.  
  330. -----------------------
  331. <!DOCTYPE html>
  332. <html>
  333. <head>
  334. <script language="javascript">
  335. function cal()
  336. {
  337. var m1,m2,m3,m4,avg=0,total=0,result="",grade="";
  338. m1=parseInt(document.student.s1.value);
  339. m2=parseInt(document.student.s2.value);
  340. m3=parseInt(document.student.s3.value);
  341. m4=parseInt(document.student.s4.value);
  342. alert(m1);
  343. total=m1+m2+m3+m4;
  344. avg=total/4;
  345. if(m1<35||m2<35||m3<35||m4<35)
  346. {
  347. result="fail";
  348. grade="D";
  349. }
  350. else if(avg>=75)
  351. {
  352. result="distinction";
  353. grade="A+";
  354. }
  355. else if(avg>=60||avg<75)
  356. {
  357. result="first class";
  358. grade="A"
  359. }
  360. else if(avg>=50||avg<60)
  361. {
  362. result="second class";
  363. grade="B";
  364. }
  365. else if(avg>=35||avg<50)
  366. {
  367. result="pass class";
  368. grade="C";
  369. }
  370. else if(avg<35)
  371. {
  372. result="fail";
  373. grade="D";
  374. }
  375. document.student.result.value=result;
  376. document.student.grade.value=grade;
  377. document.student.total.value=total;
  378. document.student.avg.value=avg;
  379. }
  380. </script>
  381. </head>
  382. <body>
  383. <h2><center>Result calculation for a student</center></h2><br/>
  384. <center><form name="student" method="get" action="">
  385. Name &nbsp
  386. <input type="text" name="name" id="t1" value=""><br/><br/>
  387. class &nbsp;&nbsp
  388. <input type="text" name="cls" id="t2" value=""><br/><br/>
  389. sub1 &nbsp;&nbsp
  390. <input type="text" name="s1" id="t3" value=""><br/><br/>
  391. sub2 &nbsp;&nbsp
  392. <input type="text" name="s2" id="t4" value=""><br/><br/>
  393. sub3 &nbsp;&nbsp
  394. <input type="text" name="s3" id="t5 value=""><br/><br/>
  395. sub4 &nbsp;&nbsp
  396. <input type="text" name="s4" id="t6" value=""><br/><br/>
  397. <input type="button" onclick="cal()" value="calculate">
  398. <br/><br/><br/>total &nbsp;&nbsp
  399. <input type="text" name="total" id="t7" value=""><br/><br/>
  400. average
  401. <input type="text" name="avg" id="t8" value=""><br/><br/>
  402. result &nbsp;&nbsp
  403. <input type="text" name="result" id="t9" value=""><br/><br/>
  404. grade &nbsp;&nbsp
  405. <input type="text" name="grade" id="t10" value=""><br/><br/>
  406. </form></center>
  407. </body>
  408. </html>
  409. --------------------
  410. <!DOCTYPE html>
  411. <html>
  412. <head>
  413. <title>Insert title here</title>
  414. <style type="text/css">
  415. img{opacity:0.5;}
  416. marquee
  417. {
  418. height:100%;
  419. bottom:0;
  420. width:200px;
  421. float:right;
  422. }
  423. li{
  424. color:purple;
  425. font-family:Calibri ;
  426. }
  427. img:hover
  428. {opacity:1}
  429. </style> </head>
  430. <body>
  431. <marquee onmouseover="stop()"onmouseout="start()"scrollamount="2"direction="up"behavior="scroll">
  432. <img alt="IMG1" width=100 height=100 src=".JPG"><br>
  433. <img alt="IMG1" width=100 height=100 src=".JPG"><br>
  434. </marquee>
  435. <header> LIST OF IMAGES DISPLAYED</header>
  436. <ol>
  437. <li>img0
  438. <li>img1
  439. <li>img2
  440. </ol>
  441. </body>
  442. </html>
  443. --------------------
  444. <html>
  445. <head></head>
  446. <body>
  447. <h3>Simple Calculator</h3>
  448. <br/>
  449. <form Name="calc">
  450. <table id="calc" border=2>
  451. <tr>
  452. <td colspan=5><input id="btn" name="display" onkeypress="return event.charCode >= 48 && event.charCode <= 57" type="text"></td>
  453. <td style="display:none"><input name="M" type="number"></td>
  454. </tr>
  455. <tr>
  456. <td><input id="btn" type=button value="MC" OnClick="calc.M.value=''"></td>
  457. <td><input id="btn" type=button value="0" OnClick="calc.display.value+='0'"></td>
  458. <td><input id="btn" type=button value="1" OnClick="calc.display.value+='1'"></td>
  459. <td><input id="btn" type=button value="2" OnClick="calc.display.value+='2'"></td>
  460. <td><input id="btn" type=button value="+" OnClick="calc.display.value+='+'"></td>
  461. </tr>
  462. <tr>
  463. <td><input id="btn" type=button value="MS" OnClick="calc.M.value=calc.display.value"></td>
  464. <td><input id="btn" type=button value="3" OnClick="calc.display.value+='3'"></td>
  465. <td><input id="btn" type=button value="4" OnClick="calc.display.value+='4'"></td>
  466. <td><input id="btn" type=button value="5" OnClick="calc.display.value+='5'"></td>
  467. <td><input id="btn" type=button value="-" OnClick="calc.display.value+='-'"></td>
  468. </tr>
  469. <tr>
  470. <td><input id="btn" type=button value="MR" OnClick="calc.display.value=calc.M.value"></td>
  471. <td><input id="btn" type=button value="6" OnClick="calc.display.value+='6'"></td>
  472. <td><input id="btn" type=button value="7" OnClick="calc.display.value+='7'"></td>
  473. <td><input id="btn" type=button value="8" OnClick="calc.display.value+='8'"></td>
  474. <td><input id="btn" type=button value="x" OnClick="calc.display.value+='*'"></td>
  475. </tr>
  476. <tr>
  477. <td><input id="btn" type=button value="M+" OnClick="calc.M.value=(Number(calc.M.value))+(Number(calc.display.value))"></td>
  478. <td><input id="btn" type=button value="9" OnClick="calc.display.value+='9'"></td>
  479. <td><input id="btn" type=button value="±"
  480. OnClick="calc.display.value=(calc.display.value==Math.abs(calc.display.value)?-(calc.display.value):Math.abs(calc.display.value))">
  481. </td>
  482. <td><input id="btn" type=button value="=" OnClick="calc.display.value=eval(calc.display.value)"></td>
  483. <td><input id="btn" type=button value="/" OnClick="calc.display.value+='/'"></td>
  484. </tr>
  485. <tr>
  486. <td><input id="btn" type=button value="1/x" OnClick="calc.display.value=1/calc.display.value"></td>
  487. <td><input id="btn" type=button value="." OnClick="calc.display.value+='.'"></td>
  488. <td><input id="btn" type=button value="x2" OnClick="calc.display.value=Math.pow(calc.display.value,2)"></td>
  489. <td><input id="btn" type=button value="v" OnClick="calc.display.value=Math.sqrt(calc.display.value)"></td>
  490. <td><input id="btn" type=button value="C" OnClick="calc.display.value=''"></td>
  491. </tr>
  492. </table>
  493. </form>
  494. </body>
  495. </html>
  496. ------------------------------
  497. 4. Calc
  498.  
  499. <!DOCTYPE html>
  500. <html>
  501. <head>
  502. <meta charset="ISO-8859-1">
  503. <title> WHATEVER U FEEL SO </title>
  504. <script>
  505. var plus,minus,divide,prod,mod;
  506.  
  507. function calculate()
  508. {
  509. plus=document.calc.operator.options[0];
  510. minus=document.calc.operator.options[1];
  511. divide=document.calc.operator.options[2];
  512. prod=document.calc.operator.options[3];
  513. mod=document.calc.operator.options[4];
  514.  
  515. var fir=document.calc.val1.value;
  516. var sec=document.calc.val2.value;
  517.  
  518. if((fir==null)||(fir==""))
  519. { {
  520. alert("enter first number");
  521. fir.focus()
  522. }
  523. }
  524. if((sec==null)||(sec==""))
  525. {
  526. alert("enter second number")
  527. sec.focus()
  528. }
  529. x=parseInt(document.calc.val1.value)
  530. y=parseInt(document.calc.val2.value)
  531. if(plus.selected)
  532. document.calc.answer.value=x+y
  533. if(minus.selected)
  534. document.calc.answer.value=x-y
  535. if(divide.selected)
  536. document.calc.answer.value=x/y
  537. if(prod.selected)
  538. document.calc.answer.value=x*y
  539. if(mod.selected)
  540. document.calc.answer.value=x%y
  541. }
  542. </script>
  543. </head>
  544. <body>
  545. <h2>Calculator</h2>
  546. <form name="calc" >
  547. <input type=text name=val1 size=10>
  548. <select name=operator>
  549. <option value=plus>+
  550. <option value=minus>-
  551. <option value=divide>/
  552. <option value=prod>*
  553. <option value =mod>%
  554. </select>
  555. <input type=text name=val2 size=10>
  556. <input type=text name=answer size=10>
  557. <input type=button value=ans onClick="calculate()">
  558. </form>
  559. </body>
  560. </html>
  561. ---------------------------------------
  562.  
  563. 8. Php login
  564.  
  565. Php prgm
  566.  
  567.  
  568. <!DOCTYPE html>
  569.  
  570.  
  571. <html>
  572.  
  573.  
  574. <head>
  575.  
  576.  
  577. <meta charset="ISO-8859-1">
  578.  
  579.  
  580. <title>insert title here</title>
  581.  
  582.  
  583. </head>
  584.  
  585.  
  586. <body>
  587.  
  588.  
  589. <h1>login page</h1>
  590.  
  591.  
  592. <form action ="LOGO.php" method="post">
  593.  
  594.  
  595. user name:<input type="text" name="uname">
  596.  
  597.  
  598. password:<input type=text" name="pass">
  599.  
  600.  
  601. <input type="submit" value="login">
  602.  
  603.  
  604. </form>
  605.  
  606.  
  607. </body>
  608.  
  609.  
  610. </html>
  611.  
  612.  
  613.  
  614.  
  615. php file
  616.  
  617.  
  618.  
  619.  
  620.  
  621. <?php
  622.  
  623.  
  624. $username="root";
  625.  
  626.  
  627. $password="";
  628.  
  629.  
  630. $database="login";
  631.  
  632.  
  633.  
  634.  
  635. $first=$_POST["uname"];
  636.  
  637.  
  638. $pa=$_POST["pass"];
  639.  
  640.  
  641. $con=mysql_connect("localhost",$username,$password);
  642.  
  643.  
  644. mysql_select_db("login",$con);
  645.  
  646.  
  647.  
  648.  
  649. $query="select * from log";
  650.  
  651. $result=mysql_query($query);
  652.  
  653.  
  654.  
  655.  
  656. $f=1;
  657.  
  658.  
  659. while($row=mysql_fetch_array($result))
  660.  
  661.  
  662. {
  663.  
  664.  
  665. if($row['uname']==$first && $row['pass']==$pa)
  666.  
  667.  
  668.  
  669. {
  670.  
  671.  
  672.  $f=2;
  673.  
  674.  
  675. }
  676.  
  677.  
  678. }
  679.  
  680.  
  681. if($f==1)
  682.  
  683.  
  684. {
  685.  
  686.  
  687.  echo "login not correct";
  688.  
  689.  
  690. }
  691.  
  692.  
  693. else
  694.  
  695.  
  696. {
  697.  
  698.  
  699.  echo "correct";
  700.  
  701.  
  702.  header("location:success.html");
  703.  
  704.  
  705. }
  706.  
  707.  
  708. mysql_close();
  709.  
  710.  
  711. ?>
  712.  
  713.  
  714.  
  715. success page
  716.  
  717.  
  718.  
  719. <!DOCTYPE html>
  720.  
  721.  
  722. <html>
  723.  
  724.  
  725. <head>
  726.  
  727.  
  728. <meta charset="ISO-8859-1">
  729.  
  730. </html>
  731.  
  732. <body>
  733.  
  734. <h1>success
  735.  
  736. <br>
  737.  
  738. login correct</h1>
  739.  
  740.  
  741. </body>
  742.  
  743.  
  744. </html>
  745. ------------------------------------
  746. 9. Bank transaction
  747.  
  748. <html>
  749. <head>
  750.  
  751. <title>Insert title here</title>
  752. </head>
  753. <body>
  754. <form action="Bank_log.php" method="post">
  755. you Number:<input type="text" name="acc"><br>
  756. Pin :<input type="number" name="pin">
  757. <input type="submit" name="check" value="check">
  758. </form>
  759. </body>
  760. </html>
  761.  
  762. login php
  763.  
  764.  
  765.  
  766. <?php
  767. $username="root";
  768. $password="";
  769. $database="bankdb";
  770.  
  771. $first=$_POST["acc"];
  772. $pa=$_POST["pin"];
  773.  
  774.  
  775. session_start();
  776. $_SESSION['myValue']=$first;
  777. $con = mysql_connect("localhost",$username,$password);
  778. mysql_select_db("bankdb",$con);
  779.  
  780. $query = "select * from bank1";
  781. $result=mysql_query($query);
  782.  
  783. $f=1;
  784. while($row = mysql_fetch_array($result))
  785. {
  786. if($row['acc'] == $first && $row['pin'] == $pa)
  787. {
  788. $f=0;
  789. header("location:Bank_Wit.html");
  790.  
  791. }
  792. }
  793. if($f==1)
  794. {
  795. echo "login incorrect";
  796. }
  797.  
  798. mysql_close();
  799. ?>
  800.  
  801. operation html
  802.  
  803. <!DOCTYPE html>
  804. <html>
  805. <head>
  806. <meta charset="ISO-8859-1">
  807. <title>Insert title here</title>
  808. </head>
  809. <body>
  810. <form action="Bank_updat.php" method="post">
  811. <select name="sel">
  812. <option>Withdraw</option>
  813. <option>Deposit</option>
  814.  
  815.  
  816. </select>
  817. Enter ur amount:<input type="text" name="amt">
  818. <input type="submit" name="sub" value="update">
  819.  
  820. </form>
  821. </body>
  822. </html>
  823.  
  824. update php
  825.  
  826.  
  827.  
  828.  
  829.  
  830. <?php
  831. $username="root";
  832. $password="";
  833. $database="bankdb";
  834.  
  835. $wit=$_POST["sel"];
  836. $amt=$_POST["amt"];
  837. $con = mysql_connect("localhost",$username,$password);
  838. mysql_select_db("bankdb",$con);
  839.  
  840. session_start();
  841. $a= $_SESSION['myValue'];
  842.  
  843. $query = "select * from bank1";
  844. $result=mysql_query($query);
  845. $am=0;
  846. $f=1;
  847. while($row = mysql_fetch_array($result))
  848. {
  849. if($row['acc']==$a)
  850. {
  851. if ($wit=="Withdraw" )
  852. {
  853.  
  854. $am=$row['amt']-$amt;
  855. echo"record updated";
  856. }
  857. if ($wit=="Deposit")
  858. {
  859. $am=$row['amt']+$amt;
  860. echo "record add";
  861. }
  862. }
  863. }
  864. $query="update bank1 set amt='$am' where acc='$a' ";
  865. $result=mysql_query($query);
  866.  
  867. mysql_close();
  868. ?>
  869. ---------------------------------
  870. 10. Cookies
  871.  
  872. <!DOCTYPE html>
  873. <html>
  874. <head>
  875. <meta charset="ISO-8859-1">
  876. <title>Insert title here</title>
  877. </head>
  878. <body>
  879. <form method='post' action='cookies_sess.php'>
  880.  
  881. To: (Email) <br />
  882. <input type='text' name='recipient' size='35' />
  883. <p />
  884.  
  885. Subject: <br />
  886. <input type='text' name='topic' size ='35' />
  887. <br />
  888. Mail Message:
  889. <br />
  890. <textarea name='message' rows='4' cols='40'></textarea>
  891.  
  892. <br />
  893. <input type='submit' value='Send Message' />
  894. <br />
  895. </form>
  896.  
  897. </body>
  898. </html>
  899.  
  900. php
  901.  
  902. <?php
  903. $intime=60*60*24+time();
  904. setcookie('lastvisit',date("G:i -m/d/y"),$intime);
  905. if(isset($_COOKIE['lastvisit']))
  906. {
  907. $visit=$_COOKIE['lastvisit'];
  908. echo "you last visit was",$visit;
  909. }
  910. else
  911. echo"cookies expired";
  912.  
  913.  
  914. session_start();
  915. if(isset($_SESSION["vie"]))
  916. $_SESSION["vie"]=$_SESSION["vie"]+1;
  917. else
  918. $_SESSION['vie']=1;
  919. echo" page views=",$_SESSION["vie"];
  920. ?>
  921. --------------------------------------
  922. 11. form validation
  923.  
  924. <!DOCTYPE html>
  925.  
  926. <html>
  927.  
  928. <head>
  929.  
  930. <meta charset="ISO-8859-1">
  931.  
  932. <title>Insert title here</title>
  933.  
  934. <script type="text/javascript">
  935.  
  936. function val()
  937.  
  938. {
  939.  
  940. var nam=document.fname.nam;
  941.  
  942. var pas=document.fname.pass;
  943.  
  944. var pas1=document.fname.rpass;
  945.  
  946. var em=document.fname.email;
  947.  
  948. var no=document.fname.mno;
  949.  
  950. var dob=document.fname.db;
  951.  
  952.  
  953.  
  954. if(nam.value==""||nam.value==null)
  955.  
  956. {
  957.  
  958. alert("Name Should not be empty");
  959.  
  960. nam.focus();
  961.  
  962. nam.style.background = 'Yellow';
  963.  
  964.  
  965.  
  966. return false;
  967.  
  968. }
  969.  
  970. nam.style.background = 'white';
  971.  
  972. if(pas.value==""||pas1.value=="")
  973.  
  974. {
  975.  
  976. alert("password must not be empty");
  977.  
  978. return false;
  979.  
  980. }
  981.  
  982.  
  983.  
  984. if(pas.value!=pas1.value)
  985.  
  986. {
  987.  
  988. alert("Password must match");
  989.  
  990. pas1.value="";
  991.  
  992. pas1.focus();
  993.  
  994. pas1.style.background = 'Yellow';
  995.  
  996. return false;
  997.  
  998.  
  999.  
  1000. }
  1001.  
  1002.  
  1003.  
  1004. if(no.value.length != 10)
  1005.  
  1006. {
  1007.  
  1008. alert("enter 10 digit number");
  1009.  
  1010. no.focus();
  1011.  
  1012. no.style.background = 'Yellow';
  1013.  
  1014. return false;
  1015.  
  1016. }
  1017.  
  1018. var dt=new Date();
  1019. alert(dt);
  1020.  
  1021. var mon=dt.getMonth()-1;
  1022.  
  1023. var day=dt.getDate();
  1024.  
  1025. var year=dt.getFullYear();
  1026.  
  1027.  
  1028.  
  1029. var d=dob.value.slice(0,4);
  1030.  
  1031. var m=dob.value.slice(5,7);
  1032.  
  1033. var y=dob.value.slice(8,10);
  1034.  
  1035.  
  1036.  
  1037. if((parseInt(y)<day)||(parseInt(m)<mon)||(parseInt(d)<day))
  1038.  
  1039. {
  1040.  
  1041. alert ("invalid date");
  1042.  
  1043. dob.focus();
  1044.  
  1045. dob.style.background = 'Yellow';
  1046.  
  1047. return false;
  1048.  
  1049. }
  1050.  
  1051.  
  1052.  
  1053. return true;
  1054.  
  1055. }
  1056.  
  1057. </script>
  1058.  
  1059.  
  1060.  
  1061. </head>
  1062.  
  1063. <body>
  1064.  
  1065. <form name="fname" action="welcome.html" onsubmit="return val()">
  1066.  
  1067. <h2>Ticket Booking:<br></h2>
  1068.  
  1069. <table>
  1070.  
  1071. <tr><th>
  1072.  
  1073. Enter your Name: </th><td><input type="text" name="nam"><br></td>
  1074.  
  1075. </tr>
  1076.  
  1077. <tr><th>
  1078.  
  1079. Enter the Password: </th><td> <input type="password" name="pass"><br></td></tr>
  1080.  
  1081. <tr><th>
  1082.  
  1083. Re enter the password: </th><td> <input type="password" name="rpass"><br></td></tr>
  1084.  
  1085.  
  1086.  
  1087. <tr><th>
  1088.  
  1089. E-mail: </th><td> <input type="email" name="email"><br></td></tr>
  1090.  
  1091. <tr><th>
  1092.  
  1093.  
  1094.  
  1095. <tr><th>Mobile Number: </th><td><input type="number" name="mno"><br></td></tr>
  1096.  
  1097. <tr><th>No of Tickets:</th><td> <select>
  1098.  
  1099. <option>1</option>
  1100.  
  1101. <option>2</option>
  1102.  
  1103. <option>3</option>
  1104.  
  1105. <option>4</option>
  1106.  
  1107. <option>5</option>
  1108.  
  1109. <option>6</option>
  1110.  
  1111. </select><br></td></tr>
  1112.  
  1113. <tr><th>
  1114.  
  1115. Date: </th><td> <input type="date" name="db"><br></td></tr>
  1116.  
  1117. <tr><th rowspan="2"><input type="submit" name="sub" value="Book"><br></th></tr>
  1118.  
  1119. </table>
  1120.  
  1121. </form>
  1122.  
  1123. </body>
  1124.  
  1125. </html>
  1126. --------------------------------------
  1127. 12. book
  1128.  
  1129. <html>
  1130. <body>
  1131. <?php
  1132. $username="root";
  1133. $password="";
  1134. $database="bookdb";
  1135. $con = mysql_connect("localhost",$username,$password);
  1136. $db=mysql_select_db("bookdb",$con);
  1137. $query = "select bname from book";
  1138. $result=mysql_query($query);
  1139. ?>
  1140. <form method="post" action="bookdisp.php">
  1141. search:<select name=sel>
  1142. <?php
  1143. while ($row = mysql_fetch_array($result))
  1144. {
  1145. ?>
  1146. <option><?php echo $row['bname'];?>
  1147. </option>
  1148. <?php }?>
  1149. </select>
  1150. <input type="submit" value="search">
  1151. </form>
  1152. <?php
  1153. mysql_close();
  1154. ?>
  1155. </body></html>
  1156.  
  1157.  
  1158.  
  1159.  
  1160. <?php
  1161. $username="root";
  1162. $password="";
  1163. $database="bookdb";
  1164.  
  1165. $selval=$_POST["sel"];
  1166.  
  1167. $con = mysql_connect("localhost",$username,$password);
  1168. mysql_select_db("bookdb",$con);
  1169.  
  1170. $query = "select * from book where bname='$selval'";
  1171. $result=mysql_query($query);
  1172. echo "<table border=1><tr><th>BOOKID</th>
  1173.  
  1174. <th>BOOKNAME</th><th>BOOKpublisher</th><th>BOOKNumber</th></tr>";
  1175.  
  1176. $row = mysql_fetch_array($result);
  1177.  
  1178.  
  1179. echo "<tr><td>",$row['bookid'] ,"</td><td> ", $row['bname']," </td><td>", $row['bpublisher']," </td><td>", $row['bnumber'],"</td><tr></table><br>";
  1180.  
  1181.  
  1182.  
  1183. mysql_close();
  1184. ?>
Add Comment
Please, Sign In to add comment