Jump to content

mostafatalebi

Members
  • Posts

    200
  • Joined

  • Last visited

Everything posted by mostafatalebi

  1. I have done all steps, it goes up to the last step, but erros: Commands out of sync; you can't run this command now
  2. Here is the password-change code. In the login page a session is saved storing the username. <?php session_start(); mysqli_report(MYSQLI_REPORT_ERROR); // Default Connections include("config/db.php"); include("config/pass_config.php"); // Default Variable $form['old_password'] = "";$form['password'] = ""; $alert['main'] = ""; $alert['old_password'] = "";$alert['password'] = ""; if(isset($_POST['submit']))// this is the main if statement { if($_POST['old_password'] == "" || $_POST['password'] == "") // this if is for form validation { if($_POST['old_password'] == "") { $alert['old_password'] = "Required"; } if($_POST['password'] == "") { $alert['password'] = "Required"; } $alert['main'] = "Please complete the form correctly."; $form['old_password'] = $_POST['old_password']; $form['password'] = $_POST['password']; include("view/password_view.php"); // this renders styled page }// form validation else// this means that all fields are working and now we need to connect the php engine to the database { $form['old_password'] = htmlentities($_POST['old_password']); $form['password'] = htmlentities($_POST['password']); $currentUser = $_SESSION['username']; // this is the if of database connect if ($connect = $db->prepare("SELECT id FROM member WHERE user = ? ")) { $connect->bind_param("s", $_SESSION['username']); $connect->execute(); $connect->bind_result($id); $connect->fetch(); if($id) { $connect->close(); // add session variables $_SESSION['id'] = $id; if($connect = $db->prepare("SELECT pass FROM member WHERE id=?")) { $connect->bind_param("i", $_SESSION['id']); $connect->execute(); $connect->bind_result($password_change); if(md5($form['old_password'] . $comb ) == $password_change) { if($connect = $db->prepare("UPDATE member SET pass = ? WHERE id =?")) { $connect->bind_param("si", md5($form['password'] . $comb),$_SESSION['id']); $connect->execute(); $connect->close(); header("Location: member.php?passwordChanged"); // SUCESSFUL UPDATION of PASSWORD } else { echo $alert['main'] = "Updating password failed."; } } else { echo $alert['main'] = "Retreiving the old password failed."; } } else { echo $alert['main'] = "Password incorrect, or the connection has not been established."; } header("Location: member.php?userLogin"); } else { echo $alert['main'] = "User not found."; } } // this is the else of database connect else { $alert['main'] = "No connection established. Please try in a few minutes."; include ("view/password_view.php"); // this is renders stylistic page } }// this is else form validation } else// this is the main else statement { include("view/password_view.php"); }
  3. Here is the password-change code. In the login page a session is saved storing the username. <?php session_start(); mysqli_report(MYSQLI_REPORT_ERROR); // Default Connections include("config/db.php"); include("config/pass_config.php"); // Default Variable $form['old_password'] = "";$form['password'] = ""; $alert['main'] = ""; $alert['old_password'] = "";$alert['password'] = ""; if(isset($_POST['submit']))// this is the main if statement { if($_POST['old_password'] == "" || $_POST['password'] == "") // this if is for form validation { if($_POST['old_password'] == "") { $alert['old_password'] = "Required"; } if($_POST['password'] == "") { $alert['password'] = "Required"; } $alert['main'] = "Please complete the form correctly."; $form['old_password'] = $_POST['old_password']; $form['password'] = $_POST['password']; include("view/password_view.php"); // this renders styled page }// form validation else// this means that all fields are working and now we need to connect the php engine to the database { $form['old_password'] = htmlentities($_POST['old_password']); $form['password'] = htmlentities($_POST['password']); $currentUser = $_SESSION['username']; // this is the if of database connect if ($connect = $db->prepare("SELECT id FROM member WHERE user = ? ")) { $connect->bind_param("s", $_SESSION['username']); $connect->execute(); $connect->bind_result($id); $connect->fetch(); if($id) { $connect->close(); // add session variables $_SESSION['id'] = $id; if($connect = $db->prepare("SELECT pass FROM member WHERE id=?")) { $connect->bind_param("i", $_SESSION['id']); $connect->execute(); $connect->bind_result($password_change); if(md5($form['old_password'] . $comb ) == $password_change) { if($connect = $db->prepare("UPDATE member SET pass = ? WHERE id =?")) { $connect->bind_param("si", md5($form['password'] . $comb),$_SESSION['id']); $connect->execute(); $connect->close(); header("Location: member.php?passwordChanged"); // SUCESSFUL UPDATION of PASSWORD } else { echo $alert['main'] = "Updating password failed."; } } else { echo $alert['main'] = "Retreiving the old password failed."; } } else { echo $alert['main'] = "Password incorrect, or the connection has not been established."; } header("Location: member.php?userLogin"); } else { echo $alert['main'] = "User not found."; } } // this is the else of database connect else { $alert['main'] = "No connection established. Please try in a few minutes."; include ("view/password_view.php"); // this is renders stylistic page } }// this is else form validation } else// this is the main else statement { include("view/password_view.php"); }
  4. Hello everybody. I want ask a php programmer that whether or not my method for changing an already-logged in user is true or not. When the user logs in his username is saved in a $_SESSION. When user clicks on the change password link to be directed toward the edit_password page his/her id is queried using his $_SESSION. an example would be something Like this: ("SELECT id FROM tableName WHERE username=?) then I go on: bind_param(), execute(), bind_result($id), fetch() And then if $id != 0 "UPDATE tableName SET password WHERE id=?) and again like above doing mysqli steps. is my method true? but it doesn't work, it does nothing, neither error nor working.
  5. yes. something like livechat.com script.
  6. Hello everybody I have a question regarding my mysqli fetch() command. What does is do? as the name suggest it fetches some information. I know this. /////////////////////////////////////////////////////////////////////// But why in such circumstance it is not used: (Loging in user) $stmt = $mysqli_variable->prepare("SELECT * FROM users WHERE username=$user AND password=$pass"); $stmt->execute(); $stmt->store_result(); $stmt->close(); //////////////////////////////////////////////////////////////////// (for storing the ID of currently logged user)[changed areas are in red] While in here we have it: $stmt = $mysqli_variable->prepare("SELECT id FROM users WHERE username=$user AND password=$pass"); $stmt->execute(); $stmt->bind_result($id); $stmt->fetch(); /// Why here we have fetch and in above script we don't have? $stmt->close();
  7. Hello everybody I want to add a chat-contact box in my site, so when I sign in to my yahoo/gmail account the customer in my site could instant message with me. How is the theory then?
  8. Hello I want to add a edit-profile page to my site. To do this I make a session variable to store the email of the logged-in user when he logs in. Later when the user clicks on the edit-information page's link, it goes through theform. I want to add to all form's inputs including firstname, lastname, about me, phone etc. the user's current information. So how I can query (using PHP) a row entirely when I have only one element of it which is "email"?
  9. What to do on a complex level where there are 200.000 words with definition which at least would account for 1.000.000 words in total!
  10. let me provide you with an example then see is it a good solution: I have a database which consists of two columns: "Word" "definition" Then the user searches a word called "Pixel", what happen is that my dictionary goes through the table and searches for that specific word: "SELECT definistion FROM dictionary WHERE word='Pixel'" Is it logical?
  11. no it is probably a script to be installed on my Host, then provide an authentication just like any website, and the user login into my site and searches for his word. It is server-side. The user who is employed as a translator in my website, and then has access to an area called "Get Help from Dictionary", then he enters and searches for his vocab.
  12. For instance Shall I use a mySQL or just a file of words being processed by regular expression?
  13. Hello everybody I am creating a translation-service website, and I want to know how theoretically I can make an online dictionary. I mean using javascript I make a medical-dictionary or something else. Can anyone give me a general process of how to make a dictionary online using javascript?
  14. Hey man thank you very much. I searched the whole net and found nothing. Thanks a million, again. problem is solved by your solution
  15. <form action="" method="post" name="register_form"> <label for="first_name"> First Name </label> <input type="text" name="first_name" class="inputs" value=<?php echo $input['firstname']; ?>/> <?php // get the value of the variables if($error['firstname_alert'] != "") { echo "<div id='required'>" . $error['firstname_alert'] . "</div>"; } ?> <br /><br /> This is a part of the script. The rest is the duplication of this part and making other inputs. so this showa you almost the entire stracture of my register_view.php. this file then is included in another register.php file and is shown. EVERYTHING works fine but the only problem is the forward slash added to the input. Also here is the variables for all of my PHP scripts: $error;// now the elements $error['register_alert'] = ""; $error['firstname_alert'] = " "; $error['lastname_alert'] = ""; $error['password_alert'] = ""; $error['password2_alert'] = ""; $error['email_alert'] = ""; // all the elements for erroring while registration $input; $input['firstname'] = ""; $input['lastname'] = ""; $input['password'] = ""; $input['password2'] = ""; $input['email'] = ""; $input['information'] = ""; // all the elements for
  16. I mean I have made a form in HTML, static, and I have added several inline php script. I have set the value of the each text input to this inline script: <?php $thisInputValue = htmlentities($_Post['username'], ENT_QUOTES]; echo $thisInputValue; ?> Everything works fine, but the problem is that when i run the page for the first time, there is a "/" in the inputs. This is quite little strange, but seem to be common. my input eventually looks like this: <html> <input type="text" value="/" /> </html>
  17. hello everybody I have made a form with several inputs and made a php script to echo a variable in the value of each input, something like this: <?php $aVariable = ""; <input name='test' value=<?php echo $aVariable ?> but what I get at the end is an input with a slash in it. I should get an empty input indeed.
  18. is it possible for you to explain a little about this component? is it a plugin for jQuery and also a framework for Js?
  19. just go to twitter an on the top there is a nice search bar. I want a look quite near to it.
  20. puttin the form in a div, and set a bg for the div, how to get rid of the form orginal displat? something like this: <form, the type is text/> <attach #formInvisible style to this input> <div></div> <attach #formStyle to the div> <#formInvisible is hidden>->->-> I can not do this statement. how to get rid of original form, so when I click on the form the cursor don't be off the .png background. <#formStyle has a .png rounded image as a backgrouns>
  21. Hello everybody I want to get a stylish form element with border style. I want a all-browser-compatible technique such as that of a background image (.png). I don't know how to get rid of orignial form visibility and use a rounded png image as its background. How? I also can use Javascript so if you any technique please tell it. Thanks
×
×
  • 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.