Exemple #1
0
function GUID()
{
    if (function_exists('com_create_guid') === true) {
        return trim(com_create_guid(), '{}');
    }
    return strtolower(sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)));
}
 /**
  * AttributeUse constructor.
  *
  * @param int    $attributeSetId
  * @param int    $attributeId
  * @param int    $lineNo
  * @param string $displayId
  */
 public function __construct($attributeSetId, $attributeId, $lineNo, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->attributeSetId = $attributeSetId;
     $this->attributeId = $attributeId;
     $this->lineNo = $lineNo;
 }
 /**
  * TaxCustomerCategory constructor.
  *
  * @param string $name
  * @param int    $taxCategoryId
  * @param string $displayId
  */
 public function __construct($name, $taxCategoryId = null, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->name = $name;
     $this->taxCategoryId = $taxCategoryId;
     $this->taxes = array();
 }
Exemple #4
0
 public function generate_waybill_no()
 {
     if (function_exists('com_create_guid') === true) {
         return trim(com_create_guid(), '{}');
     }
     return 'NXL' . sprintf('%04X%04X%04', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
 }
Exemple #5
0
 public static function genFileName()
 {
     if (function_exists('com_create_guid') === true) {
         return trim(com_create_guid(), '{}');
     }
     return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
 }
 /**
  * AttributeInstance constructor.
  *
  * @param int    $attributeSetInstanceId
  * @param int    $attributeId
  * @param string $value
  * @param string $displayId
  */
 public function __construct($attributeSetInstanceId, $attributeId, $value, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->attributeSetInstanceId = $attributeSetInstanceId;
     $this->attributeId = $attributeId;
     $this->value = $value;
 }
Exemple #7
0
 public function getNextId()
 {
     if (function_exists('com_create_guid')) {
         return trim(com_create_guid(), '{}');
     }
     return md5(uniqid(dechex(mt_rand()), true) . dechex(mt_rand()));
 }
 function mdi_guid()
 {
     if (function_exists('com_create_guid') === true) {
         return str_replace('-', '', trim(com_create_guid(), '{}'));
     }
     return sprintf('%04X%04X%04X%04X%04X%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
 }
Exemple #9
0
function uuid()
{
    if (function_exists('com_create_guid')) {
        return com_create_guid();
    } else {
        mt_srand((double) microtime() * 10000);
        //optional for php 4.2.0 and up.随便数播种,4.2.0以后不需要了。
        $charid = strtoupper(md5(uniqid(rand(), true)));
        //根据当前时间(微秒计)生成唯一id.
        $hyphen = chr(45);
        // "-"
        $uuid = '' . substr($charid, 0, 8) . $hyphen . substr($charid, 8, 4) . $hyphen . substr($charid, 12, 4) . $hyphen . substr($charid, 16, 4) . $hyphen . substr($charid, 20, 12);
        //.chr(125);// "}"
        return $uuid;
    }
    function createGuid($namespace = '')
    {
        static $guid = '';
        $uid = uniqid("", true);
        $data = $namespace;
        $data .= $_SERVER['REQUEST_TIME'];
        $data .= $_SERVER['HTTP_USER_AGENT'];
        $data .= $_SERVER['LOCAL_ADDR'];
        $data .= $_SERVER['LOCAL_PORT'];
        $data .= $_SERVER['REMOTE_ADDR'];
        $data .= $_SERVER['REMOTE_PORT'];
        $hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data)));
        $guid = '{' . substr($hash, 0, 8) . '-' . substr($hash, 8, 4) . '-' . substr($hash, 12, 4) . '-' . substr($hash, 16, 4) . '-' . substr($hash, 20, 12) . '}';
        return $guid;
    }
}
 /**
  * {@inheritdoc}
  */
 public function generate(EntityManager $em, $entity)
 {
     if (defined('PHP_WINDOWS_VERSION_BUILD')) {
         return substr(com_create_guid(), 1, 36);
     }
     return uuid_create(UUID_TYPE_RANDOM);
 }
 /**
  * @param string $name
  * @param string $image
  * @param string $displayId
  */
 public function __construct($name, $image = null, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->name = $name;
     $this->image = $image;
     $this->places = array();
 }
 /**
  * Receipt constructor.
  *
  * @param int       $cashId
  * @param \DateTime $date
  * @param string    $attributes
  * @param string    $displayId
  */
 public function __construct($cashId, \DateTime $date, $attributes = null, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->cashId = $cashId;
     $this->date = $date;
     $this->attributes = $attributes;
 }
 /**
  *
  * @param string $SessionID
  * @param string $StreamName
  * @param string $Keywords
  * @return string
  */
 public function CreateStream($SessionID, $StreamName, $Keywords)
 {
     //check if the $SessionID is valid then create a record in the video table with stream id
     //returns the stream id
     $Message = com_create_guid();
     return $Message;
 }
function newFund($username, $password, $xml_url, $user_email, $fundName, $numMembers, $stateLaw, $fundAddressCareOf, $fundAddressLevel, $fundAddressStreet, $fundAddressSuburb, $fundAddressState, $fundAddressPostcode, $teeMtgAddressLevel, $teeMtgAddressStreet, $teeMtgAddressSuburb, $teeMtgAddressState, $teeMtgAddressPostcode, $m1MemberNamePrefix, $m1MemberGivenNames, $m1MemberFamilyName, $m1MemberDOB, $m1MemberTFN, $m1AddressLevel, $m1AddressStreet, $m1AddressSuburb, $m1AddressState, $m1AddressPostcode, $m2MemberNamePrefix, $m2MemberGivenNames, $m2MemberFamilyName, $m2MemberDOB, $m2MemberTFN, $m2AddressLevel, $m2AddressStreet, $m2AddressSuburb, $m2AddressState, $m2AddressPostcode, $m3MemberNamePrefix, $m3MemberGivenNames, $m3MemberFamilyName, $m3MemberDOB, $m3MemberTFN, $m3AddressLevel, $m3AddressStreet, $m3AddressSuburb, $m3AddressState, $m3AddressPostcode, $m4MemberNamePrefix, $m4MemberGivenNames, $m4MemberFamilyName, $m4MemberDOB, $m4MemberTFN, $m4AddressLevel, $m4AddressStreet, $m4AddressSuburb, $m4AddressState, $m4AddressPostcode, $t2NonMemberNamePrefix, $t2NonMemberGivenNames, $t2NonMemberFamilyName, $t2NonMemberAddressLevel, $t2NonMemberAddressStreet, $t2NonMemberAddressSuburb, $t2NonMemberAddressState, $t2NonMemberAddressPostcode, $corpTeeName, $corpTeeACN, $corpTeeAddressCareOf, $corpTeeAddressLevel, $corpTeeAddressStreet, $corpTeeAddressSuburb, $corpTeeAddressState, $corpTeeAddressPostcode, $d2NonMemberNamePrefix, $d2NonMemberGivenNames, $d2NonMemberFamilyName, $d2NonMemberAddressLevel, $d2NonMemberAddressStreet, $d2NonMemberAddressSuburb, $d2NonMemberAddressState, $d2NonMemberAddressPostcode, $chairmanTrustee)
{
    $ch = curl_init();
    $timeout = 3600;
    curl_setopt($ch, CURLOPT_URL, $xml_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    //    curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
    curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $data = curl_exec($ch);
    //    $response  = curl_getinfo($ch);
    curl_close($ch);
    $xml = simplexml_load_string($data);
    if (!simplexml_load_string($data) && !$xml) {
        global $wpdb;
        $wp_hasher = new PasswordHash(8, TRUE);
        $sql = "SELECT * FROM wp_users  WHERE user_login = '******' ";
        $resultuser = $wpdb->get_results($sql);
        if ($resultuser) {
            foreach ($resultuser as $results) {
                if ($wp_hasher->CheckPassword($password, $results->user_pass)) {
                    $unique = trim(com_create_guid(), '{}');
                    $result = $wpdb->insert('service_nsf', array('unique_code' => $unique, 'user_email' => $user_email, 'fundName' => $fundName, 'numMembers' => $numMembers, 'stateLaw' => $stateLaw, 'fundAddressCareOf' => $fundAddressCareOf, 'fundAddressLevel' => $fundAddressLevel, 'fundAddressStreet' => $fundAddressStreet, 'fundAddressSuburb' => $fundAddressSuburb, 'fundAddressState' => $fundAddressState, 'fundAddressPostcode' => $fundAddressPostcode, 'teeMtgAddressLevel' => $teeMtgAddressLevel, 'teeMtgAddressStreet' => $teeMtgAddressStreet, 'teeMtgAddressSuburb' => $teeMtgAddressSuburb, 'teeMtgAddressState' => $teeMtgAddressState, 'teeMtgAddressPostcode' => $teeMtgAddressPostcode, 'm1MemberNamePrefix' => $m1MemberNamePrefix, 'm1MemberGivenNames' => $m1MemberGivenNames, 'm1MemberFamilyName' => $m1MemberFamilyName, 'm1MemberDOB' => $m1MemberDOB, 'm1MemberTFN' => $m1MemberTFN, 'm1AddressLevel' => $m1AddressLevel, 'm1AddressStreet' => $m1AddressStreet, 'm1AddressSuburb' => $m1AddressSuburb, 'm1AddressState' => $m1AddressState, 'm1AddressPostcode' => $m1AddressPostcode, 'm2MemberNamePrefix' => $m2MemberNamePrefix, 'm2MemberGivenNames' => $m2MemberGivenNames, 'm2MemberFamilyName' => $m2MemberFamilyName, 'm2MemberDOB' => $m2MemberDOB, 'm2MemberTFN' => $m2MemberTFN, 'm2AddressLevel' => $m2AddressLevel, 'm2AddressStreet' => $m2AddressStreet, 'm2AddressSuburb' => $m2AddressSuburb, 'm2AddressState' => $m2AddressState, 'm2AddressPostcode' => $m2AddressPostcode, 'm3MemberNamePrefix' => $m3MemberNamePrefix, 'm3MemberGivenNames' => $m3MemberGivenNames, 'm3MemberFamilyName' => $m3MemberFamilyName, 'm3MemberDOB' => $m3MemberDOB, 'm3MemberTFN' => $m3MemberTFN, 'm3AddressLevel' => $m3AddressLevel, 'm3AddressStreet' => $m3AddressStreet, 'm3AddressSuburb' => $m3AddressSuburb, 'm3AddressState' => $m3AddressState, 'm3AddressPostcode' => $m3AddressPostcode, 'm4MemberNamePrefix' => $m4MemberNamePrefix, 'm4MemberGivenNames' => $m4MemberGivenNames, 'm4MemberFamilyName' => $m4MemberFamilyName, 'm4MemberDOB' => $m4MemberDOB, 'm4MemberTFN' => $m4MemberTFN, 'm4AddressLevel' => $m4AddressLevel, 'm4AddressStreet' => $m4AddressStreet, 'm4AddressSuburb' => $m4AddressSuburb, 'm4AddressState' => $m4AddressState, 'm4AddressPostcode' => $m4AddressPostcode, 't2NonMemberNamePrefix' => $t2NonMemberNamePrefix, 't2NonMemberGivenNames' => $t2NonMemberGivenNames, 't2NonMemberFamilyName' => $t2NonMemberFamilyName, 't2NonMemberAddressLevel' => $t2NonMemberAddressLevel, 't2NonMemberAddressStreet' => $t2NonMemberAddressStreet, 't2NonMemberAddressSuburb' => $t2NonMemberAddressSuburb, 't2NonMemberAddressState' => $t2NonMemberAddressState, 't2NonMemberAddressPostcode' => $t2NonMemberAddressPostcode, 'corpTeeName' => $corpTeeName, 'corpTeeACN' => $corpTeeACN, 'corpTeeAddressCareOf' => $corpTeeAddressCareOf, 'corpTeeAddressLevel' => $corpTeeAddressLevel, 'corpTeeAddressStreet' => $corpTeeAddressStreet, 'corpTeeAddressSuburb' => $corpTeeAddressSuburb, 'corpTeeAddressState' => $corpTeeAddressState, 'corpTeeAddressPostcode' => $corpTeeAddressPostcode, 'd2NonMemberNamePrefix' => $d2NonMemberNamePrefix, 'd2NonMemberGivenNames' => $d2NonMemberGivenNames, 'd2NonMemberFamilyName' => $d2NonMemberFamilyName, 'd2NonMemberAddressLevel' => $d2NonMemberAddressLevel, 'd2NonMemberAddressStreet' => $d2NonMemberAddressStreet, 'd2NonMemberAddressSuburb' => $d2NonMemberAddressSuburb, 'd2NonMemberAddressState' => $d2NonMemberAddressState, 'd2NonMemberAddressPostcode' => $d2NonMemberAddressPostcode, 'chairmanTrustee' => $chairmanTrustee), array('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'));
                    return array('unique_code' => $unique);
                } else {
                    return array('username' => 'Invalid username or password1');
                }
            }
        } else {
            return array('username' => 'Invalid username or password2' . $result);
        }
    } else {
        return @nsf_parser($username, $password, $xml_url);
    }
}
 /**
  * Given array of MIME parts in raw string, this function converts them into MIME
  * representation. 
  * 
  * @param array $bodyPartContents The MIME body parts.
  * 
  * @return array Returns array with two elements 'headers' and 'body' which
  * represents the MIME message.
  */
 public function encodeMimeMultipart($bodyPartContents)
 {
     $count = count($bodyPartContents);
     $mimeType = Resources::MULTIPART_MIXED_TYPE;
     $batchGuid = strtolower(trim(com_create_guid(), '{}'));
     $batchId = sprintf('batch_%s', $batchGuid);
     $contentType1 = array('content_type' => "{$mimeType}");
     $changeSetGuid = strtolower(trim(com_create_guid(), '{}'));
     $changeSetId = sprintf('changeset_%s', $changeSetGuid);
     $contentType2 = array('content_type' => "{$mimeType}; boundary={$changeSetId}");
     $options = array('encoding' => 'binary', 'content_type' => Resources::HTTP_TYPE);
     // Create changeset MIME part
     $changeSet = new \Mail_mimePart();
     for ($i = 0; $i < $count; $i++) {
         $changeSet->addSubpart($bodyPartContents[$i], $options);
     }
     // Encode the changeset MIME part
     $changeSetEncoded = $changeSet->encode($changeSetId);
     // Create the batch MIME part
     $batch = new \Mail_mimePart(Resources::EMPTY_STRING, $contentType1);
     // Add changeset encoded to batch MIME part
     $batch->addSubpart($changeSetEncoded['body'], $contentType2);
     // Encode batch MIME part
     $batchEncoded = $batch->encode($batchId);
     return $batchEncoded;
 }
 /**
  * Resource constructor.
  *
  * @param string $name
  * @param int    $type
  * @param string $content
  * @param string $displayId
  */
 public function __construct($name, $type, $content, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->name = $name;
     $this->type = $type;
     $this->content = $content;
 }
Exemple #17
0
/**
 *  OpenLSS - Lighter Smarter Simpler
 *
 *	This file is part of OpenLSS.
 *
 *	OpenLSS is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU Lesser General Public License as
 *	published by the Free Software Foundation, either version 3 of
 *	the License, or (at your option) any later version.
 *
 *	OpenLSS is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU Lesser General Public License for more details.
 *
 *	You should have received a copy of the 
 *	GNU Lesser General Public License along with OpenLSS.
 *	If not, see <http://www.gnu.org/licenses/>.
 */
function gen_guid()
{
    if (function_exists('com_create_guid') === true) {
        return strtolower(strtr('{}-', '', com_create_guid()));
    }
    return sprintf('%04x%04x%04x%04x%04x%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}
 /**
  * AttributeSetInstance constructor.
  *
  * @param int    $attributeSetId
  * @param string $description
  * @param string $displayId
  */
 public function __construct($attributeSetId, $description = null, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->attributeSetId = $attributeSetId;
     $this->description = $description;
     $this->attributeInstances = array();
 }
 /**
  * Generates and returns a GUID.
  * @see http://php.net/manual/en/function.com-create-guid.php
  * @see GuidGenerator::newGuid
  *
  * @since 1.0
  *
  * @return string
  */
 public function newGuid()
 {
     if (function_exists('com_create_guid')) {
         return trim(com_create_guid(), '{}');
     }
     return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
 }
Exemple #20
0
/**
 * create a curl handle with fetion option
 * 
 * @url url
 * @ssic user identification
 * @post data to post
 */
function fetion_curl_init($url, $ssic = null, $post = null)
{
    // create a new guid, and keep it !
    static $guid = null;
    if ($guid == null) {
        $guid = strtolower(trim(com_create_guid(), "{}"));
    }
    // set headers, e.g. pragma
    $headers = array('Content-Type: application/oct-stream', 'Pragma: xz4BBcV' . $guid);
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_USERAGENT, 'IIC2.0/PC 3.2.0540');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    // ssic
    if ($ssic != null) {
        curl_setopt($ch, CURLOPT_COOKIE, "ssic={$ssic}");
    }
    // post data
    if ($post != null) {
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
    }
    // proxy
    global $fetion_proxy;
    if ($fetion_proxy != null) {
        curl_setopt($ch, CURLOPT_PROXY, $fetion_proxy);
    }
    return $ch;
}
 /**
  * Place constructor.
  *
  * @param string $name
  * @param int    $x
  * @param int    $y
  * @param int    $floorId
  * @param string $displayId
  */
 public function __construct($name, $x, $y, $floorId, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->name = $name;
     $this->x = $x;
     $this->y = $y;
     $this->floorId = $floorId;
 }
Exemple #22
0
 protected function guid()
 {
     if (function_exists('com_create_guid') === true) {
         return trim(com_create_guid(), '{}');
     }
     return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)) . '-' . md5(time());
     // md5 hash the time at the end for extra uniqueness
 }
Exemple #23
0
 static function generate()
 {
     if (function_exists('com_create_guid')) {
         return com_create_guid();
     } else {
         return '{' . sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535)) . '}';
     }
 }
 function __construct()
 {
     //Set the partition key to today's date in "mmddyyyy" format
     $nowDT = new DateTime('now', new DateTimeZone('UTC'));
     $partitionKey = $nowDT->format("mdY");
     $this->_partitionKey = $partitionKey;
     $this->_rowKey = trim(com_create_guid(), '{}');
 }
Exemple #25
0
function generateGUID()
{
    if (function_exists('com_create_guid') === TRUE) {
        return trim(com_create_guid(), '{}');
    } else {
        return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
    }
}
 /**
  * TaxLine constructor.
  *
  * @param int    $receiptId
  * @param int    $taxId
  * @param float  $base
  * @param string $displayId
  */
 public function __construct($receiptId, $taxId, $base, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->receiptId = $receiptId;
     $this->taxId = $taxId;
     $this->base = $base;
     $this->amount = 0.0;
 }
 /**
  * Category constructor.
  *
  * @param string $reference
  * @param string $name
  * @param string $parentId
  * @param string $image
  * @param int    $displayOrder
  * @param string $displayId
  */
 public function __construct($name, $reference, $parentId, $image, $displayOrder = 0, $displayId = null)
 {
     $this->displayId = $displayId === null ? com_create_guid() : $displayId;
     $this->name = $name;
     $this->reference = $reference;
     $this->parentId = $parentId;
     $this->image = $image;
     $this->displayOrder = $displayOrder;
 }
 /**
  * - Génère un GUID
  * - Supprime les tirets et accolades
  * @author Alban Truc
  * @since 23/02/2014
  * @return string
  */
 public function generateGUID()
 {
     //http://www.php.net/manual/fr/function.com-create-guid.php
     $guid = com_create_guid();
     //caractères à enlever: -, { et }
     $patterns = array('/{/', '/-/', '/}/');
     $guid = preg_replace($patterns, '', $guid);
     return $guid;
 }
Exemple #29
0
 public static function create($separator = false)
 {
     if (function_exists('com_create_guid')) {
         $guid = trim(com_create_guid(), '{}');
         return !$separator ? str_replace('-', '', $guid) : $guid;
     }
     $pattern = !$separator ? '%04X%04X%04X%04X%04X%04X%04X%04X' : '%04X%04X-%04X-%04X-%04X-%04X%04X%04X';
     return sprintf($pattern, mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
 }
 function id_unique()
 {
     $id = '';
     if (function_exists('com_create_guid') === true) {
         $id = trim(com_create_guid(), '{}');
     } else {
         $id = sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
     }
     return $id;
 }