Jump to content

Rohlan

Members
  • Posts

    48
  • Joined

  • Last visited

    Never

Everything posted by Rohlan

  1. I have to question the usage of keyboard navigation on websites. Unless we're talking google or a very basic website layout I really don't see how navigation is anything but a harduous task. Removing the dotted border will most probably have no effect at all in accessibility from your users. I would however only remove dotted borders from specific elements other than all of them. A list of links is probably a bad idea to do without the d.border, but from a logo or for certain other situations i'm pretty sure its feasible. If keyboard navigation was such an issue, we wouldn't be able to use onclick or other js perks.
  2. oh, we posted almost at the same time, hehe thank you very much for the help
  3. ... obviously was drawing a COMPLETE BLANK. I was forgetting the GROUP BY. Here's my query ... SELECT type, COUNT(*) AS Types FROM data_table WHERE type IS NOT NULL GROUP BY type
  4. Hello all. I'm having a difficult time figuring out this query, I even think I've done it once before but can't seem to remember what I did. This is my data: +--+----------+ |ID | type | +--+----------+ | 1 | type_1 | | 2 | type_2 | | 3 | type_2 | | 4 | type_1 | | 5 | type_1 | +--+----------+ I simply need to get the results in this fashion: Types | Quantity type_1 | 3 type_2 | 2 Why am I not figuring this out? seems so simple.. Any help is appreciated.
  5. if javascript isnt enabled, the user has no access to the page already this is an internal application, not to be released to the public
  6. When the user logs out I can also clear the user's pages, that just leaves the bit when the user abruptly closes the window, or shuts down the browser.
  7. Hello everyone. I'm working with vTiger CRM 5.2.0, I'm trying to implement a feature that tells the user what if other (and which) users are on the same page as them, this will allow me to warn users that someone else is editing the same data as them and such. My first untested theory is to use the database to store what pages which user is viewing. What I can't figure out is how to remove the page from the table once the user leaves. I can run a query when the user saves the data or hits the cancel button, but what if they simply close the browser window or exits the system through some other means? Logging out, or even shutting down the computer abruptly or some such. Any suggestions are appreciated
  8. I edited my post as I was making little sense in some bits. But I will try your tip! thanks.. Edited: It works! Thanks! i didnt know that function... i guess i shouldve searched a bit better.. hehe...
  9. Hello. I have an array like this: Array ( [1] => MOR [2] => CON [3] => CP1 [4] => CP2 [5] => EMAIL [6] => NIF [7] => BI [8] => DIS ) And then I defined, for example this one variable: define("DIS","District"); When I try to... echo $array[8]; All I get is "DIS". I'm obviously trying to echo a string and it won't work that way... but I still gave it a try. How can I do this then? I need "District" to be outputted instead of the actual variable name. I know that if I were to "echo DIS;" this would work but that defeats the purpose as I have various defined variables per row... Thanks.
  10. It's just kind of ugly, and servers little purpose... i think
  11. Never knew this was possible, I'm also interested in knowing.
  12. Your code should look more like this: (didn't proof read it) //SERVER 1 $link = mysql_connect("localhost","usern1","pw1"); mysql_select_db("db_one1"); $query = "INSERT INTO db1(subject, search, News, img) VALUES('$hsubject','$key','$news','$img')"; $result = mysql_query($query); //SERVER 2 $link = mysql_connect("xxx.xxx.xx.xxx","usern2","pw2"); mysql_select_db("db_one2"); $query = "INSERT INTO db2(subject, search, News, img) VALUES('$hsubject','$key','$news','$img')"; $result = mysql_query($query); $sentOk = "The data has been added to the database."; echo "sentOk=" . $sentOk; Because you rewrite the $link variable on the second connection... This way you connect to the first db then send the info... then connect to second db and send info.
  13. I recently ran into something similar. I found this SQL Command: INSERT IGNORE INTO `table` SET `ID` = $user_id,`IP` = $user_ip; Basically it will insert the value unless it is already there, and if it IS there... it will simply ignore it and no errors will be outputed. A life saver... More info here: http://bogdan.org.ua/2007/10/18/mysql-insert-if-not-exists-syntax.html
  14. I will begin by letting you know of a great place to start your learning experience: http://www.tizag.com/phpT/ I still keep coming back to that website to learn stuff. Now... you should place the PHP files in the "WWW" folder in your apache installation... either that or a folder called "PUBLIC"
  15. Hi everyone. first, TL;DR: What are some good examples of applications that you found especially well-written or what would you recommend me to read to get a good feel of what a secure and robust looks like? Long boring version: I'll start by noting that all and any coding that I know has been self-taught by reading tutorials and endless trial-and-error experiences and thusly I am afraid I might have drifted a bit away from what the community understands as "normalization" and "proper" coding. That being said, in a crude way one could say I have "my own" way of doing things. Because of that I often run into a more efficient way to achieve something, or someone looks at my code and thoroughly explains to me it might need optimization and tweaking. I didn't attend college and many terms are also new to me, I've worked as a freelance programmer for a little more than 5 years now and I've been doing so-so. I sort of want to step away from that now, I'd like to get in touch with what is considered a secure normalized way of programming. I know this might sound like I've gone too far for too long but that isn't really the case. I just feel like my coding is a bit dodgy sometimes and that someone else that might be interested in my projects might go "wtf" and turn a cold back on it due to it looking like a mangled confusing wall of code. With that in mind... I have been working on this web application I've been calling "taskgrammer", the name comes from "Task Programmer". What it did at first was allow someone to create tasks. That was it. But it grew. Right now there's a Contacts and Customers center with CRM-like functions, Task types, User management, Robust scheduling, Payment management, Team management (currently working on internal human resources system for salaries, holidays, etc) Alerts system... with many functions that allows any small company that provides any kind of service to manage their whole activities and get reports on finances with detailed per-customer debt reports and profit margins and what-have-you. Due to my "type" of programming, I've left some things behind that need optimizing, be it cleaning some code or making sure that the application is functioning the way I want instead of leaving things "working fine so I'll leave it", rushing things always feels wrong and I tend to do it when I'm having a crap day (lol) or just need to do something real quick... but then I can't help but feel worried that that's not what I wanted to have done and it needs future "healing". I hate that feeling of helplessness when you're not sure that bit of code should be left like that... as it might interfere with future plans or it might actually re-define your work-flow without you ever planning to do so. The main thing that worries me in this application is the security aspect. It runs on the web and is prone to attacks and ill-intended shenanigans. So I went ahead and devised some amateur security "systems" (that's what I call them in my mind), one of them is for preventing direct access to include files and other files, I make a check for a defined variable on the config file, if the check is true then the file can be accessed, this means that you have no way of accessing any of the files without going through proper routes, but is that really true? Is it really safe? I have my doubts because I don't really know what tools folks can use to hack into things and break everything. Pure lack of information. My config file is a bit big, it has a lot of includes for all my functions and that is another thing that worries me, I have around 10 function library files ( i decided to divide them into various files just for easier editing ), I am loading those functions each time even if they are not necessary... is that OK? is there an influence in my application's performance? Everything seems speedy to me so that makes me believe its ok to do that... but is it taxing my server's resources? ... lack of information again, I suppose. Then there is my "template" system where I have each page in a function like contact_list(), that function simply calls the template file contact_list.php and in certain cases might provide some needed parameters. What I do then is I call each function in GET variables like index.php?action=contact_list and then have this in my main template file: $_GET["action"](); I could probably come up with some other way of doing these things nowadays that I'm a bit more knowledgeable but I don't want to have to rewrite everything so soon as I've put a lot of work into this already. I've already said a mouthful and I'm thankful that you read it, so ... what are some good examples of applications that you found especially well-written or what would you recommend me to read to get a good feel of what a secure and robust looks like? Thanks, and hugs for everyone.
  16. I posted a reply right after you hehe... glad you fixed it.
  17. I'm going to assume this is what's happening: When you use LIMIT = 5 you get 5 results but then because their images don't exit, you simply get no output because of your conditions. If that is the case, I would use a simple counter, like this: $query = mysql_query("SELECT * FROM table WHERE date >= '$now' ORDER BY max(date) desc"); $cid = $row['cat_id']; $title = $row['name']; $seoname = $row['seourl']; $img = 'images/'.$seoname.'.jpg'; $counter = 0; while ($row = mysql_fetch_assoc($query)) { if (!file_exists($img)) { $img = ''; } else { $img = 'images/'.$seoname.'.jpg'; } if (!empty($img)) { echo '<a href="images/'.$seoname.'/"><img src="'.$img .'" style="width:528px;" alt="" /></a>' . "\n"; $counter++; //$counter becomes $counter+1 } //when counter reaches 5, break off the loop //where 5 is your result "limit" if ($counter == 5) { break; } } I'm pretty sure there's a more direct way to do this but this is how I would do it until something better is suggested.
  18. Ok i've decided to go the Cron job way. Thank you guys for the help.
  19. Tables: jobs (* fields) unpayed_jobs (id field) 1. Run a cron over night or every so often to populate the unpayed_jobs table from the jobs table. 2. Display data from the unpayed_jobs table as alerts on every page on the application, limit alerts to prevent heavy taxing on resources, provide link for "all alerts" on its own page. How does this sound?
  20. Ok I was doing some quick reading and this caught my eye: The bolded bit worries me as this "jobs" table does suffer a lot of updates to its entries on a hourly basis. Insight?
  21. I have little to no experience with CRON but will definitely look into it. And indexing... also not not sure how that helps since I'm not sure as to what the usage is, but will also research immediately.
  22. Hello everyone. Maybe this belongs in the Application Design forum but I wasn't too sure so I posted it here. For my current application, I am trying to develop an "Alerts System". The main function of the app is to allow a user to manage "jobs". Jobs can be created and modified with ease, each job carries a ton of information, customer id, date, hour rate, duration, address, state, payment state, payment method, etc. So basically we have the table "jobs" with all these fields and some more. When a job has been changed to "Executed" state, it means the job has been finished and is awaiting payment by the customer, if the payment is already due and the "payment state" has not yet been filled, then an alert should be generated so the manager can quickly take care of it. I have been brainstorming on how to achieve this, this alert system has to query the DB often to check for "Executed" jobs with "payment = 0". Right now there are more than 50k jobs in my DB, and to run this query all the time is unthinkable... I can make it so the query runs when the manager decides to check for Alerts manually, but that defeats the purpose of what I am trying to achieve. This alert system would also be useful for more things: customers with no telephone number information or other sensitive data jobs that have had their final date pass and still haven't been changed to "executed" customers who haven't had any jobs done in the last year so the manager can either run a campaign or take some other action I wonder if such a thing is achievable nowadays without compromising the application's speed too much or taxing the server resources too much. Any suggestions would be very appreciated.
  23. Just found this link which I believe has helped me... http://www.desilva.biz/arrays/multidimen.html Now to proceed as planned... Sorry to bother.
  24. Hi everyone. I've been trying to figure this out for hours now and I'm feeling like throwing down the towel... though I'm sure I'm very close to finding the way to do it... I've googled a bit but I don't think I know very well what to search about... This is my array (its a big one get ready): Array ( [quartos] => Array ( [designacao] => Array ( [0] => 1 [1] => 2 ) [dimensoes] => Array ( [0] => 1 [1] => 2 ) [andar] => Array ( [0] => 1 [1] => 2 ) [janelas] => Array ( [0] => 1 [1] => 2 ) [pavimentos] => Array ( [0] => 1 [1] => 2 ) [mobilia] => Array ( [0] => 1 [1] => 2 ) [obs] => Array ( [0] => 1 [1] => 2 ) [extras] => Array ( [0] => in [1] => in ) [id] => Array ( [0] => 1 [1] => 1 ) ) [wcs] => Array ( [designacao] => Array ( [0] => 1 [1] => 2 ) [dimensoes] => Array ( [0] => 1 [1] => 2 ) [andar] => Array ( [0] => 1 [1] => 2 ) [janelas] => Array ( [0] => 1 [1] => 2 ) [pavimentos] => Array ( [0] => 1 [1] => 2 ) [mobilia] => Array ( [0] => 1 [1] => 2 ) [obs] => Array ( [0] => 1 [1] => 2 ) [extras] => Array ( [0] => in [1] => in ) [id] => Array ( [0] => 1 [1] => 1 ) ) ) What I need to do is turn these values into a string. However I can't seem to be able to obtain the values themselves. I know I can simply echo $array[quartos][designacao][0] echo $array[quartos][designacao][1] echo $array[quartos][designacao][2] echo $array[quartos][designacao][3] . . . But I need a loop to iterate through the array and do it without having to do it manually. I just can't seem to find out how to do it... Any ideas? Thank you.
  25. Please consider the following two tables: People ID NAME SERVICES_PROVIDED 1 John Cleaning | Gardening 2 Mary Gardening 3 Jack Electrician | Plumbing 4 Jane Gardening | Cooking Services ID NAME 1 Cleaning 2 Gardening 3 Electrician 4 Plumbing 5 Cooking At a certain point in my application, I need to be able to select both a worker and a service he/she provides. Obviously it can't be mismatched, Mary can't be assigned a Plumbing job because its not a service she provides. Therefore I'm building a selection program that lets the manager select a Service first, and then the program displays the people who do that job with SELECT * FROM `people` WHERE `services_provided` LIKE '%EXAMPLE%' But what if I need a way to specify the person first to obtain their services? Using these two tables, how am I supposed to be able to tell what services are provided by, for example, Jack with just one query? Another thing, I realize I might be better off using service IDs instead of their name in the People table, but if if by chance I can't (I don't own the database nor can I change it without permission), I might be in trouble if there happens to be a service called "Cooking Assistant", and then when searching for %Cooking% I'd run into a bit of a problem because it would display both those who provide the "Cooking" service and the "Cooking assistant" service which wouldn't be the ideal scenario. Thank you for your precious time.
×
×
  • 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.