Need Help... Please..
Moderator: General Moderators
why does header( Location: <address> ) not work for you?
Hedge, sometimes header()'s are needed mid script, and have been included onto the page, like in my current site. If i didn't use ob() there is no way my site would run. I might have 3 of 4 functions running on 1 page in different spots that use header() calls.
Hedge, sometimes header()'s are needed mid script, and have been included onto the page, like in my current site. If i didn't use ob() there is no way my site would run. I might have 3 of 4 functions running on 1 page in different spots that use header() calls.
well as i said previously tha download begin s to start immediately without echon some staff that i want before the redirection! The code is this:
if (isset($prog))
{
mysql_query("UPDATE visitor SET $prog=$prog+1");
$sql = mysql_query("SELECT $prog FROM visitor");
$row = mysql_fetch_array($sql);
echo "<font face='Com' size='5' color='Grey'>Åßóáé ï <font size='6' color='Yellow'>$row[0]<font size='5' color='Grey'>ïò ðïõ êáôåâÜæåé ôï $prog!<br>";
echo "<font face='Com' size='5' color='Grey'>Åëðßæù íá óïõ áñÝóåé êáé íá óïõ öáíåß ÷ñÞóéìï!!";
$url = "http://tigani.coderz.gr/~nik/$prog.exe";
header("Location: $url");
mail ("nik0s@mycosmos.gr", "ÊÜðïéïò êáôÝâáóå ôï $prog! ÊáôåâÜóìáôá: $row[0]", "", "From: spy@web.gr");
}
Where is the echo output? it just starts dowload!
if (isset($prog))
{
mysql_query("UPDATE visitor SET $prog=$prog+1");
$sql = mysql_query("SELECT $prog FROM visitor");
$row = mysql_fetch_array($sql);
echo "<font face='Com' size='5' color='Grey'>Åßóáé ï <font size='6' color='Yellow'>$row[0]<font size='5' color='Grey'>ïò ðïõ êáôåâÜæåé ôï $prog!<br>";
echo "<font face='Com' size='5' color='Grey'>Åëðßæù íá óïõ áñÝóåé êáé íá óïõ öáíåß ÷ñÞóéìï!!";
$url = "http://tigani.coderz.gr/~nik/$prog.exe";
header("Location: $url");
mail ("nik0s@mycosmos.gr", "ÊÜðïéïò êáôÝâáóå ôï $prog! ÊáôåâÜóìáôá: $row[0]", "", "From: spy@web.gr");
}
Where is the echo output? it just starts dowload!
Not sure who it'll help, but this is my general order of precedence in a PHP script
1) include functions from an external file
2) Perform pre-tasks
3) Perform $_POST tasks
--- No echoing/printing until ---
4) Perform body and $_GET tasks
You can generally work out how a script is going to work from just thinking about it. For example, say you have a form that accepts email addresses...
You'd put the form in 4 and on submit, the contents of the form are processed in 3. In 3 you'd have the code that processes the information and a header function that redirects to script.php?message=1.
message=1 is a $_GET, so that'd be in 4. Where you can format a nice message saying thanks for submitting, or some error message or whatever.
2 (pre-tasks) is where you would process such information as session creation/updates sql updates and so on.
If you can follow a simple structure, you find yourself not banging into errors every five minutes.
Of course, if you're a C programmer that moved into PHP, you should have no problem using a working structure. I bet C guys get <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> that variables can be created willy-nilly with PHP too
1) include functions from an external file
2) Perform pre-tasks
3) Perform $_POST tasks
--- No echoing/printing until ---
4) Perform body and $_GET tasks
You can generally work out how a script is going to work from just thinking about it. For example, say you have a form that accepts email addresses...
You'd put the form in 4 and on submit, the contents of the form are processed in 3. In 3 you'd have the code that processes the information and a header function that redirects to script.php?message=1.
message=1 is a $_GET, so that'd be in 4. Where you can format a nice message saying thanks for submitting, or some error message or whatever.
2 (pre-tasks) is where you would process such information as session creation/updates sql updates and so on.
If you can follow a simple structure, you find yourself not banging into errors every five minutes.
Of course, if you're a C programmer that moved into PHP, you should have no problem using a working structure. I bet C guys get <span style='color:blue' title='I'm naughty, are you naughty?'>smurf</span> that variables can be created willy-nilly with PHP too
Tah program i want to transer is at http://www.nikolas.tk click the LogReader button as i mentioned in another post! Dont be afraid man! its just a mirc reading log utility that i have made with c++ I would love to see it run on my browser!
Thanks again!
Well if u do now want to execute the file itself well i guess i have to send the code!
pls compile it and tell me if i can have the same result with php broswer output!!
#include <conio.h>
#include <iostream.h>
int main()
{
int i,flag=0;
char x,y,c,letter;
char *log;
char *arxeio="c:\\progra~1\\mirc\\logs\\";
FILE *stream;
cout << "Dose to log pou theleis na diavaseis => ";
cin >> log;
strcat(arxeio, log);
if(!(stream = fopen(arxeio, "r")))
{
textcolor(LIGHTCYAN);
cprintf("To %s den vrethike! Doste to log se morfi filename.log!", arxeio);
cout << '\7';
getch();
exit(0);
}
clrscr();
while(!feof(stream) && !(c==27))
{
textcolor(WHITE);
for (i=0; i<30000000; i++);
if (y=='\n') {cout << "\r\n\r\n"; y='\t';}
if (x!='\n') cprintf("%c", x);
else cout << "\r\n";
while ((x=fgetc(stream))=='<')
{
x=fgetc(stream);
cout << "\r\n";
if (flag==0) letter=x;
if (flag++==35) {flag=1; cout << "\7\r\n"; system("pause"); clrscr();}
if (x==letter)
{
textcolor(LIGHTGREEN);
cprintf("%c", '<');
cprintf("%c", x);
while ((y=x=fgetc(stream))!='\n')
{
cprintf("%c", x);
for (i=0; i<30000000; i++);
if (kbhit())
if (getch()==27)
{
cout << "\7\r\n\r\n ********** DIAKOPH KATOPIN AITHSEWS XRHSTH **********";
getch();
cout << "\7\r\n\r\n !!! Made by Skias !!!";
getch();
exit(0);
}
else getch();
}
}
else
{
textcolor(YELLOW);
cprintf("%c", '<');
cprintf("%c", x);
while ((y=x=fgetc(stream))!='\n')
{
cprintf("%c", x);
for (i=0; i<30000000; i++);
if (kbhit())
if (getch()==27)
{
cout << "\7\r\n\r\n ********** DIAKOPH KATOPIN AITHSEWS XRHSTH **********";
getch();
cout << "\7\r\n\r\n !!! Made by Skias !!!";
getch();
exit(0);
}
else getch();
}
}
}
}
if (feof(stream)) cout << "\7\r\n\r\n********** TELOS TOY LOG **********";
getch();
cout << "\7\r\n\r\n!!! Made by Skias !!!";
getch();
}
Thanks!
#include <conio.h>
#include <iostream.h>
int main()
{
int i,flag=0;
char x,y,c,letter;
char *log;
char *arxeio="c:\\progra~1\\mirc\\logs\\";
FILE *stream;
cout << "Dose to log pou theleis na diavaseis => ";
cin >> log;
strcat(arxeio, log);
if(!(stream = fopen(arxeio, "r")))
{
textcolor(LIGHTCYAN);
cprintf("To %s den vrethike! Doste to log se morfi filename.log!", arxeio);
cout << '\7';
getch();
exit(0);
}
clrscr();
while(!feof(stream) && !(c==27))
{
textcolor(WHITE);
for (i=0; i<30000000; i++);
if (y=='\n') {cout << "\r\n\r\n"; y='\t';}
if (x!='\n') cprintf("%c", x);
else cout << "\r\n";
while ((x=fgetc(stream))=='<')
{
x=fgetc(stream);
cout << "\r\n";
if (flag==0) letter=x;
if (flag++==35) {flag=1; cout << "\7\r\n"; system("pause"); clrscr();}
if (x==letter)
{
textcolor(LIGHTGREEN);
cprintf("%c", '<');
cprintf("%c", x);
while ((y=x=fgetc(stream))!='\n')
{
cprintf("%c", x);
for (i=0; i<30000000; i++);
if (kbhit())
if (getch()==27)
{
cout << "\7\r\n\r\n ********** DIAKOPH KATOPIN AITHSEWS XRHSTH **********";
getch();
cout << "\7\r\n\r\n !!! Made by Skias !!!";
getch();
exit(0);
}
else getch();
}
}
else
{
textcolor(YELLOW);
cprintf("%c", '<');
cprintf("%c", x);
while ((y=x=fgetc(stream))!='\n')
{
cprintf("%c", x);
for (i=0; i<30000000; i++);
if (kbhit())
if (getch()==27)
{
cout << "\7\r\n\r\n ********** DIAKOPH KATOPIN AITHSEWS XRHSTH **********";
getch();
cout << "\7\r\n\r\n !!! Made by Skias !!!";
getch();
exit(0);
}
else getch();
}
}
}
}
if (feof(stream)) cout << "\7\r\n\r\n********** TELOS TOY LOG **********";
getch();
cout << "\7\r\n\r\n!!! Made by Skias !!!";
getch();
}
Thanks!