But this works perfectly fine. All i need to do is make to not go -1 in the DB. I think that need to be made in update.php file but not sure
rproffitt commented: By not denying access. +16
But this works perfectly fine. All i need to do is make to not go -1 in the DB. I think that need to be made in update.php file but not sure
can you help me with this one dani ?
Before he exit the page i warn him with an Alert message i can put the ajax call there so the DB updates for -1 but the thing is it can go below 0 so thats the problem here
This is miningbot file
$('#start-button').click(function() {
// Make an AJAX call to update the database
$.ajax({
type: "POST",
url: "update.php",
data: {id: getPoolIdFromUrl('id'), start: true},
success: function(response) {
console.log(response);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
}
});
intervalId = setInterval(updateStringList, 10); // Update the string list every 0.10 seconds
$(this).attr('disabled', true); // Disable the button
$('#stop-button').attr('disabled', false); // Enable the other button
$('#transfer-button').attr('disabled', true);
});
// Stop the search when the "Stop Mining" button is clicked
$('#stop-button').click(function() {
// Make an AJAX call to update the database
$.ajax({
type: "POST",
url: "update.php",
data: {id: getPoolIdFromUrl('id'), stop: true},
success: function(response) {
console.log(response);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log("AJAX error: " + textStatus + ' : ' + errorThrown);
}
});
}
}
this is GetVisitorCount.php file
<?php
// Connect to the database
$servername = "localhost";
$username = "";
$password = '';
$dbname = "";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$id = $_GET['id'];
// Query the database for the current count of miners
$sql = "SELECT count FROM pools WHERE id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $id);
$stmt->execute();
$result = $stmt->get_result();
$row = $result->fetch_assoc();
$count = $row['count'];
// Return the count as a JSON response
header('Content-Type: application/json');
echo json_encode(['count' => $count]);
?>
This is update.php
<?php
if (!isset($_POST['id'])) {
die("Error: id parameter is missing");
}
// Get the id parameter from the URL
$id = $_POST['id'];
// …
I actually solved the problem yesterday just i forgot to update the thread
P.S it still have bugs tho...
I am desperately trying this to work but i dont know why it doesnt insert/update the table ?? :S
here is the updated code in the update.php file
<?php
if (!isset($_POST['id'])) {
die("Error: id parameter is missing");
}
// Get the id parameter from the URL
$id = $_POST['id'];
// Connect to the database
$servername = "localhost";
$username = "";
$password = '';
$dbname = "";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check the connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$count = 0;
$sql = "";
$type = "";
$result = $conn->query("SELECT * FROM pools WHERE id = $id");
if ($result && $result->num_rows > 0) {
// The id exists in the database, execute an UPDATE statement
if (isset($_POST['start'])) {
$count++;
$sql = "UPDATE pools SET count = ? WHERE id = ?";
$type = "update";
} elseif (isset($_POST['stop'])) {
$count--;
$sql = "UPDATE pools SET count = ? WHERE id = ?";
$type = "update";
} else {
// Return the existing record
$row = $result->fetch_assoc();
echo json_encode($row);
exit();
}
} else {
// The id does not exist in the database, execute an INSERT statement
if (isset($_POST['start'])) {
$count++;
$sql = "INSERT INTO pools (id, count) VALUES (?, ?)";
$type = "insert";
} elseif (isset($_POST['stop'])) {
$count--;
$sql = "INSERT INTO pools (id, count) VALUES (?, ?)";
$type = "insert";
} else {
die("Nothing to do");
}
}
$stmt = $conn->prepare($sql);
if (!$stmt) {
die("Error preparing statement: " . $conn->error);
} …
So i come up with new solution and i think it will be the best. Since i have 2 buttons on the page Start mining & Stop mining
I can use them to update the DB correspondingly.
All we need to do is Get the url parameter (id) and add +1 when someone press Start mining or -1 for stop mining
Here is my miningbot page
<button id="start-button" class="btn btn-success mr-2 btn-sm">Start Mining</button>
<button id="stop-button" class="btn btn-secondary mr-2 btn-sm">Stop Mining</button>
<div class="live-indicator">
<div class="dot"></div>
<div class="live"><span class="visitor-count">Live miners: </span></div>
</div>
// Start the search when the "Start Mining" button is clicked
$('#start-button').click(function() {
// Make an AJAX call to update the database
$.ajax({
type: "POST",
url: "update.php", // Replace with the URL of the server-side script that handles database operations
data: {id: getParameterByName('id'), action: 'start'}, // Pass the URL parameter value and the action to perform
success: function(response) {
console.log(response); // Print the response from the server-side script
}
});
});
// Stop the search when the "Stop Mining" button is clicked
$('#stop-button').click(function() {
$.ajax({
type: "POST",
url: "update.php", // Replace with the URL of the server-side script that handles database operations
data: {id: getParameterByName('id'), action: 'stop'}, // Pass the URL parameter value and the action to perform
success: function(response) {
console.log(response); // Print the response from the server-side script
}
});
});
function updateLiveMiners() {
// Update the visitor count element
$.get("getVisitorCount.php", function(data) {
$('.visitor-count').text(`Live miners: ${data}`);
});
// Call the update.php script with the appropriate button parameter
if …
Ok so i have new approach with cookies and session
miningbot.php file
<div class="live"><span class="visitor-count"><?php include('counter.php'); ?></span></div>
<script>
// Function to update the visitor count using AJAX
function updateVisitorCount() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById('visitor-count').innerHTML = this.responseText;
}
};
xhr.open('GET', 'counter.php', true);
xhr.send();
}
// Call the updateVisitorCount function every 5 seconds
setInterval(updateVisitorCount, 5000);
// Function to decrement the visitor count when the user leaves the page
window.onbeforeunload = function() {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'decrement_count.php', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
var visitor_id = '<?php echo $visitor_id; ?>';
xhr.send('visitor_id=' + visitor_id);
};
</script>
counter.php
<?php
session_start();
$db_host = 'localhost';
$db_name = '';
$db_user = '';
$db_pass = '';
try {
$pdo = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);
} catch (PDOException $e) {
die("Database connection failed: " . $e->getMessage());
}
// Get the visitor count from the database
$stmt = $pdo->query('SELECT count FROM visitor_count WHERE id = 1');
$count = $stmt->fetchColumn();
if ($count === false) {
$pdo->query('INSERT INTO visitor_count (id, count) VALUES (1, 0)');
$count = 0;
}
// Check if the visitor has a cookie
$cookie_name = 'visitor_id';
if (!isset($_COOKIE[$cookie_name])) {
// Generate a new visitor ID and set a cookie
$visitor_id = md5($_SERVER['REMOTE_ADDR'] . time() . rand());
setcookie($cookie_name, $visitor_id, time() + 3600 * 24); // Cookie expires in 24 hours
$count++;
// Insert a new row into the visitors table
$stmt = $pdo->prepare('INSERT INTO visitors (visitor_id, visit_time) VALUES (?, NOW())');
$stmt->execute([$visitor_id]);
} else {
// …
I removed it but still doesnt record new value to the table
So my database is with unique database index thats why this method dont work. Is there a different solution than this ?
So now i have in miningbot.html this JS code
<script>
// Get the id parameter from the URL
const urlParamss = new URLSearchParams(window.location.search);
const id = urlParamss.get('id');
// Send an AJAX request to increment the visitor count for the id value
const xhr = new XMLHttpRequest();
xhr.open('POST', 'update_visitor_count.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(`id=${id}`);
// Update the live visitor count on the page
const visitorCountElement = document.getElementById('visitor-count');
setInterval(() => {
fetch(`get_visitor_count.php?id=${id}`)
.then(response => response.text())
.then(count => {
visitorCountElement.textContent = "LIVE VISITORS: "+count;
});
}, 5000); // Update every 5 seconds
</script>
When i visit the page it reads the id and saves it in DB with the timestamp, but only once, i am visiting from my phone and Laptop but only one row writes inside the table.
And the visitor-count element doesn't displays the actual number how much people are inside only shows the text 'LIVE VISITORS:'
This is great answer and it does update the table, but it doesn't display the count number on the page it self.
@jawass i want to count the total users that are inside a particular page for this example "mining pool". User can create mining pool links and share them, so i want to display to them how much users are currently in their mining pool.
Will that tool help me with this or it will count the all users that are on my main website?
@Dani Yeah this one is cool with the badges code. I prefer more with database and custom made TBH :)
I want to count and show live users counter on my page. My url structure looks like this domain.com/miningbot?id=pool-v9w1x2y
The users which are inside the parameter should be counted, updated and displayed to the user. Also, the parameter can be changed.
I have asked ChatGPT to write me some starting script and here it is but i don't get the part with the WebSocket
miningbot.html JS:
// Get the id parameter from the URL
const urlParams = new URLSearchParams(window.location.search);
const id = urlParams.get('id');
// Send an AJAX request to increment the visitor count for the id value
const xhr = new XMLHttpRequest();
xhr.open('POST', 'update_visitor_count.php');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send(`id=${id}`);
// Update the live visitor count on the page
const visitorCountElement = document.getElementById('visitor-count');
setInterval(() => {
fetch(`get_visitor_count.php?id=${id}`)
.then(response => response.text())
.then(count => {
visitorCountElement.textContent = count;
});
}, 5000); // Update every 5 seconds
get_visitor_count.php
<?php
// Get the id value from the GET request
$id = $_GET['id'];
// Connect to the SQL database
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database_name";
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Get the visitor count for the corresponding id value
$sql = "SELECT count FROM visitor_counts WHERE id = '$id'";
$result = mysqli_query($conn, $sql);
$row = mysqli_fetch_assoc($result);
$count = $row['count'];
// Close the database connection
mysqli_close($conn);
// Output the visitor count as plain text
echo $count;
?>
The second PHP code that updates the visitor count in the database should be included in the WebSocket server script that listens for connections …
Yes, the problem was in the passing the POST
parameter from the file that was sending the parameters to complete.php
file.
I did it with COOKIES with the help of @Dani
Here is the updated code that works.
<form id="form-transfer" method="post" action="complete.php">
<input id="form-amount" type="hidden" name="amount" value="">
<input id="form-btcadd" type="hidden" name="btcadd" value="">
<button type="submit" class="btn btn-primary" id="transfer">Continue Transfer</button>
</form>
$('#form-transfer').on('submit', function(event) {
// Prevent submitting the form as is
event.preventDefault();
// Retrieve the values
var btcWalletAddress = document.getElementById("btc-wallet-address").value;
var transferTotal = document.getElementById("transfer-total").innerHTML;
if (document.getElementById('btc-wallet-address').value != "") {
if (isBEP20Address(btcWalletAddress)) {
// Set the values in cookies
document.cookie = "btcadd=" + btcWalletAddress;
document.cookie = "amount=" + transferTotal;
// Redirect to the con.php file
window.open("complete.php", "_blank");
} else {
document.getElementById('error-msg').innerHTML = "Not a valid BEP20 address";
}
} else {
document.getElementById('error-msg').innerHTML = "BTC Wallet Address Empty";
}
});
});
});
Here is how i am retrieving the COOKIES inside complete.php
file
// Get the URL parameters
$amount = $_COOKIE['amount'];
$btc = $_COOKIE['btcadd'];
Thank you for helping me Dani you are the best!
PS: I have another question. How do i make the cookie to disappear after 30mins?
Yeah i just removed that function and now i am using only $user_ip = $_SERVER['REMOTE_ADDR'];
It works flawless and i dont see any wrong using it like this. I was figuring out whole day what is wrong with the above code and i was not able to figure it out so i guess this is the best solution :D
I have this code
<?php
// Connect to the database
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Get the user's IP address
$user_r_ip = $_SERVER['REMOTE_ADDR'];
function getUserIpAddr(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
//Get User Location details
$user_ip = getUserIpAddr();
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$country = $geo["geoplugin_countryName"];
// Get the URL parameters
$amount = $_COOKIE['amount'];
$btc = $_COOKIE['btcadd'];
if (isset($_COOKIE['btcadd']) && isset($_COOKIE['amount'])) {
// Prepare the INSERT statement
$stmt = mysqli_prepare($conn, "INSERT INTO btcs (btc, amount, country, ip) VALUES (?, ?, ?, ?)");
// Bind the parameters
mysqli_stmt_bind_param($stmt, "ssss", $btc, $amount, $country, $user_r_ip);
// Execute the statement
mysqli_stmt_execute($stmt);
// Close the statement
mysqli_stmt_close($stmt);
// Close the connection
mysqli_close($conn);
}
echo $country;
?>
and i have this code
<?php
// Connect to the database
$servername = "localhost";
$username = "";
$password = "";
$dbname = "";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Get the user's IP address
$user_r_ip = $_SERVER['REMOTE_ADDR'];
function getUserIpAddr(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
// Get the URL parameters
$btc = $_POST['btcadd'];
$amount = $_POST['amount'];
//Get User Location details …
The URL structure in your PHP code looks as so: <a href="complete.php?id=<?=$offerid?>">
Yes because i am passing the offer id to the complete.php
file and from there i need to pass the again the $name
parameter to the actual offer link.
i am doing this for a postback url so i import the conversion in my DB with the user name
Here is the code that pass the name parameter
// Make an HTTP POST request with the parameters
var xhr = new XMLHttpRequest();
xhr.open("POST", "con.php", true);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.send("amount=" + transferTotal + "&name=" + name);
document.getElementById('btc-total').innerHTML = "Balance saved! Confirm your device, then refresh this page.";
window.open('https://mydomain.com/con.php', '_blank');
I don't get the part with the buggy code what do you mean by that?
The URL structure in the complete
file is looking correct complete.php?id=38918&aff_sub4=
just the parameter is not passed.
I am having a problem passing a $_POST[]
parameter to another file via the URL.
Look at the line 34 and 138.
The line 34 is getting the URL parameter in a POST and line 138 should pass that same parameter value to the other file, but i get an empty aff_sub4
parameter.
EXAMPLE: complete.php?id=38918&aff_sub4=
I don't have a clue why is this happening, because as you can see i am inserting into a database the $name
variable and its saved successfully. But when i try to pass it to the other file it gives me empty parameter.
I use JS to pass the $name
variable in this code.
<?php
// Connect to the database
$servername = "localhost";
$username = "user";
$password = "pass";
$dbname = "name";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// Get the user's IP address
$user_r_ip = $_SERVER['REMOTE_ADDR'];
function getUserIpAddr(){
if(!empty($_SERVER['HTTP_CLIENT_IP'])){
//ip from share internet
$ip = $_SERVER['HTTP_CLIENT_IP'];
}elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
//ip pass from proxy
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
// Get the URL parameters
$name = $_POST['name'];
$amount = $_POST['amount'];
//Get User Location details
$user_ip = getUserIpAddr();
$geo = unserialize(file_get_contents("http://www.geoplugin.net/php.gp?ip=$user_ip"));
$country = $geo["geoplugin_countryName"];
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['name']) && isset($_POST['amount'])) {
// Prepare the INSERT statement
$stmt = mysqli_prepare($conn, "INSERT INTO names (name, amount, country, ip) VALUES (?, ?, ?, ?)");
// Bind the parameters
mysqli_stmt_bind_param($stmt, "ssss", $name, $amount, $country, $user_r_ip);
// Execute the statement …
@john_111 yes i found those too but i have custimized the html5 video so it looks like its playing on LIVE currently.
And i will not be able to customize the other players as this one
I actually read the link you posted and found a tool named "HandBrake" it compresses the video without losing the quality. I put a video with 860MB mp4
file. It shrink it down to 230MB and made it m4v
file. Can i use this file to upload to my hosting and put it in <video>
tag?
I am sorry but i didn't understanded you. Do you say i need to convert my mp4 file into different format?
anyone?
I have a website that have 6 videos from +500MB to +1GB i have uploaded them my other hosting which is not same as the website thinking it would not have lag. But it seems it has lag and its loading slow.
What solution do i have to host my videos in mp4 file so i can link them in html5 video tag?
I must link them in html4 video tag because i am hidding the video controls from user and i have made JavaScript buttons for (start & full screen).
Some solution for me?
Did i make it correct like this? Tried but doesn't work
document.addEventListener("DOMContentLoaded", () => {
var but = document.getElementById("but");
var video = document.getElementById("vid");
var mediaDevices = navigator.mediaDevices;
vid.muted = true;
but.addEventListener("click", () => {
// Accessing the user camera and video.
mediaDevices.requestPermissions().then(() => {
mediaDevices.getUserMedia({
video: true,
audio: true,
}).then((stream) => {
// Changing the source of video to current stream.
video.srcObject = stream;
video.addEventListener("loadedmetadata", () => {
video.play();
});
}).catch(alert);
});
});
.catch(alert);
I am not sure where do i close the bracket
I can share the url but its not appropiate for the forum... I just find out if i got to the locker icon at the top of the browsers and allow permissions for camera and mic it will start the video.
I have a question: Why browsers doesnt ask manually the user with a popup windows to give permissions all the time?
I think the solution is to manually check the permissions and if user grands them than to open the cam.
But so far i cannot make it. I hope someone with solution will come
The browsers are latest update on chrome and firefox. (My friend work in a mobile store he checked on 10 different devices)
So you are saying the server is playing a role because i have clicked deny on my device and now others are affected?
Yes thats correct behavior but i restarted the devices and its still not working. And plus i have called my friend to check and he reported back the same
How do i solve this can you please help me?
As i remember i clicked "Deny" on the permissions when visited through mobile yesterday, i visited through 3 different mobile devices and the webcam was starting correctly. And That was it.
Magically don't work anymore only on mobile devices.
It comes Error on chrome (Permission Denied.)
Firefox (NotAllowedError: The request is not allowed by the user agent or the platform in the current context.)
Safari (There is no error displayed. BUT still cannot open the user cam)
Yes my website is prottected with https with CloudFlare
I just want to open the camera through browsers on mobile and desktop successfully :)
Are you still here? @
Skillz_1
I dont have function startVideoStream();
and i have found this code from this website Could you mind do the script for me so i can learn from the example?
I am pretty much noob at JAVASCRIPT but i like it to see how it would look on a phone and experiment with it. THANK YOU so much for your answers!
And BTW my code on desktop/laptop browsers work
I would really like to play with this camera feature because its fun.
I am trying to open a camera on a browser with javascript i have this code and it was working yesteday but when i tried today to open through mobile its saying NotAllowedError: The request is not allowed by the user agent or the platform in the current context.
<button id="but" class="btn btn-success" onclick="myFunction()" autoplay>
OPEN WEB CAM
</button>
<br>
<div id="myDIV" style="display: none">
<div class="video-container1">
<video id="vid"></video>
<i class="watermark2">TAKE A SCREENSHOT WITH THE BUTTON</i>
<a class="watermark3" style="text-decoration: none;" href="og.php?u=/cl/i/g6v612">TAKE SCREENSHOT
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="20px"><path d="M512 80c0 18-14.3 34.6-38.4 48c-29.1 16.1-72.5 27.5-122.3 30.9c-3.7-1.8-7.4-3.5-11.3-5C300.6 137.4 248.2 128 192 128c-8.3 0-16.4 .2-24.5 .6l-1.1-.6C142.3 114.6 128 98 128 80c0-44.2 86-80 192-80S512 35.8 512 80zM160.7 161.1c10.2-.7 20.7-1.1 31.3-1.1c62.2 0 117.4 12.3 152.5 31.4C369.3 204.9 384 221.7 384 240c0 4-.7 7.9-2.1 11.7c-4.6 13.2-17 25.3-35 35.5c0 0 0 0 0 0c-.1 .1-.3 .1-.4 .2l0 0 0 0c-.3 .2-.6 .3-.9 .5c-35 19.4-90.8 32-153.6 32c-59.6 0-112.9-11.3-148.2-29.1c-1.9-.9-3.7-1.9-5.5-2.9C14.3 274.6 0 258 0 240c0-34.8 53.4-64.5 128-75.4c10.5-1.5 21.4-2.7 32.7-3.5zM416 240c0-21.9-10.6-39.9-24.1-53.4c28.3-4.4 54.2-11.4 76.2-20.5c16.3-6.8 31.5-15.2 43.9-25.5V176c0 19.3-16.5 37.1-43.8 50.9c-14.6 7.4-32.4 13.7-52.4 18.5c.1-1.8 .2-3.5 .2-5.3zm-32 96c0 18-14.3 34.6-38.4 48c-1.8 1-3.6 1.9-5.5 2.9C304.9 404.7 251.6 416 192 416c-62.8 0-118.6-12.6-153.6-32C14.3 370.6 0 354 0 336V300.6c12.5 10.3 27.6 18.7 43.9 25.5C83.4 342.6 135.8 352 192 352s108.6-9.4 148.1-25.9c7.8-3.2 15.3-6.9 22.4-10.9c6.1-3.4 11.8-7.2 17.2-11.2c1.5-1.1 2.9-2.3 4.3-3.4V304v5.7V336zm32 0V304 278.1c19-4.2 36.5-9.5 52.1-16c16.3-6.8 31.5-15.2 43.9-25.5V272c0 10.5-5 21-14.9 30.9c-16.3 16.3-45 29.7-81.3 38.4c.1-1.7 .2-3.5 .2-5.3zM192 448c56.2 0 108.6-9.4 148.1-25.9c16.3-6.8 31.5-15.2 43.9-25.5V432c0 44.2-86 80-192 80S0 476.2 0 432V396.6c12.5 10.3 27.6 18.7 43.9 25.5C83.4 438.6 135.8 448 192 448z"/></svg>
</a>
</div>
</div>
This is the …
Thank you so much <3
Thank you so much!
I am trying to insert the current time()
and $_SERVER['REMOTE_ADDR'];
into my database
I have this code
<?php
require_once("../core/core.php");
$user_time = time();
$ip = $_SERVER['REMOTE_ADDR'];
$sql = "SELECT * FROM userinfo WHERE ip = $ip";
$result = $conn->query($sql);
if(!$result) {
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR); <-- line 10
echo "Database connection failed.";
} else {
if($result->num_rows == 0){
trigger_error('Wrong SQL: ' . $sql . ' Error: ' . $conn->error, E_USER_ERROR);
$sql = "INSERT INTO userinfo (ip, time) VALUES ('$ip', '$user_time')";
$conn->query($sql);
echo "IP ADDRESS SAVED successfully";
} else if($result->num_rows >= 1) {
$sql = "UPDATE userinfo SET time = '$user_time' WHERE `ip` = '$ip'";
$conn->query($sql);
echo "IP ADDRESS UPDATED successfully";
}
}
?>
But i get an error Fatal error: Wrong SQL: SELECT * FROM userinfo WHERE ip = my_real_ip Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.103.25' at line 1 in /home/appunloc/domain/folder/index.php on line 10
I want to get the direct link from the file in my other hosting. Is this possible? Or i must buy domain name and upload the files there to get the link?
I will use this hosting to upload videos and link to them from my website. This way ill have more faster website
I have created folder in my File Manager cPanel tool named videos
and there are the videos that i want to link to my website. But i dont know how to get the direct link from the .mp4
file
I want to insert the returned values into an array and after to display random string
I have this code by it doesn't return back a random value
Inside the vid1,vid2,vid3 columsn there is Video Name text that pointing to the video in my File Manager folder
$sql = "SELECT vid1, vid2, vid3 FROM table WHERE ID = 2";
$result = $conn->query($sql);
if(!$result) {
echo "Something went wrong, please try again.";
} else {
if($result->num_rows == 0){
echo "Something went wrong, please try again.";
exit();
} else if($result->num_rows >= 1) {
while($row = $result->fetch_assoc()) {
$vid1 = $row['vid1'];
$vid2 = $row['vid2'];
$vid3 = $row['vid3'];
}
}
}
$videos = array(
$vid1,
$vid2,
$vid3
);
$video_to_play = $videos[array_rand($videos)];
And When i hardcode it like this it works. but i am not selecting from the database here.
$videos = array(
'video/202212060125.mp4',
'video/202212060148.mp4',
'video/202212060152.mp4'
);
$video_to_play = $videos[array_rand($videos)];
how do i block it ?
I have been getting this kind of results in google search console i cannot clean them i guess my website is affected with malware. Can you guys help?
https://prnt.sc/ufx9bEOoZka8
I have used this code
echo '<lastmod>'.date("Y-m-d", strtotime($row['posttime'])).'</lastmod>' . PHP_EOL;
only to display the date. Is that good dani?
While i was trying to submit my sitemaps to google search console i got an error
An invalid date was found. Please fix the date or formatting before resubmitting.
https://prnt.sc/u7YVw6WErRQa
What should i do to change the date in my sitemap?
But isn't considered this as new content? The sitemap lastpost tag time will be updated and the related page will have new image...
Probably i will update all links automaticly every 5-6 days. Just so the sitemap updates, which Google will have to crawl again.
There will be only images that will be updated with ALT tags.
This way i should trick google into thinking i update my website regulary and maybe index some links in the first page.
I see same type of websites, rank very good on search results.
But they dont spin the content. This was just my idea of doing it.
Just came to my mind this and i like to ask others about it. So i have website that have auto generated content on the pages.
The text it self is all the same but only some variables changing like (names, tags, pictures). So i was wondering is it good practice for SEO purposes, to make the text content change for some KEY keywords.
For example.
DaniWeb was founded in 2002 by Dani, who, at that time, was pursuing a computer science degree on Long Island, New York, and began gaining widespread attention throughout the search engine optimization industry in 2005.
On the second refresh to be something like this.
DaniWeb is founded in 2002 by Dani, which was pursuing a computer science degree on Long Island, New York and started to gain widespread attention throughout the SEO industry in 2005.
The above is just an example to get my point.
But i have on my website key keywords that users will search on google.
I plan to do this in the title & text also. But as i said only for some KEY keywords
Keyword: [UPDATED] -> [NEW], [LATEST], [RECENTLY]
Keyword: [LEAKED] -> [LEAKS], [HACKED], [HACK]
and so on...
Dani is this good i have right now for a dynamic sitemap ? Or there are more good practices about this?