Jump to content

Search the Community

Showing results for tags 'key'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 6 results

  1. Hi, I have pre-written code that produces a license key but I don’t like the format that the key is in and was wondering if I could get some help fixing it? This is the code @section('scripts') <script type="text/javascript"> function Createkey(length) { var result = ''; var characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; var charactersLength = characters.length; for ( var i = 0; i < length; i++ ) { result += characters.charAt(Math.floor(Math.random() * charactersLength)); } return result; } $('#licenses-gen').click(function(){ var GetType = $('#type_of_key_id').find(":selected").text(); $('#licence').val(GetType.trim()+Createkey(18)); }); </script> @endsection the output is just a random string of 18 characters like: H3CJPE5JMS501FH52A though I want to get an output like: FSOWP-DHJEO-SKJ3D-2DF5R-3FG51 What can I change in the code to get the second output option?
  2. Hi I have a question about API keys and security. I am building a mobile app (learning) and will be using a PHP/MySQL JSON Rest API (designed myself) and I am new to APIs in general so some best practices would be appreciated if you have any? My real question is to do with securing these APIs. For example I was thinking of using user name and password that the user logs into the application with to be send over HTTPS for each request to validate the user is authorised and authenticated. However I have read that I should also be using API keys, so how would I integrate this in? Would each user have their own unique API key or would each system that uses this API have a unique key? If its each user that has their own key would I send all three pieces of data with the request (API Key, username and password). Any advice would be great. Thanks
  3. Hi all, This seems like it should be really simple but to me it's not. I have an array in a variable called $numbers. When I run print_r ($numbers) I get the following... $earchForNumber = '0304'; // Array called $numbers Array ( [0] => Array ( [0] => 0219, 0220, 0221, 0222, 0223 ) [1] => Array ( [0] => 0301, 0302, 0303, 0304 ) [2] => Array ( [0] => 1230, 1231, 0101, 0102 ) ) if (in_array($earchForNumber, $numbers)) {echo 'The key is' . $key;} What I need to do is search for a number within all of the sub arrays and find the key which it belongs to. So if I wanted to find the key for the value of $earchForNumber (0304) it would return a key of 1. There are tons of posts on stack overflow about this sort of thing but I can't find any that perform this task. I played around with inarray() but couldn't get any joy. Any ideas?
  4. Hi Guys, I need to generate an AES file key (CBC/PKCS7/256bit) using PHP and then obviously need to store the key. The second phase is to encrypt a string using the key generated and stored above, however for the moment its the key generation that is the issue. My first thought was to use OpenSSL as it is a library that can be added to any Apache installation. Any help is greatly appreciated. Cheers in advance.
  5. I'm looking to sort this multidimensional array according to its integer value under the key name 'rank'. In other words $r_set contains the combined results of a number of search engines and each result is assigned a 'rank' according to which I want the array to be sorted. $r_set contents look like this -> $google[$google_count] = array ('url'=>$item->link, 'url_title'=>$item->title, 'snippet' =>$item->htmlSnippet, 'rank' => 100-$google_count, 'engine' => 'Google'); $google_count++; I load a number of these kinds of results(.ie $google[google_count] and others like it) in to $r_set when they have the same structure. I want $r_set to be sorted by its 'rank' key starting highest to lowest.
  6. Hi all I have a function below that searches an array and assigns it to $totalmonthlycost. I need to know how I get the array key of the chosen array value ($m12 - $m60) How do I return the array key in the below code? $monthvalues = array($m12,$m18,$m24,$m30,$m36,$m42,$m48,$m54,$m60); function closest($monthvalues, $number){ #does the array already contain the number? if($i = array_search( $number, $monthvalues)) return $i; #add the number to the array $monthvalues[] = $number; #sort and refind the number sort($monthvalues); $i = array_search($number, $monthvalues); #check if there is a number above it if($i && isset($monthvalues[$i-1])) return $monthvalues[$i-1]; //alternatively you could return the number itself here, or below it depending on your requirements } $totalmonthlycost = closest($monthvalues, $idealcostpermonth); Thanks for your help. Pete
×
×
  • 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.