Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. build file XML with Xpath and Python

    thanks
  3. Today
  4. How how how

    how can I make a page like this? http://melanie-f.com/en/ and a HomePage like this? https://www.lonelyplanet.com/ are there any names for these types of pages?
  5. Hello Everybody... The following code is in a flex container. I have some issues to vertically center my links in the center. Image is display:block. a is position:absolute; top:50% etc. The problem is that I have a second div container. I can't align the links in the middle of the image. Thanks for your help.. <div class="slideshow"> <div> <img src="../img/1.jpg" width=100%> <a class="prev" onclick="plusDivs(-1, 0)">&#10094;</a> <a class="next" onclick="plusDivs(1, 0)">&#10095;</a> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 0)"></span> <span class="dot" onclick="currentDiv(2, 0)"></span> </div> </div>
  6. PHP Upgrade from 5.5.38 to 5.6.33

    I don't think that's necessarily true, if you try to access an undefined variable I don't think PHP allocates anything for it in the hash tables, because if you try to access it a second time it does the same thing.
  7. Yesterday
  8. PHP Upgrade from 5.5.38 to 5.6.33

    Undefined variables and array keys have always been an error in PHP, whether or not the error messages are being hidden. PHP is a very forgiving language, in any other language undefined variables or properties would not even allow the code to compile. PHP has mechanisms to catch and fix attempts to access unallocated memory, but it comes at a cost, which is why the PHP engine sends warnings every time it fixes these mistakes. The problem with accessing undefined variables or properties is that PHP has to allocate memory for a variable that is never going to be used, the cost being the amount of memory allocated and the amount of processing time required to allocate that memory. Problems like this are why I would never recommend PHP or Javascript for somebody who wants to start learning programming. They allow the use of undefined variables and the variables do not have a strict data type assigned to them.
  9. PHP Upgrade from 5.5.38 to 5.6.33

    So what? I'll bet 10 to 1 that the major change was that your php.ini changed so that PHP is now reporting more errors than it used to. Referencing undefined variables has been an error for a long, long time. If you weren't seeing it, your options were set up to ignore those errors. Ignoring errors isn't a good idea, because like you're finding out you might take your code to a PHP environment that is configured differently and all of a sudden it's emitting all of these notices and warnings that your old server was set to ignore. You should always develop code with maximum error reporting, and you shouldn't stop until there are no more error messages. The solution is to fix the errors in your code. I bet they're hiding them! Not a good idea. For what it's worth, our applications report all errors, but have display_errors disabled so that users do not see them, but we use error logging to write them all to a file. So if someone is reporting problems I can go check the log to see the actual error messages that happened when that person was using it. What I would never even think about doing is just turning off error reporting. That's your opinion. In practice, if well-written code is trying to refer to an undefined value then it's highly likely that the programmer made an error. Your code should never produce error messages regardless of error reporting settings. if (isset($_GET['refer_type']) && filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) {
  10. PHP Upgrade from 5.5.38 to 5.6.33

    I am a little confused by your answer: 1) Recall that all I did was upgrade from PHP version 5.5.38 to 5.6.33 on my local server. 2) Further, understand that my error reporting was turned off both before and after the upgrade, and that the error messages only began appearing after the upgrade. 3) In addition, please note that my 3rd-party host server, where the relevant PHP files are set identically with those on my local test server, also uses 5.6.33. There, no error messages are reported. Finally, I do not understand why the following code produces the undefined notice. if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } My UNDERSTANDING: If there is a value registered for $_GET['refer_type'], the variable is obviously set, and the value is assigned to $refer_type. If there is no value, it matters not whether the variable is set or not, for the value 0 is assigned to $refer_type, no matter whether $_GET['refer_type'] is set or not. REQUEST: How would you write the same code to avert the error message, if indeed, it is the code that is creating the message and not something else. ? Roddy
  11. How to place arrow to slideshow next and prev buttons

    Never mind. I removed some code and now it is working. Thanks.
  12. PHP Upgrade from 5.5.38 to 5.6.33

    Anytime you're checking for input values in POST, GET, or COOKIE you should use isset () to check that they exist before doing any operations with them. This is not new to PHP. My guess is that previously you had warnings turned off. Using empty () also works since it uses isset () internally.
  13. PHP Upgrade from 5.5.38 to 5.6.33

    BACKGROUND: I recently upgraded my version of PHP from 5.5.38 to 5.6.33. PHP code that functioned perfectly well now fails with imposed notifications complaining about undefined variables. Mind you, my error logs and notifications are turned off. This suggests that I must either learn how to turn off these imposed intrusions or learn to write PHP properly and modify all of my PHP processing files accordingly. In the belief that I will be better served by the latter, I am appealing to W3Schools to set me straight. REQUEST: Please examine the following two pieces of code and correct then so that I do not receive a notice from PHP telling me that the variable is undefined, when indeed no value was intended. This is just a sampling of the problem that I am now confronted with. Sampling One - The CODE My Action: I selected webinar, but not newsletter before the form was submitted. <?php // ini_set('display_errors', 1); // ini_set('display_startup_errors', 1); // error_reporting(E_ALL); require_once '../../_utilities/php/php_mailer/PHPMailerAutoload.php'; // var_dump(class_exists('PHPMailer')); $name = $email = $newsletter = $webinar = $language = $error_msg = '' ; /* function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } */ if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST['language'])) { $error_msg = "Please select your first language or add another, if yours is not listed."; } else if ($_POST['language'] == 'other_tongue') { if (empty($_POST['other'])) { $error_msg = "Please enter your first language."; } else { $language = filter_var($_POST["other"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } } else { $language = filter_var($_POST["language"], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW); } if (!($_POST["newsletter"]) && !($_POST["webinar"])) { $error_msg = "Have you forgotten to select a gift?"; } else { $newsletter = filter_var($_POST["newsletter"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $newsletter = !empty($newsletter) ? "$newsletter" : 0; $webinar = filter_var($_POST["webinar"], FILTER_SANITIZE_NUMBER_INT, FILTER_VALIDATE_INT); $webinar = !empty($webinar) ? "$webinar" : 0; } ... The ERROR MESSAGE: Sampling Two - The CODE My Action: I opened the page directly. There was no referral. <?php /* ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); */ if (filter_var($_GET['refer_type'], FILTER_VALIDATE_INT)) { $refer_type = $_GET['refer_type']; } else { $refer_type = 0; } ... The ERROR MESSAGE: Please advise. Roddy
  14. What questions do you have about it? If most of your page content is stored in a database then you would search those fields for what someone types in. There are several ways to search in MySQL depending on the type of tables and fields.
  15. 403 Error

    I would start by removing most of that htaccess file and then check if you get the 403, and if not then start adding things back piece by piece and testing until you see the 403 again. If so, the last thing you added caused the problem and at least you've narrowed it down to a specific part and can then figure out why that's causing the issue.
  16. Hello, I created a slideshow in carousel and I had white color arrows of prev and next buttons. I applied some css animation and now the arrows are gone. Instead, I see white color square. Below is the css: .carousel-control.left { left: 22px; opacity: 1; } css_injector_4.css?p4k674:194 .carousel-control.left, .carousel-control.right { position: absolute; z-index: 100; top: 50%; margin-top: -30px; opacity: 0; color: #fff; font-size: 0px; -webkit-transition: all 0.2s ease-in-out; -moz-transition: all 0.2s ease-in-out; transition: all 0.2s ease-in-out; text-shadow: none; width: 30px; height: 30px; } css_injector_4.css?p4k674:183 .carousel-control.left { left: -22px; } bootstrap.css? [sm]:6306 .carousel-control.left { background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); background-image: -o-linear-gradient(left, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, .5)), to(rgba(0, 0, 0, .0001))); background-image: linear-gradient(to right, rgba(0, 0, 0, .5) 0%, rgba(0, 0, 0, .0001) 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1); background-repeat: repeat-x; } opacity.less:7 .carousel-control { position: absolute; top: 0; bottom: 0; left: 0; width: 15%; font-size: 20px; color: #fff; text-align: center; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); background-color: rgba(0, 0, 0, 0); filter: alpha(opacity=50); opacity: .5; } Image to see the page in chrome inspect: https://drive.google.com/open?id=1U0G2BXb1kDOvQIM-x_Zk67VLY-CXyebO Please advise.
  17. Hide/Show if elements are checked in forms

    Ah great, I can see this now thanks dsonesuk for your help!
  18. SHOW COLUMNS with prepared in php

    Prepared statements are more difficult to implement. Match the method with the task. Prepared statements are only required when security is an issue. Roddy
  19. I'm back with a new kind of machine.

  20. Hide/Show if elements are checked in forms

    Its looking for class 'ampwizard' child element, which an input can't have because its a void element (self closes, no closing tag, like a div element would have). You would have to maybe use '+' next following sibling or '~' any siblings element following it. Note: Even though you have made it totally transparent, its STILL click-able, try visibility: instead.
  21. Hi there, I am trying to only allow a 'next' button to show if a form element is selected. For some reason I am only succeeding to hide the button, and not reveal when the radio button is selected. I am sure it should be relatively simple... The code: .ampwizard .button {opacity: 0;} input[type="radio"]:checked .ampwizard .button{opacity: 1;} <div class="ampwizard"><input type="submit" class="button" name="install-next" value="Next" /></div> Help appreciated with thanks!
  22. three arrays in 1 foreach loop

    This is what i meant $prefix_arr = array('col_a', 'col_b', 'col_c', 'col_d', 'col_e', 'col_f', 'col_g',); $col2 = uniqid(); $suffix = substr($col2, 5, 11); $servername = "xxxxxxxx"; $username = "xxxxxx"; $password = "xxxxxxxx"; $dbname = "test_database"; $conn = new mysqli($servername, $username, $password, $dbname); if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } else { echo "Connection successful<br>"; } $stmt = $conn->prepare("SHOW COLUMNS FROM table_xyz"); $stmt->execute(); $res = $stmt->get_result(); $pres_colname = $res; foreach ($pres_colname as $key => $val) { $col = $val['Field']; $col_new = $prefix_arr[$key] . "_" . $suffix; ?> <br><input type="text" value ="<?php echo $col; ?>"> <input type="text" value ="<?php echo $col_new; ?>"> <?php $stmtAlter = $conn->prepare("ALTER TABLE `table_xyz` CHANGE COLUMN `$col` `$col_new` VARCHAR(30) NOT NULL;"); $stmtAlter->execute(); } $conn->close();
  23. SHOW COLUMNS with prepared in php

    Hi Roddy. I think your method of querying is (almost) obsolete and I prefer the methods I described.
  24. SHOW COLUMNS with prepared in php

    Using the 2nd option was a useful solution. Thanks for helping me out dsonesuk.
  25. How to combine these?

    Damn Damn you're good! Thanks for inlightning!!!
  26. 403 Error

    I'm facing a prolong error of 403 forbidden. Tried all common methods, but no luck yet. My site, https://www.astrocopia.com/ is hosted on Godaddy VPS HOSTING I hereby attach the .htaccess file for your kind perusal. Can anybody help me out? .htaccess
  27. BACKGROUND: I am in the process of integrating Matomo website analytics into my web application and stumbled across an important functional element that is missing on my main page -- namely, an onsite search window that delivers information about the site to the page. Not only would such an element provide valuable information about what users are looking for on my site -- this, as opposed to what I am offering --, but it would also provide them with a reason to tarry just a little longer on my site. QUESTION: Can you provide me with some leads into setting up such functionality. As most of my content is delivered dynamically, this need not be anything as elaborate as that provided by the InvisionZone domain. Roddy
  28. Last week
  29. using curl

    That's the curl command line tool. If you want to use their service with PHP, the easiest way is to use their PHP SDK. Most likely they have clear documentation in their tutorials for the PHP SDK. If you want to use PHP's implementation of curl, you'll have to learn to translate the command line language to PHP. All of this can be done by setting options with the curl_setopt() method. The manual page has a list of all the possible options. In the example you posted, it starts by indicating that the method is POST. In PHP the option for that is CURLOPT_POST. The following four items are HTTP headers. You can add headers in PHP using the CURLOPT_HTTPHEADER option. Following that is the request body, this would go in th <?php // Information needed for the request $api_key = 'XXXXXXXXXXXXXXXX'; $data = [ 'username' => 'cooldude6', 'password' => 'p_n7!-e8', 'phone' => '415-392-0202' ]; // Send a cURL request $request = curl_init('http://parseapi.back4app.com/parse/users'); curl_setopt(CURLOPT_POST, true); // This is a POST request curl_setopt(CURLOPT_HTTPHEADER, [ 'X-Parse-Application-Id: APPLICATION_ID', 'X-Parse-REST-API-Key: ' . $api_key, 'X-Parse-Revocable-Session: 1', 'Content-Type: application/json' ]); curl_setopt(CURLOPT_POSTFIELDS, json_encode($data)); curl_exec(); By default, PHP prints the curl response straight to the browser. If you want to store the result in a variable instead, you should read the PHP manual on how to use the CURLOPT_RETURNTRANSFER option.
  1. Load more activity
×