Quote:
Originally Posted by dlaroche22
Looking at the PHP code that you have, it appears that your query string is wrong. I would try something like this for your query string.
PHP Code:
<? require_once('dbconnect.php');
$password=substr(md5(microtime()),0,rand(5,2));
mysql_query("INSERT INTO users ( email, password, handle ) VALUES ( '$_POST[email]', '$password', '$_POST[UserName]' )"); $affected = mysql_affected_rows(); if($affected == 1) { echo 'User made. Check email for password.'; } else { echo 'Failed to create user'; }
?>
|
Don't simply use the above code for your script. It will probably work, but it is NOT secure. You need to first validate and sanitize any variables you insert into your database. Never trust user input. You are have a major security risk if you use the above code as is. Do some research on SQL injection attacks and you will find more information.
Edit: On looking at the first post, it looks like you may be validating already, but please make sure you do if you aren't.
Last edited by VirtuosiMedia; 03-29-2008 at 03:45 PM..
|