-
Posts
3,404 -
Joined
-
Last visited
-
Days Won
55
Everything posted by Ch0cu3r
-
Which one is better for a Login system, Sessions of Cookies
Ch0cu3r replied to Andor's topic in PHP Coding Help
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. -
Call PHP Function from within another function
Ch0cu3r replied to reptile's topic in PHP Coding Help
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!- 14 replies
-
- php
- javascript
-
(and 2 more)
Tagged with:
-
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
-
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.
-
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?
-
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.
-
So what is the question/problem?
-
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'>";
- 3 replies
-
- php
- drop down menu
-
(and 2 more)
Tagged with:
-
I dont see any point in recoding the site in PHP if they are going to continue using ASP scripts.
-
It is because Div is a reserved keyword in MySQL5. Edit your query and wrap it in backticks so Div='2' becomes `Div`='2'
-
Having an issue with an array in a dropdown box
Ch0cu3r replied to dsillaman's topic in PHP Coding Help
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> -
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.
-
Then use if(!isset($_SESSION['logged_in') || (isset($_SESSION['logged_in') && $_SESSION['logged_in'] != true)) { // display login link }
-
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.
-
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.
-
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.
-
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.
- 6 replies
-
- email headers
- to: header
-
(and 1 more)
Tagged with:
-
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.
-
Multidimensional array with interaction of colors
Ch0cu3r replied to Yuri's topic in PHP Coding Help
Your question is not very clear. Can you please explain your question more clearly. -
Using MySQL? Then you can perform transcations.
-
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; }
-
Prepared statement changes value of SHA1 vs. non-prepared
Ch0cu3r replied to tork's topic in PHP Coding Help
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 -
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']."')";