Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: błąd na stronie :/
Forum PHP.pl > Forum > Przedszkole
rts
Witam. Wchodza na moją stronę index.php wyświetla mi się taki błąd:

Cytat
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /www/rts_www/www/index.php:2) in /www/rts_www/www/include/common.php on line 2

Fatal error: Using $this when not in object context in /www/rts_www/www/include/common.php on line 11


W pliku common.php mam taki kod:

  1. <?
  2. include("config.php");
  3.  
  4. $paypal_item = $sitename." Service Monthly Subscription";
  5. $paypal_item_number = $sitename;
  6. $mainipn = $siteurl."/ipn.php";
  7. $paypal_ipn = $siteurl."/site_ipn.php";
  8. $paypal_cancel_return = $siteurl."/cancel.php";
  9. $paypal_return = $siteurl."/thanks.php";
  10. $this->min_pass_length=8;
  11. $this->max_pass_length=12;
  12. $this->chars='abcdefghijklmnopqrstuvwxyz0123456789';
  13. $logfile = "logfile.txt";
  14. $postmode = 1;
  15. $invalidcode = "<table cellpadding=4 width=170><tr><td align=center><font size=2><b>Invalid Button Code!</b><p>Run Your Own PayPal Donation Campaigns at <a href=$siteurl/join.php>$sitename</a></font></table>";
  16. $table1 = "<TABLE class=design cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR='#ffffff' STYLE='border-collapse: collapse'>";
  17. $table2 = "<TABLE class=design cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR='#ffffff' STYLE='border-collapse: collapse'>";
  18. $table3 = "<TABLE class=design cellPadding=3 cellSpacing=0 width=100% border='1' BORDERCOLOR='#ffffff' STYLE='border-collapse: collapse'>";
  19.  
  20. @mysql_connect($dbServer, $dbUser, $dbPass) or die("Couldn't connect to database server: " . mysql_error());
  21. @mysql_select_db($dbName) or die("Couldn't connect to database: " . mysql_error());
  22.  
  23. function errform($msg, $var = ''){ 
  24. global $posterr, $_POST; 
  25. $posterr = 1; 
  26. echo "<div style='color: #FF0000;'>$msg</div>";
  27. if ($var) $_POST[$var] = '';
  28. }
  29.  
  30. function addreport($user,$site,$status){
  31. mysql_query("INSERT INTO report SET user='$user',site='$site',status='$status',date='".time()."'");
  32. }
  33.  
  34. function quickcheck($host,$port){
  35. $running = @fsockopen($host, $port, $errno, $errstr, 30);
  36. if (!$running){
  37. return 0;
  38. }else {
  39. fclose($running);
  40. return 1;
  41. } 
  42. }
  43.  
  44. function fullstatus($host){
  45. $services = array(
  46. "http"=>"80",
  47. "ssh"=>"22",
  48. "ftp"=>"21",
  49. "smtp"=>"25",
  50. "pop3"=>"110",
  51. "mysql"=>"3306");
  52.  
  53. $date = date("l, M d, Y - h:i:s A");
  54. ?>
  55. <p><font face="Arial" size="2"><b>System Status: <?= $host ?></b></font><br>Time: <?= $date ?></p> 
  56. <font face="Arial" size="2"> 
  57. <p><table> 
  58. <tr bgcolor="#5590CC"><td>Status</td><td>Service</td><td>Host</td></tr> 
  59. <?
  60. foreach ($services as $name=>$port){
  61. $running = @fsockopen($host, $port, $errno, $errstr, 30);
  62. if (!$running){
  63. $status_color = "red";
  64. $status_sign = "X";
  65. }else {
  66. fclose($running);
  67. $status_color = "green";
  68. $status_sign = " ";
  69. }
  70. echo "<tr><td align=center><div align="center" style="font-size: 20pt; border: 2px solid $status_color; color:$status_color;" width="15" height="15">$status_sign</div></td><td>$name</td><td>$host</td></tr>";
  71. }
  72. ?>
  73. </table></p> 
  74. <?
  75. }
  76.  
  77. function myround($amt,$dec="3"){
  78. if($dec == 2){
  79. printf("%6.2f",$amt);
  80. }else{
  81. printf("%6.3f",$amt);
  82. }
  83. $amount = ob_get_contents();
  84. $amount = str_replace(" ","",$amount);
  85. return $amount;
  86. }
  87.  
  88. class fptime{
  89. function fptime(){
  90. return 1;
  91. }
  92.  
  93. function mytime($stamp="",$format="m/d/Y"){
  94. return date( $format,($stamp ? $stamp : time()) );
  95. }
  96.  
  97. function stamp($mm,$dd,$yy,$hh=0,$min=0,$sec=0){
  98. return mktime($hh,$min,$sec,$mm,$dd,$yy);
  99. }
  100.  
  101. function subhours($interval,$mm,$dd,$yy,$hh,$m,$s){
  102. return $this->stamp( $mm,$dd,$yy,($hh-$interval),$m,$s );
  103. }
  104.  
  105. function addhours($interval,$mm,$dd,$yy,$hh,$m,$s){
  106. return $this->stamp( $mm,$dd,$yy,($hh+$interval),$m,$s );
  107. }
  108.  
  109. function subdays($interval,$mm,$dd,$yy){
  110. return $this->stamp($mm,($dd-$interval),$yy);
  111. }
  112.  
  113. function adddays($interval,$mm,$dd,$yy,$hh=0,$min=0,$sec=0){
  114. return $this->stamp($mm,($dd+$interval),$yy,$hh,$min,$sec);
  115. }
  116.  
  117. function submonths($interval,$mm,$dd,$yy){
  118. return $this->stamp( ($mm-$interval),$dd,$yy );
  119. }
  120.  
  121. function addmonths($interval,$mm,$dd,$yy){
  122. return $this->stamp( ($mm+$interval),$dd,$yy );
  123. }
  124.  
  125. function subyears($interval,$mm,$dd,$yy){
  126. return $this->stamp( $mm,$dd,($yy-$interval) );
  127. }
  128.  
  129. function addyears($interval,$mm,$dd,$yy){
  130. return $this->stamp( $mm,$dd,($yy+$interval) );
  131. }
  132.  
  133. function DateDiff ($interval, $date1,$date2) {
  134. // get the number of seconds between the two dates
  135. $timedifference = $date2 - $date1;
  136. switch ($interval) {
  137. case "w":
  138. $retval = $timedifference/604800;
  139. $retval = floor($retval);
  140. break;
  141. case "d":
  142. $retval = $timedifference/86400;
  143. $retval = floor($retval);
  144. break;
  145. case "h":
  146. $retval = $timedifference/3600;
  147. $retval = floor($retval);
  148. break;
  149. case "n":
  150. $retval = $timedifference/60;
  151. $retval = floor($retval);
  152. break;
  153. case "s":
  154. $retval = floor($timedifference);
  155. break;
  156. }
  157. return $retval;
  158. }
  159.  
  160. function dateNow($format="%Y%m%d"){
  161. return(strftime($format,time()));
  162. }
  163.  
  164. function dateToday(){
  165. $ndate = time();
  166. return( $ndate );
  167. }
  168.  
  169. function daysInMonth($month="",$year=""){
  170. if(empty($year)) {
  171. $year = $this->dateNow("%Y");
  172. }
  173. if(empty($month)) {
  174. $month = $this->dateNow("%m");
  175. }
  176. if($month == 2) {
  177. if($this->isLeapYear($year)) {
  178. return 29;
  179. } else {
  180. return 28;
  181. }
  182. } elseif($month == 4 or $month == 6 or $month == 9 or $month == 11) {
  183. return 30;
  184. } else {
  185. return 31;
  186. }
  187. }
  188.  
  189. function isLeapYear($year=""){
  190. if(empty($year)) {
  191. $year = $this->dateNow("%Y");
  192. }
  193. if(strlen($year) != 4) {
  194. return false;
  195. }
  196. if(preg_match("/D/",$year)) {
  197. return false;
  198. }
  199. return (($year % 4 == 0 && $year % 100 != 0) || $year % 400 == 0);
  200. }
  201. }
  202. ?>


Nie mam pojęcia o co chodzi :/
Może mi kots pomóc rozwiązać problem?
Pozdrawiam
UDAT
1. Do pliku index.php, na początku wstaw:
  1. <?php
  2. ?>


2. Jeśli to twoja strona to nie używaj w tych liniach $this
  1. <?php
  2. $this->min_pass_length=8;
  3. $this->max_pass_length=12;
  4. $this->chars='abcdefghijklmnopqrstuvwxyz0123456789';
  5. ?>


----
A poza tym nie przekopiowałeś całego pliku.
rts
Dzięki, usunięcie $this pomogło.
Strone kupiłem jako gotowiec za pare złotych i okazuje się że jest cała w błędach :/

Na stornie join.php wyświetlają się błędy:

Cytat
Notice: Undefined variable: submit1 in /www/rts_www/www/join.php on line 11

Notice: Undefined variable: submit1 in /www/rts_www/www/join.php on line 35

Notice: Undefined variable: submit2 in /www/rts_www/www/join.php on line 43

Notice: Undefined variable: submit3 in /www/rts_www/www/join.php on line 100


A taki jest kod strony:

  1. <?php
  2. ini_set('display_errors', 1);
  3. ?>
  4. <?
  5. include("include/common.php");
  6. include("include/header.php");
  7. ?>
  8. <?
  9. # if(!$submit1)$submit1=1;
  10. if($submit1 == "1") {
  11. if($requirepaid) {
  12. ?>
  13. <h3>Zakładanie Nowego Konta. Krok 2</h3><form method=post>
  14. <?=$table2?>
  15. <tr align=center>
  16. <td colspan=3>Select a Username. A password will be generated and emailed to you at the end
     of the signup process.<p></td>
  17. </tr>
  18. <? include("include/paidsignupform.php"); ?>
  19. </table>
  20. </form> 
  21. <?
  22. }
  23. if(!$requirepaid) {
  24. ?>
  25. <h3>Zakładanie Nowego Konta. Krok 2</h3><form method=post>
  26. <?=$table2?>
  27. <tr align=center>
  28. <td colspan=2>Pola <b>pogrubione</b> są obowiązkowe. Hasło zostanie do Ciebie wysłane na email. Resztę danych wyp
    ełnij po zalogowaniu się. W razie pytań prosimy o kontakt.<p></td>
  29. </tr>
  30. <? include("include/nopaidsignupform.php"); ?>
  31. </table></form>
  32. <?
  33. }
  34. }else if($submit1 == "2") {
  35. ?>
  36. <h3>Brak Akceptacji Regulaminu</h3>
  37. <?=$table2?>
  38. <tr align=center>
  39. <td colspan=2>Nie akceptując regulaminu nie możesz się zarejestrować. Jeśli chcesz zaakcept
    ować regulamin kliknij na "Cofnij". W razie pytań prosimy o kontakt.<p></td>
  40. </tr> 
  41. <?
  42. }else if($submit2) {
  43. if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
  44. $serror="Invalid username! Use no more than 15 characters and only letters, numbers,
     and underscores.<br>"
    ; 
  45. }
  46. $this->c=@mysql_query("select username from users where username='$susername'");
  47. $this->d=mysql_fetch_object($this->c);
  48. if(is_object($this->d)) { $serror="Username is already in use<br>"; }
  49. $this->c=@mysql_query("select username from pending where username='$susername'");
  50. $this->d=mysql_fetch_object($this->c);
  51. if(is_object($this->d)) { $serror="Username is already in use<br>"; }
  52. echo "<h3>Signup for a New Account Step 3</h3>";
  53. if (!$serror) {
  54. $nowtime = time();
  55. mysql_query("insert into Pending (username,since) values ('$susername','$nowtime')"); 
  56. ?>
  57. <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
  58. <?="$table2";?>
  59. <tr>
  60. <td align=center>
  61. Click the button below to signup for our <?=$paypal_sub?> subscription through PayPal. 
  62. The first 7 days are free, and you can cancel anytime before the 7 days are up 
  63. and be charged nothing.<p>
  64. <input type="hidden" name="cmd" value="_xclick-subscriptions">
  65. <input type="hidden" name="no_shipping" value="1">
  66. <input type="hidden" name="no_note" value="1">
  67. <input type="hidden" name="p3" value="1">
  68. <input type="hidden" name="t3" value="<?=$paypal_subcode?>">
  69. <input type="hidden" name="a1" value="0.00">
  70. <input type="hidden" name="src" value="1">
  71. <input type="hidden" name="sra" value="1">
  72. <input type="hidden" name="business" value="<?="$paypal_email";?>">
  73. <input type="hidden" name="item_name" value="<?="$paypal_item";?>">
  74. <input type="hidden" name="item_number" value="<?="$paypal_item_number";?>">


c.d. kodu:

  1. <input type="hidden" name="a3" value="<?="$paypal_price";?>">
  2. <input type="hidden" name="notify_url" value="<?="$paypal_ipn";?>">
  3. <input type="hidden" name="cancel_return" value="<?="$paypal_cancel_return";?>">
  4. <input type="hidden" name="return" value="<?="$paypal_return";?>">
  5. <input type="hidden" name="os0" value="<?="$susername";?>">
  6. <input type="hidden" name="on0" value="Username">
  7.  
  8. <input type="submit" value="Subscribe now">
  9. </td>
  10. </tr>
  11. </table></form>
  12. <? 
  13. }
  14. if ($serror) {
  15. ?>
  16. <form method=post>
  17. <?=$table2?>
  18. <tr align=center>
  19. <td colspan=3><font color=red>$serror</font><p></td>
  20. </tr>
  21. <? include("include/paidsignupform.php"); ?>
  22. </table></form>
  23. <?
  24. }
  25. }else if($submit3) {
  26. if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
  27. $serror="Invalid username! Use no more than 15 characters and only letters, numbers,
     and underscores.<br>"
    ; 
  28. }
  29. $this->c=@mysql_query("select username from users where username='$susername'");
  30. $this->d=mysql_fetch_object($this->c);
  31. if(is_object($this->d)) { $serror="Username is already in use<br>"; }
  32. $this->c=@mysql_query("select username from pending where username='$susername'");
  33. $this->d=mysql_fetch_object($this->c);
  34. if(is_object($this->d)) { $serror="Username is already in use<br>"; }
  35. if (!$serror) {
  36. mt_srand((double)microtime()*1000000^getmypid());
  37. $pass_length = mt_rand($this->min_pass_length,$this->max_pass_length);
  38. while(strlen($spassword)<$pass_length) {
  39. $spassword.=substr($this->chars,(mt_rand()%strlen($this->chars)),1); 
  40. }
  41. include("include/emails.php");
  42. $signupmessage=str_replace("<username>","$susername",$signupmessage);
  43. $signupmessage=str_replace("<password>","$spassword",$signupmessage);
  44. $signupmessage=str_replace("<first_name>","$sfirst_name",$signupmessage);
  45. $signupmessage=str_replace("<last_name>","$slast_name",$signupmessage);
  46. $signupmessage=str_replace("<login_url>","$login_url",$signupmessage);
  47. $subject = "$signupsubject";
  48. $message = "$signupmessage";
  49. mail($semail,$subject,$message,"From: $adminemail");
  50. $adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
  51. $adminsignupmessage = str_replace("<password>","$spassword",$adminsignupmessage);
  52. $adminsignupmessage = str_replace("<first_name>","$sfirst_name",$adminsignupmessage);
  53. $adminsignupmessage = str_replace("<last_name>","$slast_name",$adminsignupmessage);
  54. $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
  55. $subject = "$adminsignupsubject";
  56. $message = "$adminsignupmessage";
  57. mail($adminemail,$subject,$message,"From: $adminemail"); 
  58. $nowdate = date("M d, Y");
  59. mysql_query("insert into users (
  60. uid, username, password, first_name, 
  61. last_name, street, city, state, zip, 
  62. country, email, telephone, last_paid, 
  63. signup_date,cat,age,chest,height,weight,
  64. waist,eyes,hair,dress,shoe
  65. ) values (
  66. '','$susername', '$spassword', '$sfirst_name', 
  67. '$slast_name', '$sstreet', '$scity', '$sstate', 
  68. '$szip', '$scountry', '$semail', '$stelephone', 
  69. 'free', '$nowdate','$scat','$sage','$schest','$sheight',
  70. '$sweight','$swaist','$seyes','$shair','$sdress','$sshoe'
  71. )");
  72. echo ("<center>Dziękujemy. Hasło oraz szczegółowe informacje dostaniesz zaraz na emaila. Po 
    zalogowaniu uzupełnij resztę danych Wrazie problemów lub pytań prosimy o kontakt.
    .</center>"
    );
  73. }
  74. if ($serror) {
  75. ?>
  76. <h3>Zakładanie Nowego Konta. Krok 2 - Błąd</h3>
  77. <form method=post>
  78. <?=$table2?>
  79. <tr align=center>
  80. <td colspan=3><font color=red>$serror</font><p></td>
  81. </tr>
  82. <? include("include/nopaidsignupform.php"); ?>
  83. </table></form>
  84. <?
  85. }
  86. }else {
  87. ?>
  88. <h3>Zakładanie Nowego Konta. Krok 1</h3>
  89. <?=$table2?>
  90. <tr>
  91. <td align=center>
  92. Proszę zapoznać się z regulaminem i zasadami.<p>
  93. <font size=3><b>Ragulamin</b></font><p>
  94. <form method=post><textarea name=textfield cols=60 rows=15 wrap=virtual>
  95. <? include "include/terms.php"; ?>
  96. </textarea><p><input type=radio name=submit1 value=1> Akceptuję<br><input type=radio name=submit1 value=2> Nie Akceptuję<p><input type=submit value='Dalej -->'></form>
  97. </td>
  98. </tr>
  99. </table>
  100. <?
  101. }
  102. include("include/footer.php");
  103. ?>
  104. <?
  105. function buildCatBox($name,$sel=""){
  106. ?>
  107. <SELECT NAME="<?=$name?>">
  108. <option value="">-----
  109. <?
  110. $qr1 = mysql_query("SELECT * FROM cats ORDER BY name ASC");
  111. while ($a = mysql_fetch_object($qr1)){
  112. if($sel == $a->id){
  113. echo "<OPTION VALUE="{$a->id}" SELECTED>{$a->name}</OPTION>n"; 
  114. }else{
  115. echo "<OPTION VALUE="{$a->id}">{$a->name}</OPTION>n"; 
  116. }
  117. }
  118. ?>
  119. </select>
  120. <?
  121. }
  122. function getCat($cat){
  123. $qr1 = mysql_query("SELECT name FROM cats WHERE id='$cat'");
  124. $a = mysql_fetch_object($qr1);
  125. return $a->name;
  126. }
  127. ?>


Co w niej jest nie tak sad.gif

Jest jakaś strona/program który pokazuje gdzie są błędy na stronie dokładnie?
Pozdrawiam
Cysiaczek
Te błedy, to są NOTICE - nie spowodują nic złego - świadczą jedynie o niechlujstwie programisty smile.gif
W pliku php.ini masz sterowanie wyświetlaniem błędów - ustaw na E_ALL ~E_NOTICE - ostrzeżenia znikną.
rts
Ale chyba coś musi być nie tak. Nie można się w ogóle rejestrować. Na stronie www.rts.iq.pl/join.php likacjąc na 'akceptuj' strona się tylko odświerza, nie chce iść dalej. Na innym serwerze z tymi samymi plikami wszystko działało ok :/
piwoszeq
nie masz zadeklarowanych tych zmiennych gdzie sprawdzasz je w ifach party.gif
1010
moze inne urtawienia registers_globals ?
rts
A co to jest registers_globals smile.gif

Na jednym serwerze strona mi działa na drugim nie, dokładnie chodzi o tą rejestracje.
Czy jest to spowodowane błędami na stronie i ustawieniami serwera w różnych firmach?
I czy jedynym sposobem na to aby rejestracja działała na tym serwerze gdzi enie działa jest poprawienie błędów na stronie?
Pozdrawiam
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.