[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.


Closed Thread
 
LinkBack Thread Tools
Old 03-22-2006, 08:27 PM   #1 (permalink)
NamePros Regular
 
cvxdes's Avatar
 
Join Date: Oct 2005
Location: Milford MA
Posts: 692
96.45 NP$ (Donate)

cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of


Make one php file post info to another? [+rep]

I'm working on re-doing my site, and I have a login panel. I have a dropdown of "cPanel", "WHM", and "Client Center".

How would i make this info that's relayed to login.php, be sent to difrent locations depending on what $i['spot'] is? ($i is input, in all my scripts)

Like:

PHP Code:
<?
if($i['spot'] == "cPanel"){
//post Username and Password to http://ip:2082
}
if(
$i['spot'] == "WHM"){
//post Username and Password to http://ip:2086
}
?>
Thanks for any help, will add rep

Edit: Please, don't say to use hidden inputs and a "Continue" button or something.
cvxdes is offline  
Old 03-22-2006, 08:41 PM   #2 (permalink)
Senior Member
 
luxinterior's Avatar
 
Join Date: Jul 2004
Location: Kizmiaz
Posts: 1,091
638.00 NP$ (Donate)

luxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of light


http://www.php.net/manual/en/function.header.php

And I'd use 'switch' (http://www.php.net/manual/en/control...res.switch.php) rather than if especially if you're going to have a few cases.

Good luck

Lux
luxinterior is offline  
Old 03-22-2006, 11:08 PM   #3 (permalink)
NamePros Regular
 
Join Date: Mar 2006
Posts: 394
211.38 NP$ (Donate)

sacx13 is on a distinguished road


Arrow header

I think you can use header.

The syntax is something like
Code:
header("Location: http://server:port/");
Best Regards
Adrian
sacx13 is offline  
Old 03-23-2006, 03:57 AM   #4 (permalink)
NamePros Regular
 
cvxdes's Avatar
 
Join Date: Oct 2005
Location: Milford MA
Posts: 692
96.45 NP$ (Donate)

cvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud ofcvxdes has much to be proud of


^If they're logging into the Client center, then the postdata will need to be there. Is there a way to put postdata in the header?
cvxdes is offline  
Old 03-23-2006, 04:06 AM   #5 (permalink)
Senior Member
 
luxinterior's Avatar
 
Join Date: Jul 2004
Location: Kizmiaz
Posts: 1,091
638.00 NP$ (Donate)

luxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of lightluxinterior is a glorious beacon of light


Using a 'search engine' (dogpile.com) and 5 seconds of my time I found this...

http://www.faqts.com/knowledge_base/...d/12039/fid/51

Lux
luxinterior is offline  
Old 03-23-2006, 12:20 PM   #6 (permalink)
NamePros Regular
 
Tree's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
13.25 NP$ (Donate)

Tree will become famous soon enoughTree will become famous soon enough


Here is what I use:

PHP Code:
<html>
<?php

   $domain
= "ncisolutions.com";

   if(!
$_POST['login']) {
   exit;
   }

   
$user = $_POST['user'];
   
$pass = $_POST['pass'];
   
$port = $_POST['port'];
   
   
$port == "2083" || $port == "2096" ? $pre = "https://" : $pre = "http://";
   
$port == "2095" || $port == "2096" && !eregi("@", $user) ? $user = "".$user."@".$domain."" : $user = $user;
   
?>
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo "".$pre."".$domain.":".$port."/login/"; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>">
<input type="hidden" name="pass" value="<?php echo $pass; ?>">
</form>
Please wait while we log you in.
</body>
</html>
Tree is offline  
Old 03-24-2006, 04:17 AM   #7 (permalink)
NamePros Member
 
whyme953's Avatar
 
Join Date: Jun 2004
Posts: 92
183.00 NP$ (Donate)

whyme953 is an unknown quantity at this point


syntax?

Quote:
Originally Posted by Tree
PHP Code:
   $port == "2083" || $port == "2096" ? $pre = "https://" : $pre = "http://";
   
$port == "2095" || $port == "2096" && !eregi("@", $user) ? $user = "".$user."@".$domain."" : $user = $user;
Hi,
i hate to sound stupid but i've never seen such syntax before and i was just wondering what's going on? seems like some kind of shorthand?

they seem to be if/else statements, i've just never seen this syntax...
__________________
Bais Menachem
whyme953 is offline  
Old 03-24-2006, 06:42 AM   #8 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
 
Join Date: Aug 2004
Posts: 3,794
47.60 NP$ (Donate)

stscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud ofstscac has much to be proud of


Quote:
Originally Posted by whyme953
seems like some kind of shorthand?
It is a kind of shorthand.

You'll see this in javascript as well.



-Steve
stscac is offline  
Old 03-24-2006, 03:27 PM   #9 (permalink)
NamePros Regular
 
Tree's Avatar
 
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
13.25 NP$ (Donate)

Tree will become famous soon enoughTree will become famous soon enough


Yep, see the PHP Manual for more info on it.
Tree is offline  
Old 03-24-2006, 03:43 PM   #10 (permalink)
NPQ's PA, Slave, and On Call Coder

Technical Services


 
Eric's Avatar
 
Join Date: Mar 2005
Posts: 4,545
0.71 NP$ (Donate)

Eric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond reputeEric has a reputation beyond repute

Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse
Quote:
Originally Posted by Tree
Yep, see the PHP Manual for more info on it.
Actually.. here

Quote:
Ternary Operator

Another conditional operator is the "?:" (or ternary) operator.

Example 15-3. Assigning a default value
PHP Code:
<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
     
$action = 'default';
} else {
     
$action = $_POST['action'];
}

?>
Quote:
The expression (expr1) ? (expr2) : (expr3) evaluates to expr2 if expr1 evaluates to TRUE, and expr3 if expr1 evaluates to FALSE.

Note: Please note that the ternary operator is a statement, and that it doesn't evaluate to a variable, but to the result of a statement. This is important to know if you want to return a variable by reference. The statement return $var == 42 ? $a : $b; in a return-by-reference function will therefore not work and a warning is issued in later PHP versions.
__________________
Eric is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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 On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 06:21 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85