-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
If it is HostGator, here is their backup policy: https://www.hostgator.com/help/article/backup-policy-do-you-provide-backups They also offer some alternative recovery advice here: https://www.hostgator.com/help/article/restoring-a-website-without-a-backup
-
Are you familiar with getting data from HTML forms? If not, you could start here: https://www.php.net/manual/en/tutorial.forms.php Note that your <form> tag doesn't include the method attribute, which causes the data to be sent using the GET method. So, the data will be available through $_GET in PHP. More information about the <form> tag can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form Side note: HTML5 provides a built-in date field. That will be much easier for the user...and more accessible to people with disabilities. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date
-
Thanks for clarifying. I was just about to modify my post. The validation should happen on both ends. @Erwin007 With that said, the jQuery portion probably isn't necessary. Is there a reason you're not passing the information using the default behavior of the <form> tag? If the values need to be passed using GET, you could modify the method attribute.
-
You should be able to duplicate some of the jQuery code to get the new field and pass the information: <script> $("#to").change(function(){ var view = $(this).val(); var ikke = $('#ikke').val(); //get "ikke" value var from = $('#start').val(); var to = $('#to').val(); window.location.href = "test.php?from="+from+"&&to="+to+"&&ikke="+ikke; //updated to pass "ikke" value }) </script> Be aware that the form code can potentially be tampered with by a malicious user. So, you'll want to take some extra precautions when using the data. For example, you could make sure "ikka" actually contains a number before executing the window.location.href redirect.
-
Allow subdomains to access session data
cyberRobot replied to jasonc310771's topic in PHP Coding Help
Are you wanting to use $_SESSION (data stored server side) or $_COOKIE (data stored client side)? Others can correct me if I'm wrong, but I don't think session.cookie_domain applies to $_COOKIE. Whether (sub)domain(s) have access to $_COOKIE is determined by the corresponding argument in setcookie(). Of course, it has been a while since I've needed to deal with either $_SESSION or $_COOKIE. -
Is "admin" the column name in the database table "users"? Have you tried outputting $row to see if it contains the expected values? For example, you could add the bottom two lines after the $row assignment. $row = mysqli_fetch_assoc($result); print '<pre>' . print_r($row, true) . '</pre>'; //<-- debug code exit; //end script to avoid header() from executing
-
Is it still always going to index_admin.php? Have you tried outputting $admin to see if it contains the expected value? Of course, you'll need to temporarily disable the header calls so you can see the output. Also, it's always a good idea to use exit after a header call. Otherwise, the code below the header call may still execute. More information can be found here: https://www.php.net/manual/en/function.header.php //... $admin = $row['admin']; if( $admin == 1 ){ header("location:index_admin.php"); exit; }else{ header("location:index.php"); exit; } }else{ header("location:login.php?msg=error"); exit; }
-
Side note: you'll want to be extra cautious with values that can be tampered with by the users (i.e., $username and $password). The values could potentially break the query...or be used for SQL Injection Attacks. These issues can be avoided with Prepared Statements. https://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php
-
You're using the assignment operator "=". Try if( $admin == 1 ){
-
Warning: Undefined property: WP_Error::$slug
cyberRobot replied to leasben's topic in PHP Coding Help
The error is likely caused by the following line: $icon $icon = 'default-icon'; Note the duplicate $icon. -
Warning: Undefined property: WP_Error::$slug
cyberRobot replied to leasben's topic in PHP Coding Help
Have you tried outputting the variables to see if they contain expected values? Based on the error message in the title, it sounds like $term contains an error object (WP_Error) instead of a term (WP_Term). https://developer.wordpress.org/reference/functions/get_term/#return -
The code just attempts to establish a database connection using MySQLi. More information can be found here: https://www.php.net/manual/en/mysqli.real-connect.php If WP_DEBUG is enabled, the code will handle errors as normal (e.g., display them). Otherwise, it suppresses the errors using the "@" symbol. https://www.php.net/manual/en/language.operators.errorcontrol.php As for the error, it sounds like you're hitting the limit for the number of active users connected with the database. You could check with your website host on what that limit is and whether it can be increased.
-
syntax error unexpected 'public' (t_public)
cyberRobot replied to LeonLatex's topic in PHP Coding Help
I primarily used Dreamweaver for hand-coding purposes. I never really used the WYSIWYG side because of the experience I had with Microsoft FrontPage. So much wasteful code in a time when file size of the HTML files being downloaded was more important. I think I only started using Dreamweaver because it was bundled with other Macromedia software I needed for class projects. Plus, it was much better than coding everything in Notepad...and whatever I used later on that performed some basic color coding. -
What's the differences between include...
cyberRobot replied to LeonLatex's topic in PHP Coding Help
More information can be found here: https://www.php.net/manual/en/language.constants.magic.php -
syntax error unexpected 'public' (t_public)
cyberRobot replied to LeonLatex's topic in PHP Coding Help
FYI - Looking into the DW issue a bit more, I guess only PHP 5.6 and PHP 7.1 are supported for error detection. More information, including how to switch which version is used, can be found here: https://helpx.adobe.com/dreamweaver/using/setting-coding-environment.html#SupportforPHP56and71versions The default appears to be PHP 5.6. At least that's what mine was set to...and I installed DW within the last month or so. I switched to VS Code several years ago and apparently never noticed how outdated DW is. -
@CWT - How familiar are you with coding in PHPRunner? It sounds like you need a loop (e.g., foreach, while). If you haven't worked with loops before, I'm sure there's some documentation you could look through. Note that I haven't used PHPRunner before. So I don't have any specific code for you.
-
syntax error unexpected 'public' (t_public)
cyberRobot replied to LeonLatex's topic in PHP Coding Help
If you hover over the red line numbers in Dreamweaver, it will likely say something like "syntax error, unexpected private (T_PRIVATE)". Basically, it doesn't like "private" before each of the arguments for the class method. -
In case you're not aware, the console can also be used for debugging purposes. For example, you could add console.log() in different parts of your script to see if things are executing as expected. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/API/Console/log You can also watch your "days" elements to see if they're changing to "block" or "none", as intended.
-
Are you familiar with the Developer Console in your browser? The console is a good place to check for JavaScript errors.
-
Note that the W3C validator can be a useful tool for fixing broken HTML code. Of course, it can take some time getting used to the various warnings and errors. https://validator.w3.org/
-
Is it in the <body> tag...or <head> tag? It should go in the latter. Of course, I haven't tested what happens if its in the <body> tag...
-
Since the <button> doesn't have a "type" attribute, the default behavior is to submit the form. That's likely why the page is flashing and the button is redisplayed. You could try the following: echo" <br><br><button name='submit' type='button' class = 'btn' id='btn' onclick='hideButton()'>Click to Verify Information</button>"; More information about the <button> tag can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/button With that said, I'm guessing the button is supposed to submit the form given it's named "submit". So you may need to tweak the JavaScript to submit the form if the verification process doesn't find any issues.
-
It was less about the "packing" and more about the irrelevant keywords. So you're good. 😊
-
Here's a quick example: <?php $meta = array( '<meta name="viewport" content="width=device-width, initial-scale=1">', '<meta name="resource-type" content="document">', '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' ); echo implode($meta); ?>
-
As for the code, how is $meta populated? Are you able to get it so $meta only contains the meta tags for the page being viewed? If so, you could skip the loop and do something like this instead echo implode($meta);