Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Hi I have been working on a way to generate names using md5 and date function in PHP
Old 09-09-2007, 07:19 PM Hi I have been working on a way to generate names using md5 and date function in PHP
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
Hi I have been working on a way to generate names using md5 and date function in PHP.
I am wondering if there is a limit to the number of characters in a filename.
*Currently the length is 32+4 =36 because of the extension and the period
EX: 99d865983dd505bfd2ba20ea7239e60c
and how do I make it so that If I export a file *.jpg and *.flv so the hash doesn't change when it is done with the first one from to the second one
if you see anything wrong let me know.
MY CODE ONLY HAS THE GENERATOR PART FOR THE LINK ONE

PHP Code:

<?

$input 
=$_GET['input'];
$encryptText date('dDjLNSwzWFmMntLoYyaABgGhHisueIOPTZcru');
$encryptedText md5($encryptText ); 
echo 
$encryptedText;
$output=$encryptedText;
    
        
exec('ffmpeg -i /home/forbushj/uploadvidd/'.$input.' -ar 22050 -ab 32 -f flv -s 320x240 /home/forbushj/public_html/2vidd/'.$output.'.flv');
        
exec('ffmpeg -i /home/forbushj/uploadvidd/'.$input.' -an -ss 00:00:45 -an -r 1 -vframes 1 -y -s 150x100 /home/forbushj/public_html/2vidd/'.$output.'.jpg');
        echo
'<p></p>';
        echo(
'ffmpeg -i /home/forbushj/uploadvidd/'.$input.' -ar 22050 -ab 32 -f flv -s 320x240 /home/forbushj/public_html/2vidd/'.$output.'.flv');
        echo
'<p></p>';
        echo(
'ffmpeg -i /home/forbushj/uploadvidd/'.$input.' -an -ss 00:00:45 -an -r 1 -vframes 1 -y -s 150x100 /home/forbushj/public_html/2vidd/'.$output.'.jpg');
 
?>

Here is a link:
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Last edited by goheadtry; 09-09-2007 at 07:22 PM..
goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
 
Register now for full access!
Old 09-09-2007, 09:46 PM Re: Hi I have been working on a way to generate names using md5 and date function in
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
Check out the date() function at php.net, you're not using it correctly.

You may want to consider $encryptText = date('Y-m-d h:i:s');

File name limitations are based on the operating systems involved, i.e. the server and the user. Macs will have trouble with filenames over 30 chars.

As long as the md5 function is passed the same string to encrypt, it will output the exact same encrypted string.
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Old 09-09-2007, 11:58 PM Re: Hi I have been working on a way to generate names using md5 and date function in
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
According to you it is not used correctly?
I am using it correctly
acording to this
http://www.php.net/date
then I am converting it to MD5 but what to do about the length?
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE


Last edited by goheadtry; 09-10-2007 at 12:01 AM..
goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 09-10-2007, 12:49 AM Re: Hi I have been working on a way to generate names using md5 and date function in
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
What exactly are you trying to do? The way you are using the date function seems incorrect. From the looks of it I think you are trying to generate unique file names but I'm not sure if thats a good approach. If you want a uniqe file name based on time use a timestamp instead of the date function. Is there a reason why you are using a md5 hash rather than just using a simple counter?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-10-2007, 03:54 PM Re: Hi I have been working on a way to generate names using md5 and date function in
goheadtry's Avatar
Webmaster Talker

Posts: 730
Name: John
Location: United States of America, California
Trades: 0
I am trying to generate output filenames from ffmpeg via shell access using PHP's Date function then converting the date to md5 so I don't have to worry about files overrighting because it can only be that date once then that date is converted to md5 so the output files don't over right each other.

But I need a way to get shorternames though of any algorithms I can user let me know.
__________________
Free $1 gift card when you signup at
Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

goheadtry is offline
Reply With Quote
View Public Profile Visit goheadtry's homepage!
 
Old 09-10-2007, 04:10 PM Re: Hi I have been working on a way to generate names using md5 and date function in
Super Talker

Posts: 130
Trades: 0
look at this:
PHP Code:
$encryptText date('dDjLNSwzWFmMntLoYyaABgGhHisueIOPTZcru');
echo (
$encryptText); 
output:
10Mon1001th125237September09Sep93002007200707pmPM8 8031503150732uAmerica/Chicago1-0500-05:00CDT-180002007-09-10T15:07:32-05:00Mon, 10 Sep 2007 15:07:32 -0500u

You're not using the date function correctly.

I just looked at what you entered closer. You've entered every option for the date function. So I guess you could say you're using it correctly as each option is valid. However you're not using it efficiently.

Lets say you want to output the mm/dd/yyyy.

PHP Code:
echo (date('m/d/Y')); 
Try playing with some of these options to see the output, and keep in mind you don't have to use them all at the same time .
__________________
flann

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Last edited by flann; 09-10-2007 at 04:38 PM..
flann is offline
Reply With Quote
View Public Profile
 
Old 09-10-2007, 07:45 PM Re: Hi I have been working on a way to generate names using md5 and date function in
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by goheadtry View Post
I am trying to generate output filenames from ffmpeg via shell access using PHP's Date function then converting the date to md5 so I don't have to worry about files overrighting because it can only be that date once then that date is converted to md5 so the output files don't over right each other.

But I need a way to get shorternames though of any algorithms I can user let me know.
It is still possible to overwrite a file. A hash function given two different inputs can sometimes generate the same output. Its not likely but possible. Instead of using that approach maybe just use a counter.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 09-10-2007, 08:50 PM Re: Hi I have been working on a way to generate names using md5 and date function in
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
Use this and there will always be unique filenames!

PHP Code:
list($usec$sec) = explode(' 'microtime());
$filename str_replace('.''', (float)$usec + (float)$sec); 
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 09-10-2007, 09:43 PM Re: Hi I have been working on a way to generate names using md5 and date function in
metho's Avatar
Ultra Talker

Posts: 481
Location: Gold Coast - Brisbane QLD, Australia
Trades: 0
goheadtry, you are a difficult person to help. It seems you have a fixed idea that there's nothing wrong with your code, but there is. We point it out and you ignore.

I went to the trouble of writing a function to help you with this, did you even attempt to use it? Instead you've taken a completely different tack which seems more convoluted that your first approach.

If you're not going to heed the advice of more experienced coders, why bother asking for help?
__________________
I do
Please login or register to view this content. Registration is FREE
based.
Spend a lot of time in
Please login or register to view this content. Registration is FREE
.
And
Please login or register to view this content. Registration is FREE
chews up the rest.
metho is offline
Reply With Quote
View Public Profile Visit metho's homepage!
 
Reply     « Reply to Hi I have been working on a way to generate names using md5 and date function in PHP
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.35086 seconds with 12 queries