Clever People Please Help Asap Plz? Lol

Started on the old forum in February 2008 · view the original in the archive · old links redirect here

2 replies · 782 views · started 18 years ago · 1 min read

3 participants
SpiderWap Lead · 622 posts #1

It creates a file just named index, i'm gana post 2 files to make you understand better whats going on with the script and how it works, for 2 days ive almost slept nothing, feels like im in a trance but still trying to go on with my script....

Ok, this page is 100% needs no editing.

<?php
echo("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php
require('includes/utils.php');
require('includes/db.php');
require('includes/config.php');

if($_SERVER['REQUEST_METHOD'] == 'POST')
{
   $error = '';
   if($_POST['login'] == '' || $_POST['pass'] == '' || $_POST['pass2'] == '' || $_POST['name'] == '' || $_POST['surname'] == '' || $_POST['email'] == '')
   {
      $error = 'No input, please try again!';
   }
   else if($_POST['pass'] != $_POST['pass2'])
   {
      $error = 'Password mismatch';
   }
   else if(!ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'. '@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $_POST['email']))
   {
      $error = 'There are special charactors in your registration!';
   }
   else if(strlen($_POST['login']) < 2)
   {
      $error = 'Username already in use';
   }

   $users = mysql_query('SELECT * FROM users WHERE login = "' . addslashes($_POST['login']) . '"');
   $n_users = mysql_num_rows($users);
   if($n_users > 0 || $_POST['login'] == 'includes' || $_POST['login'] == 'admin')
   {
      $error = 'Error "' . $_POST['login'] . '".';
   }
   if($_POST['login'] == 'admin' || $_POST['login'] == 'catalog' || $_POST['login'] == 'cgi-bin' || $_POST['login'] == 'generationnx' || $_POST['login'] == 'images' || $_POST['login'] == 'includes')
   {
      $error = 'Error"' . $_POST['login'] . '" .';
   }
   if($n_users > 15)
   {
      $error = 'Please try again';
   }

   if($error != '')
   {
?>
<head>
<meta http-equiv="refresh" content="10;URL=main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="2"/>
<title>Cpanel: Error!!!</title>
</head>
<body>
<div align="center">
<?php echo $error; ?>

[url="reg.php"]BACK[/url]
</div>
</body>
</html>

<?php
      exit;
   }
   else
   {
      $_POST = decode_array($_POST);
      // insert data into DB
      mysql_query('INSERT INTO users (login, password, name, surname, email) VALUES ("' . addslashes($_POST['login']) . '", "' . md5($_POST['pass']) . '", "' . addslashes($_POST['name']) . '", "' . addslashes($_POST['surname']) . '", "' . addslashes($_POST['email']) . '")');
      $uid = mysql_insert_id();
      mysql_query('INSERT INTO counter (id, today, total, last_date) VALUES ("' . $uid . '", "0", "0", CURRENT_TIMESTAMP)');

      // creating new sub-domain
      //mkdir(addslashes($_POST['login']));
      //mkdir(addslashes($_POST['login']) . '/files');

      // Add Cpanel sub-domain creation
      $login = addslashes($_POST['login']);

      file("https://" . $cpanel_login . ":" . $cpanel_pass . "@" . $cpanel_server . ":2083/frontend/x/subdomain/doadddomain.html?domain=$login&rootdomain=" . $server_name);

      $ftp_server = $server_name;
      $ftp_user_name = $cpanel_login;
      $ftp_user_pass = $cpanel_pass;

      $conn_id = ftp_connect($ftp_server);

      $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);

      $dir = "public_html/$login";
      //ftp_mkdir ($conn_id, $dir);
      $string="chmod 755 $dir";
      ftp_site($conn_id,$string);

      $dir = "public_html/$login/files";
      ftp_mkdir ($conn_id, $dir);
      $string="chmod 755 $dir";
      ftp_site($conn_id,$string);

      ftp_close($conn_id);

      $random_link = get_random_link();

      $fp = fopen(addslashes($_POST['login']) . '/index.html', 'w');
      $counter_tag = '[img]http://' . $server_name . '/counter.php?id=' . $uid . '[/img]';
      $clear_page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
';
      $clear_page .= <<<CLEARPAGE
<title>SpiderWap</title></head><title>index</title></head><body bgcolor="#000000" text="#FFFFFF" link="#FF0000" vlink="#409FFF" alink="#FFFFFF">

<p align="center">
Site activated successfully!!!

To get the most out of your site, login and start playing around with the stuff that your equipt with, you can edit this text, add links, add images, upload content to your site and so much more.
Well, i wont spoil all your fun, login now and see for yourself
[url="http://spiderwap.co.za/main.php"]Login here[/url]

$random_link

$counter_tag
</p>
</body>
</html>
CLEARPAGE;
      fputs($fp, $clear_page);

      fclose($fp);

?>
<head>
<meta http-equiv="refresh" content="10;URL=main.php?id=<?php echo mysql_insert_id()?>&p=<?php echo $_POST['login']?>"><timer value="2"/>
<title>Cpanel: Success!!!</title>
</head>
<body>
<div align="left">
Site Name:

[b]http://<?php echo $_POST['login']?>.<?php echo $server_name; ?>[/b]

Login:

[b]<?php echo $_POST['login']?>[/b]

Password:

[b]<?php echo $_POST['pass']?>[/b]

Name:

[b]<?php echo $_POST['name']?>[/b]

Surname:

[b]<?php echo $_POST['surname']?>[/b]

E-mail:

[b]<?php echo $_POST['email']?>[/b]

*********

<a href="main.php?id=<?php echo mysql_insert_id()?>&p=<?php echo $_POST['login']?>">Enter
</a>
[url="index.php"]Wap-builder[/url]
</div>
</body>
</html>
<?php
      exit;
   }
}
?>
<head>
<title>Cpanel: Register</title>
</head>
<body>
<div align="left">
<form action="reg.php" method="post">
Username:

<input name="login" maxlength="15" format="*x" title="login"/>

Password:

<input name="pass"  maxlength="10" title="pass"/>

Password:

<input name="pass2"  maxlength="10" title="pass2"/>

Name:

<input name="name" maxlength="20" title="name"/>

Surname:

<input name="surname" maxlength="20" title="surname"/>

E-mail:

<input name="email" maxlength="50" title="email"/>

<input type="submit" value="Ok" />
</form>
</div>
<div align="center">
[url="home.php"]Back[/url]
</div>
</body>
</html>

Now,,,,,,,

Heres the page that has the trouble, look when it creates a file, the file doesnt have an extention, i wont to create a .html extention....

<?php
echo("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >

<?php
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');

if((isset($_GET['page']) && preg_match('/[^\w\.]/', $_GET['page'])) || (isset($_POST['page']) && preg_match('/[^\w\.]/', $_POST['page'])))
{
?>
<head>
<meta http-equiv="refresh" content="10;URL=main.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>"><timer value="2"/>
<title>Cpanel: Error!!!</title>
</head>
<body>
<div align="center">
[b]Error!!![/b]

[url="main.php?id=<?php echo $id; ?>&p=<? echo $login; ?>"]BACK[/url]
</div>
</body>
</html>

<?php
   exit;
}

if(isset($_POST['action']))
{
[b]   if($_POST['action'] == 'create')
   {
         // creating new page
         $fp = fopen("$login/" . $_POST['page'], 'w');
      $clear_page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
';
      $clear_page .= <<<CLEARPAGE
<title>SpiderWap</title></head><title>index</title></head><body bgcolor="#000000" text="#FFFFFF" link="#FF0000" vlink="#409FFF" alink="#FFFFFF">

<p align="center">
$random_link

$counter_tag
</p>
</body>
</html>

CLEARPAGE;
         fputs($fp, $clear_page);
         fclose($fp);
         $message = 'Page "' . $_POST['page'] . '" Created';
   }[/b]
   else if($_POST['action'] == 'change')
   {
     if(file_exists("$login/" . $_POST['page']))
     {
        $contents = join('', file("$login/" . $_POST['page']));
        $contents = preg_replace('/<title(.*?)\> <title>.*?</title>/i', '<title>' . $_POST['title'] . '">', $contents);
         $fp = fopen("$login/" . $_POST['page''.html'] , 'w');

        fputs($fp, $contents);
        fclose($fp);
        $message = 'Page "' . $_GET['page'] . '" has been edit';
     }
     else
     {
       $message = '"' . $_POST['page'] . '" not found';
     }
   }
?>
<head>
<meta http-equiv="refresh" content="10;URL=edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_POST['page']; ?>"><timer value="2"/>
<title>Cpanel: <?php echo $message; ?></title>
</head>
<body>
<div align="center">
<?php echo $message; ?>

[url="edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_POST['page']; ?>"]Back[/url]
</div>
</body>
</html>
<?php
   exit;
}
?>
<head>
<title>Cpanel: Edit Link</title>
</head>
<body>
<div align="center">
[b]Delete, Clear, Edit Pages[/b]

Write page name without .html extention

</div>
<form action="edittitle.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>" method="post">
<input name="page" emptyok="true" maxlength="20" value="<?php echo preg_replace('/\..*?$/',"",$_GET['page']); ?>" title="page"/>

<select name="action">
<option value="create">Clear/Create</option>
</select>

<input type="submit" value="Ok" />
</form>
<div align="center">
*********

[url="edit.php?id=<?php echo $id; ?>&p=<?php echo $login; ?>&page=<?php echo $_GET['page']; ?>"]Edit[/url]

</div>
</body>
</html>

The bolded text is what i have a problem with, it doesnt create a file extention, as in that case it must be .html, but it creates only a normal file example mp3s

if anyone can help me out,,,,,, thanx in advance. see you all on monday gana go to the sea for the long weekend lol but still, plz help??

alesh Lead · 604 posts #2

where is the bolded txt????

eeeeerrr....

amylee Principal · 1,092 posts #3
[b]   if($_POST['action'] == 'create')
   {
         // creating new page
         $fp = fopen("$login/" . $_POST['page'], 'w');
      $clear_page = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
';
      $clear_page .= <<<CLEARPAGE
<title>SpiderWap</title></head><title>index</title></head><body bgcolor="#000000" text="#FFFFFF" link="#FF0000" vlink="#409FFF" alink="#FFFFFF">

<p align="center">
$random_link

$counter_tag
</p>
</body>
</html>

CLEARPAGE;
         fputs($fp, $clear_page);
         fclose($fp);
         $message = 'Page "' . $_POST['page'] . '" Created';
   }[/b]

thats the bold text

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close