Jump to content

Archived

This topic is now archived and is closed to further replies.

nerdco

mkdir relative to mysql

Recommended Posts

Hey,

I have a registration process for a upload site I'm creating. When they register a 8 digit long key is created to be their home folder and stored in a mysql table ('users'). Now when they activate their account I want it to create a directory based on the 'directory' key.

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]<?
if ($_GET['action'] == "activate") {
?>
<?
$alias = $_REQUEST['alias'];
$activationcode = $_REQUEST['code'];

$sql = mysql_query("UPDATE users SET access='1' WHERE alias='$alias' code='$activation'");

$sql_doublecheck = mysql_query("SELECT * FROM users WHERE alias='$alias' AND access='1'");
$doublecheck = mysql_num_rows($sql_doublecheck);

if($doublecheck == 0){
echo "An error occured during the activation of your account";
} elseif ($doublecheck > 0) {

[!--coloro:#CC0000--][span style=\"color:#CC0000\"][!--/coloro--] $result = mysql_query("SELECT * FROM users WHERE alias='$alias'");
$row = mysql_fetch_array( $result );
mkdir("/home/nerdco/public_html/uploader/storage/.$row['directory']", 0777);
echo "Your account is now active, you may now login";
[!--colorc--][/span][!--/colorc--]
}
?>
<?
exit;
}?>[/quote]
I've tried to do it but I get the followed error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/nerdco/public_html/uploader/index.php on line 43

Thanks in advance,
nerd

Share this post


Link to post
Share on other sites
[code]$result = mysql_query("SELECT * FROM users WHERE alias='".$alias."' LIMIT 1");
$row = mysql_fetch_array($result);
mkdir("/home/nerdco/public_html/uploader/storage/".$row['directory'], 0777);
echo "Your account is now active, you may now login";
[/code]

This should resolve your problem.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.