NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Make one php file post info to another? [+rep]

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

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 03-22-2006, 09:27 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
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:
<?
????: NamePros.com http://www.namepros.com/programming/179649-make-one-php-file-post-info.html
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, 09:41 PM   #2 (permalink)
Senior Member
 
luxinterior's Avatar
Join Date: Jul 2004
Location: Kizmiaz
Posts: 1,091
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 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-23-2006, 12:08 AM   #3 (permalink)
NamePros Regular
Join Date: Mar 2006
Posts: 397
sacx13 is on a distinguished road
 



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, 04:57 AM THREAD STARTER               #4 (permalink)
NamePros Regular
 
cvxdes's Avatar
Join Date: Oct 2005
Location: Milford MA
Posts: 692
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, 05:06 AM   #5 (permalink)
Senior Member
 
luxinterior's Avatar
Join Date: Jul 2004
Location: Kizmiaz
Posts: 1,091
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 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, 01:20 PM   #6 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
Tree will become famous soon enoughTree will become famous soon enough
 



Here is what I use:

PHP Code:
<html>
????: NamePros.com http://www.namepros.com/showthread.php?t=179649
<?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?>">
????: NamePros.com http://www.namepros.com/showthread.php?t=179649
</form>
Please wait while we log you in.
</body>
</html>
Tree is offline  
Old 03-24-2006, 05:17 AM   #7 (permalink)
NamePros Member
 
whyme953's Avatar
Join Date: Jun 2004
Posts: 92
whyme953 is an unknown quantity at this point
 



syntax?


Originally Posted by Tree
PHP Code:
   $port == "2083" || $port == "2096" $pre "https://" $pre "http://";
????: NamePros.com http://www.namepros.com/showthread.php?t=179649
   
$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, 07:42 AM   #8 (permalink)
A Wealth of Knowledge
 
stscac's Avatar
Join Date: Aug 2004
Posts: 3,809
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
 



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, 04:27 PM   #9 (permalink)
NamePros Regular
 
Tree's Avatar
Join Date: Feb 2006
Location: Atlanta, GA, USA
Posts: 335
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, 04:43 PM   #10 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
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'];
????: NamePros.com http://www.namepros.com/showthread.php?t=179649

 
// 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.
????: NamePros.com http://www.namepros.com/showthread.php?t=179649

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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 03:18 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger