Good evening. Please help me.
I built my website on my home pc using Wamp as webserver. On one page I pass arguments to backend.php via URL.
Like this
echo "<a href='backend.php?g=$row[2]'><button >nbsp$row[1]</button></a>";
The code is working fine.
Now I uploaded the site to my godaddy hosting and can’t send the argument in the same manner. I gives me 404. The requested page "/backend.php?g=http://bc.luckyfaucets.com/" could not be found.
The code is exactly the same as on my home server, .htaccess is the same and they both have clean URL enabled. Can someone tell me the cause of this ?
This is the backend.php file.
<?php
define('DRUPAL_ROOT', getcwd());
require_once
DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
variable_set('ref', $_GET['g']);
$g = $_GET['g'];
$con=mysqli_connect($db_host,$db_user,$db_pwd,$database);
// Get infos siteid sitecyle from _sites_
$result = mysqli_query($con, "SELECT `siteid`, `sitecycle` FROM `_sites_` WHERE `siteurl` = '$g'");
while($row = mysqli_fetch_row($result)) {
$siteid = $row[0];
$sitecycle = $row[1];
// Count time + sitecycle
$next = (time() + ($row[1]*60)+15);
}
// Update _counters_
$result = mysqli_query($con, "SELECT `siteid`, `uid` FROM _counters_ WHERE `uid` ='$user->uid' AND `siteid` ='$siteid'");
if( mysqli_num_rows($result) > 0) {
mysqli_query($con, "UPDATE _counters_ SET `cycleend` = '$next' WHERE `uid` = '$user->uid' AND `siteid` = '$siteid'");
}
else
{
mysqli_query($con, "INSERT INTO _counters_ (uid, siteid, cycleend) VALUES ('$user->uid', '$siteid', '$next')");
}
drupal_goto('page');
?>
I would like to know what/why the same code does work with Wamp but not on my hosting. Is this maybe cause by some setting at godaddy?
Thanks for the help
<a href=’example.com/backend.php?g=$row[2]'>
<a href='www.example.com/backend.php?g=$row[2]'>
<a href='http://www.example.com/backend.php?g=$row[2]'>
Still getting 404 in all cases.mysqli_query
directly if you can avoid it. It seems your code can be subject to SQL injections now. Use Drupal's database API.db_insert
,db_update
etc will not allow you to make mistakes like that.example.com/backend.php
in your browser what happens?