i have i file on it username and passwoed and i want to use them on the code the code read the values but when i use it it is not working i want help please and this is the code $myFile = "file.txt"; $fh = fopen($myFile, 'r'); $cpuser = fgets($fh); $cppass = fgets($fh); i put eah line on a variable then i use this $cpuser and $cppass but the code not working
$fh have both user name and password. You have to extract them. In which format you are saving login pass in "file.txt" paste here so we can better understand and help you.
i use this password and username on the control panel of the account that creat an email account this is the code <?php $myFile = "file.txt"; $fh = fopen($myFile, 'r'); $cpuser = fgets($fh); $cppass = fgets($fh); $cpdomain = fgets($fh); function getVar($name, $def = '') { if (isset($_REQUEST[$name])) return $_REQUEST[$name]; else return $def; } // check if overrides passed $username = getVar('username', ''); $epass = getVar('password', $epass); $edomain = getVar('domain', $edomain); $equota = getVar('quota', $equota); $msg = ''; if (!empty($username)) while(true) { if ($antispam) { @session_start(); // start session if not started yet if ($_SESSION['AntiSpamImage'] != $_REQUEST['anti_spam_code']) { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); // let user know incorrect code entered $msg = '<h2>Incorrect antispam code entered.</h2>'; break; } else { // set antispam string to something random, in order to avoid reusing it once again $_SESSION['AntiSpamImage'] = rand(1,9999999); } } // Create email account $f = fopen ("http://$cpuser:$cppass@$cpdomain:2082/frontend/$cpskin/mail/doaddpop.html?email=$username&domain=$edomain&password=$epass"a=$equota", "r"); if (!$f) { $msg = 'Cannot create email account. Possible reasons: "fopen" function allowed on your server, PHP is running in SAFE mode'; break; } $msg = "<h2>Email account {$username}@{$edomain} created.</h2>"; // Check result while (!feof ($f)) { $line = fgets ($f, 1024); if (ereg ("already exists", $line, $out)) { $msg = "<h2>Email account {$euser}@{$edomain} already exists.</h2>"; break; } } @fclose($f); break; fclose($fh); } ?>