Jump to content

Recommended Posts

i am trying to modify the Post variable sent to a script..I just want to add @domain.com to the username..

Here is my script

 

<?php
if($_POST['domain'] && $_POST['username'] && $_POST['pass'] && !($_GET['failed'] == "1")) {
    $port = $_POST['port']; 
  switch($port) {
      case '2095': // Webmail
        $protocol = 'http://';
        break;
      case '2096': // Secure Webmail
        $protocol = 'https://';
        break;
    }
  // Build the URL
  $redirectlocation = $protocol.$_POST['domain'].':'.$port.'/login/?user='.$_POST['username'].$dom.'&pass='.$_POST['pass'].'&failurl='.$_POST['failurl'];
  header ("Location: ".$redirectlocation); // Send URL
} else {
  $error = 1;
  header ("Location: ".$_POST['failurl']); // Send URL if all neede information is not provided
}
?>

i added $POST_['username'] .= "@domain.com"; but it dint work

and i also tried copying it to a new variable and modifying it ...it dint work out too

Link to comment
https://forums.phpfreaks.com/topic/169798-solved-modify-post-variable/
Share on other sites

ive tried it before...Not working ...Unable to figure out the fault...

ok is there a way so that i can modify it before sending it to script...

 

<form action="login.php" method="POST">
<?php
if(($_GET['failed'] == "1") or ($error == 1)){
echo '<font color="#FF0000">login attempt failed!</font><br />';
}
?>
Domain: <input type="hidden" name="domain" value="domain.com"/><br />
Username: <input type="text" name="username" value="" size="20" /><br />
Password: <input type="password" name="pass" value="" size="20" /><br />
<?php
// This failurl allows cPanel to redirect back to this site
echo '<input type="hidden" name="failurl" value="http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?failed=1">';
?>
Options: <select name="port">
  <option value="2095">Webmail</option>
  <option value="2096">Secure Webmail</option>
</select><br />
<input type="submit" value="Login" />
</form>

It should do. What does the generated url look like?

 

Change

$username = $_POST['username'] . '@domain.com';
$redirectlocation = $protocol.$_POST['domain'].':'.$port.'/login/?user='.$username.'&pass='.$_POST['pass'].'&failurl='.$_POST['failurl'];

 

to

$username = $_POST['username'] . '@domain.com';
$redirectlocation = $protocol.$_POST['domain'].':'.$port.'/login/?user='.$username.'&pass='.$_POST['pass'].'&failurl='.$_POST['failurl'];

echo $redirectlocation;
exit;

Is the url formatted correctly?

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.