Jump to content

ankur0101

Members
  • Posts

    242
  • Joined

  • Last visited

Everything posted by ankur0101

  1. I tried to do $(windows).load(function () { alert('hi); myFunc(str); }); and document.onload=function{ alert('hi'); }; I know this is simple thing but god knows its not working
  2. I found out no jquery is running at all. I have added jquery file. in header.
  3. Does not work. My function is myFunc(str) and I write as follows : <script> $(document).ready(function () { myFunc(); }); </script> This didnt work so I added parameter i.e. str <script> $(document).ready(function () { myFunc(str); }); </script> Here is how my page looks like <script> function myFunc(str) { ... ... </script> <script> $(document).ready(function () { myFunc(str); }); </script> It does not work at all
  4. Hey trq, how can I execute any existing java script function ? Do I have to write like this > <script> $(document).ready(function () { myFunc(); }); </script>
  5. The "Tagged with" and "Posted in" listed at the bottom of a product page have links, but they are in black text and don't look like links But, the Post Date link takes the user to the product page. I would think it would take me to a list of all products posted on that date. > I will work on that Thanks Psycho, Thanks for your opinion
  6. Hi, I have following code > <select name="type"> <option value="all">All</option> <option value="act" selected="">Active</option> <option value="res">Re-signed</option> </select> Is there any way I can add onload event to <select> ? onload is only available for <body>. I am using MVC architecture in PHP. My <body> is located in header.php so I cannot use onload in <body>. What I want to have is when a page loads, my java script function will automatically execute. It would be fine if I put event in any other tag such as <p>
  7. Hi friends, Our team have started a new website. www.pricetagindia.com Its about listing prices, specifications, positives, drawbacks about all those electronic items, cars bikes which are launching in India. I would be happy to read your all reviews concerning onsite SEO and design.
  8. Hi friends, My Post title says it all. How to extend cookie expiry date from last activity which user has done ? Lets take an example, by default, cookie is set for 30minutes after user login. userA do login at 1PM, hence given cookie will expire at 1.30PM. Problem with this scenario is that if userA is doing something very important activity in app, then when he click on submit form on any internal link, he will get redirected to login. Hence he loses his work which he as done. What I want to have is when userA log in at 1PM (First activity), then at first, cookie will expire at 1.30PM. After that userA become idle, that means he does not click anywhere, he just leave his computer and come back again after 15 minutes i.e. at 1.15PM and starts using php portal, then cookie expiry should become 1.45PM How to do that ? I found script PHPmyadmin has done same thing. It leads to expiration of cookie when user become inactive for more that 1440 seconds. How to do that ? Thanks
  9. But CMS like wordpress n joomla use md5
  10. I am using codeigniter. It uses mysql real escape string everywhere. I am also using for filtering cookies. My post just give an idea how logic is working. I am sorry, I did not mentioned regarding that.
  11. But I am applying mysql_real_escape_string() everywhere.
  12. Yes, but if any hacker changes MD5 of cookie token, then he will get redirected to logout.php where all cookies will get deleted. @The Letter E - I am thinking about using SHA1 for storing passwords in DB and token in cookie How is SHA1. Off course, I am already using mysql_real_escape_string() My concern is I am storing token in user's database. Lets take an example. user1 loggs in and random SHA1 get stored in his cookie token. So if any other person(hacker) grabs that cookie token from his browser and sets the same in his (hacker's) browser cookie, then he will get automatically logged in as user1. Means anyone who is having that user1's cookie will get entry in system. How to stop that ?What I want to do is if hacker optains user1's cookie and even he stores the cookie in his browser, then he should not get logged in in system.
  13. Hi guys, I have created a login script. Well, actually its in Codeignier but I would like to ask whether it is secure or not. I have a database with table USERS having columns as id----username----password----token example ... 1--john.p---81F2DFDBC1DB6362CFDE9CF6310F9B61---29A5D7EA71557AA13F6E2F8863E15F22 Password and token fields are VARCHAR(32) which actually stores MD5. Logic for login.php =============================================================== Checks for entry in DB using after converting $passbox = md5($password) SELECT * FROM users WHERE username='$userbox' and password = '$passbox' If number of rows for above query == 1, then 1. Set Randomly generated cookie in users browser (e.g. 29A5D7EA71557AA13F6E2F8863E15F22) 2. Update USER table, update token field in front of john.p as 29A5D7EA71557AA13F6E2F8863E15F22 2. Forward user using header() to privatepage.php =============================================================== Logic for privatepage.php =============================================================== At first, it will check whether $_COOKIE['token'] ( which we set above ) exists or not. If($_COOKIE['token'] == NULL || !isset($_COOKIE['token'])), { then forward user to logout.php } else { // Now token exists in users browser and now checking whether that token exists in our table or not $token = $_COOKIE['token']; Now searching in DB using $token_chk = SELECT * FROM users WHERE token='$token' if(number of rows for $token_chk == 1) { // Do nothing , because user has logged in and is a valid user } else { header('Location:logout.php'); } } =============================================================== In this scenario, when a VALID user logges in, we are setting a random MD5 in that users row under token and same MD5 in users browser. In Private ie. login protected pages, at the top of page, we are matching the user's browser cookie TOKEN with the one which we set in database. If user removes cookie token OR changes its value to something else by manually editing, he will get forwarded to logout.php where all token cookie gets deleted from users browser and that user's token column updates to new random MD5. Is this secure ? Is this good ? In other words, system recognizes user using a $_COOKIE['token'] (user's browser based token cookie)
  14. Hi, Web developers use a tool called Firebug wth mozilla. But we can use this firebug to crack any form which connects to payment gateway. Support we have <form id="form1" name="form1" method="post" action="to_pay_gateway"> <p> <input type="hidden" name="amount" value="10" /> </p> <p> <input type="submit" name="button" id="button" value="Submit" /> </p> </form> In above sample code, action is to_pay_gateway i.e. it could any any link given by payment gateway. While running this code in browser shows just a button, after clicking that button we would go to third party payment gateway page.with $10 When I start firebug and see source code of page, I changed amount to 1 So after clicking on submit button, I went to payment page, where I have to pay $1 and not $10. This is very dangerous for automated system portals such as bus booking, movie booking etc. Is there any alternative ? How can we stop this crack-hack using PHP? Thanks
  15. Hi, I have a wordpress blog. I posted Google Adsense ads in Wordpress POST content area which exist in column 'post_content' under table wp_posts. Now I want to write PHP script to remove that in just execution of specific PHP file. Here is something in my mind. <?php $ad = "<script type=\"text/javascript\">// <![CDATA[ google_ad_client = \"pub-xxxxxxxxx\"; /* PostInnerAds-Banner */ google_ad_slot = \"xx\"; google_ad_width = 468; google_ad_height = 60; // ]]></script> <script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">// <![CDATA[ // ]]></script>"; ?> Now after connecting to database, I think I can use %LINK% query. But what can I do after that ?
  16. I did nothing. Just installed xampp and started using it.
  17. Hi, I am running Windows XP where I have installed XAMPP Its 6:30 PM at my windows xp's clock. I run a following code <?php echo date("h:i A"); ?> It is showing me 02:50 PM Why it is showing wrong time ?
  18. Hi, In my database, date is stored as in the format of YYYY-MM-DD Something like $date = 2012-04-01 How can I extract this as follows ... $year = 2012 $month = 04 $day = 01 Thanks
  19. I am using $categorywork->form because I am performing multiple actions under a page category.php such as /category.php?action=add /category.php?action=edit /category.php?action=del add will display addition form and that works. edit will display a drop down list which is not working
  20. I am generating a drop down menu i.e. <select> and its values are driven from database. In Simple language, what I want to do is : I have class called CategorWork class CategoryWork{ public $form = ""; public $edit_form1_first = "<br /><p><strong>Edit Category</strong></p><form id=\"form1\" name=\"form1\" method=\"post\" action=\"category.php?action=edit\"> <table width=\"454\" height=\"79\" border=\"0\"> <tr> <td width=\"110\">Category :</td> <td width=\"334\"><label for=\"select\"></label> <select name=\"select_cat\" id=\"select\">"; public $edit_form1_last = "</select> </td> </tr> <tr> <td> </td> <td><input type=\"submit\" name=\"button\" id=\"button\" value=\"Submit\" /></td> </tr> </table> </form>"; } Now you can see that starting part i.e. <select> is in $edit_form1_first Ending part i.e. </select> is in $edit_form1_last Now middle part <option value=""></option> is generated by a function as follows : class CategoryWork{ // above code here public function GenerateDropDown(){ $dropdown_query = "SELECT * FROM category ORDER BY name"; $dropdown_result = mysql_query($dropdown_query); echo $this->edit_form1_first; // Here First part is called while($row = mysql_fetch_array($dropdown_result)) { echo "<option value=".$row['id'].">".$row['name']."</option>"; // Here middle options are displayed from database } echo $this->edit_form1_last; // and last part is called } // end of GenerateDropDown function } Now I am putting this function in an object $this->form = $this->GenerateDropDown(); Now lets go to main page which will display data i.e. index.php <?php include('config.php'); $categorywork = new CategoryWork; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <p>Wazzupp world</p> <p>Here is my second line</p> <p>Below this line, I want that function</p> <p><?php echo $categorywork->form; ?></p> </body> </html> Problem : index.php should show data in following order : Wazzupp world Here is my second line Below this line, I want that function <<< Now that drop down should be here >>> [/color]BUT It is showing in different way as, Drop Down Wazzupp world Here is my second line Below this line, I want that function My question is WHY drop down is getting displayed at top and not at its given location ???
  21. Hi, I have 2 pages, config.php and category.php config.php is class CategoryWork { public $form = ""; public $error = ""; public $add_form = "<br /><p><strong>Add New Category</strong></p><form id=\"form1\" name=\"form1\" method=\"post\" action=\"category.php?action=add\"> <table width=\"550\" height=\"170\" border=\"0\"> <tr> <td width=\"153\">Name :</td> <td colspan=\"2\"><label for=\"cat_name\"></label> <input name=\"cat_name\" type=\"text\" id=\"cat_name\" size=\"50\" maxlength=\"50\" /></td> </tr> <tr> <td>Slug :</td> <td colspan=\"2\"><label for=\"cat_slug\"></label> <input name=\"cat_slug\" type=\"text\" id=\"cat_slug\" size=\"50\" maxlength=\"50\" /></td> </tr> <tr> <td>Description</td> <td colspan=\"2\"><label for=\"cat_desc\"></label> <textarea name=\"cat_desc\" id=\"cat_desc\" cols=\"48\" rows=\"10\"></textarea></td> </tr> <tr> <td> </td> <td width=\"97\"><input type=\"submit\" name=\"button\" id=\"button\" value=\"Submit\" /></td> <td width=\"286\"><input type=\"reset\" name=\"button2\" id=\"button2\" value=\"Reset\" /></td> </tr> <tr> <td> </td> <td colspan=\"2\"></td> </tr> </table> </form>"; public $edit_form1_first = "<br /><p><strong>Edit Category</strong></p><form id=\"form1\" name=\"form1\" method=\"post\" action=\"category.php?action=edit\"> <table width=\"454\" height=\"79\" border=\"0\"> <tr> <td width=\"110\">Category :</td> <td width=\"334\"><label for=\"select\"></label> <select name=\"select_cat\" id=\"select\">"; public $edit_form1_last = "</select> </td> </tr> <tr> <td> </td> <td><input type=\"submit\" name=\"button\" id=\"button\" value=\"Submit\" /></td> </tr> </table> </form>"; public $invalid_get_error = "<br /><br /><p><font color=\"#990000\"><strong><em>ERROR : Invalid Option.</em></strong></font></p>"; public function CheckAction($action){ if(!isset($action)) { header("Location:dashboard.php"); } else { $action = $action; if($action == "add") { $this->form = NULL; $this->form = $this->add_form; } else if ($action == "edit") { $this->form = NULL; $this->form = $this->GenerateDropDown(); } else if ($action == "del") { $this->form = "del"; } else { $this->form = $this->invalid_get_error; } // if else .. else if ends here }// if else ends here } // Function CheckAction ends public function ValidateAddForm($name, $slug, $desc){ if(isset($name) || isset($slug) || isset($desc)) { if($name == NULL || $slug == NULL || $desc == NULL) { $this->error = "<br /><br /><p><font color=\"#990000\"><strong><em>ERROR : All 3 fields are required.</em></strong></font></p>"; } else { // Data Insert in database $name = $name; $slug = $slug; $desc = $desc; $check_category_query = "SELECT * FROM category where slug = '$slug'"; $check_category_result = mysql_query($check_category_query); $check_category_count = mysql_num_rows($check_category_result); if($check_category_count == 1) { $this->error = "<br /><br /><p><font color=\"#990000\"><strong><em>ERROR : Slug Already exists.</em></strong></font></p>"; } else if ($check_category_count == 0) { // Do insertion in database $categoryinsert_query = "INSERT INTO category (name, slug, description) VALUES ('$name', '$slug', '$desc')"; $categoryinsert_result = mysql_query($categoryinsert_query); $this->error = "<br /><br /><font color=\"#009900\"><p><em><strong>Success, Category added.</strong></em></p></font>"; } } } } // function ends here public function GenerateDropDown(){ $dropdown_query = "SELECT * FROM category ORDER BY name"; $dropdown_result = mysql_query($dropdown_query); echo $this->edit_form1_first; while($row = mysql_fetch_array($dropdown_result)) { echo "<option value=".$row['id'].">".$row['name']."</option>"; } echo $this->edit_form1_last; } // end of GenerateDropDown function } Here is the code of category.php page <?php include('config.php'); $system = new SystemAdmin; $categorywork = new CategoryWork; $system->ValidateToken($_COOKIE['token']); $categorywork->CheckAction($_GET['action']); $categorywork->ValidateAddForm($_POST['cat_name'], $_POST['cat_slug'], $_POST['cat_desc']); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Welcome <?php echo $system->username; ?></title> <?php echo $system->metalines; ?> <?php echo $system->slug_javascript; ?> </head> <body> <h1>Welcome <?php echo $system->username; ?>,</h1> <?php echo $system->mainmenu; ?> <?php echo $system->spryfunctions; ?> <?php echo $categorywork->error; ?> <?php echo $categorywork->form; ?> </body> </html> Problem is that when I go to /category.php?action=edit, it shows dropdown at the top of page and not at the position of <?php echo $categorywork->form; ?> I have attached a screenshot, please go through it. How can I solve this ? Second problem is how can I hide undefined index notice ?
  22. By some how methode, I did what I wanted. I declared error variable before add form variable separately and now no problems
  23. technically domain is xxxyyyzzz.tld and www.xxxyyyzzz.tld is 3rd level domain
  24. Can you give me example of this ?
  25. I think PHP cannot store the form content with what you have written. I copy and pasted your $add_form content and PHP shows errors at that line only.
×
×
  • 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.