Jump to content


Photo

mkdir relative to mysql


  • Please log in to reply
3 replies to this topic

#1 nerdco

nerdco
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 March 2006 - 07:38 AM

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

#2 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 11 March 2006 - 08:06 AM

$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";

This should resolve your problem.

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.


#3 nerdco

nerdco
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 11 March 2006 - 08:30 AM

Hey,

Thanks, exactly what I want :)

nerd

#4 txmedic03

txmedic03
  • Members
  • PipPipPip
  • Advanced Member
  • 313 posts
  • LocationCall, TX, USA

Posted 11 March 2006 - 08:36 AM

Glad I could help. :-)

SEMPER FIDELIS!

I can't stop you from doing something silly, but at least I can help you do it right.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users