Jump to content

DanRz

Members
  • Posts

    22
  • Joined

  • Last visited

DanRz's Achievements

Member

Member (2/5)

0

Reputation

1

Community Answers

  1. Hi All, I am terrible at regex. I have the following code, which works fine for number such as 123456M... if(!preg_match('/[1-9]\d{5}M/', $explode[1])) { throw new RuntimeException('Error: Membership number invalid. Please try again.'); } However, I also need to accept number such as TMP1 and TMP1000 - essentially TMP followed by up to 5 numbers... How would I add this too... I need it to error if it doesn't match any of the two types. Thanks
  2. Hey, I am developing an small app that will add data to a mySQL database. This is working fine however, I need to encrypt the data. I have the code to do this; however, I am not sure how people structure the mySQL tables for this? Obviously, something like varchar(255) might not be long enough. So do you set all columns to be TEXT? Is there a better way of doing this? Thanks Dan
  3. Hi, I have the following expression but it doesn't work as I wish it to... [1-9]\d{5}M I need any 6 numbers followed by an M.... however, it can be any 5 numbers followed by an M... for example 123456M = Valid 1234M = Valid But... 123445 = Invalid RANDOM = Invalid Thanks
  4. https://github.com/nick322/secure-spreadsheet adding this repo works.
  5. Looks like PhpSpreadsheet can't actually protect the opening of a document... see https://github.com/PHPOffice/PhpSpreadsheet/issues/761 Which is odd because to me the documentation reads like it does...
  6. I tried adding that code but it still doesn't seem to password protect the actual document... Just unable to edit a sheet or cell... $security = $spreadsheet->getSecurity(); $security->setLockWindows(true); $security->setLockStructure(true); $security->setWorkbookPassword("PhpSpreadsheet");
  7. Hey, I have the following script that looks to make an excel document using PHPSpreadsheet... the script works great, but it doesn't apply the password to the workbook... what am I missing? use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; // Information $arrayData[] = array('cells'); // Make File Name $filename = 'file-'.time().'.xlsx'; $spreadsheet = new Spreadsheet(); $spreadsheet->getActiveSheet()->getProtection()->setSheet(true); $security = $spreadsheet->getSecurity(); $security->setLockWindows(true); $security->setLockStructure(true); $security->setWorkbookPassword("PhpSpreadsheet"); $sheet = $spreadsheet->getActiveSheet(); $sheet->setCellValue('A1', 'Report Generated '. date(DATE_FORMAT_LONG)); $sheet->fromArray($arrayData, NULL, 'A3'); header('Content-Disposition: attachment;filename='.$filename); $writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, 'Xlsx'); $writer->save('php://output'); Thanks Dan
  8. Hey, I have the following jQuery line... it gets the object noteInfo and displays it into a modal. Works great! However, it doesn't seem to output the line breaks, I just get a big chunk of text. Any ideas would be amazing. jQuery Line $("#viewNoteModal .modal-body").html(obj.noteInfo); Console output noteInfo: "This is a note\r↵Sent: 26 September 2022 12:56" Dan EDIT - I have worked this out. It was a bug in the code that outputted the text.
  9. Thanks for your reply. I have managed to fix this see code below; on: push: branches: [ development ] name: 🚀 Deploy app on new tag jobs: web-deploy: name: 🎉 Deploy runs-on: ubuntu-latest steps: - name: 🚚 Get latest code uses: actions/checkout@v3 - name: 🏷️ Get Current Tag id: vars run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - name: 🔏 Write Tag Version env: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | echo $RELEASE_VERSION - name: 🗃️ Make env File uses: SpicyPizza/create-envfile@v1.3 with: envkey_APP_ENV: "live" envkey_APP_STATUS: "1" envkey_APP_VERSION: ${{ steps.vars.outputs.tag }} - name: 📂 Sync files uses: SamKirkland/FTP-Deploy-Action@4.3.3 with: server: FTPSERVER username: USERNAME password: ${{ secrets.ftp_pwd }}
  10. Hey! I am using the following GitHub workflow to publish to FTP when a new tag is pushed however I need to alter it to get the tag name and update the .env file on the server with the new version... I just can't work out how to do it... on: push: tags: - '*' name: 🚀 Deploy app on new tag jobs: web-deploy: name: 🎉 Deploy runs-on: ubuntu-latest steps: - name: 🚚 Get latest code uses: actions/checkout@v3 - name: 📂 Sync files uses: SamKirkland/FTP-Deploy-Action@4.3.3 with: server: ftp.domain.com username: XXX password: ${{ secrets.ftp_pwd }} - name: 🔐 Set Env Version id: vars run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - name: 🔏 Write Env Version env: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | echo $RELEASE_VERSION echo ${{ steps.vars.outputs.tag }} Any help would be appreciated. Dan
  11. Thanks, I was thinking sleep but I've had problems with that in the past... Hmmm I think this might be the way forward... I shall do it like this Ahh yes, they gave me something like 150,000 emails per day, however, my access keys were leaked and used to send 50,000 odd emails.... so I asked them to move my limit down to 5000 per day as I would never send over that so if it ever happened again I would get stung... Thanks
  12. Hey! I am trying to write a script that will send emails to users using Amazon SES, I have a send limit of 1 per second... Currently I have 1500 records... how would I throttle the script to only send 1 email per second? Currently, I just use a foreach loop to go through an array and send the email using that... $allActiveMembers = $this->getAllMembers('1'); foreach($allActiveMembers as $member){ // If email blank... skip. if($member['memberEmail'] == NULL){ continue; } // Email Valid. if($this->helper->isValidEmail($member['memberEmail']) == false){ continue; } // Send Email $this->SendMail($member['memberEmail']); } Thanks Dan
  13. Hey! I updated my server from PHP 7.4 to PHP 8.1... I have several website on the server and all are now showing some sort of error or another... Most of the errors are warnings such as: I have changed the php.ini file for 8.1 to exclude warnings bit it doesn't seem to do anything... Any idea how to stop them from coming up without having to add error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE); to every website..., Thanks Dan
  14. Thanks so much! I never thought of this bit that indeed was the problem... an oversight I think!! I have now secured it with htaccess so its Forbidden now. Thanks for your help!
  15. I have a php application I made… Currently I use phpdotenv https://github.com/vlucas/phpdotenv to store my creds in a .env file in the root directory… It works, however twice now the AWS SES creds have been stolen and used to send mass emails… Im not sure how they’re finding the information but they are… so I’m just trying to figure out how to store them better to avoid them getting into the wrong hands…
×
×
  • 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.