Jump to content

Is this Possible ? Form ACTION question


JamesThePanda

Recommended Posts

Hi

Basically I have a login script, and I need the user name and password to be sent to 2 different places. at the moment the username and password are sent to "self" the actualy action is this

 

action = "<?php echo $PHP_SELF; ?>?subscription=<?php echo $subscription; ?>"

 

I need it to go to this and also a file other.php

 

Any ideas on how I would achieve this.

 

Thanks

 

James

Link to comment
Share on other sites

Ok here is the form script

 

<style>BODY{font-family: Verdana; font-size: 9px; color: #666666; margin: 0px; }*{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }</style>

<?php

//--------------------------------------------------------- iPHPAuthorize v1.0 by IDS - www.idevspot.com

 

$SQL = "SELECT * from SETTINGS"; $result = mysql_query( $SQL ); $row = mysql_fetch_array( $result );

$sender = $row['EMAIL'];

$action = $_GET['action'];

$t_ = 'MEMBERS';

$u_ = 'USERNAME';

$p_ = 'PASSWORD';

 

//---------------------------------------------------------

 

mysql_query ("CREATE TABLE IF NOT EXISTS `MEMBERS` (`ID` INT NOT NULL AUTO_INCREMENT ,

`USERNAME` varchar(255) NOT NULL,

`PASSWORD` varchar(255) NOT NULL,

`STATUS` varchar(255) NOT NULL,

`SUBSCRIPTION` varchar(255) NOT NULL,

PRIMARY KEY ( `id` ) )")  or die (mysql_error());

 

//---------------------------------------------------------

 

if ($action == logout) { session_start(); session_unset(); session_destroy(); }

 

//---------------------------------------------------------

 

if ($action == lostpassword)

{

$a = $_POST['1'];

if (empty($a)) {$message = 'Error : Field cannot be blank'; } else {

 

$SQL = "SELECT * from $t_ WHERE $u_ = '$a'";

$result = mysql_query( $SQL );

while( $row = mysql_fetch_array( $result ) )

{

$Xuser = $row["$u_"];

$subscription = $row["SUBSCRIPTION"];

 

$Xpass = $row["$p_"];

$to="$a";

$headers.= "MIME-Version: 1.0\r\n";

$headers.= "Content-type: text/html; ";

$headers.= "charset=iso-8859-1\r\n";

$headers.= "From: $sender";

$subject = "Lost password recovery for subscription ID : $subscription";

$body = "Your log in details : [ Username : $Xuser ] [ Password : $Xpass ]";

mail($to,$subject,$body,$headers);

$message = 'Password sent, please check your email';

}

}

if (empty($Xuser)) {$message = 'Error : Username not found';}

}

 

//---------------------------------------------------------

 

$Zuser = $_SESSION['username'];

$Zpass = $_SESSION['password'];

if (empty($Zuser)) $Zuser = '0-0-0-n-u-l-l-0-0-0';

$ZuserZpass = "$Zuser$Zpass";

 

$SQL = "SELECT * from $t_ WHERE $u_ = '$Zuser' AND SUBSCRIPTION = '$subscription' AND STATUS != 'Ended'";

$result = mysql_query( $SQL );

while( $row = mysql_fetch_array( $result ) )

{

$Auser = $row["$u_"];

$Apass = $row["$p_"];

}

 

$AuserApass = "$Auser$Apass";

if ($ZuserZpass == $AuserApass) {} else {

 

$a = $_POST['1'];

$b = $_POST['2'];

$ab = "$a$b";

 

$SQL = "SELECT * from $t_ WHERE $u_ = '$a' AND SUBSCRIPTION = '$subscription' AND STATUS != 'Ended'";

$result = mysql_query( $SQL );

while( $row = mysql_fetch_array( $result ) ) {

        $user = $row["$u_"];

        $pass = $row["$p_"];

}

        $userpass = "$user$pass";

 

if ($ab == $userpass) {

 

$_SESSION['username'] = "$user";

$_SESSION['password'] = "$pass";

 

$Zuser = $_SESSION['username'];

$Zpass = $_SESSION['password'];

 

}else {

 

$subscription = $_GET['subscription'];

?>

<table width="30%" border="0" cellspacing="5" cellpadding="0" align="center">

<tr>

  <td nowrap><b> Log In</b></td>

  <td background="<?php echo $row[$PATH]; ?>i_01.jpg" width="100%" height="29"> </td>

</tr>

</table>

<table width="30%" border="0" cellspacing="5" cellpadding="0" align="center">

<tr valign="top">

  <td width="50%">

  <form name="form1" method="post" action="<?php echo $PHP_SELF; ?>?subscription=<?php echo $subscription; ?>">

    <div align="center"><b>Paypal email address :</b><br>

          <input type="text" name="1" size="25" value="<?php echo $_GET[qun]; ?>">

    <br>

    <br>

    <b>Subscription password : </b><br>

          <input type="password" name="2" size="25" value="<?php echo $_GET[qpw]; ?>">

    <br>

    <br>

    <input type="submit" name="Submit" value="Sign In">

    </div>

  </form>

  </td>

</tr>

</table>

<table width="30%" border="0" cellspacing="5" cellpadding="0" align="center">

<tr>

  <td nowrap><b> Lost Password?</b></td>

  <td background="<?php echo $row[$PATH]; ?>i_01.jpg" width="100%" height="29"> </td>

</tr>

</table>

<table width="30%" border="0" cellspacing="5" cellpadding="0" align="center">

<tr valign="top">

  <td width="50%">

  <form name="form1" method="post" action="<?php echo $PHP_SELF; ?>?action=lostpassword">

    <div align="center"><b>Paypal email address :</b><br>

    <input type="text" name="1" size="25">

    <br>

    <br>

    <input type="submit" name="Submit" value="Send">

    </div>

  </form>

  </td>

</tr>

</table>

<div align="center">

<?php echo $message; ?>

</div>

<table width="30%" border="0" cellspacing="5" cellpadding="0" align="center">

<tr>

  <td background="<?php echo $row[$PATH]; ?>i_01.jpg" width="100%" height="29"> </td>

</tr>

</table>

</body>

</html>

 

<?php die();}} ?>

 

 

and here is the script I am trying to link it with, i was thinking I could put this script into the other one.

 

<?php

/*****************************************************************************************************

* user_create API example

* Connects to our gateway and creates user if not already in our database

* Place this on your login.php page right after verification of username & password in your database

*****************************************************************************************************/

$member_user = 'testuser'; //user you want to create, 4-16 chars a-zA-Z0-9, get from $_POST[]

$member_pass = 'testpassword'; //password for this user, 6-16 chars a-zA-Z0-9, get from $_POST[]

/****************************************************************************************************/

 

include('global.php');

$setCookies = false;

 

$params = '&action=user_info_request';

$params .= '&account_id='.$account_id;

$params .= '&gateway_pass='.$gateway_pass;

$params .= '&user='.$member_user;

$result = sendPost($gateway_ip,$params,true);//use ssl

 

// Check if user already is in our database

if(stristr($result['message'],'error:Username Not Found')){

// Not found so create this user

$params = '&action=user_create';

$params .= '&account_id='.$account_id;

$params .= '&gateway_pass='.$gateway_pass;

$params .= '&user='.$member_user;

$params .= '&pass='.$member_pass;

$result = sendPost($gateway_ip,$params,true);//use ssl

 

if(stristr($result['message'],'ok:User Created')){//user created

$setCoookies = true;

}

 

// Check user and pass

}else if($result['user'] == $member_user){

if($result['pass'] == $member_pass){

$setCookies = true;//already in our database

 

}else{//password needs updating

$params = '&action=user_update';

$params .= '&account_id='.$account_id;

$params .= '&gateway_pass='.$gateway_pass;

$params .= '&user='.$member_user;

$params .= '&pass='.$member_pass;

$result = sendPost($gateway_ip,$params,true); //use ssl

 

if(stristr($result['message'],'ok:User Updated')){

$setCookies = true;

}

}

}

 

if($setCookies){

setcookie('account_id',$account_id,0,'/');

setcookie('gateway_ip',$gateway_ip,0,'/');

setcookie('member_user',$member_user,0,'/');

setcookie('member_pass',$member_pass,0,'/');

 

}else{

//unknown error, handle somehow

}

//print_r($result);

 

?>

 

 

What your ideas?

 

 

Thanks

 

James

Link to comment
Share on other sites

 

does the other chat script have a login function you could call with the parameters received from your script?

 

is this chat script you have written or something like PHPBB?

 

just wondering as I've done similar with phpbb before and i think i created a wrapper class that

called it's login functions to start the users bulletin board session directly based on their username/pass

on our main site, i needed to make sure the username/password in both databases were synchronised.

 

if its something you wrote, forget I said anything :)  it's late and i'm waffling.  ;D

Link to comment
Share on other sites

you use $_GET because forms are the only method of post, so you would have to have another button going to the next page with hidden inputs containing the already submitted username and password.

 

Using get means that you can add them to the address so it immediately goes onto the next page without the need of another form.

 

I hope this helps.

Link to comment
Share on other sites

Hey

I tried it and this is what I got at the top of the page

 

"Warning: Cannot modify header information - headers already sent by (output started at /home/touchho/public_html/members/inc_config.php:3) in /home/touchho/public_html/members/authorize.php on line 59"

 

Any ideas

 

James

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.