{"id":213,"date":"2010-05-01T16:05:45","date_gmt":"2010-05-01T23:05:45","guid":{"rendered":"http:\/\/192.168.1.2\/wordpress\/?p=213"},"modified":"2013-03-13T17:31:03","modified_gmt":"2013-03-14T00:31:03","slug":"studyroom-reservation","status":"publish","type":"post","link":"http:\/\/cywang.no-ip.org\/wordpress\/?p=213","title":{"rendered":"Studyroom Reservation"},"content":{"rendered":"<p>\n\tFeatures:\n<\/p>\n<ol>\n<li>\n\t\tLogin automatically\n\t<\/li>\n<li>\n\t\tAutomatically select an available seat\n\t<\/li>\n<li>\n\t\tSend a text message to your cellular phone via <a href=\"http:\/\/www.smsgo.com.tw\">SMSGO API<\/a>\n\t<\/li>\n<\/ol>\n<p>\n\tIn order to login to the reservation system, I use <a href=\"http:\/\/www.ieinspector.com\/httpanalyzer\">HTTP Analyzer <\/a>to analyze HTTP\/HTTPS traffic:\n<\/p>\n<p><!--more--><\/p>\n<p>\n\t<em>login.aspx?type=1&amp;__EVENTTARGET=LinkButton1&amp;__EVENTARGUMENT=&amp;__VIEWSTATE=%2FwEPDwUJNjY4NzU5MzE0ZGTZg4txRnBH%2Bs%2B84oIQlb%2Bz%2BJlJLQ%3D%3D&amp;__EVENTVALIDATION=%2FwEWBQKoi57rDgLr%2F4HeAgK%2Bmv37AgLM9PumDwKxi96RBUBQxiaTFm%2FOXRelnZ%2BE%2FRkGRcDS&amp;UserId=UserId;PassWd=PassWd<\/em>\n<\/p>\n<p>\n\tThen, I can use the above parameters to login to the system.\n<\/p>\n<p>\n\tAlso, there are two parameters used to select a seat: seatID and date.\n<\/p>\n<p>\n\t<strong>Main Screen:<\/strong>\n<\/p>\n<p>\n\t<a href=\"http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/studyroom_reservation.jpg\"><img loading=\"lazy\" decoding=\"async\" alt=\"studyroom_reservation\" class=\"alignnone size-full wp-image-219\" height=\"600\" src=\"http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/studyroom_reservation.jpg\" width=\"582\" \/><\/a>\n<\/p>\n<p>\n\t<strong>Available\/Unavailable Seats:<\/strong>\n<\/p>\n<p>\n\t<a href=\"http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats.jpg\"><img loading=\"lazy\" decoding=\"async\" alt=\"seats\" class=\"alignnone size-large wp-image-217\" height=\"223\" src=\"http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats-1024x392.jpg\" width=\"584\" srcset=\"http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats-1024x392.jpg 1024w, http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats-300x115.jpg 300w, http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats-500x191.jpg 500w, http:\/\/cywang.no-ip.org\/wordpress\/wp-content\/uploads\/2010\/05\/seats.jpg 1027w\" sizes=\"auto, (max-width: 584px) 100vw, 584px\" \/><\/a>\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t<strong>Partial code:<\/strong>\n<\/p>\n<pre class=\"brush:cpp;\">\r\nif(iURLPos == 1)\/\/iURLPos :current webpage (0: home; 1: login page; 2: select seat page; 3: reservation result)\r\n{\r\n&nbsp;&nbsp;&nbsp;&nbsp;Timer_Login-&gt;Enabled = false;\r\n&nbsp;&nbsp;&nbsp;&nbsp;Variant doc = CppWebBrowser_Main-&gt;ControlInterface-&gt;Document;\r\n&nbsp;&nbsp;&nbsp;&nbsp;if (((IDispatch *)doc) != NULL)\r\n&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant body = doc.OlePropertyGet(&quot;Body&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant html = body.OlePropertyGet(&quot;InnerHTML&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnsiString tmp_body = html;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(tmp_body.Pos(&quot;logout&quot;)&gt;0)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Timer_Login-&gt;Enabled = false;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Btn_Seat-&gt;OnClick(Sender);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Timer_Login-&gt;Enabled = true;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n}\r\nelse if(iURLPos == 2)\r\n{\r\n&nbsp;&nbsp;&nbsp;&nbsp;Timer_Refresh-&gt;Enabled = false;\r\n&nbsp;&nbsp;&nbsp;&nbsp;Variant doc = CppWebBrowser_Main-&gt;ControlInterface-&gt;Document;\r\n&nbsp;&nbsp;&nbsp;&nbsp;if (((IDispatch *)doc) != NULL)\r\n&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant body = doc.OlePropertyGet(&quot;Body&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant html = body.OlePropertyGet(&quot;InnerHTML&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnsiString tmp_body = html;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(tmp_body.Pos(&quot;2013\/2&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/3&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/4&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/5&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/6&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/7&quot;)&gt;0 || tmp_body.Pos(&quot;2013\/8&quot;)&gt;0)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Timer_Refresh-&gt;Enabled = false;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant disp,alllinks,eachlink;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int linkcount;\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;disp = CppWebBrowser_Main-&gt;Document;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;alllinks = disp.OlePropertyGet(&quot;links&quot;); \/\/get all links\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;linkcount = alllinks.OlePropertyGet(&quot;length&quot;); \/\/get link numbers\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb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;Navigate(Variant(Edit_URL1-&gt;Text));\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n}\r\nelse if(iURLPos == 3)\r\n{\r\n&nbsp;&nbsp;&nbsp;&nbsp;Variant doc = CppWebBrowser_Main-&gt;ControlInterface-&gt;Document;\r\n&nbsp;&nbsp;&nbsp;&nbsp;if (((IDispatch *)doc) != NULL)\r\n&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant body = doc.OlePropertyGet(&quot;Body&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Variant html = body.OlePropertyGet(&quot;InnerHTML&quot;);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnsiString tmp_body = html;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(tmp_body.Pos(&quot;successful&quot;)&gt;0)\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;isChoose = true;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/\/reservation is successful; send a text message to your cell phone\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AnsiString SMSBody = &quot;Reservation is Successful&quot; + ChooseDate+&quot;(&quot;+SeatID+&quot;)&quot;;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;SMSURL=&quot;http:\/\/www.smsgo.com.tw\/sms_gw\/sendsms.asp?username=xxx&amp;password=xxx&amp;dstaddr=phone_number&amp;smbody=&quot;+SMSBody;\/\/SMSGO API\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;iURLPos = -1;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;CppWebBrowser_SMS-&gt;Navigate(Variant(SMSURL));\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Timer_FindWin-&gt;Enabled = true;\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Btn_NextSeat-&gt;OnClick(Sender);\r\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}\r\n&nbsp;&nbsp;&nbsp;&nbsp;}\r\n}<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\t&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Features: Login automatically Automatically select an available seat Send a text message to your cellular phone via SMSGO API In order to login to the reservation system, I use HTTP Analyzer to analyze HTTP\/HTTPS traffic:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[14],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-projects"],"_links":{"self":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=213"}],"version-history":[{"count":8,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":215,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions\/215"}],"wp:attachment":[{"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cywang.no-ip.org\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}