awavekidornah Posted August 25, 2015 Share Posted August 25, 2015 I just came across this website that generates a unique code (a number) for people who want a PSN code. The site looks like this: It shows the domain as domain.com/claim.php The code/numbers listed after "YOUR CODE IS:" changes every time someone revisits the website. Does anyone know how to do this? The reason I would like to know how to add this code is that I would like to create my own site that offers a variety of codes like the site above. If anyone can help and or provide the PHP code on how to do this, I would appreciate it a lot! Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/ Share on other sites More sharing options...
requinix Posted August 25, 2015 Share Posted August 25, 2015 Yeah, that's not how PSN codes work. Your site would have to buy the codes (from wherever) and then... what do you want to do, just give them away? These sites do it by using advertising and affiliate programs to recoup the money spent. It's not free. Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/#findComment-1519633 Share on other sites More sharing options...
awavekidornah Posted August 26, 2015 Author Share Posted August 26, 2015 Yeah, that's not how PSN codes work. Your site would have to buy the codes (from wherever) and then... what do you want to do, just give them away? These sites do it by using advertising and affiliate programs to recoup the money spent. It's not free. You basically ignored my question and told me something I already know, but I don't do that. I do buy codes and I offer them away for a prize on my sites. I do it via e-mail but I was wondering how I can implant this by using PHP on my site like how the site above screenshot I shared previously. Do you know the PHP code on how to do this? Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/#findComment-1519634 Share on other sites More sharing options...
requinix Posted August 26, 2015 Share Posted August 26, 2015 Your question was "This site has PSN codes that [look like they] change every time. How do I make those codes?" Your question was not "This site distributes PSN codes. I want to do that too. Here is how I plan to get the codes and how I want to offer them to the users: [...]. How do I do that?" You have codes. Two things come first: 1. Store those codes in a database. You'll need to know the code, the amount, and whether it's been used. You'll probably want to track other information like the IP address of the person who claimed it, when they claimed it, maybe a SKU or barcode or whatever of the actual product you bought (for record-keeping), etc. 2. Build some way for you to enter new codes. If you already have an admin-type area on your site, that would be a great place. You'll want to add new codes as well as look at existing codes, check usage, and maybe create some reports like how many have been used and by whom. As for the way for a user to get those codes, how are you going to offer (aka subsidize) them? Referral programs? Whose? Or do something else? Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/#findComment-1519635 Share on other sites More sharing options...
awavekidornah Posted August 26, 2015 Author Share Posted August 26, 2015 (edited) Your question was "This site has PSN codes that [look like they] change every time. How do I make those codes?" Your question was not "This site distributes PSN codes. I want to do that too. Here is how I plan to get the codes and how I want to offer them to the users: [...]. How do I do that?" You have codes. Two things come first: 1. Store those codes in a database. You'll need to know the code, the amount, and whether it's been used. You'll probably want to track other information like the IP address of the person who claimed it, when they claimed it, maybe a SKU or barcode or whatever of the actual product you bought (for record-keeping), etc. 2. Build some way for you to enter new codes. If you already have an admin-type area on your site, that would be a great place. You'll want to add new codes as well as look at existing codes, check usage, and maybe create some reports like how many have been used and by whom. As for the way for a user to get those codes, how are you going to offer (aka subsidize) them? Referral programs? Whose? Or do something else? I don't think I ever asked "How do I make these codes?" I think you are misunderstanding my question and I apologize if I am not writing it clear enough. Forget the codes and forget the psn codes. All I know that this It's a PHP script because it has .com/claim.php in the domain. Again: This is probably a basic PHP script or something and every time you refresh the paqe, it shows a different number. Note that the number/code/text (whatever) is after "YOUR CODE IS:" doesn't stay the same after you refresh the browser. This code or those numbers could be anything, it can be a sentence or whatever. What matters is that it changes, and I would like to know the PHP code on how to do that. And if we're still talking about the code whether it being a psn code, they could be fake. Made up numbers, I am not talking anything official. I don't know any PHP or coding at all, hence the fact that I came and joined here for some help. 1. I know about databases, however as I already mentioned - I don't know ANY coding. I am not a professional. I am not looking for something professional like this at all. If you want, I can make a video of the site and refresh the browser and show you what's after "YOUR CODE IS:" which are these made up numbers: H2x9-NXN2-****". Though to add on, these numbers can be a sentence, anything. They don't have to be psn codes, I am just looking for the PHP code on how I can add it to my own site and have a duplicate of the site in the screenshot of my OP. 2. I don't know how to enter them, that's why I uploaded a screenshot on my original post to show the example of the site I would like to properly duplicate, and that is impossible because you cannot copy a php script with website copiers. I don't already have a admin-type area, that is highly professional and I am still a beginner to all of this so I wouldn't want something that difficult to implant on my site. As I think I have already mentioned in my post here, the codes can be fake. Or they can be real. As long as when someone (a visitor on my site) see's that when he goes to where the code is being displayed after "YOUR CODE IS:" and if he refreshes his browser and see's the same code then it will look unprofessional and I would like the PHP script (or HTML/javascript) whatever it is to change these numbers/codes every time someone refreshes the page. If you don't know the PHP code or how to do that, I guess I would have to keep looking on Google for some help. If you are wondering how I would support the codes, can't I just purchase them? I don't know if you are purposely trying to get off-topic from the main question or not, but that is honestly not relevant to my question. Moreover, to clear up more of what I have said: The codes or "numbers" being displayed after "YOUR CODE IS:" can be fake. I think on the screenshot I posted above displays fake codes. But that is also not relevant. What's relevant is that is it possible to make a duplicate of this page and to add my own numbers being displayed after "YOUR CODE IS:" and for these numbers to change around a bit every time a user refreshes the page? Here is a video GIF of me refreshing the domain.com/claim.php if you would like to see what I mean by what's after "YOUR CODE IS:" changes: https://gyazo.com/28800ab0109ab27e341bb0c33192bdd9 I would hate to post or tell anybody the real domain because it would violate the owner's privacy. Anyway, if anyone knows how to do this - I would highly appreciate it if you can still help me. Thanks! Edited August 26, 2015 by awavekidornah Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/#findComment-1519640 Share on other sites More sharing options...
Solution Ch0cu3r Posted August 26, 2015 Solution Share Posted August 26, 2015 (edited) If you want to create fake PSN codes then google "PHP random string generator" you will find many tutorials/code snippets which will show how to generate random strings. To format the random string into a fake PSN code all you do is generate a 12 character string then use use str_split and implode to add the hyphens every 4 characters. To know if the code has been generated before you need to use a database. Every time you generate a code you will need to check the database to see if it has not been generated before. If the code has not been used you will display the code and insert it into your database. If you want to create genuine PSN codes then it will not be possible for to generate these. What you will have to do is (obviously) purchase genuine PSN codes and add them to a database. To get a code from the database you will run a SQL query which will randomly select a code that has not been issued before, example SQL query SELECT code FROM psn_codes WHERE issued = 0 ORDER BY RAND() LIMIT 1 When you got the code you will update the database and mark that code has been used. UPDATE psn_codes WHERE code = '$thePSNCode' SET issed = 1 When issued is set to 1 then code not be used again. To make your page look pretty like your screenshot you'll use HTML/CSS. There are plenty of basic HTML/CSS tutorials available if you google, you should be able to reproduce the screenshot quite easily. Or use a readily available template Edited August 26, 2015 by Ch0cu3r Quote Link to comment https://forums.phpfreaks.com/topic/297930-your-code-is-anyone-know-this-php-code/#findComment-1519650 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.