sDJh 39 Posting Whiz in Training

a) I don't know. And for me it would take too much time to find out. Just write a code like that:

$a=mysql_fetch_row($result);
$sum=array_sum($a);//http://de3.php.net/manual/en/function.array-sum.php
arsort($a);//http://de3.php.net/manual/en/function.arsort.php
$max=$a[0];

b) why not? Save a unique ID for each user in your `player_stats` and `player_pics` and select the image from `player_pics

sDJh 39 Posting Whiz in Training

What kind of ideas are you looking for? I can't really see a problem. Just create a file, with all options given by the author and save an array after a specific symbol (I always use a pipe "|") with all users that have already voted. To know how many users have voted you just need to call "count()". On the other hand you can simply check whether a user has already voted or not.

sDJh 39 Posting Whiz in Training

It's not so easy to explain in words , I think, but don't worry it's quite easy to solve in PHP. You have to decide wether you want to use a database like MySQL or not. It's not really necessary, but can make changes to the code easier in the future.

I personally would prefer the database. And I would create just one tables for all position an order can be. But again this is no need.

Try to do it like this:
Create a table with the following columns: ID, Position, Student, Rejected or something like that. Now when a student wants to leave (student.php), you store a new row in the database with the information about the student and set the position to 'warden'.
In 'warden.php', or whatever, you simply output all columns that have the position 'warden'. If the warden accepts it you update the position to 'keeper'. If not, than the field 'Rejected' is set. The same is to be done for the keeper.
In 'student.php' you fetch all rows that are posted by that specific student. You can show the author, at which position the request currently is and if the request was rejected.

I wouldn't do anything special with the administration. If the administrator logs in he/she can simply read all entries.

That should give you a good start for your project. If you still have questions than feel free to ask. If you have problems with …

sDJh 39 Posting Whiz in Training

You should probably ask in the Javascript forums as this can't be done in PHP. And honestly, if you really want the arguments passed to PHP to be shown in the webbrowser's addressbar than you're better of not using iframes.

[EDIT]
The only thing that I can think of to solve your problem at least is to use the global variable $SERVER. It's an array that contains information about the scriptname, the arguments passed and so on. Have a look here: http://www.php.net/manual/en/reserved.variables.server.php

sDJh 39 Posting Whiz in Training

Hi ShawnCplus:

you could be right. But how do I crate an array then? Trying to define it with

$bes=array()

doesn't work either.

Cheers
Simon

sDJh 39 Posting Whiz in Training

Hello folks,

I just updated my homeserver to PHP 5.3.1 and I get now the following error when executing my scripts:

Cannot use string offset as an array

The variable looks like: $bes[$a[3]][$a[4]][$a[6]], where $bes is a three-dimensional array that holds all information I need during runtime. The $a's can basically hold the information about a location, a day and an hour. So after runtime I have a nice smooth table of all information I need for a place and a time.

So the problem is, that the main variable causes the problem. Replacing it with something new means to rewrite the whole code. And this is as you know awful work and costs quite a few bucks.

The old server (online): Apache 2.0.54 / PHP 4.3.10-22 (Debian, I guess)
My new home server: Apache 2.2.14 / PHP 5.3.1 (opensuse 11.2)

So has anyone experiences with reorganisation of old PHP-4-code? I tried to use intval() to make all possible strings to ints but that doesn't seem to do the trick.

Any help is much appreciated!
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

That shouldn't be hard at all. When you use one of the newest versions of phpMyAdmin this function is already available. Just go to export data and choose PDF.

If you want to write an export yourself, you have to get to know how the PDF-library of PHP is working. Have a look at http://php.net to find the official documentation to all stuff that is possible in PHP.

sDJh 39 Posting Whiz in Training

hi cpsusi,

I can't find anything wrong with your assembly. The C++-output however looks awful. And I also don't have a clue why it perform worse than your C++-code.

A reason might be, that MASM puts tons of unnecessary stuff to your simple code. Try NASM instead. That really is a reliable and fast assembler. Maybe you can get the programm run faster than compiled in C++.

sDJh 39 Posting Whiz in Training

hi operator,

you are right! I never noticed that before. Could simply be a trick for the CPU-manufacturer to find out, if just a byte or a whole word is to be changed.

Don't take programming-life too seriously. You'll find so many just remarkably funny thinks especially when programming assembly.

Bye
Simon

sDJh 39 Posting Whiz in Training

look for ralf brown. The godfather of interrupts: http://www.ctyme.com/rbrown.htm

sDJh 39 Posting Whiz in Training

I can't tell you exactly how it works under Windows as I haven't tried it for a long time now.

With FTP or AFS you can basically access servers like the drives in your computer. Just google a bit and try to find something like "FTP Mount Windows" etc. Then you can maybe choose the webserver as the drive where you want the download to store. This at least works perfectly under UNIX.

If you're doing it with PHP, then you can have a look at the FTP-documentation and write something like that yourself. It's a bit work but actually not too tricky.

sDJh 39 Posting Whiz in Training

Try a very simple trick:
Just put

<?echo "blah";

directly at the top of the current PHP source code where you want to modify the header. Then run the code and open the HTML source code in your browser and have a look what stuff is put before "blah". Then you can easily find the module that actually puts text before your header-modification.

sDJh 39 Posting Whiz in Training

This definitely is a case for replacing some part of the hardware. I can't guarantee you anything - I don't know how long you own the computer. But apple should do it for free or do it for quite little money. I bet it's worth going to the apple store.

sDJh 39 Posting Whiz in Training

Hi Parva,

Having screen artifacts is definitely an hardware-error. You don't have to have any insurance as this is covered by the guarantee. If the guarantee has run up, you still should get help for (little) money.

The reason for the artifacts can be quite a few. Maybe your screen isn't plugged correctly to the graphic-card or the crystals in your display are broken. In your case I would insist to find the problem at the apple store. Then they can tell you how much it will cost and in case it's not too expensive you simply go for it.

sDJh 39 Posting Whiz in Training

Hello Parva,

first of all: I can't imagine that the problem is caused by the game.

Very strange problem you have there. Personally I would try to replace the computer completely.

What you can try is:
1) Check if your harddisk is full. This may cause the OS to slow down when having used the complete amount of RAM (but I don't think so).
2) Go to "Applications -> Utilities" and open the programme "Activity Monitor". Sort the list of running threats by the percentage of CPU activity. If you have an app running it should be in the range up to 30%. If you have an app that consumes more than 100% stop the process and look if your computer runs more stable.
3) urgently go back to your apple store and insist that your computer defiantly has a problem. It might also be something with your hardware.

That's what I think about your problem. As I said, the easiest thing would be to try to get a new iMac. Never heard about such a problem. I guess it's something serious.

Simon

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

Yeah, I know. But you cannot send variables with a space via HTTP. So replace the names of your HTML-Tags with "_"'s.

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

What you could do, but really bad style, is making the document refresh automatically with

<META http-equiv="refresh" content="...">

or JS

document.location.href="..."

If you just want to split up your code, than you can access the output of a php-file with

fopen("http://yourserver/yourfixle.php");

but this may make the whole stuff slow down.

But why do you want to run a script when a user is not viewing your site?

sDJh 39 Posting Whiz in Training

Hi vista,

I'm not used to to MASM-syntax as I'm usually working with NASM or the AT&T-syntax. RESB X means "reserve X Bytes". You can use "DB" 26 times as well but makes the code longer.

I guess "dup" stands for duplicate. You have to make sure that you only reserve 26 Bytes of memory. Is there a command like "dbyte"? Or you define just 13 words, as words are two bytes.

LINE 12:
In line 12 I copy the character of the string at position EAX to the register DL. I know it's written different in MASM, but please don't ask me how. Have a look in your handbook.

If you still have questions, feel free to ask =).

Simon

sDJh 39 Posting Whiz in Training

well that's basically quite simple though. Add an array with 26 fields to it where you store the number of occurrences of a character. eg:

countlist  RESB 26
XOR EBX,EBX
XOR EAX,EAX
XOR EDX,EDX
l1:
MOV AL,[ESI+EBX]
SUB EAX,65    ;so that A=0, B=1 etc
MOV DL,[countlist+EAX]
INC DL
MOV [countlist+EAX],DL
INC EBX
LOOP l1

After having executed the code the table has stored the number of all characters in the string.

Remember to clear the array before you call the procedure again.

sDJh 39 Posting Whiz in Training

Don't know what you really want, but you could have a look at phpMyAdmin.

sDJh 39 Posting Whiz in Training

Well I guess, noone is interested to read your code. If you have a question, that please specify your problem and post just a few line where you think the problem occurs.

sDJh 39 Posting Whiz in Training

Hi van_smiles,

it actually doesn't matter which database you go for. MySQL is totally okay.

The login-in-script has to be done in a programming-language and I guess, as you are in the PHP-forum, you want to use PHP. The login is in general nothing really special.

1) You need a form that will allow the user to enter the username and password. Try something like this:

<html>
<body>
<form method=post action="login.php">
Username: <input type=text name="username"><br>
Password: <input type=password name="password"><br>
<input type=submit>
</body>
</html>

Clicking on "Submit" and the entered values will be send to login.php. So you have to create a file call "login.php" with the following code:

<?
$username=$_REQUEST["username"];
$password=$_REQUEST["password"];

//fetch your data from the database here....

if($username==$dbusername && $password=$dbpassword){
echo "welcome back, ".$username;
//store a value, that confirms, that the user has logged on
}
?>

If you need help how to fetch data from a database then ask here or have a look in the forum. There are plenty of tutorials that explain how to do that. I'm a bit to lazy to explain it right now.

Hope that helps for the moment. Feel free to ask if you still have problems.

Simon

sDJh 39 Posting Whiz in Training

I definitely have to contradict you! There's nothing that I hate more than giving people wrong advice, especially if these kind of person don't seem to have a single clue what they are talking about! And on top of that: Why not protecting if it's so simple as today?

@all: Always, but really always protect your computer! Don't discuss whether you have Windows, Mac, Linux, ChromeOS or any system that comes up in the future running. Every Operating System does have vulnerabilities in the source-code. And every operating system can be attacked by hackers and viruses.

Also remember: even the best antivirus-software doesn't give you an absolute protection. Always be careful what programmes you install and who you let work with your computer. So the best thing is to keep these 4 guidelines in mind:

1. Always create TWO accounts! First one as administrator (or root under Linux) with a very strong password and DON'T use it. This account is just for changing the preferences of the system. And try not to be online while using it.
The second one is your normal account that you use for office, web and whatever you do. In 1 out of 50 days you don't even have to login with the administrator password.

2. Activate the firewall and install a virus-software! Maybe your computer will never be attacked by hackers because they can't modify your system as you work with your second account. But maybe a bug in …

Danarchy commented: Poster knows of what he speaks. 2 of my browsers got hijacked so it does and will happen. +7
sDJh 39 Posting Whiz in Training

Hi Xlphos.

I copied the iso myself but don't ask me which command I used.

I solved the problem yesterday. I could rewrite the MBR on linux with cfdisk. After that MacOS formated it correctly. That wasn't really a shortcut ^^but it did solve the problem though.

Many thanks
Simon

sDJh 39 Posting Whiz in Training

Hello altogether,

a couple of weeks ago I updated my linux-system and copied the ISO-Image on an USB-stick so that I can boot it. It did work though, but now I don't have a clue how to format it back to a FAT32-system.

Any idea?

Thank you!
Simon

sDJh 39 Posting Whiz in Training

Simply point yoxur browser to http://serverip/ where serverip is the current IP address of your computer that runs xampp.

sDJh 39 Posting Whiz in Training

You men the voice that reads the text on the screen? I don't know which version of MacOS you have, but try "/Applications/Utilities/VoiceOver Utility.app". There you can unchek the option.

Hope that helps.

sDJh 39 Posting Whiz in Training

If you still can't find the folder, the last chance you have is FileSavage (about 50$ quit) or the testdisk-utility. I do prefer testdisk, because it's for free and has very good results. During the last scan it found data, I deleted about two years ago.
The only drawback of testdisk is, it doesn't have a nice GUI. It's quite a simple terminal-window. After having started the programme, it scans the whole hard-disk, so it takes some time (80Gigs in nearly an hour for me).

Hope that helps!
Simon

sDJh 39 Posting Whiz in Training

I always suggest: Just because you don't use Windows it doesn't mean, you don't have to bother about antivirus software, firewall and system upgrades! Every code, even written under Steve Jobs, is somewhere buggy, every developer will forget about a security issue, and it just a matter of time until someone who is interested in demolishing a system will find it out.
When you care about your system, actually every OS is secured. I just believe, that MacOS is in the moment, the one that you have to care at least about. But that never means, you don't have to at all!

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

The difference between $_POST and $_REQUEST is simply, that $REQUEST handles POST as well as GET variables. So don't mind about this.

Now seeing if the user has selected a checkbox you can simply access the variable in PHP. Example:

Your form:
<form method=post action="output.php">
<label><input type=checkbox name="checkbox1" value="helpivebeenclicked">Please click me, I look like a frog, but I'm a princess!</label>
<input type=submit>
</form>

Your PHP-Skript "output.php"
<?
$checkbox1=$_REQUEST["checkbox1"];
if($checkbox1=="helpivebeenclicked"){echo "User released the princess!";}
if($checkbox1==""){echo "User denied clicking the frog.";}
?>

If you now name the checkbox "whatevericanthinkof" the variable in PHP is also called "whatevericanthinkof". I you set the value of the checkbox to "donthaveanyidearightnow" the variable will be set to "danthaveanyidearightnow" and so on.
If the user hasn't clicked the box, the variable is simply an empty string.

sDJh 39 Posting Whiz in Training

You just need a single form-element, which goes around all of your checkboxes and a submit-button at the very end. Then the state of the checkboxes are represented in PHP by simply having a variable named after your checkbox set to the text you put in the "value"-element. If the user hasn't clicked the box, the variable keeps empty.
Example:

<?
$cr=$_REQUEST["cr"];
$bt=$_REQUEST["bt"];
$cr=="checkbox" if clicked or $cr=="" if not clicked
sDJh 39 Posting Whiz in Training

How about trying your WHERE-Clause? My best advice is to echo your query, examine it and check Mysql_error() or just copy and paste it to PHPmyAdmin. Some sort of this question can't and won't be answered by anyone here in the forum.

sDJh 39 Posting Whiz in Training

Are you sure? Normally, when using session_destroy() the cookie isn't deleted - you have to do it manually. Maybe, you can post your code here, so that people get an ideo of your problem.

sDJh 39 Posting Whiz in Training

Check if the webserver has permission to write to your tmp- and your destination-folder. This is the only thing I can think of right now.

sDJh 39 Posting Whiz in Training

I can promise you, there's nothing easier than this:
1) rename your html-file to the extension ".php" so that your parser knows it has some code to execute.
2) Everywhere you want PHP-code you can simply include it in your HTNL:

HTML-style-formatting
<?
your PHP-code comes here
?>
and HTML-style-formatting again

That's all you've to do.

sDJh 39 Posting Whiz in Training

Hello everybody,

I use a HP Scanner with ADF and the programme "HP Scan Pro" under MacOS 10.5. The scanner saves the documents in a folder and openes my self programmed application. I can perfectly work with the files. Just HP Scan Pro reports after about 10 seconds (translated from german): "The application couldn't be started. Try to restart it. Resize the virtual memory if the problem still occurs."

I guess I have to tell HP Scan Pro somehow, that I recieved the scans and that I can work with them. Does anybody know how to do it? Or can anybody tell me where I can get support?

I know this is a very tricky question, so many, many thanks in advance!
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

Hello alltogether,

it's a really silly question actually, but I just can't figure it out. I want to write a simple server, that serves the HTTP-protocoll (Port 80). The connection does work, when I let the programme run on port 8080, but Mac OS prohibits the connection on port 80. What can I do?

Many, many thanks
Simon

PS I thought I posted this thread yesterday already, but can't find it anymore. So if the old thread still exist, please delte this one.

sDJh 39 Posting Whiz in Training

Umm... not sure. You can try to set "cellspacing=0" and "cellpadding=0" in each <td>. And you have an "</a>" in each field without any opening tag.

sDJh 39 Posting Whiz in Training

It seems, as if you can't unlink the file. Try to write an @ before unlink (eg @unlink()). That makes the PHP engine not to print the error occured.
I can't tell you, why you don't have the permission to unlink the file but at least the execution of your script will be fine.

sDJh 39 Posting Whiz in Training

Not directly. To shutdown the computer or reboot it, you can simply use direct hexcodes. Reboot for example is

DB 0EAh
DW 0000h
DW 0FFFFh

When you run your programme without an OS you can put your code in the interruptvector (should be many tuts in the net). But if you use your programme yourself (so if you don't intent to write your own OS ;)) it's not neccessary.

sDJh 39 Posting Whiz in Training

I guess that during the encodation of the zips under PHP or whatever the engine writes a space, a carriage-return, a line-feed or any other ASCII-character that normally doesn't cause any problems. Now when PHP executes it, the engine thinks the HTML-code begins, sends the HTTP headers and then stucks when it comes to modify the header.

That's my only explaination I can think of. But it's quite interesting to know what really is the problem.

sDJh 39 Posting Whiz in Training

Do you execute the scripts on a server or on your local machine. When I changed to Mac, I had sometimes a few problems with the configarion of my apache. It had some trouble where my server on the old Win didn't say anything. Then you have to debug your code. In my case it wasn't really bad. Just had a few "untidy" lines in my scripts that did some trouble with the different linebreaks on Macs.

When you have your scripts on a server and get them via the internet, then jbennet is right. Could it be that you developed under IE? That often caused trouble because IE has a very bad decoding engine and when programmer stick to that many other browser misunderstand the code.

sDJh 39 Posting Whiz in Training

The format of MP3 isn't as difficult as one might think at first time. Information like title, author, album etc are simple string stored at the end of the file. This section always starts with "ID3".
To get the length of the song you need various information. The number of tracks (eg mono, stereo, surround), the frequency used and so on. Then you have to skip through the so called "blocks", read the current compression rate (not all MP3s are encoded with a constant bitrate), add them all together and divide by a quotient of the stuff you found out at the beginning.
Personally, I never did that in PHP, but I used some of these files to figure it out: http://www.wotsit.org/list.asp?page=3&fc=12&search=&al=
It might be quite fuzzy at the beginning, but keep going. Once you understood the basics of MP3, you'll get on very quickly. I think it took me about 3hrs to understand the framework of MP3 - the coding stuff was then about just half an hour.

Greetings Simon

sDJh 39 Posting Whiz in Training

Hello all together,

my old computer with WinME got a really bad virus that I couldn't remove so I reinstalled the OS. The trouble is, that after the setup BIOS tells me that no OS is installed - which seems to me that the MBR (first sector with information about OSs and partitions) is not updated by Win. What can be the problem?

Many thanks in advance
Simon

PS Personally I just can think of one other possibility. I can delete the first partition completely with Linux so that Win creates a ew one. Do you think that might help?