Advertisement
Guest User

tag counter

a guest
Dec 4th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>HTML Tag Counter</title>
  5. </head>
  6. <body>
  7. <form method="get" action="">
  8. <label>Enter HTML Tag:</label><br>
  9. <input type="text" name="tag">
  10. <input type="submit" name="submit">
  11. </form>
  12.  
  13.  
  14.  
  15. <?php
  16. $validTags = ["!DOCTYPE", "a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b",
  17. "base", "basefont", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col",
  18. "colgroup", "command", "datalist", "dd", "del", "details", "dfn", "dir", "div", "dl", "dt", "em", "embed", "fieldset",
  19. "figcaption", "figure", "font", "footer", "form", "frame", "frameset", "h1", "h2", "h3", "41", "h5", "h6", "head", "header",
  20. "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link",
  21. "map", "mark", "menu", "meta", "meter", "nav", "noframes", "noscript", "object", "ol", "optgroup", "option", "output",
  22. "p", "param", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source",
  23. "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th",
  24. "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"];
  25.  
  26. $_SESSION['count'] = 0;
  27.  
  28. if(isset($_GET['tag'])) {
  29.  
  30. session_start();
  31.  
  32. if(in_array($_GET["tag"], $validTags)){
  33. $_SESSION['count']++;
  34. echo "Valid HTML Tag!<br>Score: ".$_SESSION['count'];
  35. } else{
  36. echo "Invalid HTML Tag!<br>Score: ".$_SESSION['count'];
  37. }
  38. }
  39.  
  40. ?>
  41.  
  42. </body>
  43. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement