Jump to content

IamMarvin1a

Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by IamMarvin1a

  1. I also have other codes using the setTimeout <p id="HHootteeLLClock"></p> <script> var serverClock = new Date(<?php echo time() * 1000 ?>); timeInterval(); //start the time interval function timeInterval(){ var currentMS = serverClock.getTime(); currentMS += 1000; serverClock.setTime(currentMS); document.getElementById('HHootteeLLClock').innerHTML = "The date today is " + serverClock.toDateString() + "<br>" + "The time today is " + serverClock.toTimeString(); setTimeout(timeInterval, 1000); } </script>
  2. Hello. I got some code or other technique/solution which I found while researching in the internet. Here is the code: <div id="websiteClock"></div> <script> var serverClock = new Date(<?php echo time() * 1000 ?>); function startInterval(){ setInterval('updateTime();', 1000); } startInterval();//start the time interval function updateTime(){ var currentMS = serverClock.getTime(); currentMS += 1000; serverClock.setTime(currentMS); document.getElementById('websiteClock').innerHTML = serverClock.toDateString() + " " + serverClock.toTimeString(); } </script> RIght now I am still looking for another way of solution/technique. Please share codes on this topic. Thank you.
  3. Hello. I already tried using JavaScript Clock With Timing Event Code like this: <script> function startTime() { var today = new Date(); var h = today.getHours(); var m = today.getMinutes(); var s = today.getSeconds(); m = checkTime(m); s = checkTime(s); document.getElementById('txt').innerHTML = h + ":" + m + ":" + s; var t = setTimeout(startTime, 500); } function checkTime(i) { if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10 return i; } </script> But I notice it will be much better to use PHP Server Date/Time to avoid user's device incorrect time/clock. Anyone here can help me to share code or other technique/solution on how to use PHP Server Date/Time to create clock with timing event to display in a website.
  4. Hi Dodra. I visited the link you gave. The website has an application for calendar reservation system. I already seen many of this kind in Wordpress Plugin website available for free version. However what I need is a simple calendar with Start Date and End Date selection just like this url: http://iammarvin261.x10host.com/wphottel1a/single-bed-2/
  5. Hello. Right now I am looking for an open source code for hotel online reservation calendar with check-in(start date) - check-out(end date) selection. It may be a PHP code, JavaScript, JQuery or any relate javascript library which do not need to use javascript server like node.js Please visit the url for a example calendar selection: http://iammarvin261.x10host.com/wphottel1a/single-bed-2/ I will use the source code to change/remodel my current check-in/checkout reservation form. Can you help me easily find the source code on your CP Reservation Calendar on your php plugin files.
  6. Thanks justsomeguy A good information about using PHP SUPERGLOBALS $_SERVER[‘HTTP_REFERER’]; and PHP Session code $_SESSION[“session_name”]; I will now use PHP Session code $_SESSION[“session_name”];
  7. Hi to all. Sorry for late reply. It took me 4 days to choose how block unauthorized access to my WordPress php plugin file using JQUERY AJAX. I tried to to use wordpress is_user_logged_in() function but you can only use this function if the php file is included on WordPress plugin main php file. I decided to choose PHP SUPERGLOBALS $_SERVER[‘HTTP_REFERER’]; over PHP Session code $_SESSION[“session_name”]; I will add sample code: /** javascript JQuery AJAX code of my php file which can copy/get through a browser by any user */ $(document).ready(function(){ $.post("/wp-content/plugins/SLMS/UserRecord.php", { saveUserBtn: "Save", FName: fname, LName: lname, UNumber: unumber, address: address, contact: contact, email: email }, function(data, status){ document.getElementById('userr-page-notice').innerHTML = data; if(data.includes("New record saved.")) { document.getElementById("userRecord").reset(); } }); }); /** Here is the code to my other php file that contains database access and saving data to database */ <?php if($_SERVER['HTTP_REFERER'] == "https://iammarviin26.000webhostapp.com/user-record/") { if(isset($_POST['saveUserBtn']) and $_SERVER['REQUEST_METHOD'] == "POST") { insertRecord(); /** insertRecord(); echo "working" ; */ } elseif(isset($_POST['searchUNBtn']) and $_SERVER['REQUEST_METHOD'] == "POST") { searchUNRecord(); /** searchUNRecord(); echo $_POST['searchUN']; echo "Success";*/ } elseif(isset($_POST['updateUserBtn']) and $_SERVER['REQUEST_METHOD'] == "POST") { updateRecord(); /** updateRecord(); echo $_POST['ID']; echo "Update Status";*/ } } /** Other php code/script that contains database credentials/sql script */ /** While using PHP SUPERGLOBALS $_SERVER['HTTP_REFERER']; any users cannot access my php file without the correct http referrer and actively login to my web application. */ ?> In case you cannot use wordpress is_user_logged_in() you can use SUPERGLOBALS $_SERVER[‘HTTP_REFERER’]; or PHP Session code $_SESSION[“session_name”]; Any suggestion or comment Thanks
  8. Hello. I made a WordPress plugin with a JQuery-AJAX/JSON code in a php file like this: $(document).ready(function(){ $.post(“/wp-content/plugins/SLMS/UserRecord.php”, { saveUserBtn: “Save”, FName: fname, LName: lname, UNumber: unumber, address: address, contact: contact, email: email }, function(data, status){ document.getElementById(‘userr-page-notice’).innerHTML = data; if(data.includes(“New record saved.”)) { document.getElementById(“userRecord”).reset(); } }); }); /** end of code */ I also notice that any user can view my javascript code with their own browser. I also noticed that any user/unauthorized user can copy these JQuery-AJAX/JSON code and pass/save/modify data to MySQL database using the link to my php file. I will also write the code for my php file: if(isset($_POST[‘saveUserBtn’]) and $_SERVER[‘REQUEST_METHOD’] == “POST”) { insertRecord(); } elseif(isset($_POST[‘searchUNBtn’]) and $_SERVER[‘REQUEST_METHOD’] == “POST”) { searchUNRecord(); } elseif(isset($_POST[‘updateUserBtn’]) and $_SERVER[‘REQUEST_METHOD’] == “POST”) { updateRecord(); } /** codes to access MYSQL Database */ /** end of code */ I notice that many developers also used these kind of JQuery-AJAX/JSON codes. I want to know what is the code to block unauthorized users to access/pass data to my php file when unauthorized users use JQuery/JSON code. I will also mention “web host cpanel File Permission” to see if this web server configuration can help.
×
×
  • Create New...