Jump to content

vikram12345

Members
  • Posts

    22
  • Joined

  • Last visited

Everything posted by vikram12345

  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 ?
  15. <?php date_default_timezone_set('Asia/Kolkata') ; $estatus = 0 ; $erepeatstatus = 0 ; $passwordstatus = 0 ; $repeatpasswordstatus = 0 ; $date = date("F j, Y, g:i a"); $active = 1 ; $blankemail = 0 ; $blankpassword = 0 ; $allokay = 0 ; if (strlen($email)==0) { $blankemail = 2 ; } else { $blankemail = 1 ; } if (strlen($password)==0) { $blankpassword = 2 ; } else { $blankpassword = 1 ; } if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $estatus = 2 ; } else { $estatus = 1 ; } if($emailtwo == $emailtwo) { $erepeatstatus = 1 ; } else { $erepeatstatus = 2 ; } if (strlen($password)<= 10) { $passwordstatus = 1 ; } else { $passwordstatus = 2 ; } if($password == $passwordtwo) { $passwordrepeatstatus = 1 ; } else { $passwordrepeatstatus = 2 ; } echo $email."<br>" ; echo $emailtwo."<br>" ; echo $password."<br>" ; echo $passwordtwo."<br>" ; //echo intval($email); $allokay = $blankemail.$blankpassword.$estatus.$erepeatstatus.$passwordstatus.$passwordrepeatstatus ; echo $allokay ; if($allokay == 111111) { require ('sqlauth2.php') ; require ('enterintodb.php') ; echo "new user registered " ; } else { $goto = "http://localhost:78/bullet2/newuserregister.php?blankemail=".$blankemail."&blankpassword=".$blankpassword."&emailformat=".$estatus."&emailrepeat=".$erepeatstatus."&longpassword=".$passwordstatus."&passwordrepeat=".$passwordrepeatstatus ; header("Location: $goto "); } exit ; ?>
  16. I shall upload the detailsverify.php, the code that verifies all fields
  17. as you can see INSERT INTO userregistry (email,password11,firstname,lastname,contact,sex,dob,active,date) VALUES ('vikram12345@gmail.com','','cv','sd','9535283163','1','01012000','1','November 17, 2012, 10:53 pm') ^ the echoed sql query
  18. Alright, looks like we're getting somewhere. echoed the query, the insert password value turns blank for some reason . Any idea ?, all other inserts have solid values, only the pw value disappears during query
  19. Can you give me an idea on how to do that, also correct me here, do you mean ? $sql = whatever query echo $sql ; ?
  20. Well, I don't seem to have a variable spelling error, seems to me the echo wouldn't have worked at all. No column spelling error either, double checked both. I'm running on Xampp, with phpmyadmin . restarted MySql twice, no progress there either . Any other way this could happen ?. Collation problems ?, any special setting for MySql to handle password fields ??
  21. Hi, I'm not new to Sql or PHP or atleast I hope not . I coded a simple register form in HTML and this file opens a 'newuser.php' which in turn opens another one, and another finally after checking all INPUT fields, reaches a 'enterintodb.php' . Now, here's the joke. Every field enters into the table of MySql except for the password field. All entries including 1st name, last name, etc etc. get added to the table and like I said , password doesn't add. Just to be sure, at the end I echo all the fields and then echo "New user created !" . No MySql error or any syntax error displayed. The password field echoes w/o any problems, it displays the entered password. But no entry in the DB . password column : varchar(255) , utf16_general_ci , Iv also attached the enterintodb.php file . the others don't matter, coz when I echo $password, it displays perfectly. in the form this is the password field " <input type="password" name="password" size="20" style="border-left-width=0px"> " and don't worry about sql auth, i run a separate PHP file for that before enterintodb.php So, guys, help me out please Here's the attachment = enterintodb.php
×
×
  • 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.