בעיה בPHP

tals4

New member
בעיה בPHP

יש לי את הקוד הזה if(!$_POST){ echo '<form action='.$_SERVER['PHP_SELF'].' method=post> Account-Name: <input name=account type=text maxlength=10> <br> Password: <input name=password type=password maxlength=10> <br> Password(Again): <input name=confirm type=password maxlength=10> <br> E-Mail: <input name=email type=text> <br> Security Question: <input name=question type=text> <br> Answer: <input name=answer type=text> </font> <br> <input name=submit type=submit value=Submit> <p> Abuse of this system will result in deletion of accounts,characters, and permanent ban.</p> '; } else{ $account = $_POST['account']; $confirm = $_POST['confirm']; $date = date('F d, Y g:i A'); $password = $_POST['password']; $email = $_POST['email']; $question = $_POST['question']; $answer = $_POST['answer']; $ip = $_SERVER['REMOTE_ADDR']; $firstletter = substr($account, 0, 1); $ascii = ord($firstletter); $filename = $dir . '\\ASCII'.$ascii.'\\'.$account.'.txt'; if($account == '') { echo 'Account creation failed. Please fill out all fields.'; } elseif(file_exists($filename)) { echo 'Account creation failed. Account name already exists.';} elseif($email == '') { echo 'Account creation failed. Please fill out all fields.';} elseif(!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $email)){ echo 'Account Creation Failed. Please enter a valid E-Mail.'; } elseif($password != $confirm) { echo 'Account creation failed. Password does not match confirmation password.';} else{ $fp = fopen($filename, 'w+'); $string = 'Account Created: '.$date.' With the IP: '.$ip.' [NAME] account-name = '.$account.' [PASSWORD] account-password = '.$password.' [ACCOUNT-STATUS] account-valid-time = 0 account-valid-date = 2003 4 5 account-change-password = 2003 3 29 [ETC] account-Gender = Male account-Age = account-Birth-Year = xxxx account-Birth-Month = xx account-Birth-Day = xx account-RealName = a account-SSN = aaaaa account-Email = '.$email.' account-Quiz = '.$question.' account-Answer = '.$answer.' account-created-by = DarkZero\'s Account Generator'; $write = fputs($fp, $string); fclose($fp); echo 'Account created successfully, you may now login.'; } } ?> וזה צריך להיראות כמו בעמוד הזה: http://80.179.212.199/AccountCreator.php וככה זה אצלי(בדף HTML) אז מה אני צריך לשנות?
 

יולו

New member
תשובה..

איך אתה שומר דף בתור html ומצפה שהוא יפעיל קוד php?
 

יולו

New member
שים לב..

אתה לא יכול לשמור דף אינטרנט בתור html ולצפות שהוא יציג קוד php.. להפך אתה שומר בתור php לדוגמא page.php ושם בתוכו html והוא מציג את שתיהם במידה ויש לך שרת שתומך ב php כמו apache או IIS או שאתה עובד על שרת באינטרנט שתומך.. בכל אופן בגלל זה הוא מדפיס למסך את הכל הקטע הזה: ; } else{ $account = $_POST['account']; $confirm = $_POST['confirm']; $date = date('F d, Y g:i A'); $password = $_POST['password']; $email = $_POST['email']; $question = $_POST['question']; $answer = $_POST['answer']; $ip = $_SERVER['REMOTE_ADDR']; $firstletter = substr($account, 0, 1); $ascii = ord($firstletter); $filename = $dir . '\\ASCII'.$ascii.'\\E:\Helbreath Abaddon Server\HBServer 3.2\Account'.$account.'.txt'; $lines = file('accountlog.txt'); foreach($lines as $b){ if(trim($b) == $ip){ $ipflag=TRUE; } } if($ipflag){ echo 'Account creation failed. You\'ve already registed an account.'; } else{ if($account == '') { echo 'Account creation failed. Please fill out all fields.'; } elseif(file_exists($filename)) { echo 'Account creation failed. Account name already exists.';} elseif($email == '') { echo 'Account creation failed. Please fill out all fields.';} elseif(!ereg("^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$", $email)){ echo 'Account Creation Failed. Please enter a valid E-Mail.'; } elseif($password != $confirm) { echo 'Account creation failed. Password does not match confirmation password.';} else{ $fp = fopen($filename, 'w+'); $string = 'Account Created: '.$date.' With the IP: '.$ip.' [NAME] account-name = '.$account.' [PASSWORD] account-password = '.$password.' [ACCOUNT-STATUS] account-valid-time = 0 account-valid-date = 2003 4 5 account-change-password = 2003 3 29 [ETC] account-Gender = Male account-Age = account-Birth-Year = xxxx account-Birth-Month = xx account-Birth-Day = xx account-RealName = a account-SSN = aaaaa account-Email = '.$email.' account-Quiz = '.$question.' account-Answer = '.$answer.' account-created-by = DarkZero\'s Account Generator'; $write = fputs($fp, $string); fclose($fp); $moo = fopen('accountlog.txt', 'a'); fwrite($moo, ''.$ip.' '); fclose($moo); echo 'Account created successfully, you may now login.'; } } } ?>
 

tals4

New member
אני ניסיתי מה שאמרת...

ניסיתי מה שאמרת וזה עדין משאיר את הדברים כל הדברים האלה, שמרתי בPHP ואני משתמש בAPACHE וזה עדין לא פועל אז מה אני צריך לעשות?
 
למעלה