Search the Community
Showing results for tags 'check'.
-
Hi, I have a question is this situation possible below? sample database table Information ID, Username,Password,level 1 user1 Pass1 1 2 user2 Pass2 2 I want a php code i which when I login my username and password it will check 3 fields in the table, the username and password if it matches from the database and the it will check what level is the user. So if ever username and password is correct it will check if what level is the user, so if the users level is 1 it will go to level1.php page and if 2 it will go to level2.php Hope you can help me with this problem of mine.
-
Hi, I'm trying to let JavaScript check if a givin user exist in the database. It seems that the _check-user.php always returns 0, but if I fill in a name that doesn't exist, and echo out the result variable in JS, the echo will return 1. Is there someone who could help me? JavaScript part: function checkUser() { $.post("_check_user.php", { 'username': document.getElementById("username").value }, function(result) { if (result == 1) { document.getElementById("checkUser").className = "succes"; document.getElementById("checkUser").innerHTML = "Name is available"; }else{ document.getElementById("checkUser").className = "errormsg"; document.getElementById("checkUser").innerHTML = "Name is not available!"; } }); } _check-user.php: <?php include("config.php"); $result = mysql_query("SELECT login FROM users WHERE login='".clean_string($_POST["username"])."'"); if(mysql_num_rows($result)>0){ echo 0; }else{ echo 1; } ?>
- 1 reply
-
- javascript
- check
-
(and 3 more)
Tagged with:
-
hi Guys, just for a quick question summary: I want to add new data in my table however, i want to check if my new data name has same name with stored data name in table, if not same name we can proceed to adding new data/post. in my database table: ===================== ID | title | remarks 01 | orange | fruit 02 | mango | fruit addfile.php $newtitle = mysql_real_escape_string($_POST['title']); $newtitle = htmlentities($newtitle); $sqldbtitle = "SELECT * FROM tblmainfile WHERE strcmp('$newtitle','title') = 0 LIMIT 1; $getdbtitle = mysqli_query($con,$sqldbtitle); newfile.php; <form> <tr> <td>Title:</td> <td><input type="text" name="title" value="<?php echo $newtitle; ?>"></td> </tr> </form> goal: if i will add orange, it will notify me that there is already orange in table. questions: 1. will strcmp be faster or i will just use mysql query? thanks a lot!
-
So, basically, I have it set up so that banned users are in a table in the database called "bans". The lift date is formatted like such.. "02/14/2013 14:06AM" How can I make it so that if the date is passed, it removes the row from the table? Like how do I set up if($lift_date >= $c_date){ //remove } when using the time of day too?
-
Can some tell me how to make this script check for the password before it starts the upload process instead of after the file is uploaded? Some of the files I need uploaded are big and it sucks to wait till the file is uploaded before it tells me that the password was wrong. Thanks for any help you can provide. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <head> <title>ES Simple Uploader</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <meta name="generator" content="handmade" /> <style type="text/css"> <!-- body { font-family: Arial, Helvetica, sans-serif; font-size: 14px; background-color: #DDDDDD; } .cnt { text-align: center; } .cnt_welcome { font-size: 16px; font-weight: bold; text-align: center; } .cnt_powered { font-size: 14px; font-weight: bold; text-align: center; } .cnt_small { font-size: 12px; text-align: center; padding-top: 50px; } .head_line { background-color: #BBBBBB; } .main_table { border: solid 1px #9D9992; font-size: 13px; } h4 { font-size: 12px; color: #DD0000; text-align: center; } .button { border: 1px solid #55555; font-weight: bold; } --> </style> </head> <body> <? include("config.php"); function path_options() { global $upload_dirs; $option = ""; foreach ($upload_dirs as $path => $pinfo) { $option .= '<option value="'.$path.'">'.$pinfo["name"].'</option>'; } return $option; } function check_vals() { global $upload_dirs, $err; if (!ini_get("file_uploads")) { $err .= "HTTP file uploading is blocked in php configuration file (php.ini). Please, contact to server administrator."; return 0; } $pos = strpos(ini_get("disable_functions"), "move_uploaded_file"); if ($pos !== false) { $err .= "PHP function move_uploaded_file is blocked in php configuration file (php.ini). Please, contact to server administrator."; return 0; } if (!isset($_POST["path"]) || (strlen($_POST["path"]) == 0)) { $err .= "Please fill out path"; return 0; } if (!isset($upload_dirs[$_POST["path"]])) { $err .= "Incorrect path"; return 0; } if (!isset($_POST["pwd"]) || (strlen($_POST["pwd"]) == 0)) { $err .= "Please fill out password"; return 0; } elseif ($_POST["pwd"] != $upload_dirs[$_POST["path"]]["password"]) { $err .= "The upload password is incorrect"; return 0; } if (!isset($_FILES["userfile"])) { $err .= "Empty file"; return 0; } elseif (!is_uploaded_file($_FILES['userfile']['tmp_name'])) { $err .= "Empty file"; return 0; } return 1; } $err = ""; $status = 0; if (isset($_POST["upload"])) { if (check_vals()) { if (filesize($_FILES["userfile"]["tmp_name"]) > $max_file_size) $err .= "Maximum file size limit: $max_file_size bytes"; else { if (move_uploaded_file($_FILES["userfile"]["tmp_name"], $upload_dirs[$_POST["path"]]["dir"].$_FILES["userfile"]["name"])) { $status = 1; } else $err .= "There are some errors!"; } } } if (!$status) { if (strlen($err) > 0) echo "<h4>$err</h4>"; } else { echo "<h4>"".$_FILES["userfile"]["name"]."" was successfully uploaded.</h4>"; } ?> <p class="cnt_welcome">Welcome to ES Simple Uploader v 1.1.</p> <p class="cnt">« <a href="http://www.energyscripts.com/Products/product2.html">Back to Product page</a> «</p> <p class="cnt">(Select folder, set it's password, then select a file to upload and click "Upload" button). <br />Note: Folder: "Images folder", Password: "images"; Folder: "Docs", Password: "docs"; Folder: "Common files", Password: "common"; Maximum file size: <?=$max_file_size/1024?> Kb.</p><br /> <form enctype="multipart/form-data" action="index.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="<?=$max_file_size?>" /> <table class="main_table" align="center"> <tr> <td colspan="2" class="head_line"> </td> </tr> <tr> <td>Folder:</td> <td><select name="path"><?=path_options()?></select></td> </tr> <tr> <td>Password:</td> <td><input type="password" name="pwd" style="width: 217px;" /></td> </tr> <tr> <td>Choose file:</td> <td><input type="file" name="userfile" style="width: 222px;" /></td> </tr> <tr> <td colspan="2" align="right"><input type="submit" name="upload" value="Upload" class="button" /></td> </tr> </table> </form> </p> <p class="cnt_powered">Powered by <a href="http://www.energyscripts.com" target="_blank">EnergyScripts</a></p> <p class="cnt_small">Find more power solution: <a href="http://www.energyscripts.com/Products/product1.html" target="_blank">ES File Upload & Download Manager</a></p> </body> </html>
-
Hi guys, I am using <?php $check = imap_check($imap); var_dump($check); ? Now this should return RECENT = 1 or however many recent emails I have - however it ALWAYS returns 0. Any ideas why? Can't find a reason for it.