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

i don't really understand what you are trying to do.
maybe you mean that:
you have an index.php file with an argument like "?act=news". Then you can include the news.php from the folder include or code or whatever.
The access to that folder can be restricted with htaccess. So nobody can get the files in there but has to use you index file.

Hope that helps. If not, try to explain it with an example.

sDJh 39 Posting Whiz in Training

you want to convert you php script to word, exel or pdf? just open you text-processor paste you code and save it.

sDJh 39 Posting Whiz in Training

PHP is not useless. PHP is just a server-script that cannot control the users browser. JS does. But therefore for instance you cannot access databases (at least not as easy as in PHP).

When you send a header, just one of the Location (I believe it is the first one) will be executed. The other one is ignored by the browser.

What you want to do is actually very simple. Just try to understand the followin logic:

You have a webpage and when clicking a button, a popup is created and the parent is refreshed. You can do it as follows.
<script language=javascript>
function popuprefresh()
newwin=window.open("popup.php?vars=...")
document.location.href="refresh.php?vars=...";
}
</script>

Now you want to parse variables to your php-script:
document.location.href="refresh.php?vars=hello%20OmniX"; (similar to popup)
In PHP you can access the variable $vars with the value "hello OmniX".

the otherway round (using php values in JS):
document.location.href="refresh.php?vars=<?echo $myphpvar?>";
which will look after the execution of the code like this:
document.location.href="refresh.php?vars=blablahblah";

If you still didn't get it, then try to post some of you code so that we can edit it.

Basically you can often link both languages very easily. Just sometimes when sending forms or multiple data with JS to PHP it gets a bit tricky.

sDJh 39 Posting Whiz in Training

you cannot open a new window with php. you have to use JS.

To open a new page in the same window use: header("Location: newpage.php");

If you want to open a popup and then refresh the page I'd prefer it to to it both in JS. first window.open("popup.php") [see manual for correct use] and then parent.location.href="newpage.php" to reload the parent window.

sDJh 39 Posting Whiz in Training

I don't have a code on the fly. You basically do it as follows.

You have a string with the execution (static or via user input). You go through the string to seperate the functions +,-,*,/ from values.

Then you convert each number to binar numbers (a bit longer function, but quite easy, maybe even somewhere on the web) and sort them, so that * and / is calculated at first.

Then you just have a term with + and -. Go through it and output the result.

If you are a bit experienced you shouldn't need more than a week to solve it quite acceptable. Have fun ^^.

sDJh 39 Posting Whiz in Training

well nevermind, but thanks anyway to everyone - it helped a lot. I have to solve it then with a redirection. Did that already some years ago but I thought it is nicer to do it this way.

sDJh 39 Posting Whiz in Training

@Scorpionz: cool, I didn't know. But saves a lot of typing, cheers ^^.

have you tried $prod_id=$_REQUEST["prod_id"] in image_viewer_window.php?
and is prod_id correctly set in the main file?

sDJh 39 Posting Whiz in Training

maybe you look for: $HTTP_SERVER_VARS["REQUEST_URI"]

you get something like "/home/user123/htdocs/myfolder/"

than you can work the folder out with explode

sDJh 39 Posting Whiz in Training

do you really save the data in textform in the db?

=>
use explode to chunk the data and add them to a string.

$str="";
for($c=0;$c<$anz;$c++){
$tmp=explode("----",$mysqlrow);
$str[0].=$tmp[0];
$str[1].=$tmp[1];
$str[2].=$tmp[2];
...
}

echo $str[0]."<bR>";
echo $str[1]."<bR>";

should work - i haven't tested it ^^

sDJh 39 Posting Whiz in Training

the textarea is html. just the processing is done by php.

Basically it looks as follows:

comment.html

<form method=post action="process.php">
<textarea name=comment style="..."></textarea>
<input type=submit>
</form>

sends the text in the textarea to "process.php" when user presses the submit-button. Variable is called "comment"


process.php

<?
$comment=$_REQUEST["comment"];
echo $comment;   //save or whatever
?>

PHP fetchs the variable and prints it on the screen. Instead of printing you can send it via email or save it in a db.

sDJh 39 Posting Whiz in Training

FTP is a bit more complicated than HTTP. It can be a bit frustating when doing it the first time, but as I did it (not in PHP), I think it's manageble =).

Still check your server if it's not restricted. Than try to connect to the other server.

Here you can find the official documentation to FTP: http://tools.ietf.org/html/rfc959
some support might offer wikipedia, which is often well documentated and nicely explained.

sDJh 39 Posting Whiz in Training

I had an intense look at my server-settings, and realized, that I can turn the error-reporting on.

These are the messages I get:

Warning: mkdir() expects at most 2 parameters, 3 given in /home/www/web573/html/web/anglistik/dat/code/redaktion.php on line 141

Warning: fopen() [function.fopen]: SAFE MODE Restriction in effect. The script whose uid is 1922 is not allowed to access /home/www/web573/html/web/anglistik/test owned by uid 33 in /home/www/web573/html/web/anglistik/dat/code/redaktion.php on line 146

Warning: fopen(./test/index.php) [function.fopen]: failed to open stream: No such file or directory in /home/www/web573/html/web/anglistik/dat/code/redaktion.php on line 146

Maybe you need some explainations:
1) I create a dir called './test'
2) I want to create an index.php-file in it './test/index.php'
3) Writing data in it (I left these messages out)

seems as if SAFE MODE restricts the access to my dir. But why? And is there any work-around?

Perhaps, I could write an 404-errorpage that redirects the browser to the file I want to?

sDJh 39 Posting Whiz in Training

> Thats odd, are you sure you don't have error reporting turned off?

I don't know. The script is running on a server and I don't have access to the php.ini


Is your PHP running as CGI or Apache module? What's the PHP user?

it is running under apache. The user is, as far as I know, wwwrun.

Can php create files in other directories not created via php's mkdir()?

Yes. I tried it out. It works perfectly.

sDJh 39 Posting Whiz in Training

basically there are two ways of solving it. The first is the explode the data into chunks and then converting them.

secondy, in my opinion the better and easier way:
use the function date("prefered format",mktime(...))
first arguments is you format that you like.
the secend argument created an unix-timestamp (look at http://de2.php.net/manual/en/function.mktime.php). it allows you to generate any date and time you like.

sDJh 39 Posting Whiz in Training

eg.
$res=mysql_query("...");
$f=fopen("db.html","w");
...fetching data
fwrite($f,"Data: ".$data."\n");

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

what you could do is to open a connection to the other server with socket_connect() (http://de2.php.net/manual/en/function.socket-connect.php). You write a HTTP-Request, save the binaries on your server and unzip it with the zip-lib (have a look at PHP.net). It should also support password protected files.

But you better try it out before you do all the fuss because, as far as I know, most servers deny the php-scriptengine to open a connection to another server.

sDJh 39 Posting Whiz in Training

@JRSofty:

$semname is the name of the folder I want to create. Typical values are "basic0708", "public" or "member". Shouldn't be a problem for the local file system. I mean, the folder is created, just the file cannot be written to it.

@digital-ether:

thanks for that idea. It does work. The properties are set correctly. Just the file is still not created.

Maybe I need a delay between the creation of the folder and the file? I'll try that out.

[EDIT]
I tried to write to that folder when not having created it just before. No chance. Accessing all other folders work perfectly, there are just problems with ones, that I created in PHP.
[/EDIT]

sDJh 39 Posting Whiz in Training

Unfortunately not.
I also echoed the variable $f2, which is supposed to be something like "Ressource id #2", but I just get an empty string.

Here is a dump:

is_writebale: 
Ressource:

Any idea?

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.

sDJh 39 Posting Whiz in Training

<?=$prod_id?>
must be: <?echo $prod_id?>

then check if $prod_id is set. maybe your php doesn't overtake variables automatically. Then try $prod_id=$_REQUEST["prod_id"].

sDJh 39 Posting Whiz in Training

Hi everyone,

I'm now fiddling over a week to fix a problem on my linux-webserver.

I have the following code:

...
$bool=mkdir(trim($semname), 0777, TRUE);
//chmod(trim($semname),0777);
$f2=fopen(trim($semname)."/index.php","w");
...

it works perfectly when working on my home server under windows but as soon as loaded up on my linux-webserver it just creates a folder with permission 755. The permission of the root-folder is also set to 0777, but no index-file is created.

What's wrong? I can't even find anything on php.net.

Thanks very much indeed
Simon

sDJh 39 Posting Whiz in Training

Hello everybody,

does anybody have some experiences with scanners or other imaging-hardware?
I am now looking for several weeks for good introductions in this topic, but so far, I couldn't find anything useful apart from the EZTwain packet that costs money.

Maybe you have a hint how to use the twain.dll or the MS interface. I don't want to write a big imaging suite but just implement a simple scanning tool in my programme that makes

Thanks for all responses.
Simon

sDJh 39 Posting Whiz in Training

I found the solution for myself. I put the function ID in AL and not AH as BIOS expect me to do. Working now the way as I want to =)

sDJh 39 Posting Whiz in Training

Hello everybody,
I just signed up, 'cause I looked through the internet over days to find a solution for the BASIC function GetKey(). It simply returns the Scancode of a key pressed by the user or 0 by default (if no key was pressed).

I found the well known BIOS Interrupt Int 16h but both functions AX=1 and AX=0 stop the execution of my programm and wait 'til a key is pressed.

So I regarded some codes with I/O exchanges, and I sat down for a few hours to read the scancode from port 60 and translate it into an ASCII-character. Well, this works fine by now, except that
1) everytime I press a key I hear a *beap* from the motherboard (I guess)
2) after a while typing in a text the programm becomes really, really slow - I guess that there's an overflow in writing to/reading from the ports (the same sort of lack of speed as I experienced when I first wrote a network-game in UDP)

How may solve that problem?
Thanks a lot for your replies!
Simon