what should i do

what should i do

first the right touchpad popped out, i didnt assume anything and would constantly try to push it back in place, and now the left one popped out, what should i do

u/Available_Hippo4035 — 3 days ago

mysqli_fetch_assoc with mysql prepared statements procedural, need help

Hello, im trying to update my website by replacing the simple mysqli queries with prepared statements, but i was stuck at trying to use mysqli_fetch_assoc to fetch associative data from the table, i looked through documentation but couldnt find anything, Any help will be appreciated, Thanks !

$error = array();
if(isset($_POST["login"])) {
$username = mysqli_escape_string($db, filter_input(INPUT_POST, "username", FILTER_SANITIZE_SPECIAL_CHARS));
$password = mysqli_escape_string($db, filter_input(INPUT_POST, "password", FILTER_SANITIZE_SPECIAL_CHARS));

if(empty($username)) {
array_push($error, "Username is empty!");
}
if(empty($password)) {
array_push($error, "Password is empty");
}

$sql = "SELECT `password`, `username`, `user_id` FROM `Accounts` WHERE `username` = ?;";
if(count($error) == 0) {

$stmt = mysqli_prepare($db, $sql);

mysqli_stmt_bind_param($stmt, "s", $username);
//$result = mysqli_query($db, $sql);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
if(mysqli_stmt_num_rows($stmt) > 0) {
$row = mysqli_fetch_assoc($result);
if(password_verify($password, $row["password"])) {
$_SESSION["username"] = $username;
$_SESSION["user_id"] = $row["user_id"];

header("location: /");

} else {
array_push($error, "Incorrect username or password!");
}
} else {
array_push($error, "Incorrect username or password!");
}
}
mysqli_close($db);
}
reddit.com
u/Available_Hippo4035 — 8 days ago
▲ 2 r/gmrs+1 crossposts

Amplifying reception with Spf5189z amplifier

is it possible to use this to amplify my reception on a 2 way radio, this is mostly used for transceivers like LoRa and cc1101 but i was wondering if its possible with a 2-way radio.

the maximum power output is 660mW, so it will probably get destroyed if i key up

https://preview.redd.it/1wp9lhm4afhh1.png?width=528&format=png&auto=webp&s=f39683c52118b7acb94f84ef246c75293569aa05

if not, what cheap amplifier or bandpass filter should i use.

reddit.com
u/Available_Hippo4035 — 16 days ago
▲ 2 r/gmrs+2 crossposts

Preventing sma from breaking

Hello guys, Im going to buy the rh-770 antenna for my handheld, but i heard when you are using it you should do so in a stationary place otherwise you might damage/break the sma connector, is this true and is it with any antenna even whips or just rigid long antennas? Thanks.

reddit.com
u/Available_Hippo4035 — 1 month ago

weird behavior in including files

i have a weird problem in including files in php, i have a functions.php file in a folder and a Router in the index.php file, when i include thefunctions.php in the index.php, all the other pages that rely on it get broken, the variables become empty and the functions no longer work, when i dont include it in the index.php file all the other pages function normally

i include my files in all pages in this way

require_once($_SERVER["DOCUMENT_ROOT"] . "/src/logic/functions.php");

my other pages are in /src/pages/

i have tried all ways of including the file but i keep getting the same problem, i need to include the functions.php in the index file to use some of its functions.

i do have a declare(strict_types=1) in the index file if that affects it

Any help will be appreciated thanks.

reddit.com
u/Available_Hippo4035 — 2 months ago

file not being deleted after its expiry time passes

Hello, im trying to make a rate limiting function that prevent users from using specific forms when they reach a certain threshold and the limit will get reset after a certain amount of time, when a user submits a request, a file with their ip will get created into a cache folder and the amount of requests is inside the file, the rate limiting works except the file doesnt get deleted after the specified amount of time passes, any help will be appreciated. Thanks!

rate_limiter.php

<?php
ignore_user_abort(true);
//Get the user IP
function getIP() {
$ip = null;
if(!empty($_SERVER["REMOTE_ADDR"])) {
$ip = $_SERVER["REMOTE_ADDR"];
} elseif(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}

return $ip;
}

function rate_limit($ip, $requests_limit, $limit_expiry) {
$start_time = null;
$reached_limit = null;
$amount_requests = 1;
$file_name = __DIR__ . "/cache/ratelimit-" . $ip;
$file_name = rtrim($file_name);
if(!file_exists($file_name)) {
global $start_time;
$start_time = time();
$fp = fopen($file_name, "w+") or die("An error occured");
fwrite($fp, $amount_requests) or die("Failed to write into file");
fclose($fp);
} elseif(file_exists($file_name)) {
$fp = fopen($file_name, "r+") or die("Failed to read file");
$new_amount_requests = file_get_contents($file_name);
if($new_amount_requests >= $requests_limit) {
global $reached_limit;
echo "<script>alert('You have been rate limited!')</script>";
$reached_limit = true;
header("Location: /", 423, true);
} elseif(!$reached_limit) {
$new_amount_requests++;
ftruncate($fp, 0);
fwrite($fp, $new_amount_requests) or die("Failed to write amount of requests");
}
}

if(file_exists($file_name) && time() - $start_time >= time() + $limit_expiry) {
unlink($file_name);
}




}

?>

index.php

<?php
ignore_user_abort(true);
require_once("rate_limiter.php");

if(isset($_POST["submit"])) {
$ip_Addr = getIP();
rate_limit($ip_Addr, 3, 60);
echo $_POST["text"];
}

?>
reddit.com
u/Available_Hippo4035 — 2 months ago

Difference between pwm and single wire pwm

Hello, im having trouble trying to understand the difference between pwm (the same one used to control led brightness, non-PWM fans) and single wire pwm (like in pc fans where the pwm is a single wire), i thought pwm is used to control electronics through positive and negative and not a single wire. Im asking this to control a pwm server fan without a pc Any help will be appreciated thanks! ​​​

reddit.com
u/Available_Hippo4035 — 2 months ago
▲ 1 r/Motors

What is single wire pwm on fans?

Hello, im having trouble trying to understand the difference between pwm (the same one used to control led brightness, non-PWM fans) and single wire pwm (like the one in pc fans where the pwm is a single wire), i thought pwm is used to control electronics through positive and negative and not a single wire. Im asking this to control a pwm server fan without a pc Any help will be appreciated thanks! ​​​

reddit.com
u/Available_Hippo4035 — 2 months ago

Overheating after thermal paste change on laptop

I changed my laptops cpu thermal paste, before changing the temps were around 70°c playing games, but after the thermal paste change its now 90°c

I used a zalman stc-8 on the cpu

The laptop's model is ​ınfinix inbook x1

I tightened the screws diagonally but didn't overturn, any help will be appreciated ​

u/Available_Hippo4035 — 2 months ago