I switched to php 7 and this doesn't work anymore! Please help!
When I switch back to php 5.6 it suddenly works. No idea why php would affect jquery. Please help!
I have tried everything but all other code is the same, I have changed nothing. All I did was switch php versions. I am perplexed and confused. Please help!
I can even show you screenshots of my server. I changed nothing except switch php versions. Is something missing in the config?
Please help!
function fillForm(id) {
console.log('fillForm ' + "<?=$read_call?>&id="+id+"");
$.getJSON("<?=$read_call?>&id="+id+"", function( data ) {
console.log('fillForm '+data);
$.each( data, function( key, val ) {
if(data.hasOwnProperty(key))
$('input[name='+key+']').val(val);
if(key == 'acct') {
$('select[name="acct"]').find('option:contains("'+val+'")').attr("selected",true);
}
if(key == 'priority') {
$('select[name="priority"]').find('option:contains("'+val+'")').attr("selected",true);
console.log('priority '+val);
}
if(key =='extra') {
$('textarea[name='+key+']').val(val);
}
if(key == 'password') {
$('#passwordRow').prop('title', val);
}
if(key == 'code') {
$('#codeRow').prop('title', val);
}
if(key == 'url') {
$('#url_1_href').prop('href', val);
}
if(key == 'referralURL') {
$('#url_2_href').prop('href', val);
}
});
});
}
Added php code:
<?php
include($dir.'functions.php');
include($dir.'config.php');
include($dir.'ez_sql_core.php');
include($dir.'ez_sql_mysql.php');
///////////////////////////
$tableName = 'credentials';
///////////////////////////
$id = $_REQUEST['id'];
foreach($_REQUEST as $request => $value) {
$_REQUEST[$request] = mysql_real_escape_string($value);
}
switch($_GET['action']) {
case 'update':
$update = "UPDATE $tableName SET name='".$_REQUEST['name']."',
password=AES_ENCRYPT('".$_REQUEST['password']."', '$key'),
code=AES_ENCRYPT('".$_REQUEST['code']."', '$key'),
acct='".$_REQUEST['acct']."',
priority='".$_REQUEST['priority']."',
campaign='".$_REQUEST['campaign']."',
username='".$_REQUEST['username']."',
email='".$_REQUEST['email']."',
url='".$_REQUEST['url']."',
referralURL='".$_REQUEST['referralURL']."',
extra='".$_REQUEST['extra']."'
WHERE id='".$id."'";
$success = $conn->query($update);
if($success == 1)
echo 'Updated record '.$id.': '.$update;
else
echo 'Failed to update record '.$update;
break;
case 'delete':
$query = "DELETE from $tableName WHERE id='".$id."'";
$success = $conn->query($query);
if($success == 1)
echo 'Successfully deleted record '.$id;
else
echo 'Failed to delete record '.$id;
break;
case 'create':
$insert = "INSERT INTO $tableName (name, acct, priority, campaign, username, email, password, code, url, referralURL, extra) values (
'".$_REQUEST['name']."',
'".$_REQUEST['acct']."',
'".$_REQUEST['priority']."',
'".$_REQUEST['campaign']."',
'".$_REQUEST['username']."',
'".$_REQUEST['email']."',
AES_ENCRYPT('".$_REQUEST['password']."', '$key'),
AES_ENCRYPT('".$_REQUEST['code']."', '$key'),
'".$_REQUEST['url']."',
'".$_REQUEST['referralURL']."',
'".$_REQUEST['extra']."'
)";
$success = $conn->query($insert);
if($success == 1)
echo 'Added record '.$insert;
else
echo 'Failed to add record '.$insert;
break;
case 'read':
default:
$read = "SELECT *, AES_DECRYPT(password, '$key') as password, AES_DECRYPT(code, '$key') as code FROM $tableName WHERE id='".$id."'";
$resR = $conn->query($read);
$recs = $resR->fetch_assoc();
echo json_encode($recs);
break;
}
?>