BlackMagic
Members
-
Joined
-
Last visited
Reputation Activity
-
BlackMagic reacted to Jock in Barcodes and ReadersI've built a couple of applications that use barcodes. One of them was for a local distribution company that ships herbal remedies and **** like that. When they pick an order they go round with a trolley that has a laptop attached to it and they get a screen up that shows them the location of the item, they take the picking trolley round there and scan the product sticker and it checks that item off the picking list. The barcode scanner i got them emulates a usb keyboard, when you scan something it fires in the numbers then sends a return. I just used jQuery onkeydown function to 'listen' for the return and do an ajax post to the server. Their 'warehouse' doesn't have wifi so they laptop runs apache/mysql and they sync it up to their office.
-
BlackMagic reacted to SniderDK in Restricting File Access. HtAccess?so if you have a cpanel server for example the folder path to the public folder would be
/home/ACCOUNT-NAME/public_html
you have the file in a folder accessible in the public root so
/home/ACCOUNT-NAME/public_html/incs/settings.txt
what i would do is to move incs to a new location
/home/ACCOUNT-NAME/incs/settings.txt
so say you have a php script in the public_html folder called edit-settings.php say from that script to access the txt file you would use this code
$settingsFileLocation = dirname(dirname(__FILE__)).'/incs/settings.txt';
the dirname finds the folder path of the current file using the php provided __FILE__ constant, the second dirname finds the folder name holding the folder that has the current file in which would give you "/home/ACCOUNT-NAME"
that way you dont need to know any folder paths as long as you know the folder/file you need is just one hop up the file's path.
thats the safest way, other than that you can make a new .htaccess file in the incs folder denying access but i would only do that if your going to distribute the application to non developers.
hope that helps
EDIT: to have the whole application out of the public root requires you to screw with the architecture using a index.php file to sort the system out... its easy with object orientated applications and not so much with procedural types
-
BlackMagic reacted to SniderDK in Restricting File Access. HtAccess?best way is to not put it in the public folder that way no one without file system access can view the files.... my system only has 3 files in the public folder with one of them being the .htaccess file
-
BlackMagic reacted to Seth in PHP Comments? Correct Style?Instead of just giving the poor guy a link how about telling him the answer.
To comment in PHP you can do the following
/*For Multi
Line
Comments*/
//For single line comments
# for single line comments
Cheers!
-
BlackMagic got a reaction from DigitalSquid in MySQL database table row numbers/total rows countTo add a row number create a ID in your database table, Make it primary so it is unqiue and then allow it to auto increment so it will always be unique.
To count the the total number of rows, mysql has a built in function called mysql_num_rows. Below is an example:
<?php $link = mysql_connect("localhost", "mysql_user", "mysql_password"); mysql_select_db("database", $link); $result = mysql_query("SELECT * FROM table1", $link); $num_rows = mysql_num_rows($result); echo "$num_rows Rows\n"; ?>
A full link can be seen here:
http://php.net/manual/en/function.mysql-num-rows.php
Hope this helps!
-
BlackMagic reacted to Connetu_C in server side postYou're told you can't use HTTPS and things like IP access lists can be by-passed by spoofing. Also note you're not being asked for data security (encryption), just integrity (data not modified by man-in-middle). I know how I'd accomplish this, but since this is homework assignment or similar I won't tell you the answer. However, hint: shared secret key. And yes, MD5 or SHA1 could be useful in the toolkit too.
-
BlackMagic reacted to traxor in First website for moneyIt is a very simple website, with some really peculiar code, for example you've commented out the the stylesheet at the top for some reason...
There are several problems that I have with the site:
Visual:
The very top of the site looks strange because it goes all the way to the top of the browser, if you had a rounded off top, then it would look nicer, the reason being that you've got a space by the footer with rounded corners, so you need to be consistent. The navigation and the header both have some really obvious effects added to them, such as gradient and emboss. When you're designing a website, you want to use as many effects as you can, but also be as subtle as possible, my using a small amount of gradient, small drop shadows and a small amount of emboss, you're getting a good looking header (for example), without ramming it into the viewers face. For example, take a look at this site, the header has a drop shadow and a gradient, without it, the site looks very simple and flat, but by using a small amount, it is very effective, you should take that into consideration. For your navigation, you should always use lists, this helps to keep the navigation in order and help make the code semantic, flexible and accesible, read this article on how you should create navigation using a list. Another thing about the navigation, when the anchors are :active, they should be the same state as when they are being :hover'ed, so make sure that in your css you have a:hover and a:active set as the same state, and not different, because at the moment that's really letting it down. The use of images on your site is good, although it would be better if you had ones that are higher resolution, don't worry about the filesize, most people have broadband now, so as long as they don't exceed around 500 - 1024kb, then you'll be okay. With regards to content, you seem to have a decent amount, however you need to work on your spacial awareness, at the moment a lot of your content is in line with the edges of the content area, what you need is to add margins and padding to your text and images to allow some room, and the site will look much nicer, remember your CSS box model when designing. Once again, this is an issue with over use of effects, remember that they're called 'blending options', so you should use it to blend, and make it look decent, you seem to have used drop shadows where you can, I'd avoid using the drop shadows in the content area, and instead use lines to seperate content. The footer of your site isn't sitting where it should be in Firefox 3, the reason may be because you've used a margin or padding on your text, but you need to fix that because it looks strange. Code:
You have your site set as XHTML Transitional, but your code isn't validating, visit the W3C XHTML Validator to find out what the problem is, the CSS on your validates, but there are still some issues. The first thing that strikes me as odd is the way you've laid out the styles at the top, you've got two <style></style> tags, and a <link /> tag and you only need the latter, because one of your <style> tags is empty, and the other is commented out, so you're wasting space. You can remove the <style> tags from each page. Looking at your code, you seem to have a grasp of XHTML/CSS, so you're making a good start, but there are some things that you need to start doing, for example the anchors (<a></a>) always need to have a title="" in your links, and your images (<img />) always need to have an alt="" attribute, this helps with SEO and for accessibility, so make sure they're as descriptive as possible, as these are some of the reasons your site aren't validating. For your navigation, you've used a div with the align="" attribute, you should never do this, all of your styling and positioning should be done with CSS where it can be, and most of the time it can, so use the margin:0 auto; hack in CSS to make what you need to centre, or even use the position:relative; attribute. As previously stated, your navigation isn't created using lists, and it should be, refer to the previous list of bullet points for the article. For the header of the site, you've used <strong></strong>, you really should use the header tags (<h1></h1>), to make your code more semantic and for it to make sense, plus it'll make it easier and reduce filesizes by a few bytes. You've definitely overcomplicated your website, really a lot of the stuff you've written is a waste of space, you could've massively reduced the amount of code, and I'm surprised that for such a simple site, so much code has been used where it needn't be, you should try and reduce it by learning more advanced xhtml and css. Looking at your CSS now, I can see that you've overcomplicated this too, for example in your body selector, you've used multiple items for margin and background, you can summarise all of this in one by just saying margin:0; and background:url(Jade-conservatories-images/background.jpg) fixed repeat-x; remember that for the future, and also remember never to use JPG as an image for layouts, it's purely for content purposes, try and use PNG or GIF. It's the same thing throughout to be honest, I think you just need to learn a bit more css and you'll start creating some great sites.
Hope that helps.With regards to charging, personally I wouldn't charge anything more than about £200 for that website.