[PHP] mysqldump

2003-07-25 Thread Marios Adamantopoulos
This is an attempt to create an backup script for my online databases. There
are few things to sort out and the coding is not the most effiecient out
there yet!!!

I just wanted to check on what you guys think, am I going the right way, is
there anything I should keep in mind?

Mario

Code below
-
?php 
$host = localhost;
$user = x;
$password = x;
$database = xx;
$field = xxx;

$db_link = mysql_connect($host, $user, $password) or die (error connect);
mysql_select_db($database,$db_link);
$query=DESC $field;
$results=mysql_query($query);

while ($row=mysql_fetch_array($results)) {

if ($row[3]==PRI) {
$thepri = $row[0];
}   
$thesql .= $row[0] .   . $row[1]; 
if ($row[2]==YES) {
$thesql .=  default NULL;
} else {
$thesql .=  NOT NULL;
}
$thesql .=   . $row[5];
$thesql .= , \n;  
}
$thecreate = CREATE TABLE  . $field . _backup ( \n; 
$thecreate .= $thesql;
$thecreate .=  PRIMARY KEY  ( . $thepri . )\n;
$thecreate .= ) TYPE=MyISAM;;
echo The CREATE STATEMENTbr;
echo $thecreate;
echo br;
echo br;

//==//
// INSERT CODE ==//
//==//

$result = mysql_list_tables($database);

if (!$result) {
print DB Error, could not list tables\n;
print 'MySQL Error: ' . mysql_error();
exit;
}
$z=1;
while ($row = mysql_fetch_row($result)) {
//***
   //IMPROVE
   //echo $row[0] . \nbr;
   $z++;
}
//
//MAKE THE FOLLOWING DYNAMIC

$query2 = SELECT * from  . $field;
$results=mysql_query($query2);

$m=0;
while ($row=mysql_fetch_array($results)) {


for ($i=0;$i=$z-1;$i++) {
$x = $row[$i];
if (($i == 0)  ($m0)) {
$therest .=  ),;
}
if ($i == 0) {
$therest .=  (;
}

if (!isset($x)) { 
$x = NULL;
} else {
$x = ' . addslashes($x). ';
}

if ($i0) {
$therest .= ,;
}

$therest .= $x; 
}
$m++;
}
$therest .=  );


echo The INSERT STATEMENTbr;
$theinsert =  INSERT INTO . $field . _backup VALUES ;
$theinsert .= $therest . ;;
echo $theinsert;
?


RE: [PHP] mysqldump

2003-07-25 Thread Marios Adamantopoulos
 Thanks for the replies guys but the main reason I'm doing this is because
most times I don't have access to the servers, or not enough preveleges to
install myadmin or any other tools. I wish we had our own server but I'm
trying for a solution where you can't upload any tools and cannot access
system commands.
 
-Original Message-
From: David Smith [mailto:[EMAIL PROTECTED] 
Sent: 25 July 2003 16:54
To: [EMAIL PROTECTED]

I agree with Curt, why reinvent the wheel. I mean even if you are like me
and cannot access the command-line on your web server (which really really
sucks) then there are still other tools that can do this very same thing. If
you just want to click on a link and backup the db why not use the load data
infile (of course this does not backup the database structure just the data)
http://www.mysql.com/doc/en/LOAD_DATA.html. Or why not just get phpMyAdmin
and upload it to your server. It already has these features plus many
others, and of course the best part is it is open source
http://sourceforge.net/projects/phpmyadmin/. So why take the time of
reinventing the wheel?
Of course this is just my dumb opinion...so you can always take it or leave
it.
David



-Original Message-
From: Curt Zirzow [mailto:[EMAIL PROTECTED]
Sent: Friday, July 25, 2003 10:33 AM
To: '[EMAIL PROTECTED]'
Subject: Re: [PHP] mysqldump


* Thus wrote Marios Adamantopoulos ([EMAIL PROTECTED]):
 This is an attempt to create an backup script for my online databases.
There
 are few things to sort out and the coding is not the most effiecient 
 out there yet!!!

 I just wanted to check on what you guys think, am I going the right 
 way,
is
 there anything I should keep in mind?

perhaps something like  would be a whole lot easier:
`mysqldump [options] db tables`;

My general policy is don't revent the wheel unless it isn't round.

Curt
--
I used to think I was indecisive, but now I'm not so sure.

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


RE: [PHP] Expensive WEB HOST NEEDED!!!!!

2003-06-24 Thread Marios Adamantopoulos
I need a web host too
It MUST support PHP, ASP, JSP/Servlets, MySQL, SQL Server 2000, SQL Server
7, Oracle 8 and Oracle 9. It should have a minimum of 1,000,000 pop-up ads,
but I will allow it if it has xxx pictures, big pictures though.

And and before I forget, I WANT TO PAY 1,000 a day for 1 Mb of space and 8Mb
of RAM.

GET REAL there no such thing as FREE HOSTING
 
-Original Message-
From: Jay Blanchard [mailto:[EMAIL PROTECTED] 
Sent: 24 June 2003 13:20
To: Denis 'Alpheus' Cahuk; [EMAIL PROTECTED]

[snip]
Like I said, I need a web host.
It MUST support PHP, mySQl and sending emails, optional.
It shouldn't have any ads (pop-ups, ads), but I will allow if it has
watermarks (SMALL! watermarks).
It should be TOTALY FREE!
[/snip]

Denis I am going to make a small suggestion, please Google for this
information. Apparently many of the answers that have been given to you on
this list are not acceptable. Do some research. There is no such thing as
totally free.

HTH!

Jay

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php


[PHP] WARNING: FW: Virus Found in message [PHP-DB] Re Now how about Roman Numerals?

2003-06-16 Thread Marios Adamantopoulos
 
 
-Original Message-
From: Hugh Bothwell [mailto:[EMAIL PROTECTED] 
Sent: 16 June 2003 14:50

Norton AntiVirus found a virus in an attachment from Hugh Bothwell.


Attachment:  besturingssystemen.xls.exe
Virus name: [EMAIL PROTECTED]
Action taken:  Clean failed : Quarantine succeeded : 
File status:  Infected
Richard Hutchins [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 Here's a rundown of what the script is doing based on your input:

 If you pass in the number 155, here are the calculations:
$m = $nu


[PHP] String manipulation

2003-06-11 Thread Marios Adamantopoulos
 Hi all

I wonder if anyone can help with this.
I have a piece of copy that includes this:
[link][title]the link[/title][address]http://www.php.net[/address][/link]
And I need to change it to this:
a href=http://www.php.net;the link/a 

Any help is appreciated

Mario


RE: [PHP] passing variables to flash

2003-02-21 Thread Marios Adamantopoulos
What I do in these cases is either having PARAM name=movie.swf?var1=text
...
Or use a file (something.php) which spits text like var1=var2=.
Flash can read that file and get the variables 

_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7970 428 372
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.




-Original Message-
From: Michiel van Heusden [mailto:[EMAIL PROTECTED]] 
Sent: 21 February 2003 16:37
To: [EMAIL PROTECTED]
Subject: [PHP] passing variables to flash


i want to pass variables to a shockwave-flash-file
currently that's working fine with

print  PARAM NAME=movie
VALUE=\$movie?idlinks=$idlinksidcontent=$idcontentidknoppen=$idknoppen\
etc...

but passing the variables through GET makes iexplore think it's loading a
new *.swf-file

how to fix this?

1) is there a way around using GET to pass the variables from PHP?
2) is there a way to make Iexplore realise the file has been loaded before
:)?

thanks a lot
michiel



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Redirecting - here is the code

2003-01-16 Thread Marios Adamantopoulos
I think your problem is with the meta tag
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 --
header

Also I'm not sure but the !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01
Transitional//EN
might cause problems too

Try the if statement at the top of the document.

One more thing. I think that you can't add header info after head, but I'm
not sure about this.

What I usually use for redirection is something like:
(a page after the LOGIN page that check for correct/incorrect logins)
?php
// IF LOGIN SUCCESSFUL
if ($enter == 1) {
echo
script
top.location=\cms_home.php\
/script
;
// IF NOT (you can display HTML here instead of redirecting)
} else {
echo
script
top.location=\cms_index.php\
/script
;
 }
?  

I hope that helps

Mario
_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7970 428 372
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.




-Original Message-
From: Denis L. Menezes [mailto:[EMAIL PROTECTED]] 
Sent: 16 January 2003 17:07
To: PHP general list
Subject: [PHP] Redirecting - here is the code


I tried. But I get an error as follows :

Warning: Cannot add header information - headers already sent by (output
started at /usr/local/www/virtual2/66/175/19/84/html/maintenance.php:11) in
/usr/local/www/virtual2/66/175/19/84/html/maintenance.php on line 30

My code is as follows:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN html
head titleUntitled Document/title meta http-equiv=Content-Type
content=text/html; charset=iso-8859-1 /head body bgcolor=#CC
table width=70% border=0
  tr
td height=67 colspan=3 bgcolor=#330066
  div align=centerfont color=#00 face=Arial, Helvetica,
sans-serifstrongfont size=5Site
maintenance page?php
//connecting to the database
$link = mysql_connect(localhost,mydomain,somepass);
if ($link){
   Print ;
   }  else {
   Print No connection to the database;
   }
   if (!mysql_select_db(mydomain_com)){
Print Couldn't connect database;
 } else {
 Print .br\n;
 }
 $sql=SELECT AdminFirstName,AdminLoginId,AdminPassword FROM Administrators
where
  AdminLoginId = '$AdminLoginId' and AdminPassword ='$AdminPassword';
  if ($result=mysql_query($sql)) {
   $numofrows=mysql_num_rows($result);
if ($numofrows==0){
 header(Location: http://www.php-faq.com/;);
Print STRONGfont color=\#FF\size=\3\We are
sorry./STRONG/FONT;
}
  if ($numofrows==1){
 Print font size=\3\ color=\#ff\Welcome
.$AdminFirstName.Font;
}
 if ($numofrows1){
 Print STRONGSomething wrong/STRONG;
 }
 while($row=mysql_fetch_array($result)){
 PrintFont size=\3\$row[AdminFirstName]/font;
 }

 }
 ?/font/strong/font/div/td
  /tr
/table
/body
/html


Unquote.

Line no. 30 is the one with the line : header(Location:
http://www.php-faq.com/;);

Can you please tell me what is wrong?

thanks
denis



[PHP] FTP UPLOAD

2002-12-16 Thread Marios Adamantopoulos
Hi all 
I have a problm uploading a simple file to my server using the PHP FTP
functions.
I would appreciate it if anyone could help:

The HTML part:

form enctype=multipart/form-data action=ftp.php method=post
name=FormName
Upload file : 
input type=file name=thefile size=24 border=0
input type=hidden name=phpftp_dir value =? echo $phpftp_dir?
size=24 border=0
input type=submit name=submitButtonName value=Upload border=0
/form

The PHP:
(which gives me the error: (Warning: error opening
C:\Inetpub\wwwroot\mario\phpftp\phpftp\FTPonline\12.txt in
/home/virtual/site490/fst/var/www/html/ftp/ftp.php on line 90 - the line
with the ftp_put() function)


$picture = thefile_name;
$picture1 = $$picture;
$theimage = $picture1;

$source_file =
C:\\Inetpub\\wwwroot\\mario\\phpftp\\phpftp\\FTPonline\\ . $theimage;

$destination_file = /var/www/html/ftp/ . $theimage;

$upload = ftp_put($conn_id, $destination_file, $source_file,
FTP_BINARY); 


// check upload status
if (!$upload) { 
echo brFTP upload has failed!;
} else {
echo brUploaded $source_file to $ftpServer as
$destination_file;
}

_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7970 428 372
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.




-Original Message-
From: Chris Hewitt [mailto:[EMAIL PROTECTED]] 
Sent: 16 December 2002 11:54
To: Miguel González Castaños; [EMAIL PROTECTED]
Subject: Re: [PHP] Re: Mail() Not working right


Miguel González Castaños wrote:

I am testing the php mail function with the typical script

$mailsuccess = mail(...);
if (!$mailsuccess) {
echo Mail could not be sent;
}

In one redhat linux box I got that the email was sent succesfully and 
in the other box, it cant send it, but the script is executed (no parse 
errors).

I have sendmail 8.11-2 and php 4.1.2.

As i have said in my other email, I have checked if I have set properly 
the nobody privileges to execute sendmail and set the smtp and 
sendmail_path variables in the php.ini.

Do you know how I could figure out what is going on? Any way of 
debugging or testing?

What does the mail log say? Its usually /var/log/maillog. You say that 
the email is not sent, but what error message do you get? I think we 
need to know a little more about the error.

HTH
Chris




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] FTP Can't create temp file?

2002-12-16 Thread Marios Adamantopoulos

Hi all again

I'm trying to upload to a unix server. The program I use works fine on my
2000 IIS machine but it has a problem on the online one. Permittions have
been checked and I've been looking all day to find something, but natha...

I would appreciate it if someone can have a look and suggest something. Here
is the script:


$conn_id = ftp_connect($ftpServer); 
$login_result = ftp_login($conn_id, $ftpUser, $ftpPass); 
if ((!$conn_id) || (!$login_result)) { 
echo FTP connection has failed!;
echo Attempted to connect to $ftpServer for user $ftpUser; 
exit; 
} else {
//echo Connected to $ftpServer, for user $ftpUser;
}


$phpftp_dir = ;

echo br-- . ftp_pwd($conn_id) . br;


$phpftp_tmpdir=/tmp;


srand((double)microtime()*100);
$randval = rand();
$tmpfile=$phpftp_tmpdir . / . $thefile_name . . . $randv;

echo Temp file:  . $tmpfile . br;


if (!@move_uploaded_file($thefile,$tmpfile)) {
echo Upload failed!  Can't create temp file;
} else {
ftp_chdir($conn_id,$phpftp_dir);
ftp_put($conn_id,$thefile_name,$tmpfile,FTP_BINARY);
//ftp_quit($conn_id);
unlink($tmpfile);
}

---
I always get: Upload failed!  Can't create temp file

Thank you guys in advance

Mario



_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7970 428 372
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.





RE: [PHP] FTP Can't create temp file?

2002-12-16 Thread Marios Adamantopoulos
It gives me an error
Warning: error opening none in  Line 51 (which is the ftp_put()) 



-Original Message-
From: Joseph W. Goff [mailto:[EMAIL PROTECTED]] 
Sent: 16 December 2002 17:53
To: php-general; Marios Adamantopoulos
Subject: Re: [PHP] FTP Can't create temp file?


What happens when you remove the suppresion operator (@) from the
move_upload_file and why not just use ftp_put()? That has always worked fine
for me.
- Original Message -
From: Marios Adamantopoulos [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 16, 2002 11:06 AM
Subject: [PHP] FTP Can't create temp file?



 Hi all again

 I'm trying to upload to a unix server. The program I use works fine on 
 my 2000 IIS machine but it has a problem on the online one. 
 Permittions have been checked and I've been looking all day to find 
 something, but natha...

 I would appreciate it if someone can have a look and suggest 
 something.
Here
 is the script:


 $conn_id = ftp_connect($ftpServer);
 $login_result = ftp_login($conn_id, $ftpUser, $ftpPass);
 if ((!$conn_id) || (!$login_result)) {
 echo FTP connection has failed!;
 echo Attempted to connect to $ftpServer for user $ftpUser;
 exit;
 } else {
 //echo Connected to $ftpServer, for user $ftpUser; }


 $phpftp_dir = ;

 echo br-- . ftp_pwd($conn_id) . br;


 $phpftp_tmpdir=/tmp;


 srand((double)microtime()*100);
 $randval = rand();
 $tmpfile=$phpftp_tmpdir . / . $thefile_name . . . $randv;

 echo Temp file:  . $tmpfile . br;


 if (!@move_uploaded_file($thefile,$tmpfile)) {
 echo Upload failed!  Can't create temp file;
 } else {
 ftp_chdir($conn_id,$phpftp_dir);
 ftp_put($conn_id,$thefile_name,$tmpfile,FTP_BINARY);
 //ftp_quit($conn_id);
 unlink($tmpfile);
 }

 ---
 I always get: Upload failed!  Can't create temp file

 Thank you guys in advance

 Mario



 _
 Marios Adamantopoulos
 Senior Developer

 Tonic
 +44 (0)20 7691 2227
 +44 (0)7970 428 372
 www.tonic.co.uk

 Recent projects
 www.polydor.co.uk
 www.adcecreative.org
 www.sony-europe.com/pocketlife


 
 Opinions, conclusions and other information in this message that do not
 relate to the official business of Tonic Design Limited shall be
 understood as neither given nor endorsed by them.


 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] MySql-PHP-Excel=french weird chars

2002-11-27 Thread Marios Adamantopoulos

Hi all

I'm using a MySql database to save French data. In addition, I have a PHP
page which is using

header(Content-Type: application/vnd.ms-excel; name='excel'); 
header(Content-Disposition: attachment; filename=filename.xls);

to save all the data from the database to the excel file.

The problem is that when I open the excel file I get this: é instead of
this: é and the same thing for all the French accented chars.

I've tried to save the data as acsv file too but I get the same problem.

Does anyone have a solution?

Many Thanks

Mario

_
Marios Adamantopoulos
Senior Developer

Tonic
+44 (0)20 7691 2227
+44 (0)7904 221663
www.tonic.co.uk

Recent projects
www.polydor.co.uk
www.adcecreative.org
www.sony-europe.com/pocketlife


Opinions, conclusions and other information in this message that do not
relate to the official business of Tonic Design Limited shall be
understood as neither given nor endorsed by them.