Jump to content

php_begins

Members
  • Posts

    259
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

php_begins's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. I am running an old version of php. Can a cookie be secure and httponly at the same time? Also is it important to set the domain field? If so how can i dynamically get a domain in php? header( "Set-Cookie:". $Name."=".$Id."; expires=".$expires."; path="/"; domain="";Httponly; secure"); I noticed IE has some occasional issues with setting the cookie with the above code. Also the page breaks in IE if i add either secure or httponly or both. it works when i remove both.
  2. So I am using this legacy application which is in php 4. I am trying to set the httponly flag and secure flag on. This is my code: header( "Set-Cookie:". $cookieName."=".$sessId."; expires=".$expireSeconds."; sessionID=".$sessId.";path=".$path."; domain=".$domain."; httponly; secure"); When I test it, The secure flag is set on but the httponly is not. Could it because the URL uses https protocol? Also, does the expire field take seconds. right now, $expireSeconds=14400; How do I modify the code to rectify this if it doesnt expect seconds as a parameter.
  3. My function returns a bunch of attribute ids and it's corresponding names in json format. For eg: { "DETAILS": [ { "ATTR_ID": "522", "ATTRIBUTE_ID": "4222", "ATTRIBUTE_TYPE": "email", }, { "ATTR_ID": "523", "ATTRIBUTE_ID": "4006", "ATTRIBUTE_TYPE": "interest", } ] } I need to store it in an array which i need to cache .( I'll be probably using $_SESSION) Now another function returns me set of attribute ids: $val_array = $subarray[arrayOfAttributes]; foreach ($val_array as $val) { print "Attrib Value: $val\n"; //This will print ids 4222,4223,etc } what I need to do is correspond the ids with the type from the cache nad print out the respective Types. I am unable to formulate this logic into code.
  4. Anybody familar with tcl ? I have a select query that returns an out put like {HD 208 {} 2012-04-13 25 21 4} {SD 208 {} 2012-04-13 100 97 3} {HD 2072 {} 2012-04-13 5 4 1} {SD 2072 {} 2012-04-13 50 45 6} Now I want to set to store them in a variable and display one by one so that i can display it using html tables the records are returned in $get_record. So here's what i am doing foreach record $get_record { foreach item [lindex $record 0] { set event_name [ lindex $item 0] puts $event_name set event_date [ lindex $item 1] put $event_date set attempts_cnt [ lindex $item 2] put $attempts_cnt set success_cnt [ lindex $item 3] put $success_cnt } } Unfortunately this doesnt work..
  5. But I would still want to update the whole number. For eg. If i have a number 786661234. Its should be dispalyed in the form as XXXXX1234. When I click and submit the form, it should be decoded and updated in the database as 786661234.
  6. I need to display a number(the number is retrieved from the db) in the form input field such that only the last 4 digits is visbile, the remaining can be masked as * or X or whatever is applicable. I know the last 4 can be obtained as follows: $number=substr($number,-4,4); But when i hit the submit button the form validates the input field and checks if the number is a valid number of a specific format. Therefore when I click on the submit button then I should still be able to unmask the masked numbers or do something similar that would help me validate the whole number. <input type="text" name="no" value="<?php if(!empty($number)){ echo $number;} ?>">
  7. Never mind..here is what i did. $split_date=explode("/",$date); echo "0: ".$split_date[0]."<br>"; echo "1: ".$split_date[1]."<br>"; echo "2: ".$split_date[2]."<br>";
  8. I have a date of the following format: $date='04/09/2012'; How can i split it so that I can each one of them separately to use it in a JS function. var myDate = new Date(2012, 4, 9); NOTE: javascript months run from 0 to 11 for Jan to Dec.
  9. <script type="text/javascript"> $(function() { $('#dp_date').datepicker({ dateFormat: 'm/d/yy', minDate: 1, beforeShowDay: $.datepicker.noWeekends }); }); </script> I have the following script which gets date in the future and does not show weekends. I need to modify the above code as follows: I have one more date stored in the php variable $ef_date which is greater than or equal to current date. I want my datepicker to pick only dates that are greater than the $ef_date variable. It can be equal to $ef_date only if $ef_date is greater than today's date. Else it always has to be greater than $ef_date.
  10. Thanks..but i do not want to trim all the spaces. If there are multiple white spaces between 2 words, I want to reduce them to one space..
  11. <label for="first_name">* First Name </label> <input type="text" name="first_name" maxlength="64" value=<?php echo formatPhone(clean_input($_POST['first_name']); ?>> I have a form where I want to enter a first name. I want the fields to take only alphabets(no numbers). Also when a user enters something like John Doe separated by multiple white spaces, I want it to separate the two words only by a single space. I am not sure how this is done in php.
  12. I have a code where i can edit or delete certain details from the database. Right now, if the user clicks on the edit button it takes him edit page where he can edit the details. But, I am not able to Incorporate a Delete button such that, when the user clicks on a delete button, it should ask for a confirmation box. If the user clicks YES, then do the following: DELETE from emp WHERE emp_id='$emp_id'; When there are multiple entries and I click on delete it deletes everything from the database. how can i make it to delete only the entry that is besides the delete button? if(mysql_num_rows($emp_query) > 0){ echo "<table border='1'>"; echo "<th>Employee Id </th>"; echo "<th>Employee Name </th>"; while($get_emp = mysql_fetch_assoc($emp_query)){ $emp_id = $get_emp['emp_id']; $emp_name = $get_emp['first_name']." ".$get_emp['last_name']; echo "<tr>"; echo "<td width='100'>"; echo $emp_id; echo "</td>"; echo "<td width='400'>"; echo $emp_name; $edit_path = 'edit_employee.php?id='.$emp_id; ?> <INPUT TYPE="button" style="display:inline;" value="VIEW / EDIT" onClick="location.href='<?php echo $edit_path; ?>'"> <form style='margin: 0; padding: 0; display:inline;' method="post" action="<?php echo $_SERVER['PHP_SELF'];?>" onSubmit="return confirm('Are you sure this is correct?');"> <input style='display:inline;' name="delbutton" type="submit" value="DELETE"> <?php if(isset($_POST['delbutton'])){ $del_emp = mysql_query("DELETE from employee WHERE emp_id = '$emp_id'") or die(mysql_error()); //header('Location:view_employee.php'); } echo '</form>'; echo "</td>"; echo "</tr>"; } }
  13. I actually I ll have to reframe my question. I dont think I can use NOW() with the way I am writing my code now. $qcData = Array( "date_time" => NOW(), "note" => $note ); $qcNotes = new App_Model_DbTable_QCNotes(); $qcNotes->insert($qcData);
×
×
  • 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.