-
Posts
397 -
Joined
-
Last visited
Posts posted by Nodral
-
-
To make this easier,
Change your date format to a Unix timestamp, then you can create a script which will take today's date and subtract 5 days from it (call it $date_calc or something similr). Then you would do something like
//get the values from the table which are 5 days old or younger. $sql="SELECT close FROM tablename WHERE date > $date_calc"; //run sql query $sql=mysql_query($sql); while($row=mysql_fetch_array($sql)){ //add the last 5 into an array $close_total[]=$row[close]; } //calculate the average of the array $output=(array_sum($close_total))/5 //then do what every you want with $output
-
Hi
Save yourself loads of time and effort.
Download a prebuilt mailer. I use Rmail, which can be found from Google. It will do everything you want and save you hours and hours.
-
Why would you need to do this? Surely array_flip is already a function to do this?
-
Go to the tutorials section.
There is a great tutorial about security.
If you want to know about hashing, read the sticky about 'What is the point of md5' on this forum
-
If only others had such service levels.
I mean, we've sorted this quicker than a police response to a 999 call!!!
-
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
I just Googled WebStyles and my PC just fell asleep!!!!
-
Oh WebStyles, I just wish I could be sat in a bar with you talking about the stuff you google. You make me so zzzzzzzzzzzzzzzzzzzzzzz.
Sorry, nodded off for a second there!! lol
-
If he does have the same email addy, he'll soon learn to mark topics as solved!!!
-
Do you not mean
llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch
-
Since 2007, things have changed .
- CAMP is now a personality trait rather than a hobby involving tents
- DAMP is now an issue with my house rather than a state my wife gets when we're together
- VAMP is now a fashion statement rather than a series of characters Bram Stoker's novels
- CAMP is now a personality trait rather than a hobby involving tents
-
In my local area, a MAMP (as in a fat MAMP) is a smelly girl, possibly in late teens who is quite 'easy'
-
Unfortunately I have no experience of Dreamweaver so con't help there.
I tend to write all my code from scratch so I know what everything does and I learn more as I go along.
-
I tend to use
if(strlen($_POST['field 1]>0 AND strlen($_POST['field 2])>0 AND strlen($_POST['field 3])>0 AND .......................... ){ //do something } else { //fields not complete }
-
What are they a percentage of?
You can certainly do it the way you have stated.
$value[] = "do calculation on" $row["value"];
This would create an array called $value containing all th %values in the same order as they were originally written int o th $row['value'] array
-
Whichever appears latter in the code will override the others.
Your process should be something like
if (isset($_POST['password'])){ . . . . . . $password=md5( md5($salt.$_POST['password'])); . . . . . . . either INSERT or SELECT with DB using $password . . . . . . . <form method="post" > <input type="password" name="password">
You shouldn't need to define it any more times than this really.
Your user will input in either a reg form or login form
This is then returned to the script as $_POST['password']
This will then be hashed and salted to $password
Which is then either written to DB or used as part of a SELECT statement to get existing user details.
Have a scan through your code and see if it fits to this, if you've got other complications in there (except the bit to prevent numeric SQL injection) you may want to remove them.
Hope this makes sense
-
How do you fill in the database information without using either an INSERT statement or UPDATE statement?
Show me the bit of your code which interacts with your DB and writes into it.
-
Read the post by kikesv. He has already shown how to do this.
What's the point of posting on here if you don't read, digest and try to understand what people are doing to help?
You may want to do a bit of Googling about basic MySQL databases and the fundamental statements and interactions that php has with it.
-
Ok
Somewhere along the line, you have to change $_POST['password'] into $password.
If we refer back to code in previous posts, this line has got distorted. What you acteully are trying to do is take $_POST['password'] hash it and salt it and then call it $password to be used when interacting with your DB
change
$salt="Any random gobbldy-gook"; $password=md5( md5($salt.$password));
to
$salt="Any random gobbldy-gook"; $password=md5( md5($salt.$_POST['password']));
This needs to be the same wherever you refer to $password or $_POST['password']
-
Possibly want to use
mysql_query($query) or die("<b>A fatal MySQL error occured</b>.\n<br />Query: " . $query . "<br />\nError: (" . mysql_errno() . ") " . mysql_error());
Then if you have got issues, it will tell you.
-
What error do you get?
-
Read through your original code that you posted in your question.
At no point in this code do you have either an INSERT or UPDATE statement. How can you expect to transfer information to a DB without actually having the commands in your script that will do this for you????????
That's like me thinking of a number and then asking you what it is. You won't know, because I've not transferred that information from my brain to yours via my mouth!!!!!
-
Do all your functions and processing, etc outside of your query statement, then insert it as a variable.
e.g.
$loginUsername = "admin"; $loginUsername=mysql_real_escape_string($loginUsername); mysql_select_db($database_uploader, $uploader); $query = sprintf("SELECT * FROM members WHERE uname='%s'", $loginUsername); mysql_query($query);
-
look forward to you reposting in 5 mins then!! lol
-
Check your original code.
There is no INSERT statement, so how are you writing to your DB?
hashing
in PHP Coding Help
Posted
I'd agree with this, however I tend to give them 3 attempts then they must close the browser (ie reset the session variable) and start over.