So I am reading around and was really confused about having a CSRF token, whetever I should generate a new token per each request, or just per hour or something? $data[‘token’] = md5(uniqid(rand(), …
How to encrypt the $_GET data in php?
As in php we use $_GET to pass variables in the url , i want to pass variables which include the id of the user which i want to be anonymous, so can something be done which can encrypt the variable …
download many archives for a server in one archive with php
I need to do an aplication to makes the user download a lot of pictures in the server choosing some criterias and only in one archive. i tried with php and pclzip.lib and zipstream libraries found on web, but none of the two methods work. with pclzip i only can compress 3Mb and with zipstream library in the m…
Use PHP To Generate Random Decimal Beteween Two Decimals
I need to generate a random number, to the 10th spot between 2 decimals in PHP. Ex. A rand number between 1.2 and 5.7. It would return 3.4 How can I do this? Answer You can use: or even better:
How to display localized time, based on a visitor’s location?
We’re developing a website, that will be used from people all over the world. There’s a chat section in the website and we want the messages to appear with a timestamp. I’m storing in a database a timestamp for each message. What is the way to show the right time for each message to visitor,…
Yii – dynamically change rules from controller
Let’s say I have a product which can have a colour. Depending on the product type, the colour field may or may not be required. If colour is always required, I would have the following in the product …
cURL SSL request fails
I’m trying to work with Liveperson REST API, I use the following php code: $authorization = “LivePerson appKey=MY_APP_KEY”; $accept = “application/xml”; $contentType = “application/xml”; $ch = …
Specify Mongo DB and Collection name as variables in PHP
MongoDB’s PHP library allows me to connect to a collection like this (from example): $m = new Mongo(); $db = $m->comedy; $collection = $db->cartoons; But how do I specify the database and/or …
How can I tell if PDO module installed/disabled?
I’m developing a PHP application. I just moved a bunch of files over to the production server, to discover that PDO is apparently not installed (Fatal error: Class ‘PDO’ not found in [file] on line […
How to set DSN (Delivery Status Notification) for PHPMailer?
I’m trying to find out how to set DSN when using PHPMailer. I know at the SMTP Protocol level, the DSN is specified after RCPT TO, e.g. RCPT TO: NOTIFY=SUCCESS,FAILURE ORCPT=rfc822;recipientemail@gmail.com Also, I will like to direct the DSN to other than the sender address if that is possible. Apprecia…