Jump to content

funbinod

Members
  • Posts

    501
  • Joined

  • Last visited

Everything posted by funbinod

  1. that will not be a problem. my theme is - if they want to use my application, they should follow my instructions or restrictions. i'm even thinking of limiting the use the application in a particular browser.. I don't know this will be good logic or not, but i'm gonna try this out at least once.... can u guide me if I can force the user to use the application in popup browser.. moreover, I dunno if this can be done with session variables. I dunno if session variables open a popup browser.. can u please clarify....!!!
  2. coz I need to open the page in POPUP browser. I just don't want to let user to open a regular browser. they should open it in a popup browser. for this I want to force them to click on a link mentioned above.
  3. but I think there can be implemented certain 'conditions' for many things like--- if logged in, if logged out, if submitted, if closed, etc.... likewise I wish the page to open only if the link is clicked and the link makes a popup....
  4. thank u for the reply. then can u suggest me how can I stop a visitor to open a page directly by typing a url....?????
  5. hey guys after long time. actually was busy with new baby at home..... now back to w3schools for learning.... ------------------------ I was trying to force a user only to visit the whole application in a popped up browser. to popup a browser I tried // index.php<a href='javascript:window.open("login.php?", "_blank", "toolbar=no, scrollbars=no, resizable=no, top=10, left=10, width=1000, height=650")' class="title2" id="enter">Click Here to continue!</a> but the popped up browser doesn't detect the redirected url. I wish to detect the redirected page so that I can limit the user to visit 'login.php' page only after clicking on the above link on index.php. will u please suggest any perfect idea so that I can pop up a browser with redirected url.....?????
  6. i just notied that, the 'Not Found!' alert is displayed onClick the button Get Value. <input type="text" style="width: 200px;" value="" id="CityAjax" class="ac_input"/> <input type="button" onclick="lookupAjax();" value="Get Value"/> but i wish this alert while typing.. i tried "onKeyUp" and "onBlur" and "onChange" in the "CityAjax" input, but it didn't work. can u find any idea??
  7. thank u again for another reply. but i understood only a less. with that less idea, i read the console logging (with alerts) this - ------------------------------------------- this is the log on the console ------------------------------------------- Not found! : 31 truthy value : 29 0 : 29 Not found! 0 : 31 undefined : 29 Not found! undefined : 31 null : 29 Not found! null : 31 but what i wonder is all alerts are happening just after page loads. it doesn't wait for me to try some characters in the autocomplete field...
  8. upppsssss! sorry! sorry! i just forgot i'm using jQuery and i used javascript's 'value'. it worked now. thank u. and thank u again for correcting me on select element...
  9. i'm trying to append some elements with some conditions <script type="text/javascript">function appending() { if ($('#ac_type').value == "Debtors") { $("#append").append( "<p>Test Append Element</p>" ); }}</script> i take value for the if condition and append onBlur from this -- <select name="ac_type" id="ac_type" onkeypress="return tabE(this,event)" onBlur="appending()" /> <option></option> <?php $query = "SELECT * FROM ac_type"; $result = mysqli_query($connect, $query) or die("Unable to select database: " . mysqli_error($connect)); while ($row = mysqli_fetch_array($result)) { echo "<option>" . $row['ac_type'] . "</option>"; } ?> </select> i append the element here-- <tr valign="top"> <td colspan="2"><div id="append"></div></td> </tr> but its not working with the defined condition. but if i remove the condition [ if ($('#ac_type').value == "Debtors") { ] it works...... please guide where i did wrong....
  10. i will give u the whole script i'm using "jquery.js" and "jquery.autocomplete.js" for the whole process.. <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"><head><title>test autocomplete</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><script type="text/javascript" src="ajax/jquery.js"></script><script type="text/javascript" src="ajax/jquery.autocomplete.js"></script><link rel="stylesheet" href="style.css" type="text/css" /> </head><body><form onsubmit="return false;" action=""> <p> <input type="text" style="width: 200px;" value="" id="CityAjax" class="ac_input"/> <input type="button" onclick="lookupAjax();" value="Get Value"/> </p></form><script type="text/javascript">"use strict";function findValue(li) {"use strict"; var result; var sValue; if( li == null ){ //result = (findValue(li)); //<= stack limite reach alert("Not Found!"); } else if( !!li.extra ){ sValue = li.extra[0]; result = sValue; } else{ sValue = li.selectValue; result = sValue;} return(result);}findValue(); // alert => Not Found! function selectItem(li) { findValue(li); } function formatItem(row) { return row[0] + " (id: " + row[1] + ")"; } function lookupAjax(){ var oSuggest = $("#CityAjax")[0].autocompleter; oSuggest.findValue(); return false; } function lookupLocal(){ var oSuggest = $("#CityLocal")[0].autocompleter; oSuggest.findValue(); return false; } $("#CityAjax").autocomplete( "autocomplete.php", { delay:10, minChars:1, matchSubset:1, matchContains:1, cacheLength:10, onItemSelect:selectItem, onFindValue:findValue, formatItem:formatItem, autoFill:true } ); </script></body></html> // this is the list for the autocomplete data<?php$q = strtolower($_GET["q"]);if (!$q) return;$items = array("Narayangadh","Kathmandu","Pokhara","Hetaunda",Besisahar");foreach ($items as $key=>$value) { if (strpos(strtolower($key), $q) !== false) { echo "$key|$valuen"; }}?>
  11. it is alerting "Not Found!" only when the page loads. but not if there is no match /////////////////////////////////////////// its still the same....
  12. function findValue(li) { if( li == null ) console.log(findValue(li)); return alert("Not Found!"); if( !!li.extra ) var sValue = li.extra[0]; else var sValue = li.selectValue; } still nothing....
  13. now please tell me if the following table creation with FKs is correct or not: CREATE TABLE IF NOT EXISTS `cnote` ( `tn` int(11) NOT NULL AUTO_INCREMENT, `vn` int(10) NOT NULL, `sn` int(10) NOT NULL, `date` date NOT NULL, `tr_type` varchar(100) NOT NULL, `aid` int(10) NOT NULL, `cashiddd` int(11) NOT NULL, `sid` int(10) NOT NULL, `catid` int(10) NOT NULL, `qty` int(100) NOT NULL, `rate` int(100) NOT NULL, `less` int(3) NOT NULL, `amt` int(100) NOT NULL, `ref` varchar(100) DEFAULT NULL, `user_id` int(3) NOT NULL, PRIMARY KEY (`tn`) KEY FK_user(user_id), CONSTRAINT cnoteid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2;/////////////////////////////////CREATE TABLE IF NOT EXISTS `contra` ( `vn` int(10) NOT NULL AUTO_INCREMENT, `date` date NOT NULL, `daid` int(10) NOT NULL, `caid` int(10) NOT NULL, `debit` int(100) NOT NULL, `credit` int(100) NOT NULL, `ref` varchar(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT NULL, PRIMARY KEY (`vn`) KEY FK_user(user_id), CONSTRAINT contraid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `dnote` ( `tn` int(11) NOT NULL AUTO_INCREMENT, `vn` int(10) NOT NULL, `sn` int(10) NOT NULL, `date` date NOT NULL, `tr_type` varchar(100) NOT NULL, `aid` int(10) NOT NULL, `cashid` int(11) NOT NULL, `sid` int(10) NOT NULL, `catid` int(10) NOT NULL, `qty` int(100) NOT NULL, `rate` int(100) NOT NULL, `less` int(3) NOT NULL, `amt` int(100) NOT NULL, `ref` varchar(100) DEFAULT NULL, PRIMARY KEY (`tn`) KEY FK_user(user_id), CONSTRAINT dnoteid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `fifo` ( `tn` int(10) NOT NULL AUTO_INCREMENT, `vn` int(10) NOT NULL, `date` date NOT NULL, `sn` int(10) DEFAULT NULL, `ref` varchar(100) DEFAULT NULL, `aid` int(11) NOT NULL, `sid` int(10) DEFAULT NULL, `catid` int(10) DEFAULT NULL, `qty` int(100) DEFAULT NULL, `remain` int(10) NOT NULL, `rate` int(100) DEFAULT NULL, `less` int(100) DEFAULT NULL, `amt` int(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT NULL, PRIMARY KEY (`tn`) KEY FK_user(user_id), CONSTRAINT fifoid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=39 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `journal` ( `vn` int(10) NOT NULL AUTO_INCREMENT, `date` date NOT NULL, `daid` int(10) NOT NULL, `caid` int(10) NOT NULL, `debit` int(100) NOT NULL, `credit` int(100) NOT NULL, `ref` varchar(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT NULL, PRIMARY KEY (`vn`) KEY FK_user(user_id), CONSTRAINT journalid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `payment` ( `vn` int(10) NOT NULL AUTO_INCREMENT, `date` date NOT NULL, `ref` varchar(100) DEFAULT NULL, `cashid` int(11) NOT NULL, `caid` int(11) NOT NULL, `amt` int(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT 'PAYMENT', PRIMARY KEY (`vn`) KEY FK_user(user_id), CONSTRAINT paymentid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `purchase` ( `tn` int(10) NOT NULL AUTO_INCREMENT, `vn` int(10) NOT NULL, `date` date NOT NULL, `sn` int(10) DEFAULT NULL, `ref` varchar(100) DEFAULT NULL, `aid` int(11) NOT NULL, `sid` int(10) DEFAULT NULL, `catid` int(10) DEFAULT NULL, `qty` int(100) DEFAULT NULL, `rate` int(100) DEFAULT NULL, `less` int(100) DEFAULT NULL, `amt` int(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT 'PURCHASE', `remain` int(10) NOT NULL, PRIMARY KEY (`tn`) KEY FK_user(user_id), CONSTRAINT purchaseid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `receipt` ( `vn` int(10) NOT NULL AUTO_INCREMENT, `date` date NOT NULL, `ref` varchar(100) DEFAULT NULL, `daid` int(11) NOT NULL, `cashid` int(11) NOT NULL, `amt` int(100) DEFAULT NULL, `tr_type` varchar(100) DEFAULT 'RECEIPT', PRIMARY KEY (`vn`) KEY FK_user(user_id), CONSTRAINT receiptid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;/////////////////////////////////CREATE TABLE IF NOT EXISTS `sales` ( `tn` int(10) NOT NULL AUTO_INCREMENT, `vn` int(10) NOT NULL, `date` date NOT NULL, `sn` int(10) DEFAULT NULL, `ref` varchar(100) DEFAULT NULL, `aid` int(11) NOT NULL, `sid` int(10) DEFAULT NULL, `catid` int(10) DEFAULT NULL, `qty` int(100) DEFAULT NULL, `rate` int(11) DEFAULT NULL, `less` int(3) DEFAULT NULL, `amt` int(11) DEFAULT NULL, `tr_type` varchar(100) DEFAULT 'SALES', PRIMARY KEY (`tn`) KEY FK_user(user_id), CONSTRAINT salesid_fk FOREIGN KEY (user_id) REFERENCES user(uid) ON DELETE CASCADE ON UPDATE CASCADE) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ;
  14. uhhhhh!!! another new topic! i've not read about foreign keys. gotta read this first. i'll be back to the topic after i get (or cannot understand) some/any info about this....
  15. function findValue(li) { if( li == null ) return alert("Not Found!"); if( !!li.extra ) var sValue = li.extra[0]; else var sValue = li.selectValue; console.log(findValue(li)); } logging nothing.......
  16. then what is the process to use table dynamically for different users? do u suggest i use one extra column to each table that records the user-id?
  17. sorry sorry!! i think there was something error in browser or it didn't reload the edited script. it is working as wished now. thank u but one problem more it is still not alerting "Not Found" // this is inside the main script where i populate the autocomplete items function findValue(li) { if( li == null ) return alert("Not Found!"); if( !!li.extra ) var sValue = li.extra[0]; else var sValue = li.selectValue; }
  18. i think my question created lots of misinterpretations... the table structure shown in the question is just an example to show how a info table is created (if it doesn't exist only). i use that table to read the max(sn) so that i can make prefix for the newly inserted user. in my application i just dont store user data. my application is about accounting and each user access some tables to store and read their individual datas. if u understood i'm just using different tables only for user info, i'm sorry for making u confused. or if u understood the same as i'm explaining now, please make me clear how can i use tables dynamically to record different users' activities....
  19. did u mean doing this --- $items = array();while ($item = mysqli_fetch_array($query)) { if (mysqli_num_rows($query) > 0) { $items [] = $item['item'];}}foreach ($items as $key) { if (strpos(strtolower($key), $q) !== false) { echo "$keyn"; }} if so there is nothing change in the result
  20. ok! this main problem is solved. i just commented the .blur() line and the problem is solved. case 13: // return if( selectCurrent() ){ // make sure to blur off the current field// $input.get(0).blur(); e.preventDefault(); } break; but i've got another problem. if there is no matching found it gives php errors. i just want to avoid the process if no matching found. this is my php code that autocomplete gets result from.. //item.php<?phprequire_once('function.php');$q = strtolower($_REQUEST["q"]);if (!$q) return;$query = mysqli_query($connect, "select item from stock where item like '%$q%' order by item");while ($item = mysqli_fetch_array($query)) { $items [] = $item['item'];}foreach ($items as $key) { if (strpos(strtolower($key), $q) !== false) { echo "$keyn"; }}?> if it doesn't find match it gives error please suggest.....
  21. i'm trying to work with jquery autocomplete using 'jquery.js' & 'jquery.autocomplete.js'. everything is working fine. but when i press 'Enter' after selecting one of the results it gives, i cant find where the pointer reaches. what i expect it is if i press 'Enter' then i want it to select (or focus) that same or next input field. in jquery.autocomplete.js file there is something written for the 'Enter' button $input .keydown(function(e) { // track last key pressed lastKeyPressCode = e.keyCode; switch(e.keyCode) {// ................// ................ case 13: // return if( selectCurrent() ){ // make sure to blur off the current field $input.get(0).blur(); e.preventDefault(); } break;// ................// ................ } }) but i cant understand what it is doing and what to change to make it do what i expect. can anybody please guide...????? thanks in advance...
  22. upsss! i've not thought about this big question. but sorry! i dont know anything about dynamic tables. will u please help me understand this and guide me to go through it?
  23. i got the solution for this. i wrote the whole script not just a line $prefixwrite = '<?phpdate_default_timezone_set("Asia/Kathmandu");require_once("mysql.php");require_once("classUser.php");$prefix = "'.$newprefix.'";?>';$function = fopen("function.php", "w") or die('unable to open file!');fwrite($function, $prefixwrite);fclose($function); but the another confusion continues
  24. noone interested? will anyone get attention if i posted something i've tried? i created tables with (new) prefixes while a user gets registered by this-- <?php$prefixsql = mysqli_query($connect2, "SELECT max(sn)sn FROM clients")or die('Error :' . mysqli_error($connect2));$prefixrow = mysqli_fetch_object($prefixsql);$prefixsn = $prefixrow->sn;$newprefix = 'mts'.$prefixsn.'_';$sql2 = mysqli_query($connect, "CREATE TABLE IF NOT EXISTS `{$newprefix}info` ( `id` int(3) NOT NULL AUTO_INCREMENT COMMENT 'ID', `company` char(50) DEFAULT NULL, `address` char(50) DEFAULT NULL, `email` char(50) DEFAULT NULL, `phone` char(15) DEFAULT NULL, `reg_date` date NOT NULL, `trl_end` date NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;");if ($sql2) { echo "Table {$newprefix}info created successfully!<br />";} else { die ("Error creating 'ac_type': " . mysqli_error($connect));}?> and i can add this newprefix to the functions.php file-- <?php$prefixwrite = '$prefix = '.$newprefix.";n";$function = fopen("function.php", "a") or die('unable to open file!');fwrite($function, $prefixwrite);fclose($function);?> but this writes to the end of the function file even after closing php (?>). can't i write it just before closing php on function.php? and again i'm confused how can i use this function file for each user. i mean all the script files are same for all except this prefix on function file. shall i write each function file for each user or there is another better way? if i've to use a different function files, i can i include it to the main script for respective users? i've got lots of confusions. please guide----
×
×
  • Create New...