Jump to content

anupamsaha

Members
  • Posts

    251
  • Joined

  • Last visited

    Never

Everything posted by anupamsaha

  1. Are you refering the server as localhost or a remote server? Most probably, remote server located in different time zone than your time zone, will have different time as a result.
  2. Checkbox is the correct option. But, I am not clear about getting 4 from db, while you choose 1 and 3. Can you please explain it more?
  3. Sorry, my mistake. Will there be multiple selection, or only one choice?
  4. The concept of radio button is to have only one selection from a group of selection. Form a UI perspective, can you use "checkbox" instead of radio button? Also, by using checkbox, your problem will be solved too. <table ID="poll" width="125" cellpadding="2" cellspacing="0" border="0"> <tr align="center" valign="top"> <td align="left" colspan="1" rowspan="1"> <h4>Select your favorite color.</h4> <form method="POST" action="simple-poll.php"> <input type="checkbox" name="check[]" value="1">One<br> <input type="checkbox" name="check[]" value="2">Two<br> <input type="checkbox" name="check[]" value="3">Three<br> <input type="checkbox" name="check[]" value="4">Four<br> <input type="submit" value="Add"> </form> </td></tr></table>
  5. Try this. I am using cURL here: <?php $elUser = 'username'; $elPass = 'password'; // create a new cURL resource $ch = curl_init(); // set URL and other appropriate options curl_setopt($ch, CURLOPT_URL, "https://mysiteurl.aspx?el-user=" . urlencode($elUser) . "&el-pass=" . urlencode($elPass)); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); // grab URL and pass it to the browser $response = curl_exec($ch); // close cURL resource, and free up system resources curl_close($ch); // print the response print_r($response); ?>
  6. Please visit: http://www.phpfreaks.com/forums/index.php/board,43.0.html
  7. Try this: <?php # Start the session session_start(); # Source utility functions require_once("utils.php"); # Source db functionality require_once("db.php"); $p_username = ""; $p_email = ""; $p_fname = ""; $p_lname = ""; $p_country = ""; function username_exists($uname) { global $logger, $DB; $logger->log("-->utils.php--username_exists: ".$uname,PEAR_LOG_INFO); $sql = "select username from tcustomer where username = $1"; $result = pg_query_params($DB, $sql, array($uname)); if (!$result) { $logger->log("-->utils.php--username_exists - ".pg_last_error(), PEAR_LOG_ERR); $logger->log("-->utils.php--username_exists - Got unknown result form the DB", PEAR_LOG_WARNING); return -1; } else { # ok, we have successfuly run the query, do we have a row? $logger->log("-->utils.php - Got result from the DB", PEAR_LOG_INFO); $rows = pg_num_rows($result); if($rows == 1) { # ok, we have found the user in the table, this means we can't use it to register a new user $logger->log("-->utils.php - Result has 1 row, return 1", PEAR_LOG_INFO); return 1; } else { return 0; } } } if ($_SERVER['REQUEST_METHOD'] == 'POST') { # Lets check we have values in username and password fields if (!empty($_POST['username']) && !empty($_POST['password_1']) && !empty($_POST['password_2']) && !empty($_POST['email']) && !empty($_POST['fname']) && !empty($_POST['lname']) && !empty($_POST['country'])) { $logger->log("-->do_signup.php - Getting registration fields", PEAR_LOG_INFO); $p_username = $_POST['username']; $p_email = $_POST['email']; $p_fname = $_POST['fname']; $p_lname = $_POST['lname']; $p_country = $_POST['country']; $pwrd_1 = md5(safe($_POST['password_1'])); $pwrd_2 = md5(safe($_POST['password_2'])); if (strcmp($pwrd_1,$pwrd_2) != 0) { $logger->log("-->do_signup.php - Password fields do not match, redirecting to signup.php", PEAR_LOG_WARNING); $_SESSION["feedback"] = "signup_password_missmatch"; exit; } $uname = safe($_POST['username']); $uname_check = username_exists($uname); db_close(); if ($uname_check == 1) { $logger->log("-->do_signup.php - Username ".$uname." is already in use, redirecting back to signup.php", PEAR_LOG_INFO); $_SESSION["feedback"] = "username_taken"; } else { if ($uname_check == -1) { $logger->log("-->do_signup.php - Error occured while checking username exists, redirecting back to signup.php", PEAR_LOG_ERR); $_SESSION["feedback"] = "db_unknown_result"; exit; } $email = safe($_POST['email']); $fname = safe($_POST['fname']); $lname = safe($_POST['lname']); $country = safe($_POST['country']); $uid = generateRandomString(); $logger->log("-->do_signup.php - About to add user ".$uname." to the database", PEAR_LOG_INFO); $sql = "insert into tcustomer( username, password, email, fname, lname, country, uid) values( $1,$2,$3,$4,$5,$6,$7)"; $result = pg_query_params($DB, $sql, array($uname, $pwrd_1, $email, $fname, $lname, $country, $uid)); if(!$result) { $logger->log(pg_last_error(), PEAR_LOG_ERROR); $logger->log("-->do_signup.php - Got unknown result form the DB, redirecting to signup.php", PEAR_LOG_WARNING); $_SESSION["feedback"] = "db_unknown_result"; db_close(); exit; } else { # ok, we have successfuly run the query, do we have an affected row? $logger->log("-->do_signup.php - Got result from the DB", PEAR_LOG_INFO); $rows = pg_affected_rows($result); if($rows == 1) { # ok, we have successfuly inserted a row. $logger->log("-->do_signup.php - Result has 1 row, all is fine", PEAR_LOG_INFO); send_need_confirmation_mail($email); $_SESSION["feedback"] = "just_signed_up"; exit; } else { # we don't seem to have been able to insert anything for some strange reason $logger->log("-->do_signup.php - Result has not got 1 row, redirecting to signup.php", PEAR_LOG_WARNING); $_SESSION["feedback"] = "db_no_result"; db_close(); exit; } } } } else { $logger->log("-->do_signup.php - User did not enter all required fields, redirecting to signup.php", PEAR_LOG_WARNING); $_SESSION["feedback"] = "signup_missing"; db_close(); exit; } } ?>
  8. Whats your html form look like for the file field?
  9. Seems you have structural issue with the script. Please post the script here, so that we can have better understanding about the issue.
  10. If you want to keep the form action as "get", use $_GET instead of $_POST. If you change form action to "post", use $_POST. Thanks.
  11. Change this: if ($_post["user"]!="") To: if (isset($_POST["user"]) and trim($_POST["user"])!="") Also, change: <form action='#' method='get'> To: <form action='#' method='post'> Does it help you?
  12. Change this: <?php $displayimage = mysql_query("SELECT strVideoPath FROM tblathletevideos WHERE intAtheleteID='$ID'"); $result1 = mysql_query($displayimage) or die('Error, query failed'); ?> To: <?php $displayimage = "SELECT strVideoPath FROM tblathletevideos WHERE intAtheleteID='$ID'"; $result1 = mysql_query($displayimage) or die('Error, query failed'); ?> Hope this will help.
  13. In login.php, change: <input type="text" name"user"/> To: <input type="text" name="user"/> Hope, your script will work now.
  14. See parse_url() in PHP. <?php $url = 'http://username:password@hostname/path?arg=value#anchor'; print_r(parse_url($url)); echo parse_url($url, PHP_URL_PATH); ?> Hope, this will help you.
  15. Will the following work for you? <?php switch($trade) { case 'trd': if ($previous_bp <> '' and $tp <= $previous_bp) { echo 'Sell'; } else if (($previous_class == 'Buy' or $previous_class == 'Sell') and $tp <= $previous_tp) { echo 'Sell'; } else if ($previous_class == 'Sell' and ($tp > $previous_tp or $tp >= $previous_ap)) { echo 'Buy'; } else if ($previous_class == 'Buy' and $tp >= $previous_tp) { echo 'Buy'; } else if ($tp > 3000 and $previous_bp > 3000 and $tp > $previous_bp) { echo 'Buy'; } else { echo ''; } break; default: // Do stuff here where $trade != 'trd' } ?>
  16. I bet, this article will help you a lot. http://www.php-mysql-tutorial.com/wikis/php-tutorial/form-validation-using-php.aspx Turning off JavaScript from browser from FireFox. Goto Tools -> Options. Select "Content" tab and uncheck "Enable JavaScript" and save the option.
  17. Surely. How did you validate the form? Using only JavaScript? Ok, then whatever browser you are using, please turn off javascript support from it and try to submit the form. If you don't have the backend validation (validation through PHP script), or checking for disabled JavaScript (<noscript> tag), the form will be submitted as blank. Hope, I am making things clear to you.
  18. Timezone section in date() function? http://www.php.net/date
  19. Seems that the problem is occurring when you save through the PHP code. Am I correct? If yes, can you please check whether there is any intermediate function exists to convert string to its htmlentities before saving to the DB?
  20. Try this code: <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("maps", $con) or die('Failed to select database'); $sql = "SELECT * FROM category"; $result = mysql_query($sql); $options = ""; while ($row = mysql_fetch_array($result)) { $catname = $row['cat_name']; //$cat_id=$row["cat_id"]; $options .= "<OPTION VALUE=\"$catname\">$catname</option>"; } if (isset($_POST['list']) && is_array($_POST['list'])) { $items = implode(", ", $_POST['list']); $sql="INSERT INTO `markers` (`name`, `street`, `city`, `state`, `zip`, `url`, `lat`, `lng`, `marker_cat`) VALUES ('$_POST[name]', '$_POST[street]', '$_POST[city]', '$_POST[state]', '$_POST[zip]', '$_POST[url]', '$_POST[lat]', '$_POST[lng]', '$items')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } $message = "<font face=\"verdana\" size=\"2\"><b><center>Marker Added</center></b></font>"; mysql_close($con); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <!--<META HTTP-EQUIV="Refresh" CONTENT="2; URL=admin.php">--> <title>Insert Markers</title> </head> <body> <?php if (isset($message)) { echo "<p>" . $message . "</p>"; } ?> <form method="post" action="<?php echo $_SERVER['PHP_SELF']?>"> Category: <SELECT NAME="list[]" multiple><?php echo $options?></SELECT> <br> <input type="submit" name="btnSubmit" value="Submit"> </form> </body> </html>
  21. Did you try with the entire code that I provided? I added "maxlength" attribute with the username text box, which is running absolutely fine at my end. Please re-confirm.
  22. Please provide full script here. Some other part of the script generating this error.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.