ricerocket Posted March 22, 2008 Share Posted March 22, 2008 Can someone take a quick look through here and tell me if you see anything? The script is supposed to take ten form imputs which were turned into variables on a previous page which then made the reload to go.php which is this script. It takes the variables from the get, then creates the email account using n1=n1 and p1=p1 then if it's successful it reloads the page with n1=n2 and p1=p2 but I keep getting errors. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Add Cpanel Email Accounts</title> </head> <body> <?php $n1 = $_GET['n1']; $p1 = $_GET['p1']; $n2 = $_GET['n2']; $p2 = $_GET['p2']; $n3 = $_GET['n3']; $p3 = $_GET['p3']; $n4 = $_GET['n4']; $p4 = $_GET['p4']; $n5 = $_GET['n5']; $p5 = $_GET['p5']; $n6 = $_GET['n6']; $p6 = $_GET['p6']; $n7 = $_GET['n7']; $p7 = $_GET['p7']; $n8 = $_GET['n8']; $p8 = $_GET['p8']; $n9 = $_GET['n9']; $p9 = $_GET['p9']; $n10 = $_GET['n10']; $p10 = $_GET['p10']; $task = " // required cpanel data define( 'CPEMAIL_DOMAIN', 'example.com'); // Cpanel domain define( 'CPEMAIL_SSL', 0); // 0 = no SSL, 1 = Uses SSL define( 'CPEMAIL_PORT', 2082); // usually the port is 2082 withought SSL and 2083 with SSL define( 'CPEMAIL_THEME', 'bluelagoon'); // x is the default theme, others include: bluelagoon, x2, xmail, xcontroller, monsoon define( 'CPEMAIL_QUOTA', 10); // email quota in Megabytes // sensitive cpanel info define( 'CPEMAIL_USER', 'username'); // Cpanel Username define( 'CPEMAIL_PASS', 'password'); // Cpanel Password if (isset($_GET['send'])) { $username = $_GET['username']; $password = $_GET['password1']; $url = 'http'.(CPEMAIL_SSL ? 's' : '').'://'.CPEMAIL_USER.':'.CPEMAIL_PASS.'@'.CPEMAIL_DOMAIN.':'.CPEMAIL_PORT.'/frontend/'.CPEMAIL_THEME.'/mail/doaddpop.html'; $url .= '?email='.$username.'&domain='.CPEMAIL_DOMAIN.'&password='.$password.'"a='.CPEMAIL_QUOTA; // make the http request to cpanel, this is where the email is created // this is just like the browser making the request, only php does it for the user $txt = http_request( $url ); // in a live situation, you would parse the returned html, and see if the email was successfully created. // because this is dependent on the Cpanel theme, I didnt put it in. // A simple test example would be: // if (strpos($txt, 'Successful') !== false) { echo 'Your account was created, please log in.'; } // the above checks for the occurance of Successful in the returned html, which occurs when an email is created (english) // note: different Cpanel themes give different html output, and may be in English or other language echo '<hr />'; } // makes an fopen request to the url and returns the content function http_request($url) { ini_set('user_agent','MSIE 4\.0b2;'); // set user agent as IE browser $txt = ''; if ($fp = fopen($url, 'r')) { while( !feof($fp) ) { $txt .= fread( $fp, 2082 ); } fclose($fp); } return $txt; } "; if ($task == success) { print "<meta http-equiv='refresh' content='0;url=http://"."$site"."go.php?n1=$n2&p1=$p2&n2=$n3&p2=$p3&n3=$n4&p3=$p4&n4=$n5&p4=$p5&n5=$n6&p5=$p6&n6=$n7&p6=$p7&n7=$n8&p7=$p8&n8=$n9&p8=$p9&n9=$n10&p9=$p10&n10=&p10=&send=GO"."'>"; }; ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/ Share on other sites More sharing options...
sqlnoob Posted March 22, 2008 Share Posted March 22, 2008 you sure this is ok? $password = $_GET['password1']; also can you show me the page before it sends it to this page. I'm not sure what you're trying to do exactly Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/#findComment-498302 Share on other sites More sharing options...
BlueSkyIS Posted March 22, 2008 Share Posted March 22, 2008 the problem is this: $task = " should be this: $task = ""; Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/#findComment-498306 Share on other sites More sharing options...
sqlnoob Posted March 22, 2008 Share Posted March 22, 2008 what kind of errors are you getting? I'd doublecheck this bit, because no doubt it's hard not to make an error there, like a misplaced semicolon, aphostrophe, or ampersand print "<meta http-equiv='refresh' content='0;url=http://"."$site"."go.php?n1=$n2&p1=$p2&n2=$n3&p2=$p3&n3=$n4&p3=$p4&n4=$n5&p4=$p5&n5=$n6&p5=$p6&n6=$n7&p6=$p7&n7=$n8&p7=$p8&n8=$n9&p8=$p9&n9=$n10&p9=$p10&n10=&p10=&send=GO"."'>"; }; Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/#findComment-498308 Share on other sites More sharing options...
sqlnoob Posted March 22, 2008 Share Posted March 22, 2008 oh yes a misplaced semicolon Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/#findComment-498309 Share on other sites More sharing options...
BlueSkyIS Posted March 22, 2008 Share Posted March 22, 2008 after a misplaced second double-quote. Quote Link to comment https://forums.phpfreaks.com/topic/97313-having-problem-with-a-script-im-not-sure-what-it-is/#findComment-498325 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.