Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
PHP5 issues on a script
Old 05-27-2008, 01:37 PM PHP5 issues on a script
Novice Talker

Posts: 9
Trades: 0
I have this join.php script works well in PHP4 but not 5. I used this ini_set('register_globals',true); string to get it work with php5 but I have one client running php 5.26 and it doesn't work.

How do I fix this to get this script to work.

Thanks


The code is below.

Code:
<?
 include("include/common.php");
 include("include/header.php");
ini_set('register_globals',true); 
?>
<?
# if(!$submit1)$submit1=1;
 if($submit1 == "1") {
  if($requirepaid) {
?>
   <h3>Signup for a New Account Step 1</h3><form method=post>
   <?=$table2?>
   <tr align=center>
    <td colspan=3>Select a Username. A password will be generated and emailed to you at the end of the signup process.<p></td>
   </tr>
<?   include("include/paidsignupform.php"); ?>
   </table>
   </form> 
<?
  }
  if(!$requirepaid) {
?>
   <h3>Signup for a New Account Step 1</h3><form method=post>
   <?=$table2?>
   <tr align=center>
    <td colspan=2>Fill out the form below. A password will be generated and emailed to you.<p></td>
   </tr>
<?   include("include/nopaidsignupform.php"); ?>
   </table></form>
<?
  }
 }else if($submit1 == "2") {
?>
  <h3>Signup for a New Account</h3>
  <?=$table2?>
  <tr align=center>
   <td colspan=2>Press your browser's 'Back' key and click 'I Agree' to our terms and conditions to continue the signup process.<p></td>
  </tr> 
</table>
<?
 }else if($submit2) {
  if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
   $serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>"; 
  }
  $that->c=@mysql_query("select username from users where username='$susername'");
  $that->d=mysql_fetch_object($that->c);
  if(is_object($that->d)) { $serror="Username is already in use<br>"; }
  $that->c=@mysql_query("select username from pending where username='$susername'");
  $that->d=mysql_fetch_object($that->c);
  if(is_object($that->d)) { $serror="Username is already in use<br>"; }
  echo "<h3>Signup for a New Account Step 3</h3>";
  if (!$serror) {
   $nowtime = time();
   mysql_query("insert into pending (username,since) values ('$susername','$nowtime')"); 
?>
   <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
   <?="$table2";?>
   <tr>
    <td align=center>
     Click the button below to signup for our <?=$paypal_sub?> subscription through PayPal. 
     The first 7 days are free, and you can cancel anytime before the 7 days are up 
     and be charged nothing.<p>
     <input type="hidden" name="cmd" value="_xclick-subscriptions">
     <input type="hidden" name="no_shipping" value="1">
     <input type="hidden" name="no_note" value="1">
     <input type="hidden" name="p3" value="1">
     <input type="hidden" name="t3" value="<?=$paypal_subcode?>">
     <input type="hidden" name="a1" value="0.00">
     <input type="hidden" name="src" value="1">
     <input type="hidden" name="sra" value="1">
     <input type="hidden" name="business" value="<?="$paypal_email";?>">
     <input type="hidden" name="item_name" value="<?="$paypal_item";?>">
     <input type="hidden" name="item_number" value="<?="$paypal_item_number";?>">
     <input type="hidden" name="a3" value="<?="$paypal_price";?>">
     <input type="hidden" name="notify_url" value="<?="$paypal_ipn";?>">
     <input type="hidden" name="cancel_return" value="<?="$paypal_cancel_return";?>">
     <input type="hidden" name="return" value="<?="$paypal_return";?>">
     <input type="hidden" name="os0" value="<?="$susername";?>">
     <input type="hidden" name="on0" value="Username">
     <input type="submit" value="Subscribe now">
    </td>
   </tr>
   </table></form>
<? 
  }
  if ($serror) {
?>
   <form method=post>
   <?=$table2?>
   <tr align=center>
    <td colspan=3><font color=red><?=$serror?></font><p></td>
   </tr>
<?   include("include/paidsignupform.php"); ?>
   </table></form>
<?
  }
 }else if($submit3) {
  if(!ereg("^[A-Za-z0-9_]{1,16}$",$susername)) {
   $serror="Invalid username! Use no more than 15 characters and only letters, numbers, and underscores.<br>"; 
  }
  $that->c=@mysql_query("select username from users where username='$susername'");
  $that->d=mysql_fetch_object($that->c);
  if(is_object($that->d)) { $serror="Username is already in use<br>"; }
  $that->c=@mysql_query("select username from pending where username='$susername'");
  $that->d=mysql_fetch_object($that->c);
  if(is_object($that->d)) { $serror="Username is already in use<br>"; }
  if (!$serror) {
   mt_srand((double)microtime()*1000000^getmypid());
   $pass_length = mt_rand($that->min_pass_length,$that->max_pass_length);
   while(strlen($spassword)<$pass_length) {
    $spassword.=substr($that->chars,(mt_rand()%strlen($that->chars)),1); 
   }
   include("include/emails.php");
   $signupmessage=str_replace("<username>","$susername",$signupmessage);
   $signupmessage=str_replace("<password>","$spassword",$signupmessage);
   $signupmessage=str_replace("<first_name>","$sfirst_name",$signupmessage);
   $signupmessage=str_replace("<last_name>","$slast_name",$signupmessage);
   $signupmessage=str_replace("<login_url>","$login_url",$signupmessage);
   $subject = "$signupsubject";
   $message = "$signupmessage";
   mail($semail,$subject,$message,"From: $adminemail");
   $adminsignupmessage = str_replace("<username>","$susername",$adminsignupmessage);
   $adminsignupmessage = str_replace("<password>","$spassword",$adminsignupmessage);
   $adminsignupmessage = str_replace("<first_name>","$sfirst_name",$adminsignupmessage);
   $adminsignupmessage = str_replace("<last_name>","$slast_name",$adminsignupmessage);
   $adminsignupmessage = str_replace("<member_email>","$semail",$adminsignupmessage);
   $subject = "$adminsignupsubject";
   $message = "$adminsignupmessage";
   mail($adminemail,$subject,$message,"From: $adminemail"); 
   $nowdate = date("M d, Y");
   mysql_query("insert into users (
       uid, username, password, first_name, 
       last_name, street, city, state, zip, 
       country, email, telephone, last_paid, 
       signup_date
      ) values (
       '','$susername', '$spassword', '$sfirst_name', 
       '$slast_name', '$sstreet', '$scity', '$sstate', 
       '$szip', '$scountry', '$semail', '$stelephone', 
       'free', '$nowdate'
      )") or die( mysql_error() );
  }
  if ($serror) {
?>
   <h3>Signup for a New Account Step 3</h3>
   <form method=post>
   <?=$table2?>
   <tr align=center>
    <td colspan=3><font color=red><?=$serror?></font><p></td>
   </tr>
<?   include("include/nopaidsignupform.php"); ?>
   </table></form>
<?
  }else{
   echo "<h3>Signup for a New Account Complete</h3>$table2
    <tr><td align=center>Thank you for signing up $susername. We have sent you a 
    welcome email to <b>$semail</b> with your password.</table>"; 
  }
 }else {
?>
  <h3>Signup for a New Account Step 1</h3>
  <?=$table2?>
  <tr>
   <td align=center>
    Please read through our terms and conditions below and click 'I Agree' to continue with the signup process.<p>
    <font size=3><b>Terms and Conditions</b></font><p>
    <form method=post><textarea name=textfield cols=60 rows=15 wrap=virtual>
<?  include "include/terms.php"; ?>
    </textarea><p><input type=radio name=submit1 value=1> I Agree<br><input type=radio name=submit1 value=2> I Disagree<p><input type=submit value='Next Step -->'></form>
   </td>
  </tr>
  </table>
<?
 }
 include("include/footer.php");
?>
CompuTel is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-27-2008, 01:54 PM Re: PHP5 issues on a script
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
And the error is ???

By the way, just this code is certainly useless.
You have a lot of includes, and the error could come from any of them.
__________________
Only a biker knows why a dog sticks his head out the window.

Last edited by tripy; 05-27-2008 at 01:55 PM..
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-27-2008, 03:30 PM Re: PHP5 issues on a script
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Ok firstly make it long hand php:
so <? should be <?php

and
<?=$whatever?> should be <?php echo $whatever; ?>

Not only does this help with php5, it stops errors when the user has shorthand disabled.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 05-27-2008, 05:17 PM Re: PHP5 issues on a script
Novice Talker

Posts: 9
Trades: 0
it doesn't go the the page when the user clicks I agree or I disagree.


Quote:
Originally Posted by tripy View Post
And the error is ???

By the way, just this code is certainly useless.
You have a lot of includes, and the error could come from any of them.
CompuTel is offline
Reply With Quote
View Public Profile
 
Old 05-27-2008, 05:33 PM Re: PHP5 issues on a script
Novice Talker

Posts: 9
Trades: 0
Made the changes you suggested but it doesn't work.

here is the site that doesn't work on. PHP 5.26 version

http://www.pleaseremindme.info/join.php

here is on that does work on.

http://the-reminders.com/join.php

the second site is using the # AddHandler application/x-httpd-php5 .php as they are testing with php 5

Quote:
Originally Posted by rogem002 View Post
Ok firstly make it long hand php:
so <? should be <?php

and
<?=$whatever?> should be <?php echo $whatever; ?>

Not only does this help with php5, it stops errors when the user has shorthand disabled.
CompuTel is offline
Reply With Quote
View Public Profile
 
Old 05-27-2008, 08:25 PM Re: PHP5 issues on a script
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
I think your error might be located into the payed/non payed includes.
What I see when I analyze the posts, is that it's always an
Code:
submit1=1
that is passed.
So, think that into 1 of those includes, there might be a problem onthe form generation, where it should put an
Code:
submit1=2
value into the form.
It never will go further than step 1 otherwise.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 05-27-2008, 08:38 PM Re: PHP5 issues on a script
Novice Talker

Posts: 9
Trades: 0
But it works with some php 5 hosting

what would I need to change?

Quote:
Originally Posted by tripy View Post
I think your error might be located into the payed/non payed includes.
What I see when I analyze the posts, is that it's always an
Code:
submit1=1
that is passed.
So, think that into 1 of those includes, there might be a problem onthe form generation, where it should put an
Code:
submit1=2
value into the form.
It never will go further than step 1 otherwise.
CompuTel is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to PHP5 issues on a script
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.25084 seconds with 12 queries