Jump to content


Photo

Problem With This Code


  • Please log in to reply
9 replies to this topic

#1 elementz

elementz
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 24 July 2006 - 10:57 AM

This is new.php:

<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>

And this is create.php:

<?

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();
?>

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

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

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

Thankyou,
Luke

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 24 July 2006 - 11:13 AM

In create.php, change this:
$edmn = $domain

To:
$edmn = $domain;

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 elementz

elementz
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 24 July 2006 - 11:23 AM

In create.php, change this:
$edmn = $domain

To:
$edmn = $domain;

Orio.


Will the rest work now?

#4 elementz

elementz
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 24 July 2006 - 11:28 AM

Now I get:

Parse error: syntax error, unexpected T_VARIABLE in /home/elementz/public_html/config.php on line 7

#5 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 24 July 2006 - 11:36 AM

Post your config.php

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#6 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 24 July 2006 - 11:46 AM

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

#7 elementz

elementz
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 25 July 2006 - 06:05 AM

<?

// 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

?>

This is my config code.

#8 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 25 July 2006 - 08:59 AM

<?

// 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.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.


#9 elementz

elementz
  • Members
  • PipPipPip
  • Advanced Member
  • 36 posts

Posted 25 July 2006 - 11:51 AM

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

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


#10 hackerkts

hackerkts
  • Members
  • PipPipPip
  • Advanced Member
  • 593 posts
  • LocationSingapore
  • Age:18

Posted 25 July 2006 - 03:22 PM

Line 34:

$sql="SELECT * FROM `email` WHERE email='$email'";


Line 103:

$sql="SELECT * FROM `domain` WHERE domain='$edmn'";


Line 173:

$sql="SELECT * FROM `user` WHERE user='$user'";


Take note of *, if you are using mysql_num_rows() you need to indicate which column.

Regards,
hackerkts

To be a coder, you must learn how to think and not to give up so easily.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users