PHP Form Not Submiting (Waiting for localhost...) - php

Looked over some answers here but nothing seems to work..
I'm new to PHP and trying to upload multiple files from a form that's inside a jquery bootbox dialog..
here's my form:
function dialogUpload() {
bootbox.confirm({
message: '<form name="uploadForm" action="Control/upload.php" method="post" enctype="multipart/form-data"> '
+ ' Nome do objeto:<br />'
+ ' <input name="objectname" type="text"><br />'
+ ' <input type="hidden" name="MAX_FILE_SIZE" value="10000000">'
+ ' Objeto 3D(Formato <b>.dae</b>):<br />'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Imagem 2D do objeto(Formato <b>.png</b> ou <b>.jpg</b>) (<i>Opcional</i>):'
+ ' <input name="userfile[]" type="file" /><br />'
+ ' Comentário:<br />'
+ ' <textarea name="comment" rows="5" cols="75"></textarea>'
+ '</form>',
buttons: {
confirm: {
label: 'Enviar Arquivo',
className: 'btn-success'
},
cancel: {
label: 'Cancelar',
className: 'btn-danger'
}
},
callback: function (result) {
if(result){
document.uploadForm.submit();
}
}
});
}
and heres my PHP, it just create a random file name and check the file extensions...than upload the file to respective folder.
Running on Windows 10, with XAMPP(don't know if it's relevant)
<?php
include '../Model/conexao.php';
include 'funcoes.php';
echo '<script>alert("Upload script started.");</script>';
$uploadIsOk = TRUE;
$imageUploaded = FALSE;
$targetObjectDirectory = "C:\xampp\htdocs\importaobjetos\uploads\objects";
$targetImageDirectory = "C:\xampp\htdocs\importaobjetos\uploads\images";
$fileName = createFileName($targetObjectDirectory);
$targetObjectFile = $targetObjectDirectory . basename($_FILES["userfile"][0]["name"]);
$targetObjectFileType = pathinfo($targetObjectFile, PATHINFO_EXTENSION);
if($_FILES["userfile"][1]["name"] != ""){
$targetImageFile = $targetObjectDirectory . basename($_FILES["userfile"][1]["name"]);
$targetImageFileType = pathinfo($targetImageFile,PATHINFO_EXTENSION);
$imageUploaded = TRUE;
}
$errorMessage = '<script>alert("';
$successMessage = '<script>alert("';
checkExtensions();
replaceOriginalFileName();
if(!$uploadIsOk){
$errorMessage = $errorMessage . 'Erros occoridos estão acima, upload não foi feito.';
$errorMessage = $errorMessage . '");</script>';
echo $errorMessage;
}
else{
//Tudo certo, fazer upload
if(move_uploaded_file($_FILES["userfile"][0]["tmp_name"], $targetObjectFile)){
$successMessage = $successMessage . 'Upload do objeto foi feito com sucesso.\n';
if($imageUploaded && move_uploaded_file($_FILES["userfile"][1]["tmp_name"], $targetImageFile))
$successMessage = $successMessage . 'Upload da imagem foi feito com sucesso.\n';
}
$successMessage = $successMessage . '");</script>';
echo $successMessage;
}
//Funcoes
function checkExtensions(){
echo '<script>alert("checkExtensions");</script>';
if($targetObjectFileType != "dae"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para o objeto, favor usar arquivos .dae\n';
}
if($imageUploaded){
if($targetImageFileType != "jpg" && $targetImageFileType != "jpeg" && $targetImageFileType != "png"){
$uploadIsOk = FALSE;
$errorMessage = $errorMessage . 'Formato invalido para a imagem, favor usar arquivos .jpg, .jpeg ou .png\n';
}
}
}
function createFileName($targetObjectDirectory){
$fileCreated = FALSE;
echo '<script>alert("createFileName");</script>';
while(!$fileCreated){
$fileName = "";
$size = mt_rand(5,9);
$all_str = "abcdefghijlkmnopqrstuvxyzwABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
for ($i = 0;$i <= $size;$i++){
$fileName .= $all_str[mt_rand(0,61)];
}
$filePath = $targetObjectDirectory . $fileName . '.dae';
if(checkIfExists($filePath))
$fileCreated = TRUE;
}
return $fileName;
}
function checkIfExists($filePath){
if(file_exists($filePath))
return TRUE;
else
return FALSE;
}
function replaceOriginalFileName(){
$targetObjectFile = $targetObjectDirectory . $fileName . '.' . $targetObjectFileType;
if(imageUploaded)
$targetImageFile = $targetImageDirectory . $fileName . '.' . $targetImageFileType;
else
$errorMessage = $errorMessage . 'Voce nao fez upload da imagem, será utilizada a imagem padrao.';
}
?>
things I've changed in php.ini to try to make it work...:
file_uploads = On
upload_max_filesize = 10M
max_file_uploads = 20
post_max_size = 10M
max_input_time = 360
The curious thing is that it calls the php script just after the max_input_time..then it echos the alert on the beggining of the script, and gives the error
Fatal error: Maximum execution time of 360 seconds exceeded in C:\xampp\htdocs\importaobjetos\Control\upload.php on line 113
someone can help?
EDIT:
Apache errors.log(from last trial)
[Fri Jul 14 10:34:29.219240 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.275767 2017] [core:warn] [pid 5864:tid 664] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Jul 14 10:34:29.332850 2017] [ssl:warn] [pid 5864:tid 664] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00455: Apache/2.4.25 (Win32) OpenSSL/1.0.2j PHP/5.6.30 configured -- resuming normal operations
[Fri Jul 14 10:34:29.354372 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00456: Apache Lounge VC11 Server built: Dec 20 2016 13:02:04
[Fri Jul 14 10:34:29.354372 2017] [core:notice] [pid 5864:tid 664] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Jul 14 10:34:29.355874 2017] [mpm_winnt:notice] [pid 5864:tid 664] AH00418: Parent: Created child process 4944
[Fri Jul 14 10:34:29.754780 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.929697 2017] [ssl:warn] [pid 4944:tid 632] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Jul 14 10:34:29.953227 2017] [mpm_winnt:notice] [pid 4944:tid 632] AH00354: Child: Starting 150 worker threads.
[Fri Jul 14 10:34:42.508930 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 152
[Fri Jul 14 10:34:42.509446 2017] [:error] [pid 4944:tid 1920] [client ::1:54421] PHP Notice: Trying to get property of non-object in C:\\xampp\\htdocs\\importaobjetos\\index.php on line 162
when i try to get php_error_log it gives me "the system cannot find the path specified"

Do the changes as per the link WAMPServer phpMyadmin Maximum execution time of 360 seconds exceeded. Did you restarted the wamp server?
Or still same error coming?
Send me the error details.

Related

How to make a xslt-tranformation with Saxon/C PHP-API

I have a FrontController made in PHP with XSLT 1.0, i have installed the Saxon/C PHP-API to work with the XSLT 2.0. But now is the Problem, i must write the FrontController around the Saxon syntax.
$xmlDoc = new DOMDocument();
$xslDoc = new DOMDocument();
$proc = new XSLTProcessor();
$xslDoc->load("../ressources/xslt/transform_article_partials_to_html.xslt");
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$proc->setParameter ("" , "articlePfad" , $filename);
$proc->setParameter("", "lang", $lang);
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlDoc->load($dir . "/" . $filename);
} else {
echo "404";
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlDoc->load($dir . "/" . $filename);
} else {
echo "404";
}
}
$proc->importStylesheet($xslDoc);
echo $proc->transformToXML($xmlDoc);
Some sample code, what i do with the XSLT 1.0.
The Apache2 Error.log:
PHP Warning: PHP Startup: Unable to load dynamic library 'xsl' (tried: /usr/lib/php/20170718/xsl (/usr/lib/php/20170718/xsl: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/xsl.so (/usr/lib/php/20170718/xsl.so: undefined symbol: dom_node_class_entry)) in Unknown on line 0
PHP Warning: Module 'Saxon/C' already loaded in Unknown on line 0
[Thu Jun 20 00:40:38.128672 2019] [mpm_prefork:notice] [pid 892] AH00163: Apache/2.4.29 (Ubuntu) configured -- resuming normal operations
[Thu Jun 20 00:40:38.130224 2019] [core:notice] [pid 892] AH00094: Command line: '/usr/sbin/apache2'
[Thu Jun 20 00:40:54.815341 2019] [php7:notice] [pid 2692] [client 127.0.0.1:54472] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:54.815512 2019] [php7:error] [pid 2692] [client 127.0.0.1:54472] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:55.935485 2019] [php7:notice] [pid 2691] [client 127.0.0.1:54474] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:40:55.935580 2019] [php7:error] [pid 2691] [client 127.0.0.1:54474] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:44:39.915201 2019] [php7:notice] [pid 2719] [client 127.0.0.1:54508] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5, referer: http://localhost/Comelio%20Website/
[Thu Jun 20 00:44:39.915301 2019] [php7:error] [pid 2719] [client 127.0.0.1:54508] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5, referer: http://localhost/Comelio%20Website/
[Thu Jun 20 00:44:47.966250 2019] [php7:notice] [pid 2692] [client 127.0.0.1:54510] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:44:47.966297 2019] [php7:error] [pid 2692] [client 127.0.0.1:54510] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:13.520374 2019] [php7:notice] [pid 2691] [client 127.0.0.1:54528] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:13.520447 2019] [php7:error] [pid 2691] [client 127.0.0.1:54528] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:14.887942 2019] [php7:notice] [pid 2806] [client 127.0.0.1:54530] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:14.888235 2019] [php7:error] [pid 2806] [client 127.0.0.1:54530] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:15.847351 2019] [php7:notice] [pid 2693] [client 127.0.0.1:54532] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:15.874397 2019] [php7:error] [pid 2693] [client 127.0.0.1:54532] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:16.475331 2019] [php7:notice] [pid 2690] [client 127.0.0.1:54534] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 00:50:16.475456 2019] [php7:error] [pid 2690] [client 127.0.0.1:54534] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 02:09:30.155871 2019] [php7:notice] [pid 2719] [client 127.0.0.1:54596] PHP Notice: Undefined variable: saxonProc in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
[Thu Jun 20 02:09:30.156196 2019] [php7:error] [pid 2719] [client 127.0.0.1:54596] PHP Fatal error: Uncaught Error: Call to a member function newXsltProcessor() on null in /var/www/html/Comelio Website/comelio_com/FrontController.php:5\nStack trace:\n#0 /var/www/html/Comelio Website/comelio_com/index.php(3): require()\n#1 {main}\n thrown in /var/www/html/Comelio Website/comelio_com/FrontController.php on line 5
So i changed the code and now it works!
<?php
// INITIALIZE PROCESSOR
$saxonProc = new Saxon\SaxonProcessor();
$xsltProc = $saxonProc->newXsltProcessor();
$lang = $_GET['lang'];
$rubrik = $_GET['rubrik'];
$seite = $_GET['seite'];
// LOAD XSLT SCRIPT
$xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
$xsltProc->compileFromFile($xslFile);
// SET PARAMS
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$xdmvalue = $saxonProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
$xdmvalue = $saxonProc->createAtomicValue($lang);
$xsltProc->setParameter("lang", $xdmvalue);
// LOAD SOURCE XML
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
exit;
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
$xsltProc->setSourceFromFile($xmlFile);
} else {
echo "404";
}
}
// RUN TRANSFORMATION
$result = $xsltProc->transformToString();
echo $result;
// RELEASE RESOURCES
$xsltProc->clearParameters();
$xsltProc->clearProperties();
unset($xsltProc);
unset($saxonProc);
?>
Currently, you are using PHP's XSL class to supposedly run an XSLT 2.0 script. If you really do have the Saxon/C API installed, implement this in place of PHP's XSL class.
Consider the below, untested code as example using online docs:
// INITIALIZE PROCESSOR
$saxonproc = new Saxon\SaxonProcessor();
$xsltProc = $saxonProc->newXsltProcessor();
// LOAD XSLT SCRIPT
$xslFile = "../ressources/xslt/transform_article_partials_to_html.xslt";
$xsltProc->compileFromFile($xslFile);
// SET PARAMS
$dir = __DIR__ . "/articles/" . $lang;
$filename = "{$rubrik}_{$seite}.html";
$filelist = scandir($dir, 1);
$xdmvalue = $xsltProc->createAtomicValue($filename);
$xsltProc->setParameter("articlePfad", $xdmvalue);
$xdmvalue = $xsltProc->createAtomicValue($lang);
$xsltProc->setParameter("lang", $xdmvalue);
// LOAD SOURCE XML
if($seite == null) {
$filename = "{$rubrik}.html";
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
exit;
}
} else if(isset($seite) && isset($rubrik)){
if(in_array($filename, $filelist)) {
$xmlFile = $dir . "/" . $filename;
} else {
echo "404";
}
}
$xsltProc->setSourceFromFile($xmlFile);
// RUN TRANSFORMATION
$result = $xsltProc->transformToString();
echo $result;
// RELEASE RESOURCES
$xsltProc->clearParameters();
$xsltProc->clearProperties();
unset($xsltProc);
unset($saxonproc);

Evernote PHP API getNoteContent failes with uncaught exception

Here's my code:
try {
if (!isset($_SESSION['E_TOKEN'])) {
$oauth_data = $oauth_handler->authorize($key, $secret, $callback);
$token = $oauth_data['oauth_token'];
$_SESSION['E_TOKEN'] = $token;
}
else
$token = $_SESSION['E_TOKEN'];
$reason = $_GET['reason'];
$client = new \Evernote\Client(array('token' => $token, 'sandbox' => true));
$advancedClient = $client->getAdvancedClient();
switch ($reason) {
case 'update':
$noteGuid = $_GET['guid'];
$noteStore = $advancedClient->getNoteStore();
$note = $noteStore->getNoteContent(array('token' => $token), $noteGuid, true, false, false, false);
}
} catch (Evernote\Exception\AuthorizationDeniedException $e) {
//If the user decline the authorization, an exception is thrown.
echo "Declined";
}
Here's the exception:
[Sat Apr 30 10:44:55.256042 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Warning: strlen() expects parameter 1 to be string, array given in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Thrift/StringFunc/Core.php on line 36
[Sat Apr 30 10:44:55.599976 2016] [:error] [pid 27190:tid 139957362468608] [client 216.104.244.35:32700] PHP Fatal error: Uncaught exception 'EDAM\Error\EDAMUserException' in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php:3202\nStack trace:\n#0 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(717): EDAM\UserStore\UserStore_getNoteStoreUrl_result->read(Object(Thrift\Protocol\TBinaryProtocol))\n#1 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php(678): EDAM\UserStore\UserStoreClient->recv_getNoteStoreUrl()\n#2 [internal function]: EDAM\UserStore\UserStoreClient->getNoteStoreUrl(Array)\n#3 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/Store/Store.php(38): call_user_func_array(Array, Array)\n#4 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\Store\Store->__call('getNoteStoreUrl', Array)\n#5 /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/Evernote/AdvancedClient.php(69): Evernote\S in /usr/local/apache2/htdocs/vendor/evernote/evernote-cloud-sdk-php/src/EDAM/UserStore/UserStore.php on line 3202
Note the error log entry for Core.php at line 36 expecting a string instead of an array.
Any suggestions?

imagepng not displaying what it should

So i was working on signature system, and last night it worked, it displayed image, but i went to sleep, turned off my pc, and when i got back on i figured out that it has stopped working, it started displaying this image, which was displayed last night but i got it working somehow, i don't know how to be honest.
This is what i get:
WHEN I TRY TO GET IMAGE: http://i.imgur.com/A96dYZp.jpg
PHPINFO: http://i.imgur.com/AjFJ3VF.jpg
CODE:
<?php
if (file_exists(dirname(__FILE__) . '/SSI.php')) {
require(dirname(__FILE__) . '/SSI.php');
}
else die("GRESKA: SSI.php nije pronaden!");
error_reporting(E_ALL);
$username="root"; // KORSINICKO IME
$password=""; // ŠIFRA
$database="smf"; // BAZA
$host="localhost"; // HOST
$con = mysqli_connect($host,$username,$password,$database) or die( "GRESKA: Dogodila se greska pri povezivanju na bazu podataka!");
if(isset($_GET['id'])) $korisnikov_id = $_GET['id']; // DOBAVLJA KORISNIKOV ID
else if(isset($_POST['id'])) $korisnikov_id = $_POST['id'];
$korisnikov_id = mysqli_real_escape_string($con, $korisnikov_id);
if(isset($_GET['stil'])) $stil = $_GET['stil']; // DOBAVLJA STIL POTPISA
else if(isset($_POST['stil'])) $stil = $_POST['stil'];
$stil = mysqli_real_escape_string($con, $stil);
if($stil == 1 ) // STIL I
{
$query = "SELECT * FROM `smf_members` WHERE `id_member` = '$korisnikov_id' LIMIT 1"; // VADI PODATKE IZ KOJE TABELE?
$rezultat = mysqli_query($con, $query) or die(mysqli_error());
if(mysqli_num_rows($rezultat) == "0") die("GRESKA: Taj korisnicki ID ne postoji u bazi."); // ID JE 0 ILI JOS NIJE REGISTROVAN???
$row = mysqli_fetch_assoc($rezultat);
$ime = $row['real_name']; // KORISNIKOVO TRENUTNO IME
$postovi = $row['posts']; // POSTOVI
$grupe = $row['id_group']; // GRUPA
$spol = $row['gender']; // SPOL
$email = $row['email_address']; // KORISNIKOV EMAIL
$vreme = $row['total_time_logged_in']; // VREME PROVEDENO NA FORUMU
// KONVERTER VREMENA
function secondsToWords($vreme)
{
$days=(int)($vreme/86400);
$hours = (int)(($vreme-($days*86400))/3600);
$mins = (int)(($vreme-$days*86400-$hours*3600)/60);
return sprintf("%dd %dh %dm", $days, $hours, $mins);
}
if($spol == 1) $spoltext = "Musko";
if($spol == 2) $spoltext = "Zensko";
if($spol == 0) $spoltext = "Nepoznato";
// DOBAVLJAMO STVARI DIREKTNO SA PROFILA
global $context, $settings, $modSettings, $db_prefix, $boardurl;
loadMemberData(array($korisnikov_id), false, 'profile');
loadMemberContext($korisnikov_id);
$context['status'] = $memberContext[$korisnikov_id]['online']['text']; // ONLINE/OFFLINE STATUS
$context['avatar'] = $memberContext[$korisnikov_id]['avatar']['href']; // AVATAR
header("Content-type: image/jpeg,image/gif,image/png"); // PRETVARA STRANICU U SLIKU
$Potpisi = #imagecreatefrompng("cover_1.png"); // LOKACIJA SLIKE
$BOJA_BELA = imagecolorallocate($Potpisi, 255, 255, 255);
$BOJA_CRVENA = imagecolorallocate($Potpisi, 255, 0, 0);
$BOJA_PURPLE = imagecolorallocate($Potpisi, 128,0,128);
$FONT = "./Fontovi/BebasNeue.otf"; // FONT
$ADMINISTRATOR = 'Administrator'; // RANKOVI
$SMOD = 'Super Moderator'; // RANKOVI
$CLAN = 'Clan';
if($grupe == 1) // GRUPE
{
imagettftext($Potpisi, 21, 0, 115, 50, $BOJA_BELA, $FONT, $ime); // VELIKO IME
imagettftext($Potpisi, 17, 0, 115, 90, $BOJA_CRVENA, $FONT, $ADMINISTRATOR); // ADMINISTRATOR
}
else if($grupe == 2) // GRUPE
{
imagettftext($Potpisi, 21, 0, 115, 50, $BOJA_BELA, $FONT, $ime); // VELIKO IME
imagettftext($Potpisi, 17, 0, 115, 90, $BOJA_PURPLE, $FONT, $SMOD); // ADMINISTRATOR
}
else
{
imagettftext($Potpisi, 21, 0, 115, 50, $BOJA_BELA, $FONT, $ime); // VELIKO IME
imagettftext($Potpisi, 17, 0, 115, 90, $BOJA_BELA, $FONT, $CLAN); // CLAN
}
imagettftext($Potpisi, 13, 0, 75, 194, $BOJA_BELA, $FONT, $postovi); // POSTOVI
imagettftext($Potpisi, 13, 0, 210, 194, $BOJA_BELA, $FONT, secondsToWords($vreme)); // VREME PROVEDENO ONLINE
imagettftext($Potpisi, 13, 0, 354, 194, $BOJA_BELA, $FONT, $spoltext); // SPOL
imagettftext($Potpisi, 17, 0, 115, 70, $BOJA_BELA, $FONT, $email); // EMAIL
imagettftext($Potpisi, 17, 0, 115, 110, $BOJA_BELA, $FONT, $context['status']); // ONLINE/OFFLINE INDIKATOR
// DOBAVLJAČ AVATARA SA PROFILA KORISNIKA TE KONVERTER SLIKE
if (exif_imagetype($context['avatar']) == IMAGETYPE_GIF)
$traziavatar = imagecreatefromgif($context['avatar']);
if (exif_imagetype($context['avatar']) == IMAGETYPE_PNG)
$traziavatar = imagecreatefrompng($context['avatar']);
if (exif_imagetype($context['avatar']) == IMAGETYPE_JPEG)
$traziavatar = imagecreatefromjpeg($context['avatar']);
list($width, $height) = getimagesize($context['avatar']); // KONVERTOVANJE AVATARA
$context['avatar'] = imagecreatetruecolor(512, 512);
imagecopyresampled($Potpisi, $traziavatar, 16.5, 25, 0, 0, 92, 92, $width, $height); // PRIKAZ AVATARA
ImagePng($Potpisi);
ImageDestroy($Potpisi);
}
else
{
die("GRESKA: Taj stil ne postoji u bazi podataka! Pronadjeni stilovi (1) , (2)");
}
?>
My logs contain the following:
[Fri Feb 19 15:52:12.629932 2016] [ssl:warn] [pid 5848:tid 248] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 19 15:52:12.699932 2016] [core:warn] [pid 5848:tid 248] AH00098: pid file C:/xampp/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?
[Fri Feb 19 15:52:12.859932 2016] [ssl:warn] [pid 5848:tid 248] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 19 15:52:12.899932 2016] [mpm_winnt:notice] [pid 5848:tid 248] AH00455: Apache/2.4.17 (Win32) OpenSSL/1.0.2d PHP/5.6.15 configured -- resuming normal operations
[Fri Feb 19 15:52:12.899932 2016] [mpm_winnt:notice] [pid 5848:tid 248] AH00456: Apache Lounge VC11 Server built: Oct 13 2015 10:54:13
[Fri Feb 19 15:52:12.899932 2016] [core:notice] [pid 5848:tid 248] AH00094: Command line: 'c:\\xampp\\apache\\bin\\httpd.exe -d C:/xampp/apache'
[Fri Feb 19 15:52:12.909932 2016] [mpm_winnt:notice] [pid 5848:tid 248] AH00418: Parent: Created child process 2576
[Fri Feb 19 15:52:13.449940 2016] [ssl:warn] [pid 2576:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 19 15:52:13.791941 2016] [ssl:warn] [pid 2576:tid 260] AH01909: www.example.com:443:0 server certificate does NOT include an ID which matches the server name
[Fri Feb 19 15:52:13.831941 2016] [mpm_winnt:notice] [pid 2576:tid 260] AH00354: Child: Starting 150 worker threads.

Why does the session id change on some records?

this is my config:
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 86400; //1 day
$config['sess_expire_on_close'] = TRUE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 86400; //1 day
I don't know why my session_id changes whenn im dealing with some records.
Here's the error log of the record that the session_id doesn't change (which is correct) (AJAX post):
[Thu Mar 19 14:26:14.080447 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
[Thu Mar 19 14:26:15.516590 2015] [:error] [pid 7902] [client 192.168.10.126:58565] f83e35227ac23f60d175dbbb333f9554 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=1129
Here's the error log of the record that the session_id changes (which is NOT correct) (AJAX post):
[Thu Mar 19 14:25:42.260545 2015] [:error] [pid 7590] [client 192.168.10.126:58512] 3ff5478a950d3f0d5d71f3c72d1102a0 <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
[Thu Mar 19 14:25:47.322896 2015] [:error] [pid 7511] [client 192.168.10.126:58521] 5a7f2424717505a2a68ffe717e56971b <----- session Id (Ajax), referer: http://192.168.10.126/consumer/ignite.php/update_listings_controller?listingId=28453
I'm using the same steps for both. I'm not sure when and why the session_id changes when I'm dealing with some records on back-end. I believe that my config is correct.
Additional info:
var opt;
function showPreviewMode(div,section,editmode){
showModalElement('pleasewait');
jQuery.ajax({
url:"update_listings_controller/get_listing_content/<?php echo $this->input->get('listingId'); ?>/"+section+"/"+editmode,
success:function(data){
jQuery(div).html(data);
hideModalElement('pleasewait');
masking();
if(section == 3){
opt = new OptionTransfer("serviceArea", "serviceAreaIds");
opt.setAutoSort(true);
opt.setDelimiter(",");
opt.saveNewRightOptions("newRight");
var dol = new DynamicOptionList("serviceAreaLeft");
opt.init(document.whoDoTheyServe);
}else if(section== 4){
disAbledFee();
disabledMeds();
privatePay();
}else if(section== 5){
checkDay();
waitList();
}
}
});
}
This is just what I did:
instead of calling $this->session->userdata('session_id'),
I'm just calling this:
session_id();
They don't have same value, session_id(); is not changing anyway.

iOS app causing internal server error

I'm having a very strange problem. My app is causing my server to go berserk.
My iOS app uses TFHPPLE to parse data from a php page on my server. It grabs a name from the page, and checks how much time remains for that campaign.
NSString *URL1 = #"http://alefdev.com/tzedakah/current.php";
NSData *webPage = [NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat: URL1]]];
TFHpple *xpathParser = [[TFHpple alloc] initWithHTMLData:webPage];
NSArray *elements = [xpathParser search:#"//name"];
if([elements count] == 0)
{
NSLog(#"array is empty");
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Connection Error" message:#"Cannot connect to server."
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
[alert release];
[adupdate invalidate];
rc.enabled = YES;
rc.hidden = NO;
}
else{
TFHppleElement *element = [elements objectAtIndex:0];
NSString *ttl = [element content];
NSLog(#"Charity Name: %#", ttl);
todayscharity.text = ttl;
}
Every 10 seconds, it calls to the server, grabs the info it needs, and puts it into an array. If the array is empty, the timer is invalidated, and a 'Reconnect' button appears. The 'Reconnect' button restarts the timer.
The timer:
-(void)starttimer{
adupdate = [NSTimer scheduledTimerWithTimeInterval:(10.0) target:self selector:#selector(updateAd) userInfo:nil repeats:YES];
NSLog(#"starttimer called");}
The restart function
- (IBAction)reconnect:(id)sender
{
[self starttimer];
}
If it fails (empty array) and then restarts, it tries again to grab info from my servers, but cannot. The entire site gives a Internal Server Error (500).
The php script gets the current date
$today = getdate();
$todayfull = $today['year'].$today['mon'].$today['mday'];
Checks the date:
if(($todayfull == 201192)||($todayfull == 201193))
Then echoes some text and runs the countdown function after matching the day.
function countdown($year, $month, $day, $hour, $minute)
{
$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
$today = time();
$difference = $the_countdown_date - $today;
if ($difference < 0) $difference = 0;
$days_left = floor($difference/60/60/24);
$hours_left = floor(($difference - $days_left*60*60*24)/60/60);
$minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
if($minutes_left < 1)
{
echo "<ends>Less than 1 minute</ends>";
}
else{
echo "<ends>".$days_left." day ".$hours_left." hours ".$minutes_left." minutes</ends>";
}
Error Logs show:
[Sun Sep 4 14:01:53 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:53 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
[Sun Sep 4 14:01:43 2011] [error] [client 184.100.79.143] Premature end of script headers: /home/alefdev2/public_html/tzedakah/current.php
[Sun Sep 4 14:00:25 2011] [error] [client 184.100.79.143] File does not exist: /home/alefdev2/public_html/error_500.htm
The full php script is:
<?php
$today = getdate();
$todayfull = $today['year'].$today['mon'].$today['mday'];
echo "Todayfull: $todayfull";
if(($todayfull == 201192)||($todayfull == 201193))
{
echo "<name>The Lone Soldier Center in memory of Michael Levin</name>
<description>Lone Soldier Center desc.</description>
";
countdown(2011,9,4,0,0);
}
else if(($todayfull == 201194)||($todayfull == 201195)){
echo "<name>Friends of Itamar</name>
<description>Friends of Itamar desc.</description>
";
countdown(2011,9,6,0,0);
}
else{
echo "Error: Could not match dates.";
}
?>
<?php
function countdown($year, $month, $day, $hour, $minute)
{
$the_countdown_date = mktime($hour, $minute, 0, $month, $day, $year, -1);
$today = time();
$difference = $the_countdown_date - $today;
if ($difference < 0) $difference = 0;
$days_left = floor($difference/60/60/24);
$hours_left = floor(($difference - $days_left*60*60*24)/60/60);
$minutes_left = floor(($difference - $days_left*60*60*24 - $hours_left*60*60)/60);
if($minutes_left < 1)
{
echo "<ends>Less than 1 minute</ends>";
}
else{
echo "<ends>".$days_left." day ".$hours_left." hours ".$minutes_left." minutes</ends>";
}
}
?>
My host (SiteGround) said that I just had too many IMAP processes running, but the site only ever crashes if I try to reconnect thru this app.
There's two things going on. First, you're getting too many calls to the server, so I think your timer invalidation isn't working right. Second, your PHP script isn't putting out proper header, so you're getting server errors.

Categories