Guest User

Web Programming Lab Manual

a guest
Nov 5th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.79 KB | None | 0 0
  1. 1)TIMETABLE
  2. <html>
  3. <head>
  4. <link rel="stylesheet" href="tlink.css">
  5. </head>
  6. <table border="1">
  7. <tr>
  8. <th>DAYS</th>
  9. <th>9:30-10:30</th>
  10. <th>10:45-11:45</th>
  11. <th>11:45-12:45</th>
  12. <th>12:45-1:45</th>
  13. <th>1:45-2:30</th>
  14. <th>2:30-3:30</th>
  15. <th>3:30-4:30</th>
  16. <th>4:30-5:30</th>
  17. </tr>
  18.  
  19. <tr>
  20. <td>MONDAY</td>
  21. <td> </td>
  22. <td>AI</td>
  23. <td>WP</td>
  24. <td>ADA</td>
  25. <td rowspan="6"> BREAK</td>
  26. <td> </td>
  27. <td> </td>
  28. <td> </td>
  29. </tr>
  30.  
  31. <tr>
  32. <td>TUESDAY</td>
  33. <td> </td>
  34. <td>OOAD</td>
  35. <td>CN</td>
  36. <td>AI</td>
  37. <td>WP</td>
  38. <td> </td>
  39. <td> </td>
  40. </tr>
  41.  
  42. <tr>
  43. <td>WEDNESDAY</td>
  44. <td colspan="3"><center>ADA LAB</center></td>
  45. <td>OOAD</td>
  46. <td>ADA</td>
  47. <td>WP</td>
  48. <td> </td>
  49. </tr>
  50.  
  51. <tr>
  52. <td>THURSDAY</td>
  53. <td colspan="3"><center>WP LAB</center></td>
  54. <td>CN</td>
  55. <td>ADA</td>
  56. <td>AI</td>
  57. <td> </td>
  58. </tr>
  59.  
  60. <tr>
  61. <td>FRIDAY</td>
  62. <td> </td>
  63. <td>AI</td>
  64. <td>CN</td>
  65. <td>OOAD</td>
  66. <td colspan="3"><center>PROJECT LAB</center></td>
  67. </tr>
  68.  
  69. <tr>
  70. <td>SATURDAY</td>
  71. <td>ADA</td>
  72. <td>WP</td>
  73. <td>CN</td>
  74. <td>OOAD</td>
  75. <td> </td>
  76. <td> </td>
  77. <td> </td>
  78. </tr>
  79. -------------------------------------------------------------------------------------------------------------------------
  80. 2)MARQUEE
  81. -------------------------------------------------------------------------------------------------------------------------
  82. <!DOCTYPE html>
  83. <html>
  84. <head>
  85.  
  86. <title>Insert title here</title>
  87.  
  88. <style type="text/css">
  89.  
  90. img{opacity:0.5;}
  91.  
  92. marquee
  93. {
  94. height:100%;
  95. bottom:0;
  96. width:200px;
  97. float:right;
  98. }
  99.  
  100.  
  101. img:hover
  102. {opacity:1}
  103.  
  104. li{
  105. color:purple;
  106. font-family:Algerian;
  107. }
  108. </style>
  109.  
  110. </head>
  111.  
  112. <body>
  113.  
  114. <marquee onmouseover="stop()" onmouseout="start()" scrollamount="2" direction="up" behavior="scroll">
  115.  
  116. <img alt="IMG1" width=100 height=100 src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg"><br>
  117. <img alt="IMG2" width=100 height=100 src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg"><br>
  118.  
  119. <img alt="IMG3" width=100 height=100 src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Water lilies.jpg"><br>
  120. <img alt="IMG4" width=100 height=100 src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg"><br>
  121.  
  122. <img alt="IMG5" width=100 height=100 src="Koala.jpg">
  123.  
  124. </marquee>
  125.  
  126. <header> LIST OF IMAGES DISPLAYED</header>
  127.  
  128. <ol>
  129. <li>BLUE HILLS</li>
  130. <li>SUN SET</li>
  131. <li>LILLIES</li>
  132. <li>WINTER</li>
  133. </ol>
  134.  
  135. </body>
  136.  
  137. </html>
  138.  
  139. CSS
  140. img(opacity:0.5;}
  141. maequee(
  142. width:200px;
  143. }
  144. img hover{opacity:1}
  145. ol{
  146. type:disc;
  147. }
  148. li{
  149. color:blue;
  150. font-family:Bernard MT Condensed;
  151. }
  152. --------------------------------------------------------------------------------------------------------------------------------------
  153. 3)SECTION
  154. --------------------------------------------------------------------------------------------------------------------------------------
  155. <!DOCTYPE html>
  156. <html>
  157. <title>HTML5</title>
  158. <meta charset="utf-8">
  159. <style>
  160. body {
  161.  
  162. font-family:Verdana,sans-serif;font-size:0.8em;
  163.  
  164. }
  165. aside{
  166.  
  167. float:right;
  168. height:620;
  169. width:300;
  170.  
  171. border:1px solid;
  172.  
  173. margin:5px;margin-bottom:15px;padding:8px;
  174.  
  175. background-color:white;
  176.  
  177. }
  178.  
  179. header,footer,section,article
  180. {
  181.  
  182. border:1px solid grey;
  183.  
  184. margin:5px;margin-bottom:15px;padding:8px;
  185.  
  186. background-color:white;
  187.  
  188. }
  189.  
  190. header,footer
  191. {
  192.  
  193. color:white;background-color:#444;margin-bottom:5px;
  194.  
  195. }
  196.  
  197. article{
  198.  
  199.  
  200.  
  201. width:700px;
  202.  
  203.  
  204.  
  205. }
  206.  
  207. section
  208. {
  209.  
  210. background-color:#ddd;
  211.  
  212. }
  213.  
  214.  
  215. nav ul
  216. {
  217.  
  218. margin:0;padding:0;
  219.  
  220. }
  221.  
  222. nav ul li
  223. {
  224.  
  225. display:inline; margin:5px;
  226.  
  227. }
  228.  
  229. </style>
  230.  
  231. <body>
  232.  
  233. <header>
  234.  
  235. <h1>Monday Times</h1>
  236.  
  237. </header>
  238.  
  239. <nav>
  240.  
  241. <ul>
  242.  
  243. <li>Time Table</li>
  244.  
  245. <li>Course</li>
  246.  
  247. </ul>
  248.  
  249. </nav>
  250.  
  251. <section>
  252.  
  253. <h2>News Section</h2>
  254.  
  255. <aside>
  256.  
  257. <img src="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg" width=300 height="200"><br>
  258.  
  259. <br>
  260.  
  261. <br>
  262.  
  263. Welcome
  264.  
  265. <br>
  266. to
  267.  
  268. <br>
  269. NCJ
  270.  
  271. <br>
  272.  
  273. </aside>
  274.  
  275. <article>
  276.  
  277. <h2>News Article1</h2>
  278.  
  279. <p>
  280.  
  281. <table border=1>
  282.  
  283. <tr>
  284.  
  285. <th>9.30</th>
  286.  
  287. <th>10.30</th><th>11.30</th><th>12.30</th></tr>
  288.  
  289. <tr>
  290.  
  291. <th>AI</th>
  292.  
  293. <th>IT</th><th>OOAD</th><th>ADA</th></tr>
  294.  
  295. <tr>
  296.  
  297. <th>OOAD</th>
  298.  
  299. <th>IT</th><th>ADA</th><th>AI</th></tr>
  300.  
  301. <tr>
  302.  
  303. <th>IT</th>
  304.  
  305. <th>AI</th><th>OOAD</th><th>ADA</th></tr>
  306.  
  307. </table>
  308.  
  309. </p>
  310.  
  311. </article>
  312.  
  313. <article>
  314.  
  315. <h2>News Article</h2>
  316.  
  317. <p>
  318.  
  319. .BCA<br>
  320.  
  321. .B.Sc<br>
  322.  
  323. .BA<br>.B.Com<br>
  324.  
  325. </P>
  326.  
  327. <P>
  328.  
  329. M.Sc
  330.  
  331. <br>.COMPUTER SCIENCE<br>.PHYSICS<br>.MATHS<br>
  332.  
  333. </article>
  334.  
  335. </section>
  336.  
  337. <footer>
  338.  
  339. <p>&copy; 2015 National College Jayanagar. All rights reserved.</p>
  340.  
  341. </footer>
  342.  
  343. </body>
  344.  
  345. </html>
  346. --------------------------------------------------------------------------------------------------------------------------------------
  347. 4)FORM
  348. ---------------------------------------------------------------------------------------------------------------------------------------
  349. <!DOCTYPE html>
  350. <html>
  351. <head>
  352. <script language="javascript">
  353. function cal()
  354. {
  355. var m1,m2,m3,m4,avg=0,total=0,result="",grade="";
  356. m1=parseInt(document.student.s1.value);
  357. m2=parseInt(document.student.s2.value);
  358. m3=parseInt(document.student.s3.value);
  359. m4=parseInt(document.student.s4.value);
  360. alert(m1);
  361. total=m1+m2+m3+m4;
  362. avg=total/4;
  363. if(m1<35||m2<35||m3<35||m4<35)
  364. {
  365. result="fail";
  366. grade="D";
  367. }
  368. else if(avg>=75)
  369. {
  370. result="distinction";
  371. grade="A+";
  372. }
  373. else if(avg>=60||avg<75)
  374. {
  375. result="first class";
  376. grade="A"
  377. }
  378. else if(avg>=50||avg<60)
  379. {
  380. result="second class";
  381. grade="B";
  382. }
  383. else if(avg>=35||avg<50)
  384. {
  385. result="pass class";
  386. grade="C";
  387. }
  388. else if(avg<35)
  389. {
  390. result="fail";
  391. grade="D";
  392. }
  393. document.student.result.value=result;
  394. document.student.grade.value=grade;
  395. document.student.total.value=total;
  396. document.student.avg.value=avg;
  397. }
  398. </script>
  399. </head>
  400. <body>
  401. <h2><center>Result calculation for a student</center></h2><br/>
  402. <center><form name="student" method="get" action="">
  403. Name &nbsp
  404. <input type="text" name="name" id="t1" value=""><br/><br/>
  405. class &nbsp;&nbsp
  406. <input type="text" name="cls" id="t2" value=""><br/><br/>
  407. sub1 &nbsp;&nbsp
  408. <input type="text" name="s1" id="t3" value=""><br/><br/>
  409. sub2 &nbsp;&nbsp
  410. <input type="text" name="s2" id="t4" value=""><br/><br/>
  411. sub3 &nbsp;&nbsp
  412. <input type="text" name="s3" id="t5 value=""><br/><br/>
  413. sub4 &nbsp;&nbsp
  414. <input type="text" name="s4" id="t6" value=""><br/><br/>
  415. <input type="button" onclick="cal()" value="calculate">
  416. <br/><br/><br/>total &nbsp;&nbsp
  417. <input type="text" name="total" id="t7" value=""><br/><br/>
  418. average
  419. <input type="text" name="avg" id="t8" value=""><br/><br/>
  420. result &nbsp;&nbsp
  421. <input type="text" name="result" id="t9" value=""><br/><br/>
  422. grade &nbsp;&nbsp
  423. <input type="text" name="grade" id="t10" value=""><br/><br/>
  424. </form></center>
  425. </body>
  426. </html>
  427. ---------------------------------------------------------------------------------------------------------------------------------------
  428. 5)CALCULATOR
  429. ---------------------------------------------------------------------------------------------------------------------------------------
  430. <html>
  431. <head></head>
  432. <body>
  433. <h3>Simple Calculator</h3>
  434. <br/>
  435.  
  436. <form Name="calc">
  437. <table id="calc" border=2>
  438. <tr>
  439. <td colspan=5><input id="btn" name="display" onkeypress="return event.charCode >= 48 && event.charCode <= 57" type="text"></td>
  440. <td style="display:none"><input name="M" type="number"></td>
  441. </tr>
  442. <tr>
  443. <td><input id="btn" type=button value="MC" OnClick="calc.M.value=''"></td>
  444. <td><input id="btn" type=button value="0" OnClick="calc.display.value+='0'"></td>
  445. <td><input id="btn" type=button value="1" OnClick="calc.display.value+='1'"></td>
  446. <td><input id="btn" type=button value="2" OnClick="calc.display.value+='2'"></td>
  447. <td><input id="btn" type=button value="+" OnClick="calc.display.value+='+'"></td>
  448. </tr>
  449. <tr>
  450. <td><input id="btn" type=button value="MS" OnClick="calc.M.value=calc.display.value"></td>
  451. <td><input id="btn" type=button value="3" OnClick="calc.display.value+='3'"></td>
  452. <td><input id="btn" type=button value="4" OnClick="calc.display.value+='4'"></td>
  453. <td><input id="btn" type=button value="5" OnClick="calc.display.value+='5'"></td>
  454. <td><input id="btn" type=button value="-" OnClick="calc.display.value+='-'"></td>
  455. </tr>
  456. <tr>
  457. <td><input id="btn" type=button value="MR" OnClick="calc.display.value=calc.M.value"></td>
  458. <td><input id="btn" type=button value="6" OnClick="calc.display.value+='6'"></td>
  459. <td><input id="btn" type=button value="7" OnClick="calc.display.value+='7'"></td>
  460. <td><input id="btn" type=button value="8" OnClick="calc.display.value+='8'"></td>
  461. <td><input id="btn" type=button value="x" OnClick="calc.display.value+='*'"></td>
  462. </tr>
  463. <tr>
  464. <td><input id="btn" type=button value="M+" OnClick="calc.M.value=(Number(calc.M.value))+(Number(calc.display.value))"></td>
  465. <td><input id="btn" type=button value="9" OnClick="calc.display.value+='9'"></td>
  466. <td><input id="btn" type=button value="±"
  467.  
  468. OnClick="calc.display.value=(calc.display.value==Math.abs(calc.display.value)?-(calc.display.value):Math.abs(calc.display.value))">
  469.  
  470. </td>
  471. <td><input id="btn" type=button value="=" OnClick="calc.display.value=eval(calc.display.value)"></td>
  472. <td><input id="btn" type=button value="/" OnClick="calc.display.value+='/'"></td>
  473. </tr>
  474. <tr>
  475. <td><input id="btn" type=button value="1/x" OnClick="calc.display.value=1/calc.display.value"></td>
  476. <td><input id="btn" type=button value="." OnClick="calc.display.value+='.'"></td>
  477. <td><input id="btn" type=button value="x2" OnClick="calc.display.value=Math.pow(calc.display.value,2)"></td>
  478. <td><input id="btn" type=button value="v" OnClick="calc.display.value=Math.sqrt(calc.display.value)"></td>
  479. <td><input id="btn" type=button value="C" OnClick="calc.display.value=''"></td>
  480. </tr>
  481. </table>
  482. </form>
  483. </body>
  484. </html>
  485. --------------------------------------------------------------------------------------------------------------------------------------
  486. 6)Bank Transaction (PHP)
  487. <html>
  488. <head>
  489.  
  490. <title>Insert title here</title>
  491. </head>
  492. <body>
  493. <form action="Bank_log.php" method="post">
  494. you Number:<input type="text" name="acc"><br>
  495. Pin :<input type="number" name="pin">
  496. <input type="submit" name="check" value="check">
  497. </form>
  498. </body>
  499. </html>
  500.  
  501. login php
  502. <?php
  503. $username="root";
  504. $password="";
  505. $database="bankdb";
  506.  
  507. $first=$_POST["acc"];
  508. $pa=$_POST["pin"];
  509.  
  510.  
  511. session_start();
  512. $_SESSION['myValue']=$first;
  513. $con = mysql_connect("localhost",$username,$password);
  514. mysql_select_db("bankdb",$con);
  515.  
  516. $query = "select * from bank1";
  517. $result=mysql_query($query);
  518.  
  519. $f=1;
  520. while($row = mysql_fetch_array($result))
  521. {
  522. if($row['acc'] == $first && $row['pin'] == $pa)
  523. {
  524. $f=0;
  525. header("location:Bank_Wit.html");
  526.  
  527. }
  528. }
  529. if($f==1)
  530. {
  531. echo "login incorrect";
  532. }
  533.  
  534. mysql_close();
  535. ?>
  536.  
  537. operation html
  538.  
  539. <!DOCTYPE html>
  540. <html>
  541. <head>
  542. <meta charset="ISO-8859-1">
  543. <title>Insert title here</title>
  544. </head>
  545. <body>
  546. <form action="Bank_updat.php" method="post">
  547. <select name="sel">
  548. <option>Withdraw</option>
  549. <option>Deposit</option>
  550.  
  551.  
  552. </select>
  553. Enter ur amount:<input type="text" name="amt">
  554. <input type="submit" name="sub" value="update">
  555.  
  556. </form>
  557. </body>
  558. </html>
  559.  
  560. update php
  561. <?php
  562. $username="root";
  563. $password="";
  564. $database="bankdb";
  565.  
  566. $wit=$_POST["sel"];
  567. $amt=$_POST["amt"];
  568. $con = mysql_connect("localhost",$username,$password);
  569. mysql_select_db("bankdb",$con);
  570.  
  571. session_start();
  572. $a= $_SESSION['myValue'];
  573.  
  574. $query = "select * from bank1";
  575. $result=mysql_query($query);
  576. $am=0;
  577. $f=1;
  578. while($row = mysql_fetch_array($result))
  579. {
  580. if($row['acc']==$a)
  581. {
  582. if ($wit=="Withdraw" )
  583. {
  584.  
  585. $am=$row['amt']-$amt;
  586. echo"record updated";
  587. }
  588. if ($wit=="Deposit")
  589. {
  590. $am=$row['amt']+$amt;
  591. echo "record add";
  592. }
  593. }
  594. }
  595. $query="update bank1 set amt='$am' where acc='$a' ";
  596. $result=mysql_query($query);
  597.  
  598. mysql_close();
  599. ?>
  600. ---------------------------------------------------------------------------------------------------------------------------------------
  601. 7)FORM VALIDATION/TICKET (PHP)
  602.  
  603. <!DOCTYPE html>
  604.  
  605. <html>
  606.  
  607. <head>
  608.  
  609. <meta charset="ISO-8859-1">
  610.  
  611. <title>Insert title here</title>
  612.  
  613. <script type="text/javascript">
  614.  
  615. function val()
  616.  
  617. {
  618.  
  619. var nam=document.fname.nam;
  620.  
  621. var pas=document.fname.pass;
  622.  
  623. var pas1=document.fname.rpass;
  624.  
  625. var em=document.fname.email;
  626.  
  627. var no=document.fname.mno;
  628.  
  629. var dob=document.fname.db;
  630.  
  631.  
  632.  
  633. if(nam.value==""||nam.value==null)
  634.  
  635. {
  636.  
  637. alert("Name Should not be empty");
  638.  
  639. nam.focus();
  640.  
  641. nam.style.background = 'Yellow';
  642.  
  643.  
  644.  
  645. return false;
  646.  
  647. }
  648.  
  649. nam.style.background = 'white';
  650.  
  651. if(pas.value==""||pas1.value=="")
  652.  
  653. {
  654.  
  655. alert("password must not be empty");
  656.  
  657. return false;
  658.  
  659. }
  660.  
  661.  
  662.  
  663. if(pas.value!=pas1.value)
  664.  
  665. {
  666.  
  667. alert("Password must match");
  668.  
  669. pas1.value="";
  670.  
  671. pas1.focus();
  672.  
  673. pas1.style.background = 'Yellow';
  674.  
  675. return false;
  676.  
  677.  
  678.  
  679. }
  680.  
  681.  
  682.  
  683. if(no.value.length != 10)
  684.  
  685. {
  686.  
  687. alert("enter 10 digit number");
  688.  
  689. no.focus();
  690.  
  691. no.style.background = 'Yellow';
  692.  
  693. return false;
  694.  
  695. }
  696.  
  697. var dt=new Date();
  698. alert(dt);
  699.  
  700. var mon=dt.getMonth()-1;
  701.  
  702. var day=dt.getDate();
  703.  
  704. var year=dt.getFullYear();
  705.  
  706.  
  707.  
  708. var d=dob.value.slice(0,4);
  709.  
  710. var m=dob.value.slice(5,7);
  711.  
  712. var y=dob.value.slice(8,10);
  713.  
  714.  
  715.  
  716. if((parseInt(y)<day)||(parseInt(m)<mon)||(parseInt(d)<day))
  717.  
  718. {
  719.  
  720. alert ("invalid date");
  721.  
  722. dob.focus();
  723.  
  724. dob.style.background = 'Yellow';
  725.  
  726. return false;
  727.  
  728. }
  729.  
  730.  
  731.  
  732. return true;
  733.  
  734. }
  735.  
  736. </script>
  737. </head>
  738. <body>
  739. <form name="fname" action="welcome.html" onsubmit="return val()">
  740. <h2>Ticket Booking:<br></h2>
  741. <table>
  742. <tr><th>
  743. Enter your Name: </th><td><input type="text" name="nam"><br></td>
  744. </tr>
  745. <tr><th>
  746. Enter the Password: </th><td> <input type="password" name="pass"><br></td></tr>
  747. <tr><th>
  748. Re enter the password: </th><td> <input type="password" name="rpass"><br></td></tr>
  749. <tr><th>
  750. E-mail: </th><td> <input type="email" name="email"><br></td></tr>
  751. <tr><th>
  752. <tr><th>Mobile Number: </th><td><input type="number" name="mno"><br></td></tr>
  753. <tr><th>No of Tickets:</th><td> <select>
  754. <option>1</option>
  755. <option>2</option>
  756. <option>3</option>
  757. <option>4</option>
  758. <option>5</option>
  759. <option>6</option>
  760. </select><br></td></tr>
  761. <tr><th>
  762. Date: </th><td> <input type="date" name="db"><br></td></tr>
  763. <tr><th rowspan="2"><input type="submit" name="sub" value="Book"><br></th></tr>
  764. </table>
  765. </form>
  766. </body>
  767. </html>
  768.  
  769. -------------------------------------------------------------------------------------------------------------------------------------
  770. 8)Book Details (PHP)
  771.  
  772. <html>
  773. <body>
  774. <?php
  775. $username="root";
  776. $password="";
  777. $database="bookdb";
  778. $con = mysql_connect("localhost",$username,$password);
  779. $db=mysql_select_db("bookdb",$con);
  780. $query = "select bname from book";
  781. $result=mysql_query($query);
  782. ?>
  783. <form method="post" action="bookdisp.php">
  784. search:<select name=sel>
  785. <?php
  786. while ($row = mysql_fetch_array($result))
  787. {
  788. ?>
  789. <option><?php echo $row['bname'];?>
  790. </option>
  791. <?php }?>
  792. </select>
  793. <input type="submit" value="search">
  794. </form>
  795. <?php
  796. mysql_close();
  797. ?>
  798. </body></html>
  799.  
  800. <?php
  801. $username="root";
  802. $password="";
  803. $database="bookdb";
  804.  
  805. $selval=$_POST["sel"];
  806.  
  807. $con = mysql_connect("localhost",$username,$password);
  808. mysql_select_db("bookdb",$con);
  809.  
  810. $query = "select * from book where bname='$selval'";
  811. $result=mysql_query($query);
  812. echo "<table border=1><tr><th>BOOKID</th>
  813.  
  814. <th>BOOKNAME</th><th>BOOKpublisher</th><th>BOOKNumber</th></tr>";
  815.  
  816. $row = mysql_fetch_array($result);
  817.  
  818.  
  819. echo "<tr><td>",$row['bookid'] ,"</td><td> ", $row['bname']," </td><td>", $row['bpublisher']," </td><td>", $row['bnumber'],"</td><tr></table><br>";
  820. mysql_close();
  821. ?>
  822.  
  823. --------------------------------------------------------------------------------------------------------------------------------------
  824. 9)Cookies
  825. <!DOCTYPE html>
  826. <html>
  827. <head>
  828. <meta charset="ISO-8859-1">
  829. <title>Insert title here</title>
  830. </head>
  831. <body>
  832. <form method='post' action='cookies_sess.php'>
  833.  
  834. To: (Email) <br />
  835. <input type='text' name='recipient' size='35' />
  836. <p />
  837.  
  838. Subject: <br />
  839. <input type='text' name='topic' size ='35' />
  840. <br />
  841. Mail Message:
  842. <br />
  843. <textarea name='message' rows='4' cols='40'></textarea>
  844.  
  845. <br />
  846. <input type='submit' value='Send Message' />
  847. <br />
  848. </form>
  849.  
  850. </body>
  851. </html>
  852.  
  853. php
  854.  
  855. <?php
  856. $intime=60*60*24+time();
  857. setcookie('lastvisit',date("G:i -m/d/y"),$intime);
  858. if(isset($_COOKIE['lastvisit']))
  859. {
  860. $visit=$_COOKIE['lastvisit'];
  861. echo "you last visit was",$visit;
  862. }
  863. else
  864. echo"cookies expired";
  865.  
  866.  
  867. session_start();
  868. if(isset($_SESSION["vie"]))
  869. $_SESSION["vie"]=$_SESSION["vie"]+1;
  870. else
  871. $_SESSION['vie']=1;
  872. echo" page views=",$_SESSION["vie"];
  873. ?>
Add Comment
Please, Sign In to add comment