Helpful Information
 
 
Category: Unknown sized projects (request quote)
PHP 5 update to a small php file

I have a script and one of te php files needs to be upgraded to work on PHP 5.

it is a simple fix i'm told but I know nothing about PHP programming.

I can post the php code here and explain more about it.

WHat has happened is the join.php lets a new users agree or disagree to the terms of this site and if you say I agree it sends you to a form wit in the join.php file to fill our and it also takes the inforomation and keeps it in a MYSql database. if you say you disagree it sends you to a section in the join.php that tells you you haver to agree to the terms or you can't join.

Works well in PHP 4 but in PHP 5 when you select I agree or I disagree it keeps on loading the same thing over and over and doesn't go to the next step.

If you buy pass the terms secion in the join.php and go straight to the user form it doesn't store the information and put you on to the next part in the join.php that tells you will get an email with the information.

if you like look at http://www.pleaseremindme.info/join.php

If you want to see a site that works and you will see the steps it does.

Thanks

PM sent.

Join.php (Works with added code at top of page but not secure and will not work with php 6)


<?
include("include/common.php");
include("include/header.php");
ini_set('register_globals',true);
extract($_POST)
?>
<?
# 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->[email protected]_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->[email protected]_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->[email protected]_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->[email protected]_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()&#37;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");
?>




Login.php code ( Probelm doesn't login user in php 5 it just keeps showing the login page)

<?
include("include/common.php");

if( $_POST['username'] && $_POST['password'] ){
$failed = 1;
$username = $_POST['username'];
$password = $_POST['password'];
$query = "SELECT * FROM users WHERE username='$username' AND password='$password'";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
if ( ($result) && (mysql_num_rows($result) > 0) ){
$row = mysql_fetch_object($result);
$adlogin = $row->username;
$myname = $row->username;
$adpassword = $row->password;
$myuid = $row->uid;
if ( ($username != $adlogin) || ($password != $adpassword) ){
$failed = 1;
}else{
$failed = 0;
$loggedin = 1;
session_register("loggedin");
session_register("myuid");
session_register("myname");
}
}else{
$failed = 1;
}
}
if($loggedin){
ob_start();
header("Location: account.php");
}
include("include/header.php");
?>
<p><font face=arial size=3>
<form action="login.php" method="POST">
<input type="hidden" name="action" value="login"><font face="arial" size="2"><b>Username</b><br>
<input type=text name=username size=30 tabindex="1" maxlength="12">
</font><br>
<font face="arial" size="2"><br>
<b>Password</b><br>
<input type=password name=password size=30 tabindex="2" maxlength="12">
</font><br>
<br>
<font face="arial" size="2"><input type="submit" name="" value="Login" tabindex="4" style="background-color:#e5e5e5; color:#000000; font-family:Verdana,Arial; font-weight: bold; font-size: 11px; border-left: 1 solid #a0a0a0; border-top: 1 solid #a0a0a0; border-right: 1 solid #000000; border-bottom: 1 solid #000000; padding: 2 2 2 2; outline: #a0a0a0 solid 2px;">
<br><br>
</font>
<table border="0" cellpadding="0" cellspacing="0" width="178">
<tr height="19">
<td height="19" valign="top">
<font face="arial" size="2"><b><a href="password.php"><b>Forgot Your Password?</b></a></b></font>
</td>
</tr>
<tr height="18">
<td valign="bottom" height="18">
<font face="arial" size="2"><b><a href="/join.php"><b>Register New Account!</b></a></b></font>
</td>
</tr>
</table>
</form>
</font></p>










privacy (GDPR)