Jump to content

kicken

Gurus
  • Posts

    4,695
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by kicken

  1. To alias a directory you'd generally need something like this at least. Alias /want "C:/The/Directory/You/Want" <Directory "C:/The/Directory/You/Want"> Require all granted </Directory> Depending on what exactly you want you might need some more configuration options inside the <Directory> block, like Options +ExecCGI if you need to run PHP scripts using fast-cgi. $_SERVER['SERVER_ADDR"] represents apache's local address. If you want the address of the client connecting to the server you need $_SERVER['REMOTE_ADDR']. With regard to VPN's, that remote address will be the VPN exit server's public IP. There's no way to get the clients local pre-vpn IP (which is part of the reason people use VPNs these days).
  2. @Niksou, when you're posting code, do so as text not images. Copy your code then use the Code button (<>) in the editor to create a code block and paste your code there. If you don't post it as text, nobody can copy it to a file and test it in order to help you, so they will likely just skip your thread and you'll get no help at all. If you want to change your Add to Cart button to a quantity input then change the <button> tag to an <input> tag of type number. Add your new add to cart button where you want it. After that you'll have to figure out how to update the code that handles your cart to work with the new design. If you have a specific problem you are stuck on then post about it, but a post like "I want to do <some generic thing>" followed by a bunch of code is generally not well received.
  3. https://securitynews.sonicwall.com/xmlpost/thinkphp-remote-code-execution-rce-bug-is-actively-being-exploited/
  4. You could probably just simulate a click on the link to show the popup again. if ($login==='fail'){ echo '<script type="text/javascript"> jQuery(function(){ $(".open-popup").click(); }); </script> '; }
  5. Works just fine for me using those options. First, login and get the session setup. wget --load-cookies jar --save-cookies jar --keep-session-cookies --post-data='user=test&pass=example' https://example.com/login Then run the command to mirror the site. wget --load-cookies jar --save-cookies jar --keep-session-cookies -m https://example.com/ I setup a small script that requires a login session and re-generates the session ID on every page load to test those commands with. Had no problems fetching all the content. Keep in mind that if there are links on the page that trigger a logout, you need to avoid crawling those links or you'll loose your session. That might be the issue your running into. Resolve that using the --reject or --reject-regex option.
  6. Try looking into the --load-cookies, --save-cookies, and --keep-session-cookies options.
  7. You need to have the ID isolated in the html so it's easier to find and work with. Best way to do that is to add it as a data attribute like so echo "<div class='btn btn-primary m-1 tagInArticle' data-id='$pid'>$fn $ln</div>"; Notice I also removed the onclick. Rather than having every button define it's own click handler, you can use jQuery's event delegation to handle it. $('#searchResultsHere').on('click', '.tagInArticle', function tagInArticle(){ var tagButton = $(this); tagButton.appendTo('#taggedInArticleContainer') }); No need to even mess with the ID there now, you can just reference the button directly using this and move it. Now, when searching you just gather up all the IDs from the buttons in #taggedInArticleContainer and submit them with your request. $('#searchForPeopleBox').keyup(function(){ var searchVal = $(this).val() var tagged = $('#taggedInArticleContainer').find('.tagInArticle').map(function(){ return $(this).data('id'); }).get(); $.ajax({ type: 'post', data: {"ajax" : 'one', "val" : searchVal, exclude: tagged}, success: function(resp){ $('#searchResultsHere').html(resp) } }); }); Finally, update your PHP search to account for $_POST['exclude'] when performing a search.
  8. You'll have to do some debugging by var_dumping your values at various points and seeing what they are. Make sure your query is returning the data you think it is. You should also probably be zeroing out all your variables before the loop so they start fresh for each customer. Otherwise your previous customer's data will influence the next customers data.
  9. You don't have any input fields named 'submit', so $_POST['submit'] won't exist. Note: <form> tags are not inputs, giving them a name doesn't make them submit something.
  10. Perhaps you should look at what the possible values are for button's type attribute. While you're at it, read through the rest of the spec and you'll learn all sorts of things. Bookmark it so if you have a question later you can refer back to it.
  11. mysqli_stmt_bind_result just returns a bool value, not something you'd use in mysqli_stmt_fetch. You use your $stmt variable there like you did just above. Speaking of the line just above, it shouldn't be there. You don't fetch before your loop.
  12. If you can get the quantity you could use a simple if statement. Something like <?php echo ($quantity>50)?'Secret':$order->get_formatted_line_subtotal($item);?> I'm not familiar with WooCommerce so I don't know how to determine $quantity, but if you look at the part of the template that shows the quantity you can probably figure it out.
  13. You need to make sure to exit word when you're done, otherwise it will hang around in the background causing issues. wdFieldPrint / wdPropertyTitle don't mean anything. These are constants that have a particular value so you either need to define them or use the real value in their place. wdFieldPrint isn't something you'd look for in BuiltInDocumentProperties either Make sure you use a full path to the document. When I tried a relative path it looked in C:\Windows\System32 rather than the current directory. Rather than using ActiveDocument, you could just use the value returned from your open call. <?php const wdPropertyPages = 14; const wdPropertyWords = 15; const wdPropertyTitle = 1; $word =new COM('Word.Application'); try { $document = $word->Documents->Open('W:\\test.docx'); $value = $document->BuiltInDocumentProperties[wdPropertyPages]; var_dump((string)$value); $value = $document->BuiltInDocumentProperties[wdPropertyWords]; var_dump((string)$value); $value = $word->ActiveDocument->BuiltInDocumentProperties[wdPropertyTitle]; var_dump((string)$value); } finally { $word->Quit(0); }
  14. If your query is only intended to return one row, then you just fetch the row and check with a simple if statement whether data was fetched or not. $row = $result->fetch_assoc(); if ($row){ //Yep, got data } or $row = $result->fetch_assoc(); if (!$row){ //Nope, no data available. } depending on whether a positive or negative test fits best with your situation.
  15. Perhaps you should check for errors when executing your query also.
  16. Just remember that the stuff you find in .htaccess files are just Apache configuration directives. So when you're unsure of something the thing to do is to visit the Apache directive index and find the directive in there to find the full documentation on it. Most of the time, this will give you the information you need. For example: From the RewriteCond documentation So the %{ means it's a server variable, as opposed to some other variable types. The syntax of conditions is covered in the same RewriteCond documentation. !=80 for example is covered by So it means (Not)(Equals 80) As for what condition to write, this mostly just requires you to use your brain. What condition you use depends on what you're testing against. If you're testing against %{SERVER_PORT} then the value will be a number so you'd check for =80 or =443 for example. It wouldn't make sense to check for the string 'https' in that case. Likewise the parts that require regular expressions require you to use your brain to come up with the correct expression. If you don't know regular expressions very well or at all, then you'll need to spend time learning that. Regular expressions are not just an Apache thing so their manual doesn't really cover them in detail. It does at least give you the basics and what you need to know to look for further help: The term "Regular expression"; Links to documentation and additional help. All in all, Apache has pretty good documentation. If you're struggling with it, you'll be in for a world of hurt when it comes time to deal with things that have much less well-defined documentation.
  17. The best thing to do in my opinion is to just have a way to switch the active user of your session, and expose this functionality to administrators only. For example in my systems when an administrator looks up a user in the user listing there is a link called 'Impersonate' available to them. When clicked, this modifies the $_SESSION['UserId'] (where I happen to store my login info) value to that of the selected user and as a result the person is now "logged in" as that user. I also store the ID of the administrator in a separate session variable so when they "log out" it just returns them to their session rather than actually logging them out of the system. With this method there's no need to know your users password. There's no master password that could accidentally leak. You can control better who can use this functionally via permissions (we only let a small group of 'Super Administrators' do this).
  18. See how you have data-id='".$r['id']."' for your $r['id'] variable? Do the same thing with your direction variable. data-direction='".$r['direction']."' Then in your javascript code you can access these values via the dataset property on the element. onclick="newTransactionLine(this.dataset.id, this.dataset.direction)"
  19. Why can't your "High security" pages be just like your "Low security" pages, but with the extra checks? Doesn't make sense to me why you have to send them through some post request to the index page first.
  20. I prefer using pdf-puppeteer for this job. It requires NodeJS but otherwise is fairly easy to setup. I uses a headless chrome instance to render the HTML into PDF so it supports fairly modern CSS (but not necessarily bleeding-edge). Render your template out to a temp file then pass that to the script to generate the PDF. Use a short JS script like this to handle the PDF generation const fs = require('fs'); const pdf = require('pdf-puppeteer'); const args = process.argv.slice(2); if (args.length < 2){ console.log('Usage: html2pdf source destination [options]'); process.exit(20); } const source = args[0]; const options = args.length === 2?JSON.parse(args[1]):{}; fs.readFile(source, 'UTF-8', function fileReadSuccess(err, data){ if (err){ throw err; } pdf(data, callback, options); function callback(pdfData){ console.log('PDF Data length: ' + pdfData.length); } }); Kick off the process with PHP using exec(). $cmd = $this->createCommandLine($source, $destinationPdf); exec($cmd, $output, $ret); if ($ret !== 0){ throw new \RuntimeException('Failed to generate PDF with command [' . $cmd . ']'); } $pdf = file_get_contents($destinationPdf);
  21. Then you need to check a few things. Use the third parameter to get the exit-code and see what it is. Typically 0 would mean success, anything else would be an error. There are two ways a program can output text, either via STDOUT, or STDERR. By default only STDOUT is captured. To capture STDERR as well you need to redirect it to STDOUT. This is done by adding 2>&1 to the end of your command. It's generally best to use a full path to the executable as your script may be running with a different $PATH value than you're normal shell.
  22. It doesn't appear to be used. It might just be there for consistency sake with the sw_id array. If both array's are auto-generated somewhere than it might have just been easier to keep two lists of pairs and dump them to an array rather than one list of pairs and one list of values only. I would have just written this to use either a 2d array or array of objects rather than this flattened array approach. It's unnecessarily hard to understand as written.
  23. If you look at the manual page for exec you'll see that it returns just If you look at the arguments list, you'll see there are two additional arguments you can pass to exec So if you want the full output, you need to pass a variable as the second argument and it will be filled with the output. exec('swetest -h', $output); var_dump($output);
  24. Maybe you should show what kind of redirect chain you're getting, then you can figure out where your configuration is wrong, or at least why there are multiple. Like I said above, there shouldn't be more than one, maybe two in the case of a directory.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.