Jump to content

vikram12345

Members
  • Posts

    22
  • Joined

  • Last visited

About vikram12345

  • Birthday 10/19/1991

Profile Information

  • Gender
    Male
  • Location
    Bangalore, INDIA
  • Interests
    Code , Code and a lil more Code :)

vikram12345's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Looks a little deep. Is there not an easier way ?. I just want lengthy URLs with variables to 'look' small and short.
  2. Hi people. This problem may be a stupid one. I'm totally new @ this. Okay, here I go. I'm coding this PHP website, where every page is loaded by accepting values through the URL. Eg. -> xyz.com/view_content.php?id=1234&limit=674 The entire theme of the page changes everytime I enter id and limit values. Is there any way I could reduce the URL to a shorter one like xyz.com/cool-blue OR xyz.com/eternal-red . so when a user types one of these it points to xyz.com/view_content.php?id=1234&limit=674 or something else. MY AIM is to store these values in a SQL table. Also the final URL should not be visible in the address bar.
  3. really sorry for buggin you guys, but what can I replace it with ? any other changes required in the code ??
  4. How do i match the number of parameters sent ?
  5. I solved the result issue . Now i'm gettin this Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in D:\xampp\htdocs\bullet2\sqlilogincheck.phpon line 39 my current code : // $goto = $_GET['goto'] ; session_start() ; $useremail = $_POST['emailfield'] ; $passwording = $_POST['pwfield'] ; $salt = "@cmiplpnp##" ; $iterations = 4; $hash = crypt($passwording,$salt); for ($i = 0; $i < $iterations; ++$i) { $hash = crypt($hash . $passwording,$salt); } echo $passwording ; echo '<br>' ; echo $hash ; echo '<br>' ; require ('sqliauth2.php') ; /* create a prepared statement */ if ($stmt = $mysqli->prepare("SELECT * FROM userregistry WHERE email= ? AND password11=? ")) ; { /* bind parameters for markers */ $stmt->bind_param("ss",$email, $hash); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($email,$hash); $stmt->fetch(); $row_cnt = $stmt->num_rows ; /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); echo $row_cnt ; ?>
  6. The echoes are showing properly, but errors visible. The last echo $row_cnt ; doesn't print . and of course in between you have those errors .
  7. <?php // $goto = $_GET['goto'] ; session_start() ; $useremail = $_POST['emailfield'] ; $passwording = $_POST['pwfield'] ; $salt = "@cmiplpnp##" ; $iterations = 4; $hash = crypt($passwording,$salt); for ($i = 0; $i < $iterations; ++$i) { $hash = crypt($hash . $passwording,$salt); } echo $passwording ; echo '<br>' ; echo $hash ; echo '<br>' ; require ('sqliauth2.php') ; /* create a prepared statement */ if ($stmt = $mysqli->prepare("SELECT * FROM userregistry WHERE email= ? AND password11=? ")) ; { /* bind parameters for markers */ $stmt->bind_param("ss",$email, $hash); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($email,$hash); $stmt->fetch(); $row_cnt = $result->num_rows ; /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); echo $row_cnt ; ?> ERRORS :::: Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in D:\xampp\htdocs\bullet2\sqlilogincheck.phpon line 39 Notice: Undefined variable: result in D:\xampp\htdocs\bullet2\sqlilogincheck.php on line 41 Notice: Trying to get property of non-object in D:\xampp\htdocs\bullet2\sqlilogincheck.php on line 41 Trying to understand why, but no clue HELP !!!
  8. slashed those statements out , works fine now. thx a lot
  9. <?php /* create a prepared statement */ if ($stmt = $mysqli->prepare("INSERT INTO userregistry (email,password11,firstname,lastname,contact,sex,dob,active,date) VALUES (?,?,?,?,?,?,?,?,?)")) { /* bind parameters for markers */ $stmt->bind_param("sssssssss", $email , $hash, $firstname , $secondname , $contact , $sex ,$dob , $active , $date); /* execute query */ $stmt->execute(); /* bind result variables */ $stmt->bind_result($email,$hash,$firstname,$secondname,$contact,$sex,$dob,$active,$date); $stmt->fetch(); /* close statement */ $stmt->close(); } /* close connection */ $mysqli->close(); ?> Well this is the code I've written to enter the above fields into a DB I keep getting the error Warning: mysqli_stmt::bind_result(): Number of bind variables doesn't match number of fields in prepared statement in D:\xampp\htdocs\bullet2\sqlienterintodb.phpon line 15 Any ideas ??
  10. My user authentication code -- <?php $useremail = $_POST['emailfield'] ; $userpassword = $_POST['pwfield'] ; require ('sqlauth2.php') ; mysql_select_db($database, $con); $sql = "SELECT * FROM userregistry WHERE email='".$useremail."' AND password='".$userpassword."'" ; $run = mysql_query($sql) ; $row = mysql_fetch_array($run) ; if(mysql_num_rows($run) == 1) { echo "SUCCESS <br>" ; } else { echo "No login for you " ; } ?> Looks perfect, but I keep getting this error Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\bullet2\logincheck.php on line 10 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\bullet2\logincheck.php on line 12 No login for you Any idea ? Searched everywhere, couldn't find anything proper. I know there is something wrong somewhere, can't seem to find it. Help me out people, thanks !!!
  11. Very much, should quit linking multiple php files together.
  12. Alright, here it is : before addintodb.php I run sqlauth.php Since I'm runnin sql w/o a password, the $password from the form and $password from the auth file conflict. Thereby the $password sets to null . change sql $password to $passworda or whatever and conflict resolved
  13. Solved it, any guesses !!!!!!, come on, this is fun !
  14. It doesn't get assign empty. echoed $password right before mysql query. displays the value fine anything wrong with the mysql code ?
×
×
  • 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.