sDJh 39 Posting Whiz in Training

then why don't you vary the names of the textfields? Eg

name="name<?echo date("Y-m-d")?>"
sDJh 39 Posting Whiz in Training

Hello All,

I have a chat friend online who said to me that if I don't know java or .Net then my web design will not make me money.

I know how to program in php, asp html etc and willing to learn more as knowledge has no age limit.

I wanna know the benefits and weaknesses in these three languages - Java, php, asp, .net so as to be in IT market as well which of these languages is more friendly and most popular in IT profession.

Thanks

first of all: I agree with the posters before me.

My opinion: You chat-friend doen't make money with webpages. My personal experiences say that in most cases people don't want to get anything in JS or JAVA. Secondly, if people don't care, then they don't have a clou and are just happy when everything works the way they want it to.

What language you want to learn depends on the area you want to work. Developing websites can only hardly be done in C or C++ whereas developing stand-anlone programmes don't work with PHP (at least basically).

A good language to start with is definately PHP. For three simple reasons: it is easy to learn but very powerful, you can get nice results in a very short time which motivates you and most important: it is easy to earn money with. Until you programmed an app in C than you can sell may take you several years.

sDJh 39 Posting Whiz in Training

That's not entirely true, PHP has functionality to import Java classes and manipulating your javascript through PHP is an an essential tool.

Back to the problem at hand: Paypal has an extensive PHP API available, poking around their website will help you out.

PHP is just a server-site programming-language. The code is generated once and when the output is sent it cannot be modified by the client anymore.
Javascript and Flash are executed on the client's machine. The website is can react on events.
JAVA can do both if the server also runs a JAVA-Server.

So PHP for me isn't the ultimate high-end programming language. It is just perfectly for organizing files on the server and creating dynamical websites. One very import advantage: PHP is very secure when you don't mess around too much.

sDJh 39 Posting Whiz in Training

Proberbly you don't have access to the PHP.ini. If you just want to hide a file you can put it into a directory with a .htpasswd (a 403 pops up) and then read these files with PHP, eg

echo readfile("./forbidden/test.html");
sDJh 39 Posting Whiz in Training

HTTP doesn't transfer any information about the form, because the website generates the code itself. I believe that the tag "name" was added with JavaScript to access these field in JS.

But what do you need it for? The only thing I can imagine is one of these phishers or cookie-grappers. If you want to know how this works you better don't ask me.

sDJh 39 Posting Whiz in Training

Of course you can. Basically everthing ist possible with PHP, even complicated stuff when you extend it with system-specific functions.

Things that generally cannot be solved in PHP:
- JAVA (Chat, Games)
- Flash (Animations, Games)
- JavaScript (Eventhandling and Website-manipulation)

sDJh 39 Posting Whiz in Training

I also learned Assembly years before I started really using C. C is still for me the language that I struggle most with. What I don't like about C is:
- type-casting
- pointers
- platform specific code
These three points are much, much easier in ASM, because the assembler doesn't restrict any casts. A value is a value and the programmer decides what to do with it.

I'm also working with microcontrollers (ATMEL). When writing normal codes (loops, conditions, output) I always use assembly, because I'm much quicker than in C. Even my friends who are all working in C are not faster than I am.

And I don't feel like an old animal =).

sDJh 39 Posting Whiz in Training

@jstorz: Every normal forum uses an insecure HTTP-connection when loggin in. Often the password is even saved uncrypted in a cookie. So when sending the password via HTTP it's not insecurer than any other website.

@cybernet: Of course you can use https. There should be an openSSL-module for PHP that you can use to crypt your request.
The problem with SSL is you need a certificate that costs you some bucks. What I do to get around is to crypt usernames and passwords with RSA or MD5. RSA can be written easily (see wikipedia for details) and MD5 is already included in PHP.

So what you do:
Page one (requester) crypts the data and sends it via HTTP to page 2. Page 2 decrypts data and looks if data are correct. If yes it just have to echo "correct". You 1st page reads "correct" and knows that the user is logged-in.

sDJh 39 Posting Whiz in Training

Put a variable in the form-element say

<form action="save.php?mode=edit">

In save.php you just have to distinguish between a new post (mode=="") and an update (mode=="edit").

sDJh 39 Posting Whiz in Training

Why should the user see the password when you access the data via PHP? Do you want to thank thet website by writing "Data from ...&password=unknown"? If not then the user doesn't see anything at all.

The PHP-Script on x2.com only needs to say "okay" or "incorrect". When accessing "okay" on your first server, then you know that the userdata where okay. Save it with Session of Cookie.

sDJh 39 Posting Whiz in Training

You can try to access the server directly: http://de3.php.net/manual/en/book.ftp.php. You better try it with a sample code because many server are restricted.

Once you have the data, it shouldn't be a problem for you to import the stuff into your database.

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

Of course it is. You have to write your own lib with functions for in- and output. It just is quite a fuss.

Try to google a bit, because C-Compilers can convert the code to assembly. This actually makes the code unreadable (in my opinion) but saves a lot of time and nerves.

sDJh 39 Posting Whiz in Training

You can use any of these registers. The data is stored until you/your generated code that overwrites or chages it by some functionst. eg.

MOV EAX,100h   ;<- stores 100h in EAX
some code here
MOV EAX,0    ;<-clears the register
XOR EAX,EAX ;<- clears the register as but faster
ADD EAX,EBX ;<- adds the value of EBX to EAX

If you don't know what the generated code is doing, then you better store it in memory. Define a place to store and then change it:

myval DD 100h  ;<- at that position 100h is stored
MOV EAX,[myval]  ;<- now EAX has the same value
MOV EAX,200h ;<- new value for EAX...
MOV [myval],EAX  ;<- .. that can be saved in myval.

Whereas myval can be defined anywhere you want apart directly in the code. The best is, you put it at the end (which should be done my the code-generator as well).
In this case you can always be sure, that the variable won't be overwritten.

sDJh 39 Posting Whiz in Training

Is it for an examination?

1) Go to microsoft.com and look for the official FAT32-documentation (it's quite good for microsoft-standart).

2) Some basic information:
The first sector which identifies the filesystem, size, etc is at the position (CMS) 0,0,0 or at the first cylinder (CMS) 1,0,0. Read it with INT13 (http://www.ctyme.com/intr/rb-0607.htm, http://www.ctyme.com/intr/int-13.htm).
Now dump these data and try to figure out the structures as promised in the docs.

Then you need to look for the table that saves which sectors are free (CMS/LBA). Should be given in the doc as well.

When you are lucky than that's all. Reading and writing the files/dirs to the disk can then be done by the OS.

When you have some stuff it would be nice if you drop me a line. I'm also interested in FAT.

Regards.
Simon

sDJh 39 Posting Whiz in Training

I was just working with my normal computer and tryin to access my keyboard. Unfortunately I don't have time to realize that project even though it still interests me.

When using one of these small ATMEL-processors, then you can find a lib for it. Maybe you can sort some information out of it. (http://www.atmel.com/)

sDJh 39 Posting Whiz in Training

I would solve it a bit different, because some browsers have problems displaying images like this.

Write another PHP-File that just outputs the image. Then use

<a href="image.php?id=1">

in your first script.

I hope that helps.
Simon

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

You need a semicolon after the string in echo. eg.

echo "<a...>";

.

sDJh 39 Posting Whiz in Training

Hello all together,

I've a JS-script that forces the mouse pointer to become a hand. It does work perfectly on IE, Opera, Safari and Konquerer (that's what I've tested so far). Just FireFox doesn't want to change the icon. What's the matter?

Here is the script:

document.getElementById(wid+'0a').style.backgroundColor="#E0E0E0";
document.getElementById(wid+'0b').style.backgroundColor="#E0E0E0";
document.getElementById(wid+'1').style.backgroundColor="#E0E0E0";
document.getElementById(wid+'1').style.cursor="hand";   <= Problem is here!

The elements "wid0a", "wid0b" and "wid1" are cells in one row. The first two cells are for formatting reasons.

In the JS-code first three lines are okay (changing the background color). But the fouth (changing the pointer to a hand) doesn't work.

Thanks for your replies.
Simon

sDJh 39 Posting Whiz in Training

FDisk should work. A floppy is a normal FAT32-partition.

If not, I believe, you can find good codes for formating disks in FAT.

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

Use

header("Content-Length: ".$filesize($fullpath));

to add the size of your image as well. It then should work.

sDJh 39 Posting Whiz in Training

That depends on you browser, of course. In IE (I just can guess) it is stored in Windows\Temp in a normal textfile. Opera saves all cookies in one file but but you can edit the cookies within the settings.
Firefox, Safari, Konqueror, etc save the cookies somehow else. But as I'm not using these, I don't know exactly how it works. You have to try out. Set a cookie and then use the Windows-Search-function to scan all files on your harddisk that may have stored the data from your cookie.

sDJh 39 Posting Whiz in Training

Of course you can.

The error ays that the image doesn't exist. Make sure your script is in the same dir as you image, then try to add a "./" at the beginning of image-name. And if all doesn't work, that you could try to delete the image giving the complete path (eg. "/home/acmeart/public_html/mercury/image/thumbs/thumb_1.jpg").

Probably you don't have the permission to unlink the file, but then I guess the error would be a different.

sDJh 39 Posting Whiz in Training

Personally, I haven't. But I am interested in writing USB-programmes as well. A very good place to start is usb.org. It is the official website for the USB-interface and provides many useful information and documentation.

If you have you first successful code, please let me know.

Regards Simon

sDJh 39 Posting Whiz in Training

???

When you access and search through a file you need a pointer anyway.

MOV AL,[file+EBX]

So write a routine that compares a string and a string (file) with an offset.

;ESI: string1
;EDI: string2
PUSH EBX
MOV ECX,string1length
cmp_loop:
MOV AL,[ESI+EBX]
MOV AH,[EDI+EDX]
CMP AL,AH
JNE cmp_false
LOOP cmploop
STC
POP BEX
RET
cmp_false:
CLC
POP EBX
RET

(This code returns CF=1, when the string occured)

If the string occured in the file, then you just can print the pointer (in my case EBX).

That should be all.

sDJh 39 Posting Whiz in Training

is that programme already running? Guess you have to solve that with C using events. Can't imagine that using the Linux-Kernel/the WinAPI with ASM is done in a few minutes.
Win and Linux are sending a kill-signal a soon as the user shutsdown the computer. Don't ask me how you can access this signal exactly but there should be some documents out there in the web.

When you want your programme to be started when the user suspends the computer then I just see the way to write another shutdown-programme. Use C to access the command "shutdown" (which is the command for shutdown), compile it, add an icon to it and place it on the desktop. When the user want's to shut down the computer he/she has to open your programme that runs a script and then suspends the PC.

Hope that helps. If it's what you are looking for, than ask again and try to explain your problem again.

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

I prefer NASM. It is totally free, has a very good performace and supports the native Intel-Syntax. The code is very clear.

Many examples in the internet (and also programmes) are written in the NASM-Syntax, so you don't always have to rewrite the codes you find.

Linking can be done with LD. It is also free.

If you are using Linux have a look if both programmes are already installed with you distriution.

sDJh 39 Posting Whiz in Training

I'm sorry, but I didn't understand your first question.

To print a string backwards, you can use two ways. First you print it directly the other way round:

MOV ECX,stringlength
MOV EBX,ECX   ;stringlength as well, but better performance; EBX: Vector
printloop:
DEC EBX  ;let the vector move to the beginning
MOV AL,[string+EBX]  ;get the char
;printing stuff (dont' know BIOS-Interrupt, google a bit)
LOOP printloop  ;repeat

This code stores the chars of the string the other way round and prints it on the screen.

or, in my opinion, the better way:

MOV ECX,stringlength
MOV EBX,ECX   ;stringlength as well, but better performance; EBX: Vector
XOR EDX,EDX   ;EDX: Vector for 2nd string
printloop:
DEC EBX    ;let the vector move to the beginning
MOV AL,[string+EBX]  ;get the char, but this time...
MOV [string2+EDX],AL  ;store the char in the new string
INC EDX   ;increase the vector of the 2nd string
LOOP printloop   ;...over and over again
;print string2

This time the code saves the string in string2 (new memory). Then you can not only print it but also use it for further calculation.

sDJh 39 Posting Whiz in Training

Do you mean a visualization of statistics? Then you could use the GD-Lib (see on php.net) to create images with you graph. Or in a bit simpler way just use HTML-Tables.


A "loading, please wait"-bar is a bit more tricky. I can't see any other solution then Flash. But you could get around it by using an animated GIF

sDJh 39 Posting Whiz in Training

favicon.ico is not neccessary. The PHP-logs don't show an error but a warning. If you want to add you own icon, you just have to place it in you root-dir.

sDJh 39 Posting Whiz in Training

first: you could try to access your databse directly (eg. mysql_connect("http://www.blah.com"); ). But that's in most cases restricted.

so you better do it this way:
write a simple php-routine and put it on the server where your database is running. Select all data you want to display on the other one and just echo them so that you get a plain text.
On the other server you can get these data with pfsockopen (http://de3.php.net/manual/en/function.pfsockopen.php).
For security you can have a simple password that you send via HTTP (a bit unsave though). If it's not enough then crypt it with MD5 or RSA (see wikipedia).

One more thing: pfsockopen is also restricted on some server. So try it out before you do all the fuss with coding.

sDJh 39 Posting Whiz in Training
if its plain text you can use:
$f=file("./blah.txt");
$c=0;
for($x=0;$x<count($f);$x++){
if(strstr($needle,$f[$x]))$c++;
}

Sorting can be done with assosiative arrays and the command asort.

sDJh 39 Posting Whiz in Training

use the MySQLAdmin-Tool (which is somehwere in you bin-dir). There you can add and remove users.

sDJh 39 Posting Whiz in Training

for a good tut hav a look on php.net. It's the best documented site for php in the net.

the form is done in html

<form method=post action="save.php">
Your name:<br>
<input type=text name="name"><br><br>
Your email:<br>
<input type=text name="email">

This code sends the data to save.php. In PHP you can get the variables like this:

$name=$_REQUEST["name"];
$email=$_REQUEST["email"];

Saving that stuff in txt:

$f=fopen("filename.txt","w");
fwrite($f,$name."\n");
fwrite($f,$email."\n");
fclose($f);

For PDF you can find a library on php.net. Doc maybe as well, but I'm not sure.

If you want to have a variable form you can make up you own stylesheet. Eg: style.stl

Your family-name|name|text
Your christian-name|cname|text
Your email-address|email|text
Your password|password|password
Your comment|comment|textarea

Read the lines from that file (have a look in a tut, I'm too lazy in the moment to explain) and explode them (see next example). With simple conditions you can style your output.

In save.php you do basically something like:

$f=file("style.stl");
$f2=fopen("output.txt","w");
for($x=0;$x<count($f);$x++){
$t=explode("|",$f[$x]);
fwrite($f2,$t[1].": ".$_REQUEST[$t[1]]."\n");
}

this code recieves the variable-names from your form ($f) and saves it with the data in "output.txt" ($f2).


I hope this helps. If not, than ask again.

sDJh 39 Posting Whiz in Training

of course you can.

you write a normal login-script and if the password is incorrect you just save a timestamp and a variable in you DB or textfile that you increment each time a wrong login is done.
Having more than 10 incorrect login attempts, you disable the account (again a new variable). The next login you check the time and if the last login is more than 5hrs ago, you enable the account again.

sDJh 39 Posting Whiz in Training

hmm... not neccessarily.

You can also split it up in two html-pages if you want.

<?
if($set==true){
?>
<html>
... following page 1
<?
}else{
?>
<html>
... following page 1
<?

Or if you want to use the same layout:

<html>
<body>
Style, style, style
<?
if($set==true){
?>
Congratulation! You are a member!
<?}else{?>
Please insert your name.... *form*
<?}?>
</body>
</html>

keep in mind, as buddylee says, the server doesn't bother about your html. It executes the php-commands and outputs its result. HTML is then rendered by the browser.

Greetings
Simon

sDJh 39 Posting Whiz in Training

I hope I got you this time.

You have an index-file with a couple of includes

include("./report1/1.php");  //Page 
include("./report1/2.php");  //Page 2

and you want each page to have a unique ID at the bottom.
Do you know where the page ends or do you want to find out?

If you know, then you can just insert a running number.

$nb=1;
include("./report1/1.php");  //Page 
$nb++;
include("./report1/2.php");  //Page 2

If you have to find it out, than it shouldt be possible with CSS. I can't tell you exactly how (im not fluent to CSS) but I would start with something like:

<html>
<head>
<link type=stylesheet href="style.php?id=report1">

and then generate in style.php dynamic CSS-Script that numbers you pages.
But for CSS I guess you better ask in the "Web Design" Forum.

Regards.
Simon

sDJh 39 Posting Whiz in Training

how do you mean?
you want to number each php-script you have? or do you have an output (like a forum, onlineshop etc) that you want to chunk up.

1) numbering you php-files: do it with en external text-file. write the name of the file and add a number:

index.php|1
main.php|2

You can then get the name of the php-script with

$PHP_SELF

and figure out the page-number from your textfile. That helps you to reorganize you project when adding or removing files from it.

2) splitting huge pages up:
When using a DB it is simple. First, get the number of rows:

SELECT COUNT(`ID`) FROM ...

. You can then restrict the output from MySQL for instance with

LIMIT 0,9

. That gives you the first 10 entries from you query. On page two you use

LIMIT 10,19

for the next ten entries and so on.
Using a textfile-system it is a bit fuzzier. Write similar functions like getallentries, getlimitedentries, and so on to keep you code tidy.

sDJh 39 Posting Whiz in Training

1) finding out files on the server:

$dir=opendir("./thatswhatiwant/")
readdir($dir)   //"."
readdir($dir)   //".."
do{
$file=$readdir($dir);
echo $file."<br>";
}while($file!="");

or you save all files in a thumb.

2) Selecting and printing the stuff in a textbox is made in JS. Use something like textbox.value+="; "+selected.value
or you use the html-list with multiple-entries (don't get the tag right now) and name it

... name="files[]"

important are the brakets. In php you can then get all of the selected files.

I hope that helps. If not, then, well, just ask again ^^.

Simon

sDJh 39 Posting Whiz in Training

unlikely.
you could try to connect your smtp-server with fsockopen http://de.php.net/manual/en/function.fsockopen.php and then send emails via the smtp-protocoll (which isn't very complicated). But I guess if you sever has disallowed mail() it also has restricted fsockopen().

In worst-case you have to find yourself a new server.

sDJh 39 Posting Whiz in Training

try:

echo "document.write(\"<div class=\"txt\">Pagerank: ".$rank->pagerank." <br>\")";
echo "document.write(\"Alexa: ".$rank->alexa_rank."</div>\")";

in the PHP-code.
If it doesn't help then open that JS directly in your browser and tell us the error-reporting.

sDJh 39 Posting Whiz in Training
sDJh 39 Posting Whiz in Training

PHP is very simple and that's the reason why it is so popular.

So doing it step by step:
0) get a homeserver (Apache with PHP and MySQL - you can use Xammp).
1) Set up a database and save job number and the password together with the article (eg `nb`,`pw`,`art`)
2) write a systemfile in db and put your code in simple functions:
function opendb()
mysql_connect...
end function
function checkjob($nb,$pw){
opendb()
$r=mysql_query("SELECT `art` FROM `db` WHERE `nb`=".$nb." AND `pw`=".$pw);
$a=mysql_fetch_row($r);
return $a[0];
}
and so on.
3) write you code. $art=checkjob($nb,$pw);
echo "You article is: ".$art.". How can I help you? ...";

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

Hello everybody,

I have a question about one of these scanners with automatic document input. I regulary have to make copies of documents, that are printed from both sides. I had a look on these douplex-scanner but they are very expensive and big.

Now it wouldn't be a problem for me to scan these documents twice (front and back). I just have to make sure, that the documents are in the same order (or just the other way round), because afterwards front and back have to get tied together again.

Now I'm using a simple HP-scanner (it's brilliant for photos and single texts - just a hell a lot of work for hundreds of docs). I name the files something.1 and something.2 (front and back) and somethingelse.1 and somethingelse.2. It really is a fuss.

So how do these machines work? How do they name the output-files, what format do they use? And any experience if they mess the documents around?

Many thanks
Simon

sDJh 39 Posting Whiz in Training

Guess you can do it in java or flash. Or you write you own lib and access it via exec. Could be worth trying it.

sDJh 39 Posting Whiz in Training

???

1) outsource the creation of the image. Make a image.php where you put your code into.
2) make a new file, write a html-hyperlink, and then use <img src="image.php">

should work.

You cannot output an image after having used html-syntax. So image-creation has always to be outsourced.