Jump to content

All Activity

This stream auto-updates

  1. Today
  2. If you've installed XAMPP on your Mint machine, it should be accessible through the terminal. You can launch it by opening a terminal window and typing: sudo /opt/lampp/lampp start This command will start the XAMPP services. If you want to stop XAMPP, you can use: sudo /opt/lampp/lampp stop If you prefer a graphical interface, you can create a desktop shortcut for XAMPP. To do this, follow these steps: Right-click on your desktop and select "Create a new launcher here" or similar. In the command field, enter /opt/lampp/manager-linux-x64.run if you're using a 64-bit system, or /opt/lampp/manager-linux.run if you're using a 32-bit system. Give the launcher a name, such as "XAMPP Control Panel." Save the launcher. i hope Now you should be able to launch XAMPP from your desktop Best Regard Danish hafeez | QA Assistant ICTInnovations
  3. It seems like your application is encountering issues with loading external resources, such as CSS and JavaScript files. Start by checking the network tab in your browser's developer tools for failed requests and reviewing any recent changes to your code or server configuration. Additionally, verify that file paths, URLs, and MIME types are correctly set to ensure proper resource loading. Best Regard Danish Hafeez | QA Assistant ICTInnovations
  4. Yesterday
  5. Last week
  6. "Absolute address" is just you explicitly telling the browser what you want instead of letting it fill in the blanks itself. There's no difference between an absolute URL and a relative URL if they're both referring to the same resource.
  7. Ah, so if I log in on one page, and make a Ajax call to another page; it should work? Even if the link is an absolute address like https://myodomain/page.php opposed to page.php?
  8. htaccess/htpasswd stuff works as part of the HTTP protocol, much like cookies. Same-domain AJAX shouldn't know or care that it's happening.
  9. Fancy isn't important as I am the only one using it. However easy is ideal. I was thinking of using htaccess, htpasswd, .htaccess. I have never used those before, but I think they will be pretty simple to set up. My only concern is that I use Ajax to reference other pages, and I am worry that will interfere
  10. How simple and how user-friendly do you want it? You can configure your web server to do authentication with a simple list of usernames and passwords, but it's not a fancy solution: you have to manage the list yourself, and the authentication prompt is very plain. The username is available to PHP, if you want to do something with it after the authentication happens.
  11. Hi there. I am newbie too. Nice to meet you))
  12. Hello. I'm new here member. How are you guys doing?
  13. Hey Everyone, I own a business (unrelated to programming). To make my life easier I made some php apps that automate some of the paperwork I have to do. Does any one know a good framework that will allow me to put these behind a username and password? ideally, it would be something really simple to use. I want to avoid having to learn all the intricacies of something like drupal. In my mind, I picture a software that I install, put all my files in one directory, and those files now can only be accessed though this software . any thoughts?
  14. Also apologies, this has been posted in the wrong section.
  15. HI All, I am making an application that allows a user to fill in forms. Forms can be attached to an umbrella element called a pass. A pass has dates and zones. The forms that can be attached to it can contain anything. Currently i am saving all of the data to the person record in json format. All of the fields get a field code that is unique accross the system and identify the data in the json. ie Field Name Field Code First Name fname Last Name lname However, I am going to have a listing for submissions that will need to seperate all of the data out at least in terms of viewing it. What i mean by this is that i will have a section where the user can click to view all of the form submissions, filter by type and action them - maybe reject them or accept them. My question is - what do you think would be the best way to store the submitted data - i believe that it should be saved into a normalised table with a json column containing all of the submitted data. If this is the route that i go down, it leads to another question. As the pass can contain many forms, when submitting the data, how do it split it so that it submits as multiple forms. Currently i am using ajax formData which is submitting the lot in one chunk - i have chosen this route as the forms are dynamic so i wont know what the fields are. This is currently working pretty well interms of handling the data and attaching it to the person in json format. I have attached an image of the form to give a bit of context. You can see that the pass is called P1 and there are 2 forms: test and One. I know that this is likely very subjective but i am looking for a steer in the right direction as i feel messing this up will cause major headaches down the line. As always, if you dont know what i am talking about, feel free to ask for more context and i can provide code to help. Thanks All Adam
  16. I am sorry all, i am having a bad month. Below is the answer $(document).on('click', '#newFieldRow', function() { console.log('clicked') $html = `<div class='row mb-3'> <div class='col'> <input type='text' class='form-control w-100' name='code[]' required> </div> <div class='col'> <input type='text' class='form-control w-100' name='label[]' required> </div> <div class='col'> <input type='number' class='form-control w-100' name='width[]' min='1' max='12' required> </div> <div class='col'> <?= showDataClassifications($pdo, 'select') ?> </div> <div class='col'> <select class='form-select' name='type[]' required > <option disabled selected value='0'>Please Select</option> <?= getFieldTypes($pdo, $field['Type']) ?> </select> </div> <div class='col-1 text-center'> <i class='fa-solid fa-ban'></i> </div> </div>` $('.fieldContainer').append($html) })
  17. I have a function $(document).on('click', '#newFieldRow', function() { console.log('clicked') $html = `<div class='row mb-3'> <div class='col'> <input type='text' disabled class='form-control w-100' name='code[]' value='" . htmlspecialchars($field['Code']) . "' required> </div> <div class='col'> <input type='text' class='form-control w-100' name='label[]' value='" . htmlspecialchars($field['Label']) . "' required> </div> <div class='col'> <input type='number' class='form-control w-100' name='width[]' min='1' max='12' value='" . htmlspecialchars($field['Width']) . "' required> </div> <div class='col'> ` + <?php echo (showDataClassifications($pdo, 'select', $field['Classification'])) ?> + ` </div> <div class='col'> <select class='form-select' name='type[]' required disabled> <option disabled selected value='0'>Please Select</option> " . getFieldTypes($pdo, $field['Type']) . " </select> </div> <div class='col-1 text-center'> <i class='fa-solid fa-ban'></i> </div> </div>` $('.fieldContainer').append($html) }) What is the correct way to get the php in this to execute after it is appended?
  18. Looking closer, 1. You only use a #MessageContainerFoot for info-level messages. 2. You repeat that for every info message, which means you'll potentially use the same "MessageContainerFoot" ID for more than one element, which is wrong. Think about exactly what you want to do, then check your code from top to bottom to make sure that it is working the way you wanted it to. Because there's clearly some disconnect between "put #MessageContainerFoot into #MessageContainerHead" and "only use #MessageContainerFoot for info messages".
  19. Strange a function that is defined twice should be flagged as "undefined". You have a surfeit of quotes in this line... echo '<select name="avatar" id="Avatar" onChange="changeAvi()"">'; ^
  20. im getting this error Uncaught ReferenceError: changeAvi is not defined at HTMLSelectElement.onchange I have the script working on another website which works fine ive simply tried to add it to my new website and getting this error I have the script at the top of the page <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.11.2/jquery-ui.js"></script> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="https://pkmnhelios.com/membersarea_files/button.e7f9415a2e000feaab02c86dd5802747.js.download"></script> <script src="exponential.js"></script> <script type="text/javascript"> function changeAvi(){ var image = document.getElementById('avatarchange'); var dropd = document.getElementById('Avatar'); image.src = dropd.value; }; </script> <br> <input type="submit" name="update" id="button"/> </form> <p> <script type="text/javascript"> function changeAvi(){ var image = document.getElementById('avatarchange'); var dropd = document.getElementById('Avatar'); image.src = dropd.value; }; </script> Then i run some php oose your avatar <br><?php echo '<img id=avatarchange src=images/trainers/000.png />'; ?> <?php echo '<select name="avatar" id="Avatar" onChange="changeAvi()"">'; $sql6=mysqli_query($link,"SELECT * FROM avatars"); while ($row6=mysqli_fetch_array($sql6)){ echo "<option value='".$row6['Image']."'>".$row6['Name']."</option>"; ?> <?php } echo '</select>'; And yes im gonna update it to pdo again this script works on another page inside my site but not a blank page
  21. Dear Mr.mac_gyver & Mr.Barand, Thanks for your support. The above code is working properly.
  22. nevermind. it sucks.. i tried. We all fail somtimes.
  23. Yes, I tried console.log() and alert() to check each line and function. In initial function it is giving at document.getElementById('MessageContainerHead').appendChild( document.getElementById('MessageContainerFoot') ); i tried doing var d= document.createElement("div"); d.classList.add("MessageContainerFoot"); document.getElementById("MessageContainerHead").appendChild(d); But from next part document.getElementById('MessageContainerFoot').show["display"] = "block"; won't work .
  24. Is this a good idea.. in a layered security sorta way... if ($_SERVER["REQUEST_METHOD"] == "GET" || $_SERVER["REQUEST_METHOD"] == "POST") { // List of SQL injection terms to blacklist $sqlInjectionTerms = array('DROP', 'DELETE', 'UPDATE', 'INSERT', 'SELECT', 'AND', 'TRUNCATE', 'UNION', 'SELECT * FROM'); // Function to check for SQL injection terms in request parameters function checkForSqlInjection($requestData, $sqlInjectionTerms) { // Check if $requestData is an array if (!is_array($requestData)) { return; // Exit function if $requestData is not an array } foreach ($requestData as $param => $value) { // Check if $value is a string if (!is_string($value)) { continue; // Skip iteration if $value is not a string } foreach ($sqlInjectionTerms as $term) { if (stripos($value, $term) !== false) { // Detected potential SQL injection; terminate script execution // die("Potential SQL injection detected in parameter: " . htmlspecialchars($param)); echo $string = "FLAG:".bin2hex(random_bytes(10)); echo "<br>"; die (" error: 000ajfw5"); } } } } // Check for SQL injection in GET parameters if ($_SERVER["REQUEST_METHOD"] == "GET") { checkForSqlInjection($_GET, $sqlInjectionTerms); } // Check for SQL injection in POST parameters if ($_SERVER["REQUEST_METHOD"] == "POST") { checkForSqlInjection($_POST, $sqlInjectionTerms); } } yes, I already use PDOs.
  25. here's some coding pointers - don't copy variables to other variables for nothing. just use the original variable(s) that data is in. don't write out code for every possible value. use a data-driven design and let the computer operate on each value for you. here's what I came up with. in your initialization section - // define the month number and names (columns) $months = [1=>"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Decm"]; // note: the reason you needed to use decm is because dec is a reserved word. you can use dec if you surround it in back-tacks in any sql statement inside the while(){...} loop - // array to hold the data for the current row $data = []; // loop over the month number and month names foreach($months as $mo=>$month) { // produce the year-month value $ym = $row['Year'] .'-'. str_pad($mo,2,'0',STR_PAD_LEFT); // test if the year-month is between the start and end dates if($ym >= $row['start'] && $ym <= $row['end']) // use whatever you have named the start and end date columns { // put the value into the data array // use zero for any empty value $data[] = $row[$month] == '' ? 0 : $row[$month]; } } // at this point, $data contains the entries to use for the current row of fetched data // examine the result echo '<pre>'; print_r($data); echo '</pre>'; // calculate the average $TotalMark = round((array_sum($data)) / count($data), 2); // examine the result echo $TotalMark; note: you should use a value like 9999-12 for the end date for a person who is still employed
  26. Working with what you've unfortunately got now, when you read through the query results store each record in an array which has a subarray for month values. Covert the start and dates to index values for this array (0 if the start date is earlier than Jan and 11 if the end date is after Dec. Just use that portion of the array to calculate totals and averages.
  27. since your data isn't normalized, and is stored in month name columns in a single row, you will need to produce a year-month value, e.g. 2023-04, ... for each piece of data so that you can compare if it is BETWEEN the start and end dates OR you could normalize the data, and store each value in its own row in a table. the normalized data table would have columns for - id (autoincrement primary index), Emp_No, date, and amount. i also recommend that you store the dates using a DATE datatype and use 01 as the day part - year-month-01, e.g. 2023-04-10, 2024-06-01, ...
  1. Load more activity
×
×
  • 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.