Jump to content

Problem With This Code


elementz

Recommended Posts

This is new.php:

[code]<html>

<head>
<title>New Account :: Index</title>
<link rel="stylesheet" type="text/css"
href="sheet.css" />
</head>

<body>
<table align="center" width="600" bgcolor="#41FBFD" border="2" bordercolor="#0113FC">
<form action="create.php" method="POST">
<tr align="center">
<td width="50%">
<font size="4"><b>Email:</b><br>Please enter a real email address.</font>
</td>
<td width="50%">
<input type="text" name="email" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Domain:</b><br>Please don't include the http:// or www., For subdomain please enter the domain aspect i.e. yourname would be entered for yourname.<?php echo $udomain ?>.</font>
</td>
<td width="50%">
<input type="text" name="dmn" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>&nbsp;</b></font>
</td>
<td width="50%">
<select name="dmntype" class="form">
  <option value ="subd">SubDomain</option>
  <option value ="dom">Domain</option>
</select>
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Username:</b><br>Maximum of 8 letters, please only use letters and numbers.</font>
</td>
<td width="50%">
<input type="text" name="user" class="form">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" name="Submit" value="Create" class="form">
</td>
</tr>
</form>
</table>
</body>

</html>[/code]

And this is create.php:

[code]<?

include("config.php");
include("connect.php");
require '/usr/local/cpanel/Cpanel/Accounting.php.inc';


$email=$_POST['email'];
$domain=$_POST['dmn'];
$user=$_POST['user'];
$dmntype = $_POST['dmntype'];

switch($var){
case "subd" :
$edmn= '$domain.$udomain';
break;
case "dom" :
$edmn= '$domain';
break;
}

  function randomkeys($length)
  {
  $pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
  for($i=0;$i<$length;$i++)
  {
    $key .= $pattern{rand(0,35)};
  }
  return $key;
  }

$pass = randomkeys(8);

$sql="SELECT * FROM `email` WHERE email='$email'";
$result=mysql_query($sql);
if(mysql_num_rows($result)==0){
  }
else{
  ?>
<html>

<head>
<title>New Account :: Index</title>
<link rel="stylesheet" type="text/css"
href="sheet.css" />
</head>

<body>
 
<table align="center" width="600" bgcolor="#41FBFD" border="2" bordercolor="#0113FC">
<form action="create.php" method="POST">
<tr align="center">
<td width="50%">
<font size="4"><b>Email:</b><br>Please enter a real email address.</font><br>
<font size="3" color="red">The email <?php echo $email ?> already exists</font>
</td>
<td width="50%">
<input type="text" name="email" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Domain:</b><br>Please don't include the http:// or www., For subdomain please enter the domain aspect i.e. yourname would be entered for yourname.<?php echo $udomain ?>.</font>
</td>
<td width="50%">
<input type="text" name="dmn" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>&nbsp;</b></font>
</td>
<td width="50%">
<select name="dmntype" class="form">
  <option value ="subd">SubDomain</option>
  <option value ="dom">Domain</option>
</select>
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Username:</b><br>Maximum of 8 letters, please only use letters and numbers.</font>
</td>
<td width="50%">
<input type="text" name="user" class="form">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" name="Submit" value="Create" class="form">
</td>
</tr>
</form>
</table>
</body>

</html>
<?
exit;
};


$sql="SELECT * FROM `domain` WHERE domain='$edmn'";
$result=mysql_query($sql);
if(mysql_num_rows($result)==0){

}
else{
  ?>
 
  <html>

<head>
<title>New Account :: Index</title>
<link rel="stylesheet" type="text/css"
href="sheet.css" />
</head>

<body>
 
<table align="center" width="600" bgcolor="#41FBFD" border="2" bordercolor="#0113FC">
<form action="create.php" method="POST">
<tr align="center">
<td width="50%">
<font size="4"><b>Email:</b><br>Please enter a real email address.</font>
</td>
<td width="50%">
<input type="text" name="email" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Domain:</b><br>Please don't include the http:// or www., For subdomain please enter the domain aspect i.e. yourname would be entered for yourname.<?php echo $udomain ?>.</font><br>
<font size="3" color="red">The domain <?php echo $edmn ?> already exists</font>
</td>
<td width="50%">
<input type="text" name="dmn" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>&nbsp;</b></font>
</td>
<td width="50%">
<select name="dmntype" class="form">
  <option value ="subd">SubDomain</option>
  <option value ="dom">Domain</option>
</select>
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Username:</b><br>Maximum of 8 letters, please only use letters and numbers.</font>
</td>
<td width="50%">
<input type="text" name="user" class="form">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" name="Submit" value="Create" class="form">
</td>
</tr>
</form>
</table>
</body>

</html>
<?
exit;
};

$sql="SELECT * FROM `user` WHERE user='$user'";
$result=mysql_query($sql);
if(mysql_num_rows($result)==0){

}
else{
  ?>
    <html>

<head>
<title>New Account :: Index</title>
<link rel="stylesheet" type="text/css"
href="sheet.css" />
</head>

<body>
 
<table align="center" width="600" bgcolor="#41FBFD" border="2" bordercolor="#0113FC">
<form action="create.php" method="POST">
<tr align="center">
<td width="50%">
<font size="4"><b>Email:</b><br>Please enter a real email address.</font>
</td>
<td width="50%">
<input type="text" name="email" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Domain:</b><br>Please don't include the http:// or www., For subdomain please enter the domain aspect i.e. yourname would be entered for yourname.<?php echo $udomain ?>.</font><br>
</td>
<td width="50%">
<input type="text" name="dmn" class="form">
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>&nbsp;</b></font>
</td>
<td width="50%">
<select name="dmntype" class="form">
  <option value ="subd">SubDomain</option>
  <option value ="dom">Domain</option>
</select>
</td>
</tr>
<tr align="center">
<td width="50%">
<font size="4"><b>Username:</b><br>Maximum of 8 letters, please only use letters and numbers.</font><br>
<font size="3" color="red">The username <?php echo $user ?> already exists</font>
</td>
<td width="50%">
<input type="text" name="user" class="form">
</td>
</tr>
<tr align="center">
<td colspan="2">
<input type="submit" name="Submit" value="Create" class="form">
</td>
</tr>
</form>
</table>
</body>

</html>
<?
exit;
};

$edmn = $domain

$query = INSERT INTO contacts VALUES ('','$email','$domain','$user');

createacct ($host,$user,$accesshash,0,$domain,$user,$pass,$acctplan);


$subject = 'New Free Hosting Account At $udomain.';
$message = 'Welcome to $udomain \n\n Your free hosting account has been automatically created. \n\n Your account info is the following: \n\n Username: $user \n Password: $pass \n Domain/Subdomain: $domain \n Cpanel: $domain/cpanel \n\n If you have your own domain then set the nameservers to the following: \n\n $ns1 \n $ns2 \n\n Thankyou for choosing us as your free host, \n $name';
$headers = 'From: $aemail' . "\r\n" .
          'Reply-To: $aemail' . "\r\n" .

mail($email, $subject, $message, $headers);



mysql_query($query);

mysql_close();
?>[/code]

When I try to create a new account via new.php then onto create.php it comes up with the error:

[b]Parse error: syntax error, unexpected T_VARIABLE in /home/elementz/public_html/create.php on line 244[/b]

Can you please fix that and check through the script to see if all is well?

Thankyou,
Luke
Link to comment
Share on other sites

These are syntax errors which point to errors in your source code, not logic errors. Instead of posting here and waiting for someone to answer, examine your code and look for missing semi-colons or unterminated strings (missing quotes). You will be much more productive in the long run and will be able to catch your own errors.

Ken
Link to comment
Share on other sites

[code]<?

// Admin username and password to reach
// the show user stats found at
// admin.php.
$auser =
$apass =

// Your free hosting site's domain name.
// Don't include the www. or http://.
$udomain = yourdomain.com

// Please don't change this unless you
// know what you are doing.
$host = localhost

// Your WHM username
$user = username

// Your WHM access hash. Look at google
// for what this means.
$accesshash =

// The plan name in WHM that you want
// to give for free hosting.
// Normally this is your whm username
// then _ then the plan found in WHM.
$acctplan = username_plan

// Your email, this will be used as
// a reply for your hosting users.
$aemail = youremail@yourdomain.com

// Your name, this will just be in
// the email sent to your users.
$name = Luke

// The nameservers for your domain.
// These will be used for users
// who register with their own
// domain.
$ns1 = ns1.yourdomain.com
$ns2 = ns2.yourdomain.com

?>[/code]

This is my config code.
Link to comment
Share on other sites

<?

// Admin username and password to reach
// the show user stats found at
// admin.php.
$auser = '';
$apass = '';

// Your free hosting site's domain name.
// Don't include the www. or http://.
$udomain = 'yourdomain.com';

// Please don't change this unless you
// know what you are doing.
$host = 'localhost';

// Your WHM username
$user = 'username';

// Your WHM access hash. Look at google
// for what this means.
$accesshash = '';

// The plan name in WHM that you want
// to give for free hosting.
// Normally this is your whm username
// then _ then the plan found in WHM.
$acctplan = 'username_plan';

// Your email, this will be used as
// a reply for your hosting users.
$aemail = 'youremail@yourdomain.com';

// Your name, this will just be in
// the email sent to your users.
$name = 'Luke';

// The nameservers for your domain.
// These will be used for users
// who register with their own
// domain.
$ns1 = 'ns1.yourdomain.com';
$ns2 = 'ns2.yourdomain.com';

?>

Hope you know what I mean.
Link to comment
Share on other sites

Yah remember now, but now I get this :(.

[b]Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/elementz/public_html/create.php on line 36

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/elementz/public_html/create.php on line 105

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/elementz/public_html/create.php on line 175[/b]
Link to comment
Share on other sites

[b]Line 34[/b]:
[quote]$sql="SELECT [color=red][b]*[/b][/color] FROM `email` WHERE email='$email'";[/quote]

[b]Line 103[/b]:
[quote]$sql="SELECT [color=red][b]*[/b][/color] FROM `domain` WHERE domain='$edmn'";[/quote]

[b]Line 173[/b]:
[quote]$sql="SELECT [color=red][b]*[/b][/color] FROM `user` WHERE user='$user'";[/quote]

Take note of [color=red][b]*[/b][/color], if you are using mysql_num_rows() you need to indicate which column.
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.