Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,255
Total Threads: 81,223
Total Posts: 566,959
There are 147 users currently browsing (tf).
  Our Partners:
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Need some help, not sure...

Thread title: Need some help, not sure...
    Thread tools Search this thread Display Modes  
07-30-2012, 10:58 PM
dlopez916 is offline dlopez916
dlopez916's Avatar
Status: Member
Join date: Oct 2009
Location: Russellville, AR
Expertise: CSS, HTML, Flash, Photoshop
Software: Photoshop, Dreamweaver, Frefox
Posts: 108
iTrader: 0 / 0%

dlopez916 is on a distinguished road

  Old  Need some help, not sure...

Ok, so I have an idea for a membership based site. What I am wanting to accomplish is for visitors to register, and they choose a username. Then, using that username, once a month, generate a special code that is unique to each user, and includes part of their username. How is this able to be done? I assumed PHP would be needed, thus my post in this forum. Thanks!

08-11-2012, 09:30 PM
fde is offline fde
Status: I'm new around here
Join date: Aug 2012
Location: netherlands
Expertise: php
Software: xampp, cream for vim
Posts: 3
iTrader: 0 / 0%

fde is on a distinguished road


Imo you should use a cronjob which runs a php shell script.

This script set to run monthy in cron, connects to database, grabs the usernames and email adresses from db into array or object.

Then you do something like:
PHP Code:

=" __ " 
$subject 'special code';
$headers 'From:' "\r\n" .
'Reply-To:' "\r\n" .
'X-Mailer: PHP/' phpversion();

foreach (
$users as $user){
$to      =$user['email'];
$message 'Hi here is your special code: '.$uniqspecode;


When using object, its $user->name and $user->email
Make sure this script cannot be accessed directly from the internet, you don't want someone to visit and send out a new batch of codes at every page refresh. One way to prevent this is instead of using <?php and ?>,
PHP Code:
in top of the script. Note you need the PHP CLI properly installed. Another way then cron is to just run the script manually every month via a protected login environment.

The seperator is provided to allow parsing of the specialcode and compare to md5 encrypted usernames, to determine which user it was.


Thread Tools
Display Modes

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed