Re: [PHP-DB] stripping a get variable out of url string

2003-07-05 Thread Stephen March
If all else fails, split on the &.

$url = split("&", $_SERVER["REQUEST_URI"]);
$args = $url[0];
Cheers,
~Steve
Steve B. wrote:

I have an online tutorial build into a web page.
It has button next step.
If you are on page index.php?abc=123 for instance
the code is smart enough to make it index.php?abc=123&step=x
The problem is how to remove step=x from the old url string so that steps don't pile 
up.
index.php?abc=123&step=1&step=2
I'm trying ereg but could use a nudge with the wild card aspect of searching and 
replacing.
The code below builds the get string.

$stepnum = $_GET["step"];

$laststep=$stepnum-1;
$nextstep=$stepnum+1;
$args = $_SERVER["REQUEST_URI"];
if ($_SERVER["argc"]>0) $args.="&";
else $args.="?";
if ($stepnum>1)
{
echo "step 1";
}
if ($laststep>0)
{
echo "backup 1 step";
}
echo "next step";
thx

__
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
 



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


Re: [PHP-DB] Create Temporary Table

2003-07-06 Thread Stephen March
Does the ip address of where you are trying to access the mysql database 
from (client), change?If you have a dynamic ip address
your ISP should have a grant something to the effect of:

grant all on database.* to [EMAIL PROTECTED] identified by 'password';

This would allow your client to be any address on the 10.1.X.X  network. 
 You can just grant access to the database to [EMAIL PROTECTED] if you want that 
user to be able to access the database from any ip address.   This might 
have some security implications for you, if it's wide open on the 
Internet.   That's the only reason I can think for intermittent problems.

Cheers,
~Steve
Phil Dowson wrote:

Hi,

PHP Version 4.3.1
Mysql Version 4.0.13
When I try and run the following query

CREATE TEMPORARY TABLE temptable AS SELECT * FROM permtable;

on each database, the first one will run it with no problems at all. The
second returns the error:
[server] ERROR 1044: Access denied for user: '[EMAIL PROTECTED]' to database
'database'
I have tried running the same query from MySQL at my site, from via the PHP
interface I am working with and also via PHPMyAdmin, each returns the same
error.
One thing I should note. The CREATE TEMPORARY TABLE syntax does not work,
however if I were to use the CREATE TABLE syntax, it works fine. But I'd
rather use the TEMPORARY tables.
This problem appears to be intermittent, it will work fine for a few days,
then fail for an undetermined amount of time. I have checked with my ISP,
they are sure that the rights haven't changed, and I have CREATE TEMPORARY
TABLE rights.
Any ideas why this is intermittent?

Thanks for your help!

Phil Dowson



 





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


RE: [PHP-DB] windows explorer

2003-07-14 Thread Stephen March
What I would recommend is using PEAR's HTML_TreeMenu package for this.

http://pear.php.net/package-info.php?package=HTML_TreeMenu

I use it quite a bit in applications .. .download the souce (make sure you
have PEAR configured), and it even comes with an example.
Cheers,
~Steve



> What you're looking for is available in a number of JavaScripts out
> there. I'd suggest a search on Google for things like "javascript tree"
> or other things along that line. There are quite a few out there so
> you'll have to sift through them to find the one that really suits your
> needs.
>
> Here's one I used:
>   //Smart Folding Menu tree- By Dynamic Drive (rewritten
> 03/03/02)
>   //For full source code and more DHTML scripts, visit
> http://www.dynamicdrive.com
>
> Hope this helps.
>
> Rich
>
>> -Original Message-
>> From: gates bill [mailto:[EMAIL PROTECTED]
>> Sent: Monday, July 14, 2003 10:17 AM
>> To: [EMAIL PROTECTED]
>> Subject: [PHP-DB] windows explorer
>>
>>
>> Hello ,
>> i want to make an windows explorer like application in Php
>> where on the left hand side i have the folders with + or -
>> sign and if i click on + sign it should show me the sub-folders  in
>> that folder just like we can see in windows explorer, and
>> when i click on - then it
>> should fold back and only show the main folders.
>> Also if someone click on the folder then he can see all the
>> items in that folder on the right hand sign frame.
>> hope u can provide with some input on how to do the same or
>> where to get codes for the same .
>> thanks in advance.
>>
>>
>> -
>> Do you Yahoo!?
>> The New Yahoo! Search - Faster. Easier. Bingo.
>>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




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



[PHP-DB] MS-SQL => Exec stored procedures

2003-07-16 Thread Stephen March
Anybody have code that WORKS (hehe) for executing a MS-SQL stored
proceedure through PHP?
exec viewFacilities()


Thanks in advance!
~Steve



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



Re: [PHP-DB] MS-SQL => Exec stored procedures

2003-07-16 Thread Stephen March
Thanks for the immediate response... it turns out my co-worker actually 
had a bug in his stored proc ...  

(nobody ever admits the problem is their own eh?)

hehe

~Steve

[EMAIL PROTECTED] wrote:

my experience in the past is just:

$SQL = "sp_runthis $param1, $param2, $param3";
$RES = mysql_query($SQL);
may have to prefix with exec like you mentioned...

change sp_runthis to your procedure name...   probably still works the
same..


On Wed, 16 Jul 2003, Stephen March wrote:

 

Anybody have code that WORKS (hehe) for executing a MS-SQL stored
proceedure through PHP?
exec viewFacilities()
Thanks in advance!
~Steve


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



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


Re: [PHP-DB] export mysql table to .dbf

2003-07-21 Thread Stephen March
Norma,

   I have found the best strategy is to setup an ODBC link to an 
alternative to the database.   As an example, I had a mysql database 
"intranet", and I created an ODBC link to, with the MySQL ODBC drivers 
(from the mysql.com site), and then opened up Microsoft Access.Went 
file => get external data  =>  import data, selected the tables, and 
bingo, they were in Microsoft Access, mdb format.   I would expect you 
should be able to do the same thing with Fox 2.0, and any other database 
that you have a GUI for.   I know most systems come with ODBC drivers 
for Foxpro,

HTH
~Steve
Norma Ramirez - TECNOSOFT wrote:

Hi all, does any one how export data from mysql to fox 2.0? I have to capture data from a php form and store in mysql database, and then export those data or generate a .dbf table. 
ThankĀ“s a lot. 

Norma Ramirez

 





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


Re: [PHP-DB] Inline extraction and exhibition of large objects

2003-07-21 Thread Stephen March
I'll bite.First of all, if Netscape / Opera browsers are running, 
you can be guarenteed that it is a problem with IE, especially since you 
just SP'd it.  The URL for the fix you described is located at:  
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/MS02-047.asp  
, which if you read - describes that it had a buffer-run in an Active-X 
component used to launch certain types.I'm not 100%  sure, but it 
does make mention of:

The patch eliminates the vulnerability by setting the "kill bit" on the 
affected ActiveX control. This action, which is discussed in more detail 
in Microsoft Knowledge Base Article Q240797 
, has 
the effect of preventing a particular ActiveX control from ever being 
executed within Internet Explorer, regardless of the security settings 
on the system.

If I were looking into the problem, I'd take a look to make sure the 
patch didn't wipe out my mime settings for the formats you described, 
.pdf, .xls, etc.   If your're not sure, simply point your browser with 
an absolute path to a file  http://www.yourserver.com/yourfile.pdf   and 
see if it opens properly.   It might require that you re-image your 
machine, and test the patch before you apply it.You should slap your 
sys-admins knuckles for releasing a patch without testing it fully first  :)

Having said that,  this is a PHP list and that's wy too much Windows 
talk  :)

HTH
~Steve
Ellis Robin (Bundaberg) wrote:

We have an internal document storage system that was developed over 6 months ago that uses PHP (4.2.0) on a Unix server with Apache to access a PostgreSQL database, with IE5.5 as the designated user browser. The system is used to store documents like .jpg, .doc, .html, .pdf, .xls etc, allowing users to search for relevant documents, downloading/viewing those documents they are interested in. This system has worked with no problems until 6-7 weeks ago when our administrators applied the Microsoft security patch Q323759 (MS02-047). Now IE5.5 and IE6 are unable to retrieve any documents that require another program to be opened for viewing, like PDFs and Word documents. On trying to access these documents the user is prompted to either Open or Save the document (an unwanted proecss, we want to just open every time where possible). Regardless of the option then chosen the following error is given:

Internet Explorer cannot download 'filename' from 'server'.
Internet Explorer was not able to open this Internet site. The required site is either 
unavailable or cannot be found. Please try again later.
Please note that the 'filename' is being exhibited as the address to the page executing the download code (show_ind_doc.php?theid=185), and 'server' is the appropriate server name.

Images like GIFs and JPEGs, and HTML documents still open OK as they are 'viewable' within IE, it's just those that require another program that don't work. This code still works in other browsers, like Netscape and Opera. The code is below, any assistance with configuring the 'header' sections would be appreciated, the other use contributed notes on the header section of php.net have not been able to help me at this time.



function do_con() {

global $connection; 

$host = "server";
$user = "username";
$pass = "password";
$db = "sedocs";
$port = "5432";
$connection = pg_connect ("host=$host port=$port user=$user dbname=$db");

if (!$connection)
{
die("Could not open connection to database server");
}
}

do_con();

$id = $HTTP_GET_VARS["theid"];

$result = pg_Exec($connection, "select * from sedocs where id = ".$id);
$row = pg_fetch_row($result, 0);
$num_rows = pg_num_rows($result);
$id = $row[3];
$length = $row[6];
$filename = $row[7];
$doctype = $row[5];
header('Content-Type: '.$doctype);
header('Content-Length: '.$length);
header('Content-Disposition: inline; filename="'.$filename.'"');
pg_exec ($connection, "begin");

$handle=pg_lo_open($connection, $id,"r");
$buffer=pg_lo_read($handle, $length );
pg_lo_close($handle);
pg_exec ($connection, "end");
pg_close();
echo($buffer);
?>
Thanks very much

Rob

Robin Ellis
Information & Knowledge
Department of Natural Resources and Mines
PO Box 1167
Bundaberg QLD 4670
ph +61 7 4131 5771
fax +61 7 4131 5823
[EMAIL PROTECTED]



The information in this e-mail together with any attachments is
intended only for the person or entity to which it is addressed
and may contain confidential and/or privileged material.
Any form of review, disclosure, modification, distribution
and/or publication of this e-mail message is prohibited.  
If you have received this message in error, you are asked to
inform the sender as quickly as possible and delete this message
and any copies of this message from your computer and/or your
computer system network.  
**

Re: [PHP-DB] Downloading Database?!?!

2003-07-22 Thread Stephen March
Have you considered using the console-tool,  "mysqldump  "  ?
You could write a quick script  ... say
mysqldump -u adminuser -p adminpass --all-databases > backup.sql
tar -zcvf backup.tar.gz backup.sql
mv backup.sql  /somepath/backup.sql
if you're on Winders, a batch file:

mysqldump -u adminuser -p adminpass --all-databases > backup.sql
move backup.sql z:\somepath\backup.sql
If you write a batch script, or shell script, all the "new guy" would 
have to do is run it. 
Create a cron job (on linux) or scheduled task (on windows) and the "new 
guy" just has to figure out the coffee machine  :)
Food for thought,

~Steve

Brenton Dobell wrote:

Hello all,

I am developing an Intranet page for my workplace, ATM i use phpmyadmin to
do rutine backups ect, this is cool but i am going on long service leave for
14 weeks and during that time a new guy will attempt to continue to maintain
the site and perform regular "backups"... I tried to show him how to use
phpmyadmin but has proved too dificult for him to understand, how can i make
a quick script to implement into a page that prompts you to download the
entire sctipt in .txt form?? just like php myadmin, and starting tips and
hints would be great.
Cheers in advance

Brenton

 





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


Re: [PHP-DB] simple sql problem

2003-07-25 Thread Stephen March
Any database that supports nested queries (unfortunatly this excludes 
MySQL)  ... you can do

   select pic_id from pictures where pic_id not in (select pic_id from
   album_pictures)
Otherwise you might have a harder time with MySQL ... something like set 
difference if it supports it  (I'm not sure what it supports to 
facilitate your need)
HTH

~Steve

Merlin wrote:

Hello ,

I have a sql problem which seems to be simple, but I am kind of stuck,

There are 2 tables with IDs. I would like to find out which ID from table
one is not in table 2.
My statement:
SELECT ap. *
FROM pictures p , album_pictures ap
WHERE ap.pic_id != p.pic_id
returns of course all the ids from table pictures which are not in table
album_pictures, but I would like to have
it the other way arround.
Can anybody help on this.

Thanx a lot in advance for any help,

Merlin