What Does This Do? - $ban = ($data->login) ? $lban : $iban;

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

What Does This Do? - $ban = ($data->login) ? $lban : $iban;

peroim
I'm correcting a 'few' php-files for a friend, but I got this line of code:
CODE
$ban = ($data->login) ? $lban : $iban;

and I don't know what it does xD

Could someone please explain me what this line does?

Thanks

Reply

jlhaslip
That is a terniary (sp) statement. Like an IF statement, but very concise.
If the condition [$ban = ($data->login)] is evaluated to true, then perform the assignment following the '?'. [$lban]
If the condition [$ban = ($data->login)] is evaluated to false, then perform the assignment following the ':'. [$iban]


see also here at the php.net site: http://ca.php.net/manual/en/control-struct...yntax.php#35574

Reply

Amezis
It's the same code as this:

CODE
if ($data->login) {
    $ban = $lban;
}
else {
    $ban = $iban;
}

Reply

FLaKes
Excellent... thanks jhaslip. I had bumped into terniary operators on a php tutorial before but the tutorial explained them and I didnt quite get them. I didnt understand. And a search in google didnt help me much either.

Reply

peroim
i can understand it too now, thanks smile.gif

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Similar Topics

Keywords : ban data login lban iban

  1. How Good Is This Data Cleaning Function? - (2)
    Hi all, this is my first function and as part of a script and i just want to know a couple of
    things. here is the code for the function: CODE <? function
    clean($dirty_string) { $muddy_string = stripslashes($dirty_string);
    $murky_string = strip_tags($muddy_string); $clean_string =
    htmlentities($murky_string);      }; ?> So the first thing is how secure is
    it? the script this will be used in connects to a database and sends an email so it needs to stop
    SQL injections and any email ab...
  2. One Login Account At One Time - (3)
  3. Php + Mysql Question! - While inserting data into MySQL, how can I know if the data I'm in (4)
    Basically, I want to know if the Data I'm inserting through a Form is already there or not. Sort
    of a Username registration page. I have this, but it doesn't appear to work... CODE
    $result = mysql_query("SELECT * FROM users WHERE
    username='$username'"); if($result == 1)     {     echo
    '<h1>ERROR!</h1>The username you have chosen already exists!';     }
    ...
  4. Is This A Good Script? - A login script (9)
    Okay, I am trying to password one page of my website. I need confirmation if this is a safe code or
    not. The whole code is on the page I'm protecting. CODE <?php
    include('header.php') ?> <?php // Define your username and password
    $username = "THE_USERNAME"; $password = "THE_PASSWORD"; if
    ($_POST['txtUsername'] != $username ||
    $_POST['txtPassword'] != $password) { ?>
    <h1>Login</h1> <form name="form" method=&...
  5. Php Email Validation - A PHP data validation class with many functions (1)
    I've been reading through my old php book (PHP 4.1) and came across this data validation class.
    It can check a number of things ranging from telephone numbers , credit card number formats, email
    address and some others. I checked out some of the methods although I didnt expect it to work 100%
    because I've found source code errors thoughout the book and CD. I tested out a few of the
    methods to check and some of them did return expected results but some didnt either so the data
    validation class was not perfect and it didnt really bother me. The cool thing I found...
  6. Automatic Login Using Curl - (1)
    If you'are lazy people like me. This script may help u. This script is to automated our login to
    some site. You must have cURL installed to use this script. CODE <?php // INIT CURL
    $ch = curl_init(); // SET URL FOR THE POST FORM LOGIN curl_setopt($ch,
    CURLOPT_URL, 'http://www.external-site.com/Members/Login.php'); // ENABLE HTTP POST
    curl_setopt ($ch, CURLOPT_POST, 1); // SET POST PARAMETERS : FORM VALUES FOR EACH
    FIELD curl_setopt ($ch, CURLOPT_POSTFIELDS, 'fieldname1=fieldvalue1&fieldna...
  7. Html Site With Login - Is it possible? (2)
    Hello. I´m building my own site and I need some help... Is it possible to use a login sistem in php
    and mysql database in a html site? ...
  8. Login System - (6)
    i am designing a site for my alliance for the game Dark Throne. and i want some content to be
    availabe to members of the alliance only, and other content to be available to people with a certain
    rank within the alliance. i know this should be somewhat simple, but i am not that sure how to do
    it. my idea for the website is just have basic info about the alliance available to everyone, then
    news about the alliance and member lists and other things like that available to every alliance
    member, then things such as the strike team, diplomat team, and special areas like that,...
  9. Php Login Script - (1)
    I'm looking for a good php login script. I would like one where it pops up. like http-auth. but
    with out the data base. I would also like for it to have a log out fuction....
  10. Creating A Login Box That Links To My Phpbb Forum - Have my phpBB Forum Intergrated with my Website (4)
    Can someone please give me a code that I can use to put a login box on my website, that will login a
    user into my phpBB Forum? Sort of like Having my phpBB Forum Intergrated with my Website? Thank you
    so much if you can! /angel.gif" style="vertical-align:middle" emoid=":angel:" border="0"
    alt="angel.gif" /> Ex. ...
  11. Using Multiple Selection Array In Table To Order Data - Using multiple selection array in table to order data (1)
    have a form that has a multiple select choice, like this: CODE <form method="post"
    action="display.php" <select multiple name="selectsort[]">
    <option value="code">Code</option> <option
    value="amount">Amount</option> <option value="dateammended">Date
    Ammended</option> <option value="expreviewdate">Expiration/Review
    Date</option> <option value="effectivedate">Effective Date</option>
    <option value="e...
  12. Windows Login Credentials - (0)
    On an intranet I'm running php. apache and mysql. We use Windows logins. I have a form that
    users can submit. This will require a login. I would prefer to use the windows login and passwords.
    can I link to the windows authentication? The issue I see is when a user changes the password. My
    link would need to update the password...
  13. <?php ?> Sloppy Login Script - Sloppy login script, couse i used @ on one string (12)
    Here's a sloppy 3 files login script. First file is Login file that looks like this login.php
    CODE <form action="check.php" method="post"> Username: <input
    type="text" name="username1"><br /> Password: <input
    type="password" name="password1"><br /> <input type="submit"
    value="Login"> </form> Basicly that is HTML form that's used for input
    Second part of the script is the check.php that we call from our login.php form QUOTE ...
  14. Phpmyadmin Login Problem! - (1)
    I have easyphp. But i can not log when i go to phpmyadmin. I directly enter the page. But i think i
    should normally have to log in before enter that page. What should i do to configure the access to
    phpmyadmin? Thank for help...
  15. Login System Help... - (3)
    I know, nol tried to use this script.. and erm.. i think failed.. but i installed it all good, works
    fine, UNTILL........ i tried to add a new option to the registration. Thhis is the url to the
    site.. where the dl is.. http://evolt.org/PHP-Login-System-with-Adm...nts_per_page=50 I would
    really appreciate it if somebody could add, in all the php files properly a new registration thing,
    called "name" where they write their name in so i know it for future reference. if somebody could
    get that to me i would really appreciate it. ALSO... if you can't do that, or jus...
  16. New Arisen Site Problem - Nettek Login Trouble (2)
    Okay, so I installed Nettek and got everything set up. But every time I try and login, it says
    it's incorrect. I've gone into the Database and gotten the password and since it was
    simple, put them in and had tried but with no success. I tried changing the password but I still
    couldn't get in. I tried adding another login and it still didn't work. I have no idea
    what's wrong and I need some help....
  17. Problems With Data Formatting - (2)
    I have a MySQL database which stores articles. A sample article would look like this: CODE This
    is a body. This is a body.This is a body.This is a body.This is a body.This is a body.This is a
    body.This is a body.This is a body.This is a body.This is a body.This is a body.This is a body.This
    is a body.This is a body.This is a body.This is a body. This is a body.This is a body.This is a
    body.This is a body.This is a body.This is a body.This is a body.This is a body.This is a body.This
    is a body.This is a body.This is a body.This is a body.This is a body. That'...
  18. Putting Data Of 2 Pages In Mysql At Once - (1)
    suppose i have a page, page.php?part=1 there i have some text fields. user will give input, but
    after taking input, it will not put the data in mysql .. but it will take to the next step..
    page.php?part=2 (if any field is left blank, it will not go to next page.. ) . and there also some
    fields.. after the user has filled that form also, then it will insert all data (from part1 and
    part 2) in mysql. i want to ask, how i can collect data from 2 pages and put in mysql at once....
  19. Help Improving My Login Script Code - The code works okay...just not the authorization part (4)
    I have developed a piece of code /smile.gif" style="vertical-align:middle" emoid=":)" border="0"
    alt="smile.gif" /> that is going to work as my login script for my website. I need some help making
    improvements and creating additional features. Here is my code: CODE <?php
    session_start(); $name = $_POST['username']; $password =
    $_POST['password']; $con =
    mysql_connect("localhost","myDbUser","myDbPassword");
        if(!$con)         {         die(&#...
  20. .htaccess-style Login System And Php - (13)
    I am trying to make a login system that looks and works like .htaccess using sessions, with a PHP
    script that detects the username used. Let's say I log on with the username "Amezis" and
    correct password. Then I want a PHP (or any other kind of script) to create a cookie or session
    which stores the user name, so it could be possible to store it in a variable as long as the user is
    logged in, and so it can be printed when needed. Basically, this is what I want the script to do:
    CODE /* This file can only be executed after logging in with the htaccess-style login...
  21. Login Script - (11)
    I am using the following code as a login page. I try to start by checking if a session already
    exists so that people don't have to login each time. The problem is that it is just being
    ignored. How do I check if a session is already set? CODE if
    (isset($_SESSION['loginname'])) { print('you were
    already logged in'); } else { if (submit) {
      list($users,$passwords,$accounttypes)=GetCurrentUsers($user,$
    password,$accounttype);   $nologin=1;   for (&...
  22. Sessions And Login - Without Cookies (5)
    Hi, I have a login script i made using PHP sessions and MySQL. It works fine but there is a
    problem. As you know Sessions are stored in Cookies by PHP. So if someone has switched Cookies off
    then no sessions will work. How to solve this problem ? Please help me. Thanks and have a good
    day. ...
  23. Loading Mysql Data Into A Table - (10)
    Hey i have a little problem with my php script. i dont really know how to make it work ^^; I want to
    have this exact table: ' I made mysql table that has one column for id(auto-increment,
    primary key), and then it has row and collumn and text. row means which row in the html table and
    collumn wich collum. (obviously /tongue.gif" style="vertical-align:middle" emoid=":P" border="0"
    alt="tongue.gif" />) here is the mysql table screenshoted from phpMyAdmin: r means row and c
    collumn /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue...
  24. Same 1 Registeration Data For Different Purposes - (4)
    I want to install 4 scripts on my website .. 1- Gallery 2-Classfied Ads 3-Game Cheats Script (A
    simple script where ppl can register and then submit the cheats) 4-Php Nuke The problem is that all
    of 4 scripts needs registeration of members (use 4 different databases).... I want that all the
    member which is registered at one place can login at all of the services..i mean , one registeration
    form , that can work for all.. how i can do it ? Please tell in details..thanks....
  25. Login / Authetication System Using Database - adding information (4)
    Is there any way to make such database where I can write like name and passwords.. Then make an
    login box, and when somebody trys to acces the login he needs to write the name and password.. Then
    it is verifyed if is there such name and password and if it is then acces the page.. I think there
    is posible something like that with MySQL (db).. but can anybody say me a script or way to make
    something like that? Alredy thanks.....
  26. "grand" Login System? - To Forums, Chat, and Site (7)
    Major problem I got here. A site at which I am employed as PHP Coder (privet-drive.com), needs a
    "grand" login. The login needs to be able to login them into the forums, the chat, and the site, all
    at the SAME time! The big problem is, the chat is located on another website (potterchat.net),
    and the forums are IPB and not PHPBB. Any comments, or some tips on how I am to go about this? I am
    freaking out, and any advice at all would be nice! Thanks in advanced!...
  27. Customizing Login Script - please help anyone good in PHP.. (8)
    On my main site i have this login box: Click here! ... And I want to change the look of it in
    new adress but I have only things can be get from that adres.. I put that login box (new) in my
    website and changed the page that opens but when you try to login with wrong username or password..
    It opens like you typed right usernam and password.. So I need to make it work like normal login
    box but there can be logen in with only right username and password.. I think there need to be added
    some cookies or something to that page.. So someone who is good in PHP please help...
  28. Finding Data In Meta Tags - using php to search Meta Tags for data (0)
    In the Head portion of an Html file, there are usually several Meta Tags that contain data about
    various things, like the tag for keywords, an Author's name or maybe a description field. Here
    are two example Meta tags: HTML meta name =" Keywords " content=" keyword1, keyword2 " />
    meta name =" Description " content=" A Description of the file's content is here " /> So,
    what I have a question about concerns checking a file to see what information is included in these
    tags and using that information as variables or content in the output of the page...
  29. Listing From Table Row Data - Listing all members (5)
    Hello, it's been a while since i've been active in the PHP Board ( i used to be really
    active in here ), not only to help others but also to request help ( people knowing those requests,
    dont share your bad experience with my requests /tongue.gif' border='0'
    style='vertical-align:middle' alt='tongue.gif' /> ) Anyway, i am requesting help on a listing of
    members, i totally forgot about how to fetch the rows from a table and display each row, i thought
    it was: CODE $result=mysql_query("SELECT * FROM $usertable ORDER BY id
    DESC") or...
  30. Problem With A Login Script - (10)
    I'm making a simple login script, but it doesn't seem to work like I want. The error
    messages work, but if I actually write the right username and password, it won't work.
    Here's the message I get: QUOTE Warning : Cannot modify header information - headers
    already sent by (output started at /home/ngnorge/public_html/fsm/index.php:7) in
    /home/ngnorge/public_html/fsm/logginn/login.php on line 9 Here's the script: login.php
    CODE <?php include('config.php'); if($action ==
    "submit"){ if((...



Looking for , ban, data, login, lban, iban,

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for , ban, data, login, lban, iban,

*MORE FROM TRAP17.COM*
advertisement



What Does This Do? - $ban = ($data->login) ? $lban : $iban;



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE