Report error in settings.php when max length of 64K is exceeded.

Fixes #49.
This commit is contained in:
Sei Lisa 2017-09-29 12:49:31 +02:00
parent 032e0369bf
commit d4359b133e

View file

@ -148,7 +148,22 @@ else if(isset($_REQUEST['w'])){ // write to a record
else{ else{
$row = mysqli_fetch_assoc($result); $row = mysqli_fetch_assoc($result);
$newtext = $row['text'] . $given_text; $newtext = $row['text'] . $given_text;
if($row['count']+1 == $given_count){ if (strlen($newtext) > 65535) {
$sql = "UPDATE $avpos_table"
. ' SET text = ' . StrSQL("64K limit exceeded.\n"
. "The text that was generated can't"
. " be saved as a notecard because it's"
. " too long.")
. ', count = ' . IntSQL(10000+$given_count)
. ', timestamp = NOW()'
. ' WHERE webkey = ' . StrSQL($given_webkey);
mysqli_query($link,$sql) or email_death("ERR03: " . mysqli_error($link));
$response = "NOTECARD TOO LONG";
}
else if (startsWith($newtext, '64K limit exceeded')) {
$response = "NOTECARD TOO LONG";
}
else if($row['count']+1 == $given_count){
$response = "ADDING"; $response = "ADDING";
if(endsWith($_REQUEST['t'],"\n\nend")){ if(endsWith($_REQUEST['t'],"\n\nend")){