Search the Community
Showing results for tags 'condition'.
-
i have been working on minor project this is login script of that page i am facing some problem i want to echo if user name password and category both 3 conditions dont match with error "wrong username/password" in form i have tried everything as per my knowledge please help me in this i am new to php so dont have much experience and knowledge of php <?php $msg=''; $con=mysql_connect('localhost','root',''); if(!$con) { die("Error While connecting......."); } else { mysql_select_db("sms",$con); if(isset($_POST['btnlog'])) { $res=mysql_query("select * from tbl_login where un='".$_POST['username']."' and pw='".$_POST['password']."' and cat='".$_POST['cat']."'"); while($r=mysql_fetch_array($res)) { mail("notification@receiver.com".$_POST['username']."Successfully Logged In"."From:notification@sender.com"); if($r['cat']=="admin") header("Location:admin/admin.php"); elseif($r['cat']=="faculty") header("Location:faculty/faculty.php"); else $msg="Incorrect Username/Password"; } } } ?> <body> <section class="login_container"> <div class="login_box"> <h1>Login</h1> <form method="post"> <center><?php echo $msg; ?></center> <p><input type="text" name="username" value="" placeholder="Username"></p> <p><input type="password" name="password" value="" placeholder="Password"></p> <center><select class="select" name="cat">Category <option selected="selected">Select A Category</option> <option value="admin">Administrator</option> <option value="faculty">Faculty</option> </select></center> <p class="submit"><input type="submit" name="btnlog" value="Login"> <input type="reset" value="Clear" /></p> </form> </div> </section>
- 4 replies
-
- php
- while loop
-
(and 3 more)
Tagged with:
-
Hello - First of all, I have low->medium knowledge of php, but it hasn't been used for allmost 10 years - But I'm all stuck here! I hope someone can help me, I'm pretty sure I will be getting retarded soon.. I have a CSV-file that has a structure like this: street, status, project Road Street 2, Possible, HyperGalaxy Street Road 4, Ready, Galaxy Road Street 2, Unknown, Unkown I've tried to import it into excel and making a macro, but after 3-5 hours of processing, my computer crashes and I have to start all over. My goal is that "Road Street 2, Unknown, Unknown" is deleted because of the status. - Possible is "better" than unknown - in this case.. I have around 300.000 rows and I know there will be approx. 10.000 duplicated values (and therefore 5.000 unique) Are there any way of deleting duplicates by a "condition"?
- 19 replies
-
- csv
- dublicates
-
(and 3 more)
Tagged with:
-
I searched, and there isn't much and nothing really current. Is there a code that I could use to hide specific content based on what device my User is using? Specifically, if the the User is using a mobile phone browser. Something along the lines of: if ( !is_mobile( ) ) { } I've tried this, but it didn't work.
-
Hi, I received a task to insert one more condition into filtering proces of this script. Since i am not coder i really need help on this. here is a piece of a bit larger script that i think is handling filtering proces: if($next_conds){ foreach($next_conds as $next_cond){ if($next_cond['type']=='SKIP' ){ if($compare_features){ foreach($compare_features as $compare_feature){ if(!empty($compare_features2) && $next_cond['feature2']){ foreach($compare_features2 as $compare_feature2){ if($next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){ $json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text'])); } } }else{ if($next_cond['feature'] == $compare_feature['id_feature']){ $json['js'] = array('type'=>'SKIP','pop_text'=>Pcconfig::translate($next_cond['pop_text'])); } } } } } if($next_cond['type']=='PREFER'){ foreach($a_products as $a_product){ $current_features = $a_product['features']; if($current_features){ foreach($current_features as $c_feature){ if($compare_features){ foreach($compare_features as $compare_feature){ if(!empty($compare_features2) && $next_cond['feature2']){ foreach($compare_features2 as $compare_feature2){ if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature'] && $next_cond['feature2'] == $compare_feature2['id_feature']){ $product_quantity[$a_product['id_product']] = $next_cond['yes_value']; } } }else{ if($compare_feature['id_feature'] == $c_feature['id_feature'] && $next_cond['feature'] == $compare_feature['id_feature']){ $product_quantity[$a_product['id_product']] = $next_cond['yes_value']; } } } } } } } } if($next_cond['type']=='SUM'){ $watt = 0; foreach($selected as $selectkey => $selectp){ if($selectp>0){ $selectprod = new Product($selectp); $selectprod_features =$selectprod->getFeatures(); if($selectprod_features){ foreach($selectprod_features as $s_feature){ if($s_feature['id_feature'] == $next_cond['feature']){ $f_values = FeatureValue::getFeatureValueLang($s_feature['id_feature_value']); if($f_values){ foreach($f_values as $f_value){ if($f_value['id_lang'] == $cookie->id_lang){ $watt = $watt + $f_value['value']*$selected_quan[$selectkey]; } } } } } } } } $af_products = $a_products; $a_products = array(); foreach($af_products as $af_key => $af_product){ $current_features = $af_product['features']; if($current_features){ foreach($current_features as $c_feature){ if($c_feature['id_feature'] == $next_cond['feature'] && $c_feature['value'] < $watt){ unset($af_products[$af_key]); } } } } $a_products = my_array_unique($af_products); } } } Now part of filtering that is called "PREFER" has certain "yes_value" I must insert a code in case if this yes_value == 0 so that product wich meet this yes_value gets ignored. Anyone care to help me on this one? (Do i need to paste entire script or is this enough?) Thank you in advance! V