Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Sha1 Column Type


I have read several online tutorials advocating storing a sha1() hashed
password in a column of type BLOB. As far as I can tell, sha1() always
returns a string of 40 characters, regardless of the size of the
original input. Is there any reason I can't store this as type CHAR? I
am running MySQL 4.1.x.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Column Type
when u r using combination of php and mysql to make a discussion board like this one is, then what column type do u use for storing all the posts into mysql database. Is it large text or something like that? I don't have experience with those columns too much.

View Replies !   View Related
Database Column Type And Length
Does anyone know how to extract the Database column type and length from a PEAR class? I'm using PHP with postgresql Basically, I'm running a query object which is returning a series of rows (see below). I'd like to extract the column type and length as well.

$FieldFetch = "Select * from Person";
$FieldResult = $DBSession->simpleQuery($FieldFetch, DB_FETCHMODE_ASSOC);
$FieldCount = $DBSession->numRows($FieldResult);

View Replies !   View Related
Mysql: What's The Right Type To Use For A Currency Column?
float? double? decimal? something else? which one is correct to make sure monetary calculations using the decimal values (dollars and cents) are always right?

View Replies !   View Related
Editing Table Column Ot Type Time
I created a table having a column to store data of type time (00:00:00) eg attendance record. that involve storing date_in and time_in. I am able to get the user to select the time using the following script: Code:

View Replies !   View Related
Column Data-Type For Storing Serialized Array In MySQL?
I'm really not sure - I used BLOB in the past- but the arrays are only a few kilobytes. But VARHCAR only allows 255 characters at most and the arrays might contain many more characters than that.

View Replies !   View Related
Md5 And Sha1
I'm building a registration/login script:

$result = "insert into users (username, password, email) values ('$username', sha1('$password'), '$email')";

I've tested this out by submitting (username1, password1) and (username2, password2) Both "password1" and "password2" are encrypted to the same string:

da39a3ee5e6b4b0d3255bfef95601890afd80709 or d41d8cd98f00b204e9800998ecf8427e to be exact....it doesn't matter what I use for the password

View Replies !   View Related
MD5() And SHA1()
I realise that both these functions encrypt to a hash of 32 and 40 chars respectively and see the SHA1() is more crytographically secure than MD5() but in the real world just how secure are they? Can they be hacked? I.e on my site what I want to do is protect both user and pw BEFORE calling a MySQL stored procedure which will then do something else to them in the Db.

My idea is that then it is secured during and after transit from web server to Db. So if I say SHA1'd user and pw(making sure the password is a alphanumeric string) before calling MySQL, if someone picked them up using a sniffer etc could they work them out?

View Replies !   View Related
Sha1 Or Md5?
The manual doesn't say which is better. But someone's comments in md5 chapter suggest sha1 is better. Any expert opinions? Should I use sha1 instead of md5?

View Replies !   View Related
MD5 VS SHA1 VS AES_ENCRYPT?
I've been reading up on password encryption and I've always used MD5 but seems like its not very secure any more, so now am wondering what's better MD5 VS SHA1 VS AES_ENCRYPT?

AES_ENCRYPT seems like a secure way to encrypt passwords but being able to decrypt them seems a bit cautious. Any one any thought of the best way to encrypt passwords?

View Replies !   View Related
Sha1 Implementation
I've experienced a vary strange problem working with PHP and payment gateways. If I use the sha1 function for some string I get the encrypted string, but this function output is different from the one I get using openssl on the command line of a linux machine. Ex:

inside a php I write: sha1("12345")
in the command line I type: echo 12345 ¦ openssl sha1

The output of both functions is different. However, if I store the string 12345 in a somefile.txt and I use sha1_file() function the result is the same as the standard expects, so following the previous example, when I write:

inside a php: sha1_file("somefile.txt")
in the command line I type: echo 12345 ¦ openssl sha1

The output of both functions is the same. Anybody knows if this behaviour is normal, and if it is what's it obeying to?

View Replies !   View Related
Sha1 Error
To get the password from the database i use this:

$password2 = sha1(strip_tags($_POST['user_password'])); echo "password";

i change it so if i was adding to the database? Because when i add a new password its differnt to what it would be if im getting from the database.

View Replies !   View Related
How To Decode A Sha1 Url In Noramal Url
I want to know to decode sha1 encoded url into normal url.

Example:
www.example.com/<sha1 code>/index1.htm

I want this to:
www.example.com/index1.htm

View Replies !   View Related
Md5 / Sha1 - Any Real Difference?
I use md5 hash with some of my cookies and occassionally a hidden form
field - I know the physical data on my network is insecure (unless being
served via https) but I was wondering if there are any advantages to using
md5 over sha1 or versa vicea... I know md5 gives me a unique 32bit hash
while sha1 I've read is 'secure' (?) and gives a 40bit hash... Since The
technical webpage on sha1 is lengthy and for the most part over my head...
and other than today, I've never heard of it before... I was wondering if
anyone could offer any comments on it...

View Replies !   View Related
Max Input Size SHA1
Is there a maximum input size for SHA1? Or can I input even 1000 characters and still get a different output than if I input 999?

View Replies !   View Related
Converting Sha1() To String
I generated sha1() string in order to store a password in the table. But i want to know how to retrive back the original password as a normal string in order to send the password to the users who have submitted the forgotten request. I want to know is there any function that i can retireve the password in normal string form.

View Replies !   View Related
Is It Impossible To Decrypt MD5 And SHA1?
Everyone in the PHP world knows its impossible to decrypt MD5 and SHA1 But A site has done it! But how? http://md5encryption.com/?mod=decrypt

View Replies !   View Related
Decode A Sha1 Encryption
I decided to sha1 passwords into the database for the creation of a user account. When logging into the system, this sql statement works, but I can't figure out how to reverse it, so I'm assuming this is a one-way encryption: PHP Code:

$sql = "SELECT email, password, first
                FROM `account`
                WHERE `email` = '" . addslashes(htmlspecialchars($AdminID)) . "'
                AND
                `password` = '" . sha1(addslashes(htmlspecialchars($AdminPswd))) . "'";

I need to have a statement to retrieve the encryption and decode it for password retrieval (when a user lost their password). Is there a way to decode this or should I choose another encryption technique (2-way) other than the basic base64_decode/base64_encode?

View Replies !   View Related
Sha1() Passwd In Mysql Help... (beginner)
For a log-in page I have created a mysql db and user registers
with a user name and password. The password field is encrypted with

$passwd = sha1($_REQUEST['passwd']);

I insert the $passwd in mysql_insert. The password gets
encrypted and stored in mysql. Now I want to check if the user has
entered the correct password when he logs in. How can I do that.

View Replies !   View Related
SHA1 And A Register/login File.
I am getting a couple of errors with a register/login file for a site.

Apache version   1.3.39 (Unix)
PHP version    5.2.4
MySQL version    5.0.27-standard

I added the SHA1 encryption for the passwords, but not, even thought it encrypts, the email column in the MYSQL database does not appear. Meaning there must be another way to encrypt the password properly in the file.

Second problem is that the file keeps inserting blank columns into the table of USERS - i.e without any information - so instead of telling me exactly how many users I have, it has like an extra 50 rows of blank info. So something is wrong on the insertion. Code:

View Replies !   View Related
Encrypt Passwords For The Database Use SHA1
Would it be safer if you were to like instead of just using SHA1 to encrypt passwords for the database use SHA1 and cut 2 numbers off the back of the string and add the front two or somin like that? Code:

View Replies !   View Related
Sha1() Undefined Function Error
I am using sha1 function for passwords as in the code below.

$uid=sha1($cols['pword']);

And I am getting this error;
Fatal error: Call to undefined function: sha1() in c:phpdevwwwalaskanerrandslogin.php on line 8

What's up with that?

View Replies !   View Related
Encryption - Inserting Data Into A Database Using SHA1
Another n00b question but when inserting data into a database using SHA1 do you need to do this: PHP Code:

INSERT INTO $table (`password`)
VALUES([b]'sha1($_POST['password'])'[/b]);

or something like that, and when retrieving from it: PHP Code:

SELECT * FROM $table WHERE sha1($_POST['password']);

Or can you just got $_POST['password']
Sorry I dont know how this works. Also what is a snippet for salting a sha1 command.

View Replies !   View Related
How To Query From One Column Then Sort Using Another Column
I am trying to get the last 100 albums I entered into my database using the album_id (Highest being the latest entry) then sort them alphabetically using the album_title column.

I can get the latest 100 easily but cannot figure out how to also sort the results by the album_title before I display them.

This is what I have so far which gets what I want but not in alphabetical order.

<?php
$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100", $db);

while ($result = mysql_fetch_row($sqlquery))
{
echo "<a href='music_info.php?album_id=$result[0]'><span style='text-decoration: none'>$result[1]</span><br></a>";
}
?>

I have been trying to add a second ORDER BY to the query like so.

$sqlquery = mysql_query("SELECT * FROM albums ORDER BY album_id desc limit 100 ORDER BY album_title", $db);

but this obviously isn't the way I should be doing it.

View Replies !   View Related
Paging And Sorting Column By Column Name?
I am using below code to paging my data. I want to sort my data by Column time. Not getting where i do changes. Code:

View Replies !   View Related
Form Type=submit Vs Type=image
I'm wanting to create a form with quite a few SUBMIT buttons that use an image rather then the stock (plain grey) button. Everything works fine when I use this line:

print "<INPUT TYPE="submit" NAME="editaction" VALUE=$id>";

I know which SUBMIT button was pressed by checking the value of $editaction in the receiving page. Now if I replace that line with this one:

print "<INPUT TYPE="image" SRC="icon.gif" NAME="editaction" VALUE=$id>";

I no longer get a value in $editaction. I know about $editaction_x and $editaction_y. Is there no way get to the 'VALUE' (from the VALUE=$id part) as well? Am I missing something? Has the variable name been modified to somthing like $editaction_value?

TIA for any light you can shed.

View Replies !   View Related
Upload Audio Files Of Type .wav & Video Files Of Type .avi
I need to upload audio files of type .wav & video files of type .avi
/ .mov but my current file unloader is not helping me with that. My
unloader works with application types, images, txt, pdf , mp3, mpg,
mpeg but not with those .wav & .mov/.avi files........

View Replies !   View Related
Column To Use?
I have a table with the following:

upn|parent_upn|description|etc etc

What I want to do is, when the parent_upn is not Zero, I want it to select the parent_upn as the upn column.

I was thinking something like this:

SELECT IF(`parent_upn` != &#390;', `parent_upn` AS `upn`)
ELSE(`upn` AS `upn`)
FROM `products` WHERE ......

This doesn't work, what am I doing wrong.

View Replies !   View Related
Two Column Display.
I'm trying to display records in two columns. Here's my logic so far...

$numRows=get the total number of rows
$x=divide total rows in half (rounding up for odd #'s)

do a fetch_array on the query

I store the columns into two table cells, I start the main table here Start first table cell. First column of data=do a for loop from $i=1 to $x break into HTML and start the content. End First table cell

Start Second table cell. Second Column of data = do a for loop from $j=1 to $numRows-$x break into HTML and do content. End Second table cell

If anyone sees something inherently flawed with this or just knows a better way, hints and examples are always appreciated. I am an admitted newbie and very used to ASP, so I I think the problem comes from not being able to advance to another record manually. But then again, I really don't know what I'm talking about.

View Replies !   View Related
Adding Column
Let's say that I extract some data results from the database and I want to display it such as the following:

ColumnA ColumnB
---------------------------
Result X| Result A |
---------------------------
Result Y| Result B |
---------------------------
| Result C |
---------------------------
Result Z | Result D|
---------------------------

All results come from the same row , just dispatch in several columns.
If I have a variable saying that each result value is ' 1 '.

How do I add column A and display a total (in this case 3)?
How do I add column B and display a total (in this case 4)?

I have to precise that I don't know in advance how many results I 'll collect from the database. The ideal is to post total amount in each column.

View Replies !   View Related
Split The Value Column
how can I split the value column in the below option select so that I get back $var1 = 300001 $var2 = 400000? <option value="300001-400000">£300,001 - £400,000</option>

View Replies !   View Related
Updating The Column
I am updating the column ourpage in any row of the database busdir2 where cat = farming. It reads only rows where cat = farming correctly, but isn't getting the new ourpage value into the table. Code:

View Replies !   View Related
Column Table
I have a table of records; the records belong to different user ids and are distinguishable by a reference number, Each record has a price. so theres a price column.

The problem isnt getting the total of the whole column. the problem is getting the total for the specific user id and displaying it at the bottom of the price column.

View Replies !   View Related
Column Value Blues
I am really struggling with the basics here.

PHP/MySQL

I have a database with three columns:

ID, Name, Phone

I want to return all the unique items in Name.

My Query is

$result = mysql_query ( "SELECT Name FROM database")

Let's say there are 20 entries. I want to return all twenty entries with
a <br /> between them.

I have tried to use foreach and while with mysql_fetch_row & _array, but
I can't get it to work.

View Replies !   View Related
Fetch A Column
Is it possible to fetch a column from a queryresult?

View Replies !   View Related
Column Sorting
I have found the below code to sort columns, but would like to hide it if another column is sorted as I have the following columns: username , age , online etc... so if online is sorted there is no text saying Sort ascending or Sory descending in username or age. Code:

View Replies !   View Related
MySql Column ??
What i want to do is this. I have an field in one of my database tables with money price of product, i want to display the total amount of the table,
i try to use "select sum(fieldname) from table where" but is not working.

View Replies !   View Related
Column Pagination
I have a problem in pagination of columns. 5 columns should be displayed in a page. Help me in displaying the rows based on columns. All the columns are displayed in first page. Code:

View Replies !   View Related
Column Names
how can i get the column names of ms access table?

View Replies !   View Related
Get Highest Value In Column, Then +1 To It.
i wanted to know how i can query a DB, get the highest value, or better yet what number comes next, +1 to it, and add put it in a field in my form. Code:

View Replies !   View Related
Set Column Default
we have a table  sistock with column cameramodel  varchar(30) and try to  set default value to blank with the following:

ALTER TABLE SISTOCK CHANGE COLUMN CAMERAMODEL CAMERAMODEL ENUM ('INSTOCK',
'BACKORDER','SERVICE','OBSOLETE') DEFAULT '';

and we get an error at the mysql prompt;

View Replies !   View Related
Asc And Desc For Column
How to sort in ascending and descending order for the particular column when clicked on header. Code:

View Replies !   View Related
Column Maximum +1
I have an interger column in my database. In one of my SQL statments I want to peform a query that will insert a value into that interger column that is equal to the record with the greatest value plus 1. I know about auto_increment, but this does not do what I want it to do. This field is also not being used as a key, it is being used for ordering. how to do this in a single query, and possibly know a way that will work on any/most SQL languages, not just MySQL?

View Replies !   View Related
Group By With New Column
i have a table 'children' like this :

id | child_id | startdate | enddate
------------------------------------------
1 | 1 | jan | jun
2 | 1 | jul | dec
3 | 2 | jan | mar
4 | 2 | apr | nov

Is it possible to group rows with the same child_id, but without loosing de startdate and enddate from other rows?

I want this as output :

id | child_id | startdate1 | enddate1 | startdate2 | enddate2
-------------------------------------------------------------------
1 | 1 | jan | jun | jul | dec
2 | 2 | jan | mar | apr | nov

Is this possible?

View Replies !   View Related
Automatically Add Column
I have a list of names being displayed, that currently use this basic code:

View Replies !   View Related
Index Every Column
I have an all-integer table for song info. It consists of the songid, and TINY INTs with ID's referencing seperate tables for genres and locations. It also has 9 STATS such as weekly, monthly, and total plays, downloads and score.

SONG_INFO (condensed)
songid - PRI KEY
genre1_id
genre2_id
region_id
country_id
weekly_plays
weekly_score

The nine STAT items are the target of WHERE equally, as are the 5 LOCATION items. You can use a simple sort like "show songs from England" or reference all like "find the highest weekly_score in Japan for Rap". So what do you do when they are all worthy of an index? I currently have a pri key on songid, and a two-column index on genre1-genre2. They are all TINY or SMALL INT, so is it not that big of a deal to index each column? Speed is more important than disk space and the charts are used many more times a day than songs are uploaded, so insertion times isn't a big concern either.

View Replies !   View Related
Values From Column
I have got a table where one of the columns has an enum column type. The column heading is "State" The enum string within the "State" column contains all of the fifty states of the union like so:

column heading: "State" enum( 'Alabama', 'Alaska', 'Arizona', 'Arkansas', ... and so forth)

Can I loop through the State column heading and extract each of the fifty enum values (or states) and output them on the page?

// example page output
Alabama
Alaska
Arizona
.....
If so, can anybody give me an idea about how it can be done?

View Replies !   View Related
Trying To Edit Column
I have an ID column at the beginning of my table. I want to edit it so that it's auto_increment and can support numbers up to 5 characters. The code phpMyAdmin tried to execute. SQL query:

ALTER TABLE `books` CHANGE `id` `id` INT( 11 ) NOT NULL DEFAULT &#391;' AUTO_INCREMENT

MySQL said: Documentation
#1067 - Invalid default value for 'id'

So I set the default value to 0 but I again get the same error.

View Replies !   View Related
Add All Data In A Column
I have a table called jobs that has a total column which contains integers between 0 and 25. I have a deal worked out with a client that caps the total per job at 9. How do I add multiple days to get the months total while capping any day whose total is over 9. I have tried looping it in php which I can't get to work, seems like it should be part of the query structure anyway.

View Replies !   View Related
Displaying Column(s)
I am having troubles displaying a query:

$query= "SELECT c.cardID, s.cardID FROM cards s, cards c where s.cardID <> c.cardID";

How can I display the columns ?

View Replies !   View Related
Search Column
I'm trying to build a query in mysql that searches for whether a column of strings contains any word from an array of words.

let's say the array is {'cats', 'dogs', 'bears'}

How can you perform a query in MySQL to return all rows that contain any of these words?

"SELECT * FROM table WHERE description=?

[edit: the column contains sentences]

View Replies !   View Related
Empty A Column
How do you empty a column (all rows) on information?

I know its possible to "TRUNCATE" a table, is it possible to do the same with just a column?

View Replies !   View Related
Referencing Row Column
$total = $type . "frequency";
$freq = $Row[$total];

this obviously isnt the right way to do it because i can manually input 'ptfrequency' and it works but building the variable also gives 'ptfrequency' so im guessing the "grabbing the row with a variable" syntax is incorrect. Ive tried..

$freq = $Row['$total'];
and
$freq = $Row["$total"];

also with no results.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved