Jump to content

crf1121359

Members
  • Posts

    50
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

crf1121359's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello, I am trying to figure out why paypal recurring payment always shows as Pending when I use my following code? this is a very basic HTML form which i use for recurring payment in paypal. but when the users sign up using the following code, the payment status shows as "PENDING"! could someone please help me to solve this issue? Thanks in advance. here is my html form: <form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="cmd" value="_xclick-subscriptions"> <input type="hidden" name="business" value="mysandboxemail@gmail.com"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="no_shipping" value="1"> <input type="hidden" name="cbt" value="Return to The Store"> <input type="hidden" name="cancel_return" value=" <?php echo $actual_link ?>"> <input type="hidden" name="custom" value="This is a custom field!!!"> <input type="hidden" name="item_name" value="ACCOUNT UPGRADE"> <input type="hidden" name="a3" value="5.00"> <input type="hidden" name="p3" value="1"> <input type="hidden" name="t3" value="M"> <input type="hidden" name="src" value="1"> <input type="hidden" name="sra" value="1"> <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_subscribe_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!"> </form>
  2. Hello, Let me first explain what i'm trying to do... I have two Tables in mysql database. 1st is members and the other one is storename. I save a random unique Key in both of these tables in the column randKey. This all works fine. Now, I have a login form which I am trying to use which has INNER JOIN in the SELECT. the purpose of using INNER JOIN is to be able to use the randKey in both Tables mentioned above so the users cannot login to someone else's account if you know what I mean. only if the email, password and randKey is matched then they can login? However, when I run the PHP/login page and try to login, I get That information is incorrect, try again echoed out to me... Here is my code: <?php // Parse the log in form if the user has filled it out and pressed "Log In" if (isset($_POST["email"]) && isset($_POST["password"])) { $manager = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["email"]); // filter everything but numbers and letters $password = (!empty($_POST['password'])) ? sha1($_POST['password']) : ''; // filter everything but numbers and letters // Connect to the MySQL database include "config/connect.php"; $sql = "SELECT members.id, members.email, members.password, members.randKey, storename.email, storename.password, storename.randKey FROM `members` INNER JOIN `storename` ON (members.randKey = storename.randKey) WHERE members.email = '$manager' AND members.password = '$password' "; // query the person // ------- MAKE SURE PERSON EXISTS IN DATABASE --------- $query = mysqli_query($db_conx, $sql); if (!$query) { die(mysqli_error($db_conx)); } $existCount = mysqli_num_rows($query); // count the row nums if ($existCount == 1) { // evaluate the count $row = mysqli_fetch_array($query, MYSQLI_ASSOC); $_SESSION["id"] = $row["id"]; $_SESSION["manager"] = $manager; $_SESSION["password"] = $password; header("location: dashboard"); exit(); } else { echo 'That information is incorrect, try again <a href="login">Click Here</a>'; exit(); } } ?> could someone please tell me why i cannot login using the code above ? am i MISSING SOMEHTING?
  3. I did that and it brings up this error: Fatal error: Call to undefined function mysqli_stmt_get_result()
  4. I am using the prepared statement exactly the same way in my registeration form and it works just fine! look at below code: $stmt = mysqli_prepare( $db_conx, "INSERT INTO tabelname (firstname, lastname) VALUES (?, ?)" ); //after validation, of course mysqli_stmt_bind_param($stmt, "ss", $firstname, $lastname); mysqli_stmt_execute($stmt); if (mysqli_affected_rows($db_conx)) { mysqli_stmt_close($stmt);//<-- CLEAN UP AFTER YOURSELF! //update was successful $id = mysqli_insert_id($db_conx); }
  5. P.S. i am using mysqli_stmt_execute($stmt); in my registeration form without any problem or error!
  6. No, its not a custom function. I do not have a third party class in my php page either! so what do you suggest ?
  7. Hello, this error is driving me crazy! I hope someone could help me out here: This the code for alogin form that I am trying to use but I keep getting this error: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in PHP? <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php ob_start(); session_start(); if (isset($_SESSION["username"])) { header("location: index.php"); exit(); } ?> <?php // Parse the log in form if the user has filled it out and pressed "Log In" if (isset($_POST["username"]) && isset($_POST["password"])) { $username = $_POST["username"]; // filter everything but numbers and letters $password = (!empty($_POST['password'])) ? sha1($_POST['password']) : ''; // filter everything but numbers and letters // Connect to the MySQL database include "connect.php"; $stmt = mysqli_prepare( $db_conx, 'SELECT username, password FROM members WHERE username = ? AND password = ?' ); mysqli_bind_param($stmt, 'ss', $username, $password); $result = mysqli_stmt_execute($stmt); if ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { $_SESSION['id'] = $row['id']; $_SESSION['username'] = $row['username']; $_SESSION['password'] = $row['password'];//and so on //AND CLEAN UP!! mysqli_free_result($result); header("location: index.php"); mysqli_stmt_close($stmt); }else { echo 'That information is incorrect, try again <a href="login.php">Click Here</a>'; exit(); } } ?> and this is my config.php file: <?php $db_conx = mysqli_connect("localhost", "XXXX", "TXXXX", "XXXXX"); // Evaluate the connection if (mysqli_connect_errno()) { echo mysqli_connect_error(); exit(); } else { echo "whoooooooo hoooooooooooooo"; } ?> could some please help me out with this as it really is bugging me to death. Thanks in advance.
  8. I have been reading about SQL injection and I want to secure my code. I am not asking anyone to write me a code, but I just want to learn it in simple terms. The best way for me to learn is to edit my code so I can compare them. For example, how secure is this code and if not, how can I make a secure? <?php if (isset ($_POST['email'])) { //Connect to the database through our include include_once "config/connect.php"; $email = stripslashes($_POST['email']); $email = strip_tags($email); $email = mysqli_real_escape_string($db_conx, $email); $password = preg_replace("[^A-Za-z0-9]", "", $_POST['password']); // filter everything but numbers and letters $password = md5($password); // Make query and then register all database data that - // cannot be changed by member into SESSION variables. // Data that you want member to be able to change - // should never be set into a SESSION variable. $sql = "SELECT * FROM members WHERE email='$email' AND password='$password'"; $query = mysqli_query($db_conx, $sql); $login_check = mysqli_num_rows($query); if($login_check > 0){ while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){ // Get member ID into a session variable $id = $row["id"]; session_register('id'); $_SESSION['id'] = $id; // Get member username into a session variable $username = $row["username"]; $email = $row["email"]; $password = $row["password"]; $firstname = $row["firstname"]; $lastname = $row["lastname"]; session_register('username'); session_register('firstname'); session_register('lastname'); // Update last_log_date field for this member now $sql = "UPDATE members SET lastlogin=now() WHERE id='$id'"; $query = mysqli_query($db_conx, $sql); // Print success message here if all went well then exit the script header("location: members/index.php?id=$id"); exit(); } // close while } else { // Print login failure message to the user and link them back to your login page header("location: login.php"); exit(); } } ?> Thanks in advance
  9. Hi, I have been searching for a solution for this for days and I haven't been able to find anything! I found this: dynamic ebay categorys on listing but it doesn't answer the question which is a shame. there are others that I found on google but I have to buy them! I have seen many ebay templates with dynamic categories and i am just wondering how they do that! is there any tutorial that i could follow or anything that I could learn how this is done? it cannot be that difficult as everyone does it these days! Any help would be greatly appreciated. Thanks in advance.
  10. it doesn't work with javascript disabled but at least PHP will echo the "Times Up" message or any other message if the javascript is not enabled. also, its not just the case of echoing a message! What i can do with PHP i wont be able to do with javascript if the user disable their javascript. its just not a good practice to rely on javascript especially in these day and age when there are 1000's of people/hackers trying to make a name for themselves by hacking other people's site. its bad enough to keep up with PHP updated etc... anyway, the $end_date is a field in mysql table which will hold the datetime (time that the item will/should end).
  11. you couldn't be more wrong mate, and to prove my point I have another code which will do EAXCTLY what i want but i don't want to use the code as the javascript on the timer is lagging and here is the code: <?php $date = $end_date; $exp_date = strtotime($date); $now = time(); if ($now < $exp_date ) { ?> <script> // Count down milliseconds = server_end - server_now = client_end - client_now var server_end = <?php echo $exp_date; ?> * 1000; var server_now = <?php echo time(); ?> * 1000; var client_now = new Date().getTime(); var end = server_end - server_now + client_now; // this is the real end time var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var _day = _hour *24 var timer; function showRemaining() { var now = new Date(); var distance = end - now; if (distance < 0 ) { clearInterval( timer ); document.getElementById('countdown').innerHTML = 'EXPIRED!'; return; } var days = Math.floor(distance / _day); var hours = Math.floor( (distance % _day ) / _hour ); var minutes = Math.floor( (distance % _hour) / _minute ); var seconds = Math.floor( (distance % _minute) / _second ); var countdown = document.getElementById('countdown'); countdown.innerHTML = ''; if (days) { countdown.innerHTML += 'Days: ' + days + '<br />'; } countdown.innerHTML += 'Hours: ' + hours+ '<br />'; countdown.innerHTML += 'Minutes: ' + minutes+ '<br />'; countdown.innerHTML += 'Seconds: ' + seconds+ '<br />'; } timer = setInterval(showRemaining, 1000); </script> <?php } else { echo "Times Up"; } ?> <div id="result"><div id="countdown"></div></div>
  12. I am at my wits end with this as i really need to move on and I'm stuck with such a simple task! any help would be greatly appreciated. what I am trying to do is to echo a Times Up message once the countdown reaches 0. I know the plugin has an onExpiry Function but I don't want to use javascript. I want to use PHP so the users can't disable it. This is my full code: <?php error_reporting(E_ALL); ini_set('display_errors', '1'); ?> <?php date_default_timezone_set('GMT'); ?> <?php session_start(); // Run a select query to get my letest 6 items // Connect to the MySQL database include "config/connect.php"; $dynamicList = ""; $sql = "SELECT * FROM item ORDER BY id "; $query = mysqli_query($db_conx, $sql); $productCount = mysqli_num_rows($query); // count the output amount if ($productCount > 0) { while($row = mysqli_fetch_array($query, MYSQLI_ASSOC)){ $id = $row["id"]; $product_name = $row["product_name"]; $date_added = date("Y, m, d", strtotime($row["date_added"])); $end_date = date("Y, m, j, G, i, s", strtotime($row["end_date"])); $price = $row["price"]; $dynamicList .= '<div>' . $end_date . ' </div>'; } } else { $dynamicList = "No Records"; } ?> <?php $tmp_date = explode(', ', $end_date); $tmp_date[1] = $tmp_date[1] - 1; $end_date = implode(', ', $tmp_date); ?> <?php $date = $end_date; $exp_date = date("Y, m, j, G, i, s", strtotime($date)); $now = time(); if ($now < $exp_date ) { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <noscript> <h3>JavaScript is disabled! Please enable JavaScript in your web browser!</h3> <style type="text/css"> #defaultCountdown { display:none; } </style> </noscript> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <title>jQuery Countdown</title> <link rel="stylesheet" href="jquery.countdown.css"> <style type="text/css"> #defaultCountdown { width: 240px; height: 45px; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javascript" src="jquery.countdown.js"></script> <script type="text/javascript"> $(document).ready(function () { $('#defaultCountdown').countdown({ until: new Date(<?php echo $end_date ?>), compact: true, onTick: warnUser }); }); </script> </head> <body> <?php } else { echo "Times Up"; } ?> <div id="defaultCountdown" style="font-family:Verdana, Geneva, sans-serif;"></div> <?php } else { echo "Times Up"; } ?> </body> </html> Currently I am using the code above but all i get is the (Times Up) message without anything else on the page and this is when the timer has hours to end but when i remove these lines: <?php $date = $end_date; $exp_date = date("Y, m, j, G, i, s", strtotime($date)); $now = time(); if ($now < $exp_date ) { ?> and <?php } else { echo "Times Up"; } ?> the timer shows up and starts working again. I need to find a way to show/display the Times Up message as soon as the counter hits 0 and I need to do it via PHP for security reasons. Thanks in advance.
  13. well there are plenty of "references" online if i needed one as I have posted one of the "references" myself!! also, the calculation is done using getOffset function in PHP. there is no need for setting the default time zone on the page at all. please only reply if you can answer the question otherwise everyone can search the net these days mate.
  14. Thanks but none of the above URL's help me in what i am trying to achieve! I already know the PHP timezone function and i do not know what the second link has to do with my question!
  15. Hello, I need to create a simple PHP script/application which will let the users search for two countries/cities in the world and the time difference between those two places will be shown to them on the page! a simple and good example of this is here: EXAMPLE Can someone please help me out with this. i can follow a tutorial or something as well if there are any? Thanks in advance.
×
×
  • 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.