sDJh 39 Posting Whiz in Training

Accessing Windows functions from ASM is fairly difficult. But if I get you right, that's not what you want.
Interrupts are also not accessible when having an OS running between your software and the CPU.
If you intent to write your own interrupt-handler, you can test it with an emulator. I use qemu for that. It's a very simple programme, but therefor (IMO) the best thing to examine your code.

sDJh 39 Posting Whiz in Training

or

@readfile("./path/to/your/file");

to output the content of these files. Take care that you might want to manipulate the headers for the correct content, name and size.

sDJh 39 Posting Whiz in Training

what have you then been looking for?

1. in your posted file you need the attribute "name" in all of your <select>-tags. this makes php reefer to that value.
2. in the file search_result.php you do something like this:

<?php
$destination=$_REQUEST["destination"];    //your array passed to your file
$year=$_REQUEST["year"];                  // -"-
$r=mysql_query("SELECT * FROM ... WHERE `destination`='".$destination."' AND ` year`=".$year);
?>

you can then output your data with mysql_fetcharray or something similar.
You may want to vary your boolean logic in the mysql-statement.

sDJh 39 Posting Whiz in Training

@ardav: that doesn't necessarily help either. You don't know if "drink" really is an array.
Additionally, I'd suggest to check that as well:

...
if(isset($_POST['drink'])) {
	$drinks = $_POST['drink'];
	if(is_array($drinks) && count($drinks)>=2){
	...

then you can be sure not run into a memory leak.

cu, Simon

diafol commented: good spot +14
sDJh 39 Posting Whiz in Training

Hi davy_yg,

first, put a file named ".htaccess" in the folder you want to protect. Right now, I'm not sure, if you actually have to put something in it, or if apache won't let anyone access that page when the file exists. Just fish for some info if it's not working.

Then you have to give permission to each user that shall be allowed to access these page. Simply put a flag in your database and check on top of a script (put somewhere else than your protected folder) whether it is set or not. If the access is granted, you can include these file width "include" oder "require".
Apache will only deny HTTP-accesses. With PHP, you can still work with that folder like before.

I'm wondering if that all. But I can't think of anything else to do... Try it out and report if it's not working.

Hope that helps, Simon

sDJh 39 Posting Whiz in Training

Hi Mary,

did the upload work? What does the output of

echo $_FILES[p_img][name]

say? Does your form have

enctype="multipart/form-data"

? And are uploads allowed by your php.ini-settings?

~Simon

sDJh 39 Posting Whiz in Training

Hi Makrand,

these messages aren't errors but warnings to force you to improve your coding style. If you don't fancy that (like I do) you can set your PHP.INI variable "error_reporting" to "E_ALL^E_NOTICE". This stops php to reports these warnings (http://de.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting).
If you don't have access to the PHP.INI have a look here: http://de.php.net/manual/en/function.error-reporting.php or here http://php.net/manual/en/function.ini-set.php. For me both works, but sometimes one of these may causes some fuzz.

Hope that helps - Simon

sDJh 39 Posting Whiz in Training

the best alternative is, to lock an account independently from the IP address. That's how it's done in the real world. That might be stupid for the end-user as she/he can't login after an attack, but provides the highest security.

There are two possibilities:
1) Resetting the password and sending a link to unlock the account via email.
2) Blocking any login-attempt for a defined period of time (15 mins or so).

What's best for you depends on your taste.

Regards, Simon

sDJh 39 Posting Whiz in Training

Whole codes? Well hint's are okay, but I won't cause fuss and try to figure out a completely running programme.

Think about how you determine the length of a string? Null-terminated? Fine.
I'd start like that:
Run through the string, till \0 comes. Decrease the register (let's call it the backcounter). Now run a second loop till the \0-character. Now compare the character of your backcounter with the one of your forward-counter. After each step you're decreasing the backcounter and increase the forward-counter.

That should be all.
Hope it helps.

sDJh 39 Posting Whiz in Training

Hi,

have a look here: http://www.php.net/manual/en/function.mail.php. You can simply modify the headers.

Greetings, Simon

sDJh 39 Posting Whiz in Training

Hi,

perfect hint: http://www.php.net/manual/en/reserved.variables.server.php. It's the manual for all information concerning your visitor. Look at "REMOTE_ADDR" for the IP-address.

To lock an account you simply count how often the user tried to log in in with a wrong ID. Simply place a file into a temporary folder named with the IP-address and save the time and date of the login (or even better unix-time: time()). If the time gap is lower than say 15 minutes you simply put a flag "locked" to your database or whatever system you're using for your accounts.

sDJh 39 Posting Whiz in Training

Yes, they can. You can actually do all stuff Google has done in their products apart from dynamically changing the content of your webpage without reload. You then need to work with JavaScript.

sDJh 39 Posting Whiz in Training

Yeah. Have you GD installed? Check that and look on http://php.net for some help.

sDJh 39 Posting Whiz in Training

how about having a look at the generated HTML-Output? That helps you to understand the problem.

sDJh 39 Posting Whiz in Training

Why don't you simply fetch the errpor-output of mysql http://php.net/manual/en/function.mysql-error.php? So in case something goes wrong you can still undo the paying.

sDJh 39 Posting Whiz in Training

I think we actually need more information about this. The problem itself is quite simple, though: the condition "if (in_array($fileType, $image_array))" is not met.

Start debugging you code:
make an output of $fileType and $image_array right before the condition and let the code run under FF and IE. I guess you'll then already see the problem. If you still have trouble, then paste the output here.

Greetings Simon

sDJh 39 Posting Whiz in Training

well year. This is a common mistake one makes at the beginning of writing PHP code. The data recieved in PHP is masked so that possible harmful code cannot be executed.

Try the following functions: http://de.php.net/manual/de/function.htmlspecialchars-decode.php , http://de.php.net/manual/de/function.stripslashes.php and http://de.php.net/manual/de/function.addcslashes.php . If none of these functions do what you want to, have a look at php.net for similar functions.

sDJh 39 Posting Whiz in Training

I once had that problem as well with my USB-Stick. I managed to get it working again under Linux. Try to format your storage there and even if it's not working you may can then format it under Mac.

Did work for me that time.

sDJh 39 Posting Whiz in Training

I am not really sure, but can variables declared with a space? Try to replace "Add Another Team" with "Add_Another_Team" and "Finish Adding Teams" with "Finish_Adding_Teams" and please let me know if that solves the problem.

~Simon

sDJh 39 Posting Whiz in Training

Unfortunately, PHP does handle a couple of request parallel. As I don't know exactly what these data are for, I can suppose two ideas for updating the database:

1. Lock it!
Add a new field called "inuse" or "locked" that you mark with 1 before you do all the calculation. At the end of your script you update the coulm and set it back to "0". When the second user executes the script and the column is still marked with "1" the script stops and reloads after one or two seconds.
This possibility does slow your execution down, of course.

2. Make different rows!
When the calculated data is just for player only (no global variables) you can simply add a column to the table that saves an unique ID of the player. Then you can check with each update, that only the row of the player is changed. But this just works, when the data are not important to the next player.

Hope that helped. If not, try to give a more detailed description of your problem.

Greetings
Simon

sDJh 39 Posting Whiz in Training

I can't add anything to the stuff that is said about the .htaccess. But I got you a bit different.

You have an index file in a folder and you now need the name of the folder. This can be done as follows:

$uri=$REQUEST_URI;
$tmp=explode("/",$uri);
echo $tmp[$tmp.length()-2];

$REQUEST_URI returns the URL of your script including all folders relativ to root directory of your files. You can then find the folder where index.php is in.

Hope that helps.


PS When you try to do something similar to FB, where you can access a user via facebook.com/username I would do it as well as said before.

sDJh 39 Posting Whiz in Training

You have to make sure, that you definately don't have any html, echo or print before you set the session. Thats because session sends a cookie to the client via the HTTP-header. As soon you have any output, PHP sends the header and the stuff you want the browser to show.

The reason why you don't have the problem on the one server could be, that you have the error-reporting turned off.

sDJh 39 Posting Whiz in Training

The very easiest way would be to allow only registered users to vote (as it is done at youtube, amazon, and also here).

If you don't want the visitor to sign-up you can do it with a cookie, but you must be aware that not everybody is accepting cookies and many people regulary delete them.
You could also do it as you said with saving the IP-address in a database. But as soon as the user relogins to the internet it has a totally new IP. Some might even use programmes that changes their IP-address every few seconds.

When you decide for one of the two latest ideas you cannot guarantee that a user doesn't vote more than once an hour. But therefore you can leave out a registration which might be unattractive for many users. If users have to sign up anyway when buying a product, I'd go for the very first solution.

Greetings
Simon

sDJh 39 Posting Whiz in Training

I hope I got it as well, but I'll give it a try:
When dividing a number with DIV then it returns the result in AX and the modulo in DX.

Communicating with a microchip can easily be done via the RS-232 (COM) Port. Have a look in you OS-environment to find the port you want to use. Alternatively you can have a look in the net as mostly the ports have the same address. There is a way, and not even hard, to find the 232-port in assembly but I can find the website in the moment and don't have my source-code on this computer. Sorry.

sDJh 39 Posting Whiz in Training

Just put the file favicon.ico in the directory of that file.

sDJh 39 Posting Whiz in Training

Hi,

go to php.net and look up these two functions: date() and mktime(). The first one gets you all information that you need about a specific day and mktime creates you the unix-time-stamp that is needed for date().
When reading the documentation you should get all information you need to write a calender.
Greetings
Simon

sDJh 39 Posting Whiz in Training

the simpliest way that I can find right now is saving each occurance of a char in a new array. Basically like this:

string DB 'Hello Demonoid2008!",$
yourloop:
  XOR EAX,EAX
  MOV Al,[string+EBX]  ;reads char
  MOV BL,[array+EAX] ;reads how ofter char occured till now...
  INC BL  ;and increments it 'cause it just occured right now again...
  MOV [array+EAX],BL  ;..and saves it again
LOOP yourloop

array  RESB 256

After this loop you have a map of all occurances. You can now sort it and say "o: 3x, l: 2x" etc.

sDJh 39 Posting Whiz in Training

When accessing a database in PHP you first don't have to bother of whom the data might belong to. You can access all of them and sort out which of them is available for the user and which of them not.

Example
The database for the user looks like this:

ID  Name
1   gpdrums
2   sDJh

Now you need a connection to your files. This looks something this that:

ID  Name         User
100 coffee.pdf  1     ;which is for you
101 tea.odt      2         ;which is for me (I prefer tea =))

Thirdly you need a folder to save your files in. Create one and set a .htacces to it, so that noone can access it via HTTP. Save the files with the fileid only, eg "100" for coffee.pdf.

Now write a PHP-code that does the following:
- user logs in and you find the ID (you=1)
- access the db and just fetch just the columns where the `user` is 1 (you)
- print all these files.

Now you hav a very simple but working fronted.

Secondly, write an output for the files, because you want to restrict it with PHP:
- again check the SESSION/COOKIE for the userid
- check if the file the user wants to download has the permission.
- if yes:

header("Content-Type: mime");   //<- modifies the header so that the browser believes it is a file
header("Content-Length: ".filesize($file));
@readfile($file);   //<- outputs the complete content of the …
gpdrums commented: very helpful - thank you for the generosity and hospitality +1
sDJh 39 Posting Whiz in Training

I wouldn't do any fuss to look in the net. It takes about two days to programme yourself.

1. Write a cookie/session-login. Write the functions in a smooth lib so that you can be sure that they are working correctly - and if not rewrite them eith ease.

2. Create a DB with all information you need for you (your company) and your customer. Write an output for these data (for the customer) and an input (for you company to edit and add new stuff).

3. Write a download. Store the files in in a folder that is restricted with .htaccess and output the data via a PHP-Script.

4. Show someone that stuff and let that person try to demolish your code (if he/she doesn't get it, than you won). During that time work on the layout and the design. Add some images and icons and make the website look cool.

5. Lay back and drink a strong coffee, 'cause you did it.

sDJh 39 Posting Whiz in Training

First of all, and this is my personal opinion, is assembly much more logical. When fussing around with pointers in C++ I always mess around after a while and don't have a clou which variable stands for. In assembly the compiler (or in this case the assembler) doesn't bother which type of variable you use. It just distinguish between an immediate and a memory-data. Mixing around is not a problem at all.

So for me it is at first for education. Learning how computer logic really is. Not having one of these highly developed compilers that do most of the work for me.

Today assembler is still used in the industry. Think about washing-maschines or car-electronic. I can imagnine that most of that stuff is done in micro-C but there are still certain areas that a written completely in assembly.

I'm studying engeneering and have contact to many big companies here in Europe (Airbus, Audi, Mercedes, Alstrom, Bombardier, etc). All these companies are still looking for talented assembyl-programmers for their products.

sDJh 39 Posting Whiz in Training

C is good for engeneering for two very simple reasons:
1) the code is very, very light (not every computer has 4Gig of RAM => microcontroller (between 512Bytes and 4KB))
2) it can easily be ported to different CPU-architectures. Especially in engeneering most robots and machines their own CPU (think of the car-industry but also dish-washer and microwaves).
And it is relatively simple to write a c-compiler for one of these CPUs. That also makes you code portable.

sDJh 39 Posting Whiz in Training

do you use a database or file?
when having a db:

"UPDATE `profile` SET `hobbies`='coolstuff'  WHERE `user`=".$user

with a file you can do it the same way as createing it:

$f=fopen("...","w");
fwrite("hobbies:coolstuff\n");
fclose($f);

if you still have probs then post that little piece of code.

sDJh 39 Posting Whiz in Training

you can realize that with the GD-Lib (look for it at php.net). With that you can create images and write with custom fonts on it. I'm not sure if ttf is supported, but there are a lot of fonts that are. You can look for one that is very similar to the ones you prefer in ttf.

Hope that helps.

And make sure your server supports it as well (with a simple sample-script). Shouldn't be a problem normally, but it's not worth scripting the hole stuff and finding out that it doesn't work on the server afterwards.

sDJh 39 Posting Whiz in Training

I don't know how many turkish characters differ from the ISO-Standart, but if there aren't many, you could try to mask them like for "ü" etc. You save then the masked code in SQL, fetch the data later and unmask it ""=>"ü", etc.

That might help, just is a hell a lot of work, when there are many characters to mask.