Jump to content

Recommended Posts

I have this code, how come it doesn't work?

<?php
session_start();
if(!isset($_SESSION['myusername'])){
header("location:http://www.mysite.com/home.php?type=609421098494");
} else {
			$tbl_name="email"; // Table name

			// Connect to server and select database.
			mysql_connect("$host", "$username", "$password")or die("cannot connect");
			mysql_select_db("$db_name")or die("cannot select DB");

			// select record from mysql
			$sql="SELECT * FROM $tbl_name";
			$result=mysql_query($sql);


		if(!isset($submit)){
			$submit 	= 	$_POST["submit"];
			$username 	= 	$_POST["username"];
			$password 	=	$_POST["password"];
			$quota 		= 	$_POST["quota"];
			?>
			<form action="" method="post">
			<table border="0" class="usial">
			<tr><td align="right">Username:</td> 	<td><input type="text" name="username"></td></tr>
			<tr><td align="right">Password:</td> 	<td><input type="text" name="password"></td></tr>
			<tr><td align="right">Quota:</td>    	<td><input type="text" name="quota" value="10240"></td></tr>
			<tr><td>         	<td><input type="submit" name="submit" value="submit"><input type="reset" name="reset" value="reset"></td></tr>
			</table>
			</form>

		<?php } else { 
			$submit 	= 	$_POST["submit"];
			$username 	= 	$_POST["username"];
			$password 	=	$_POST["password"];
			$quota		= 	$_POST["quota"];
			$createmail	=	fopen("http://USERNAME:PASSWORD@MYSITE.com:2082/frontend/x3/mail/dopasswdpop.html?email=$username&domain=mysite.com&password=$password&quota=$quota","r");
			if(!$createmail){
			 echo "Email has not been created.";
			} else {
	echo "$username@mysite.com with a password of $password has been created.";
	$sql="INSERT INTO $tbl_name(id, username, password, quota)VALUES('$username', '$password', '$quota')";
	$result=mysql_query($sql);	
			}

			} 
			?>

			<br><br>

			<table width="400" border="0" cellspacing="1" cellpadding="0">
			<tr>
			<td><table width="400%" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC" class="usial">
			<tr>
			<td bgcolor="#FFFFFF"> </td>
			<td colspan="5" bgcolor="#FFFFFF"><strong>Email Wizard</strong> </td>
			</tr>
			<tr>
			<td align="center" bgcolor="#FFFFFF"><strong>ID#</strong></td>
			<td align="center" bgcolor="#FFFFFF"><strong>Username</strong></td>
			<td align="center" bgcolor="#FFFFFF"><strong>Password</strong></td>
			<td align="center" bgcolor="#FFFFFF"><strong>Quota</strong></td>
			<td align="center" bgcolor="#FFFFFF"> </td>
			<td align="center" bgcolor="#FFFFFF"> </td>
			</tr>
			<?php
			while($rows=mysql_fetch_array($result)){
			?>
			<tr>
			<td bgcolor="#FFFFFF"><? echo $rows['id']; ?></td>
			<td bgcolor="#FFFFFF"><? echo $rows['username']; ?></td>
			<td bgcolor="#FFFFFF"><? echo $rows['password']; ?></td>
			<td bgcolor="#FFFFFF"><? echo $rows['quota']; ?>MB</td>
			<td bgcolor="#FFFFFF"><a href="index.php?page=email&do=update&id=<? echo $rows['id']; ?>" class="oran">update</a></td>
			<td bgcolor="#FFFFFF"><a href="index.php?page=email&do=delete&id=<? echo $rows['id']; ?>" class="oran">delete</a></td>
			</tr>
			<?
			// close while loop
			}
			?>				
			</table></td>
			</tr>
			</table>
			<?php
			// close connection;
			mysql_close();
			}
			?>

 

basicly it doesn't create an email in cPanel, nor does it store the data in mysql

Link to comment
https://forums.phpfreaks.com/topic/124239-solved-cpanel-php-email-creator/
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.