Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Sessions uses cookies. The only difference being that sessions stores the data on the server. If you use cookies then the user can easily modify the data stored. Where as with sessions the data is private, all the user sees will be the unique session token assigned to them. However if someone malicious gets access to this token then session hijacking can occur. http://phpsec.org/projects/guide/4.html http://stackoverflow.com/questions/12233406/preventing-session-hijacking Personally I'd use sessions. Use cookies for non sensitive data.
  2. Read Kevins first point.. All what PHP is doing outputting the javascript code for defining the Updateforbodyfittingoptions javascript function, When you call this function the PHP code that defined it will not be called!
  3. I wouldn't assign each field to a seperate variable. Instead I make the field label the key. $fields = array(); foreach( $form['fields'] as $field ) { // make field label the key $key = str_replace(' ', '_', strtolower($field['label'])); $fields[ $key ] = array( 'id' => $field['id'], 'label' => $field['label'], 'value' => $lead[ $field['id'] ], ); } So to access the Estate Agent field value you'd can do $fields['estate_agent']['value']. Note: I renamed the $values array to $fields
  4. The log_path is set to nothing $config['log_path'] = ''; How does error_log() know to write to the log file located in C:\xampp\htdocs\glup2\application\logs error_log is not a native PHP or CodeIgniter function. Is this your own custom function? If its maybe post the source code here.
  5. The foreach loop is creating a multidimensional $values array containing your form fields. It is using the form fields id as the key in $values. What is the issue?
  6. You'd call session_set_cookie_params before you start the session to enable sessions to span across sub domains, example session_set_cookie_params(0, '/', '.domain.com'); session_start(); Alternatively hardcode the cookie settings in the php.ini, specifically the session.cookie_domain directive.
  7. Ch0cu3r

    PHP script

    Yes, but you still got to type out the queries manually for creating the databases/tables. You're better of using some form of gui such as MySQL Workbench (desktop gui) or using phpMyAdmin (web based gui) to easily manage your MySQL server.
  8. So what is the question/problem?
  9. On line 26 of home.php you are not closing the select tag. This is how line 26 should read. echo "<select name='cust_id'>";
  10. I dont see any point in recoding the site in PHP if they are going to continue using ASP scripts.
  11. It is because Div is a reserved keyword in MySQL5. Edit your query and wrap it in backticks so Div='2' becomes `Div`='2'
  12. There is no dropdown type for <input> in HTML. This just create a text field echo '<input type="dropdown" name="'. $fieldName . '_' . $field_id . '" value="'. $children. '" style="width:20%" placeholder="Category" />'; To define a dropdown menu you use the <select></select> tags and then you add options to the menu using <option></option> tags. Example code for a menu <select name="my_dropdown_menu"> <option value"value1">Option 1</option> <option value"value2">Option 2</option> <option value"value3">Option 3</option> ... etc </select> if you want to allow the user to select multiple entries from the dropdown you add the multiple attribute to the opening select tag, eg <select name="my_dropdown_menu" multiple>
  13. What is the syntax error you are getting? No. But if you're using PHP5 then it is recommend to use the mysql improved function library instead of the standard mysql function (mysql_*) library as these are now deprecated.
  14. Then use if(!isset($_SESSION['logged_in') || (isset($_SESSION['logged_in') && $_SESSION['logged_in'] != true)) { // display login link }
  15. That is because your HTML for those buttons is invalid. You have merged the anchor (<a> ) tag and button (<input>) tag together you cannot do that. You are better of using anchors tags and then use CSS to style them to look like buttons. You place that code where you want the login/logout buttons to be displayed.
  16. The error on line 20 is caused by the query on line 19 failing probably due to the parenthesis $sql="SELECT * FROM serv WHERE(track_number='".$track_number."')"; Remove the ( and ) from the query.
  17. When the user is loggged in set a session varibal such as $_SESSION['logged_in'] = true; You can use a simple if statement to display the logout link if they are logged in. Otherwise display the login link if(isset($_SESSION['logged_in') && $_SESSION['logged_in'] == true) { // display logout link } else { // display login link } Also the HTML code you have posted for the login and register links/buttons is invalid html. You appear to of merged a link and a button together.
  18. What do you mean by that. What should those two script do? What are they doing now? Getting any errors?
  19. The headers will be the same, except there should only be one To: header, which should be set to the email address you are sending the email to. Something in your code is setting multiple To: headers which is causing the error. You need to debug your PHP script that is sending the emails.
  20. It loops through the list of field names in the $required_fields array and If they don't exist in the $_POST array or their values is empty it's add the field to the $error array It then validates the field value lengths. It uses the field name as the key and the maximum string length as the value in the $fields_with_length array. It then loops though that array and sets the field to $error if the field length exceeds the string length assigned to it. For example if the field named menu_name has a string length of 30 or more then that field will be added to the $error array.
  21. Your question is not very clear. Can you please explain your question more clearly.
  22. Using MySQL? Then you can perform transcations.
  23. Use HTML to markup your webpage, then use CSS to style it. CSS code for applying a background to <body></body> body { background: url(bgimage.jpg) no-repeat; }
  24. Remove the single quotes around $p $pw = SHA1('$p'); Variables are not parsed inside of single quotes. Also if you're using prepare statements then there is no need to use mysqli_real_escape_string
  25. If you're using $_SESSION variables within "..." (double quoted string) then you need to wrap the session variable within curly braces $sql = "INSERT INTO `shp_order_items`(`product_id`, `user_id`) VALUES ('{$_SESSION['prod_id']}' , '{$_SESSION['user_id']}')"; Or use concatenation $sql = "INSERT INTO `shp_order_items`(`product_id`, `user_id`) VALUES ('".$_SESSION['prod_id']."' , '".$_SESSION['user_id']."')";
×
×
  • 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.