Jump to content

nitiphone2021

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by nitiphone2021

  1. first I tried this code will show all rooms in system select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id` I tried this code but no any output select `tb_rooms`.`id`, `tb_rooms`.`room_name` from `tb_reservation_room` right join `tb_rooms` on `tb_rooms`.`id` = `tb_reservation_room`.`room_id` where `checkin_date` < '2022-02-12'
  2. yes, both greater than and less than $checkin_date
  3. it's a good tutorial but how can I get the available room? I tried to follow your logic but it's not work This is my sql query from laravel $load_room = DB::table('tb_reservation_room') ->rightJoin('tb_rooms', 'tb_rooms.id', '=', 'tb_reservation_room.room_id') ->select('tb_rooms.id', 'tb_rooms.room_name') ->whereDate('checkin_date','<',$checkin_date) ->whereDate('checkin_date','>',$checkin_date) ->get();
  4. Dear all, I am design hotel management system as below schema. Do you have any idea to improve it? to verify room status
  5. hi all, as I reinstall old project for my customer and the service is working fine but I found sometimes it can't query some information. from checking it's because @@Global.sql_mode and @@SESSION.sql_mode set to "ONLY_FULL_GROUP_BY" the step to solve it need to run command SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY','')); So any way can I make it not change the mode?
  6. Dear All, I uploaded my Laravel Project to Server by remove "vendor" directory and then run command "composer install --no-dev" then I got error message Do not run Composer as root/super user! See https://getcomposer.org/root for details Continue as root/super user [yes]? yes Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 - league/commonmark is locked to version 2.0.2 and an update of this package was not requested. - league/commonmark 2.0.2 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement. Problem 2 - league/config is locked to version v1.1.1 and an update of this package was not requested. - league/config v1.1.1 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement. Problem 3 - psr/container is locked to version 1.1.2 and an update of this package was not requested. - psr/container 1.1.2 requires php >=7.4.0 -> your php version (7.3.33) does not satisfy that requirement. Problem 4 - league/commonmark 2.0.2 requires php ^7.4 || ^8.0 -> your php version (7.3.33) does not satisfy that requirement. - laravel/framework v8.74.0 requires league/commonmark ^1.3|^2.0.2 -> satisfiable by league/commonmark[2.0.2]. - laravel/framework is locked to version v8.74.0 and an update of this package was not requested.
  7. Dear friends. As I create a website and javascript to record voice and send it to server side(PHP). it's work on small file size but if it's large the sending will be fail. Could you please kindly help me check my code? why I can't see the file on the server? Existing code Javscript var fd = new FormData(); fd.append('to_user_id', to_user_id); fd.append('audio_data', blob, filename); $.ajax({ url: "../func/upload.php", method: "POST", processData: false, contentType: false, data: fd, enctype: 'multipart/form-data', success: function(data) {}, error: function(err) {} }); PHP /* Check If the guest send file to admin */ if (isset($_FILES)) { //this will print out the received name, temp name, type, size, etc. $input = $_FILES['audio_data']['tmp_name']; //get the temporary name that PHP gave to the uploaded file $output = $originalsFolder . $FileName; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name $result = move_uploaded_file($input, $output); $txt_msg = '<audio controls controlsList="nodownload"> <source src="' . $originalsFolderDB . $FileName . '" type="audio/wav"> Audio. </audio>'; } MY NEW CODE FOR SLICE BLOB FILE Javascript var chunks = chunksAmount(blob.size); var blobChunksArray = sliceFile(blob,chunks,blob.type); var slice_chunk = blobChunksArray.shift(); var fd = new FormData(); fd.append('to_user_id', to_user_id); fd.append('chunksupload',true); fd.append('filename', filename); fd.append('data', slice_chunk); if(chunksArray.length){ fd.append('chunksend',false); }else{ fd.append('chunksend',true); } $.ajax({ url: "../func/upload.php", method: "POST", processData: false, contentType: false, data: fd, enctype: 'multipart/form-data', success: function(data) {}, error: function(err) {} }).done(function(data) { if(chunksArray.length){ sendChunkFile2(chunksArray,filename) }else{ console.log(JSON.stringify(data)); } }); function slice(file, start, end) { var slice = file.mozSlice ? file.mozSlice : file.webkitSlice ? file.webkitSlice : file.slice; return slice.bind(file)(start, end); } function sliceFile(file, chunksAmount, mimetype) { var byteIndex = 0; var chunks = []; for (var i = 0; i < chunksAmount; i += 1) { var byteEnd = Math.ceil((file.size / chunksAmount) * (i + 1)); chunks.push( new Blob([slice(file, byteIndex, byteEnd)], { type: mimetype })); byteIndex += (byteEnd - byteIndex); } return chunks; } function chunksAmount(size){ const BYTES_PER_CHUNK = ((1024 * 1024)*5); //5MB chunk sizes. return Math.ceil(size / BYTES_PER_CHUNK); } FOR PHP if (isset($_POST['chunksupload'])) { file_put_contents($_POST['filename'], file_get_contents($_FILES['data']['tmp_name']), FILE_APPEND | LOCK_EX); if($_POST['chunksend']){ echo json_encode(["url"=>$originalsFolderDB . $_POST['filename'],"size"=>filesize($_POST['filename']) . " bytes"]); } //this will print out the received name, temp name, type, size, etc. // $input = $_FILES['audio_data']['tmp_name']; //get the temporary name that PHP gave to the uploaded file // $output = $originalsFolder . $FileName; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name // $result = move_uploaded_file($input, $output); $txt_msg = '<audio controls controlsList="nodownload"> <source src="' . $originalsFolderDB . $FileName . '" type="audio/wav"> Audio. </audio>';
  8. According to I created a API authen by sanctum and it's work when I send logout by php artisan serve but when i close it and use xampp http://localhost/Laravel/laravel2/api/logout it's said "Unauthenticated" Why it work only on artisan serve?
  9. I have a table include column name license_plate(String),car_bike(1 or 2),price,create_date I would like to create a report about income for system I try as below command SELECT DATE(create_date) as Park_Date,car_bike,price,COUNT(car_bike) * price as income from 1_tb_parking group by Park_Date,car_bike I would like to get result like this date, car_bike = 1, count(car_bike=1),sum(price for car_bike = 1) as sum1, car_bike = 2, count(car_bike=2),sum(price for car_bike = 2) as sum2, Total = sum1 + sum2 Do you have any idea?
  10. I am planing to develop a Delivery App like foodpanda, from starting I think the customer not too much but I want to know the technology for it that we can upgrade it after the customer increase
  11. Oh, Seem my question is not clear, I mean I make a POS online software and sell it to many shop, so how can I saperate shop information, shop name, stock, login info....
  12. Dear friends. As I would like to create a software like POS on web application. my question is: 1. Should I create only one Database for all customers? 2. in case I have only one Database, How can I saperate the customer information? by field or table name? 3. if I have new customer. I need to create new table or information for them?
  13. According to I would like to try to use JWT for my PHP and these are my step on domain/app/ composer require firebase/php-jwt so I have domain/app/login.php domain/app/vendor/firebase/... and on the login.php try{ echo "1"; require_once('vendor/autoload.php'); use firebase\JWT\JWT; echo "2"; } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } It's not show any thing and error "HTTP ERROR 500" I think the code is really find the autoload.php but I don't know why it's internet error on line use firebase\JWT\JWT; If I add this command, the PHP will be error 500
  14. But I want to send them some notify when the user is not open the browser. How can i send to it?
  15. According to I have a SOAP API send to a operator for SMS server and the operator they create API by PHP so I want to send a URL to them "https://covaf.gov.la/covaf-web/" But the operator always cut to be "https:covaf.gov.la/covaf-web/" I try /// but get only one / So Do you have any idea to get the URL as I want without get help from the operator?
  16. According to I create a mobile app by Flutter and I also build it to web base also. But I want to send some notify to mobile web browser to alert them come back to do sometask. I ever see it on other website but I don't know how to make it. Is it on PWA? Please guide me how can I make it like that
  17. As I install old PHP project and it's not work some feature from checked, it stuck on wget command $command = "wget -b -q -P public/logs/ '" . $url . "' " . LINK_URL_SSL; $output = shell_exec($command); This is the full command wget -b -q -P public/logs/ 'https://localhost/users/receiveToAll?user=5&transfer_order_id=10531&order_date=2021-07-04&receive_number=21TR&receive_date=04/07/2021&json=536038974_to_r_10531&pos=ud@y@ip@s' --no-check-certificate I check the $output is Continuing in background, pid 6224. so on the public/logs I don't find any file generate very long time, so I think this wget has something wrong. I try to run http://websitename/users/receiveToAll?user=5&transfer_order_id=10531&order_date=2021-07-04&receive_number=21TR&receive_date=04/07/2021&json=536038974_to_r_10531&pos=ud@y@ip@s it's work correctly
  18. But the file I created it's no sound, it's like empty file always 44K //this will print out the received name, temp name, type, size, etc. $input = $_FILES['audio_data']['tmp_name']; //get the temporary name that PHP gave to the uploaded file $output = "../management/design/voices/" . time() . uniqid() .".wav"; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name $result = move_uploaded_file($input, $output); It is because the blob? This is th javascript function for save record function stopRecording() { //tell the recorder to stop the recording rec.stop(); //stop microphone access gumStream.getAudioTracks()[0].stop(); //create the wav blob and pass it on to createDownloadLink rec.exportWAV(createDownloadLink); } async function createDownloadLink(blob) { var filename = new Date().toISOString(); var fd=new FormData(); fd.append('audio_data', blob,filename); $.ajax({ url: "../func/upload.php", method: "POST", processData: false, contentType: false, data: fd, enctype: 'multipart/form-data', success: function (data) { console.log('SUCCESS' + data); }, error: function (err) { } }); }
  19. Now it's work. seem it's fail on $output because I just copy but don't change the path so this code is work //this will print out the received name, temp name, type, size, etc. $input = $_FILES['audio_data']['tmp_name']; //get the temporary name that PHP gave to the uploaded file $output = "C:\\xampp\htdocs\dlap\ABC.wav"; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name $result = move_uploaded_file($input, $output); echo $output; echo "Result = [" . $result . "]";
  20. //this will print out the received name, temp name, type, size, etc. $input = str_replace(":","_",$_FILES['audio_data']['tmp_name']); //get the temporary name that PHP gave to the uploaded file $output = $_FILES['audio_data']['name'].".wav"; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name $result = move_uploaded_file($input, $output); echo "Result = [" . $result . "]"; The result from these code is "Rsult = []" $input = $_FILES['audio_data']['tmp_name']; //get the temporary name that PHP gave to the uploaded file If I follow the original code by this line, The server will said file not found.
  21. According to I make a website for chat and I want to send voice to communicate. so I use this script from https://blog.addpipe.com/using-recorder-js-to-capture-wav-audio-in-your-html5-web-site/ This is javascript function createDownloadLink(blob) { //name of .wav file to use during upload and download (without extendion) var filename = new Date().toISOString(); console.log('bob = ' + typeof(blob)); console.log('file name = ' + typeof(filename)); var fd=new FormData(); fd.append("audio_data",blob, filename); $.ajax({ url: "../func/upload.php", method: "POST", processData: false, contentType: false, data: fd, enctype: 'multipart/form-data', success: function (data) { console.log('SUCCESS' + data); }, error: function (err) { } }); } and this is server side PHP <?php //this will print out the received name, temp name, type, size, etc. print_r($_FILES); $input = str_replace(":","_",$_FILES['audio_data']['tmp_name']); //get the temporary name that PHP gave to the uploaded file $output = $_FILES['audio_data']['name'].".wav"; //letting the client control the filename is a rather bad idea //move the file from temp name to local folder using $output name move_uploaded_file($input, $output); ?> This is the print output Array ( [audio_data] => Array ( [name] => 2021-07-02T07:59:33.877Z [type] => audio/wav [tmp_name] => C:\xampp\tmp\phpF3C8.tmp [error] => 0 [size] => 44 ) ) It seem no any error but I don't find any file on the server. Could you please kindly help me check?
  22. According to I want ot run a websocket for PHP and javasscript. and I have a private host on internet example 202.112.113.114 How can I basic use websocket on it? on client slide it's easy for copy some javascript's example but on Server side. what should I do? need to install by composer or any library?
  23. Dear all, According to I install old project about cakePHP and I make some report but get a error about Server Internal error As I checked It's error about this code try{ $excelContent = chr(255).chr(254).@mb_convert_encoding($excelContent, 'UTF-16LE', 'UTF-8'); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n"; } Do you have any idea about this code? I try to catch the error but it's not work
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.