Current location: Hot Scripts Forums » Programming Languages » PHP » unique number/hash?


unique number/hash?

Reply
  #1 (permalink)  
Old 06-23-05, 12:30 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
unique number/hash?

Is there a way to generate a unique number or hash from an email? I use IMAP and PHP to fetch the emails, and for the email ID I use:

for ($id = 1; $id <= $total; $id++) {

But if I store the id in a database and they delete that email, then a new email will have $id 1 but will not be the same email!

Any ideas??
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
  #2 (permalink)  
Old 06-23-05, 01:02 PM
Keith's Avatar
Keith Keith is offline
Community Liaison
 
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
I'm assuming you're grabbing this from another site and don't have access to the database.

Try encrypting the subject, date, and author - or whatever info you have access to and want to use - into one variable.

PHP Code:

$unique_id md5($subject) . md5($date) . md5($author); 

or
PHP Code:

$unique_id md5($subject intval(ereg_replace("[^0-9]"""$date))); 


Last edited by Keith; 06-23-05 at 01:25 PM.
Reply With Quote
  #3 (permalink)  
Old 06-23-05, 03:09 PM
FiRe FiRe is offline
Code Guru
 
Join Date: Oct 2004
Location: UK
Posts: 801
Thanks: 0
Thanked 0 Times in 0 Posts
good idea...
__________________
Alexa Share <-- Trade virtual shares in websites with this online game.

codR.us <-- Submit and vote for your favorite code snippets with codR.us.

XEWeb.net <-- The ultimate PHP resource network.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
unique visitors... florison Script Requests 0 12-29-04 08:11 PM
Help with C Code..need to count unique words jasonsthomas C/C++ 3 12-08-04 06:50 AM
An unique login script Jan_Maes PHP 1 11-07-04 06:46 AM
Unique hit counter..... Eclipse PHP 5 09-17-04 11:08 PM
Stunning unique design for sale ~ $250! banners2go General Advertisements 0 08-25-04 08:36 AM


All times are GMT -5. The time now is 06:51 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.