Copy link to clipboard
Copied
Is Dreamweaver capable of running GRANT and CREATE commands? I want to setup a page that allows users to create their own user and password.
I have tried the following but doesn't seem to work.
<?php require_once('Connections/med.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$createUserSQL = sprintf("CREATE USER %s@'localhost' IDENTIFIED BY %s; GRANT USAGE ON * . * TO %s@'localhost' IDENTIFIED BY %s WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; CREATE DATABASE IF NOT EXISTS %s ; GRANT ALL PRIVILEGES ON %s . * TO %s@'localhost';",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['username'], "text"));
mysql_select_db($database_med, $med);
$Result1 = mysql_query($createUserSQL, $med) or die(mysql_error());
?>
Copy link to clipboard
Copied
I am not seeing what you are referring to as "the following" but if I knew what you were attempting I might be able to help.
If you are not coding your site yourself I am not sure what DW can do as far as user creation and authentication. My guess is not as much as you would hope. But I am still on CS4.
Copy link to clipboard
Copied
>Is Dreamweaver capable of running GRANT and CREATE commands?
Not that I am aware of. Of course, you can use DW to create web pages that can execute DDL statements such as GRANT, CREATE.
>I want to setup a page that allows users
>to create their own user and password.
Why would you need to execute GRANT or CREATE commands, or any other DDL? Can you explain what you are trying to do?