Jump to content

mkdir relative to mysql


nerdco

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
Link to comment
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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.