php-windows Digest 12 Sep 2003 04:04:35 -0000 Issue 1907
Topics (messages 21361 through 21367):
Re: excel tables to mysql tables
21361 by: chris.neale.somerfield.co.uk
Re: No answers found - Why var and why & ?
21362 by: Dave Dash
Re: Extracting images from active directory using php
21363 by: Igor Portnoy
Array problem
21364 by: John Ellingsworth
Re: Array problem (NEVERMIND)
21365 by: John Ellingsworth
getting download resume to work
21366 by: Scott Dotson
setting directory permission
21367 by: Exiang
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Kerem,
I wrote the following code to do this some time ago. It could probably be
improved by using the header row in the spreadsheet to generate the keys
for an associative array instead. This might make life easier when it comes
to generating your sql query. You'll just have to save the spreadsheet as a
csv file to make it work.
Regards
Chris
<code>
<?php
$datalist = fopen("filename.csv", "r");
while(!feof($datalist))
{
$datalistentries = fgetcsv($datalist, 2500, ",");
$datalistentriesprocessed[] = $datalistentries;
}
$z = count($datalistentriesprocessed);
for ($n=0; $n<$z; $n++)
{
$entry = $datalistentriesprocessed[$n];
addslashes(&$entry[1]);
addslashes(&$entry[2]);
$query="update tablename set fieldName1 = '".$entry[1]."' where
FieldName2 = '".$entry[0]."'";
dbconnect("user", "pass");
$result=mysql_query($query);
$rowid=mysql_insert_id();
echo $rowid;
}
fclose($datalist);
?>
</code>
-----Original Message-----
From: arslanli [mailto:[EMAIL PROTECTED]
Sent: 11 September 2003 08:10
To: [EMAIL PROTECTED]
Subject: excel tables to mysql tables
I have 4500 records in excel tables waiting to be insert into mysql
structure ....did anyone done this before i need it so much......
Kerem Arslanli
Istanbul Technical University
UEPRC
If you are not the intended recipient of this e-mail, please preserve the
confidentiality of it and advise the sender immediately of any error in
transmission. Any disclosure, copying, distribution or action taken, or
omitted to be taken, by an unauthorised recipient in reliance upon the
contents of this e-mail is prohibited. Somerfield cannot accept liability
for any damage which you may sustain as a result of software viruses so
please carry out your own virus checks before opening an attachment. In
replying to this e-mail you are granting the right for that reply to be
forwarded to any other individual within the business and also to be read by
others. Any views expressed by an individual within this message do not
necessarily reflect the views of Somerfield. Somerfield reserves the right
to intercept, monitor and record communications for lawful business
purposes.
--- End Message ---
--- Begin Message ---
var $varname before a constructor is just conventional syntax when defining
a class.
class myClass {
var $myThis;
function myClass() {
}
}
I'm sure you can do this another way, but it just makes reading the class
very easy, and it defines those variables for the entire scope of the class.
-dd
"André Cupini" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Save all programers! (sorry my "brazilian english")
>
> I have a simple doubt, but i´m tired because i not found answers...
> Why, inside a class, declarare $this variables in a format "var
$varname;"
> before of a constructor?
> And, please, what intend the "&" signal before functions name?
>
> I know the arguments reference methods like this:
> function bla(&$reference_arg)
>
> But what's the diference of the sintax:
> function &bla(&$var)
>
> Thanks for attention
>
> --
> André Cupini
> Programador - NeoBiz
> [EMAIL PROTECTED]
> http://www.neobiz.com.br
--- End Message ---
--- Begin Message ---
Simon,
I've seen thumbnailPhoto attribute in LDAP, but I have never seen this
reference anywhere in the Active Directory. How do you store image in
the Active Directory? In other words where do you upload the image?
Thanks
Igor P.
-----Original Message-----
From: Simon Taylor [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 5:07 AM
To: [EMAIL PROTECTED]
Subject: Re: [PHP-WIN] Extracting images from active directory using php
Thanks Stephen,
yep I have already made sure connection etc is good, the main problem
here
is getting binary data out of the ldap directory - I was hoping someone
around has had experience with this, but I will have to scratch my head
some
more.
Cheers
Simon
"Stephen" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> I'm not familar with how LDAP works, so my comments are more general
coding
> type ones.
>
> I suggest first checking your connection for error messages by
removing
this
> bit
> > echo Header("Content-Type: image/jpg").$data;
> That should then mean that the php error messages become visable (or,
if
> there are none, a blank page will be displayed.
>
> Secondly, I didn't think you used echo with the header function.
Instead,
I
> normally do this:
> Header( "Content-Type: image/jpg" );
> echo $data;
> This may or may not fix your problem, but some help is better than
none!
> With any luck someone with more experiance in this field will read
your
> email in the not to distant future.
>
> Stephen
>
> ----- Original Message -----
> From: "Simon Taylor" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 10, 2003 1:19 PM
> Subject: [PHP-WIN] Extracting images from active directory using php
>
>
> > Hi All,
> > I am busy trying to display an image extracted from the active
directory
> on
> > our intranet. This is what I have so far, I have searched the net on
this
> > and come up with very little info.
> > The following just shows a page stating it could not display the
image
> > because it had errors. If anyone has had experience with this please
> help...
> >
> > <?php
> > $ldap_server = 'ldap://server.world.com';
> > $auth_user = '[EMAIL PROTECTED]';
> > $auth_pass = 'password';
> >
> > $res=ldap_connect($ldap_server);
> > $bind=ldap_bind($res,$auth_user,$auth_pass);
> >
> > $info = ldap_read($res,'CN=Joe
> > Bloggs,OU=Users,DC=world,DC=com','objectclass=*');
> >
> >
> > $ar = ldap_get_entries($res,$info);
> > $data = $ar[0]['thumbnailphoto'][0];
> >
> > echo Header("Content-Type: image/jpg").$data;
> > ?>
> >
> > Cheers
> > Simon
> >
> > --
> > PHP Windows Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
Hi.
In the code below, I always get an error from the sql statement due to some
problem in the array result.
The goal is to add as many keywords to as many thumbnails selected from a
form.
The thumbnails have this checkbox:
<input type=checkbox name=thumb[] value=3267>
And the keyword this:
<select MULTIPLE SIZE=5 name=keyword[] class=select>
<option value="Animals">Animals
etc ...
</option>
The error info is this, with the actual thumb array results output from
print_r():
Array ( [0] => 3266 [1] => 3267 [2] => 3268 [3] => 3269 [4] => 3270 [5] =>
3271 [6] => 3272 [7] => 3273 [8] => 3274 [9] => 3275 [10] => 3276 [11] =>
3277 )
Error: Unable to perform query: SELECT Path.name AS path, Thumbnail.name AS
filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path ON
Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = 'Array') :
Anyone have any suggestions? I have tried is_array, foreach($thumbarray as
$key => $value), and can't tell why I am getting this problem.
Thanks,
John Ellingsworth
http://mail.med.upenn.edu/~jellings/
Code:
<?
require("constant.php");
if (isset($_POST["thumbAction"])) {
$thumbAction = $_POST["thumbAction"];
} else {
$thumbAction = "default";
}
switch ($thumbAction) {
case "multipleThumbs":
if(isset($_POST["pathid"]))
{
$pathid = $_POST["pathid"] ;
$relative_url = "search.php?idpath=".$pathid;
}
if (isset($_POST["thumb"])) { $thumbarray =
$_POST["thumb"]; }
print_r($_POST["thumb"]);
foreach($thumbarray as $key => $value)
{
$query = "SELECT Path.name AS path,
Thumbnail.name AS filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path
ON Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = '$value') ";
// EXECUTE THE QUERY
$sql->QueryItem($query);
$getResults = $sql->data;
$path = $sql->data["path"];
$file =
$sql->data["filename"];
// CLEAN UP THE PATH INFO
$origpath = "\\". $path
."\\" . $file;
if
(isset($_POST["keyword"]))
{
$keyword =
$_POST["keyword"] ;
if(is_array($keyword))
{
for($k=0; $k<count($keyword); $k++)
{
$cmd = "tpcmd.exe Keyword(\"+$keyword[$k];|d:$origpath\")";
passthru($cmd);
}
}
}
if
(isset($_POST["thumbFTxt"]))
{
$thumbFTxt =
ucwords($_POST["thumbFTxt"]);
$cmd = "tpcmd.exe
Keyword(\"+$thumbFTxt;|d:$origpath\")";
passthru($cmd);
// DEBUGGER
//echo $cmd;
}
}
default:
$thumbid = $_POST["thumb"];
$relative_url = "showdetail.php?thumb=".$thumbid;
$query = "SELECT Path.name AS path, Thumbnail.name AS
filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path ON
Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = '$thumbid') ";
// EXECUTE THE QUERY
$sql->QueryItem($query);
$getResults = $sql->data;
$path = $sql->data["path"];
$file = $sql->data["filename"];
// CLEAN UP THE PATH INFO
$origpath = "\\". $path ."\\" . $file;
if (isset($_POST["keyword"])) {
$keyword = $_POST["keyword"] ;
if(is_array($keyword))
{
for($i=0;
$i<count($keyword); $i++)
{
$cmd = "tpcmd.exe
Keyword(\"+$keyword[$i];|d:$origpath\")";
passthru($cmd);
}
}
}
if (isset($_POST["thumbFTxt"])) {
$thumbFTxt = ucwords($_POST["thumbFTxt"]);
$cmd = "tpcmd.exe
Keyword(\"+$thumbFTxt;|d:$origpath\")";
passthru($cmd);
// DEBUGGER
//echo $cmd;
}
}
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/".$relative_u
rl);
?>
--- End Message ---
--- Begin Message ---
I forgot the break; for the switch :(
Thanks,
John Ellingsworth
http://mail.med.upenn.edu/~jellings/
-----Original Message-----
From: John Ellingsworth [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 11, 2003 2:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] Array problem
Hi.
In the code below, I always get an error from the sql statement due to some
problem in the array result.
The goal is to add as many keywords to as many thumbnails selected from a
form.
The thumbnails have this checkbox:
<input type=checkbox name=thumb[] value=3267>
And the keyword this:
<select MULTIPLE SIZE=5 name=keyword[] class=select>
<option value="Animals">Animals
etc ...
</option>
The error info is this, with the actual thumb array results output from
print_r():
Array ( [0] => 3266 [1] => 3267 [2] => 3268 [3] => 3269 [4] => 3270 [5] =>
3271 [6] => 3272 [7] => 3273 [8] => 3274 [9] => 3275 [10] => 3276 [11] =>
3277 )
Error: Unable to perform query: SELECT Path.name AS path, Thumbnail.name AS
filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path ON
Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = 'Array') :
Anyone have any suggestions? I have tried is_array, foreach($thumbarray as
$key => $value), and can't tell why I am getting this problem.
Thanks,
John Ellingsworth
http://mail.med.upenn.edu/~jellings/
Code:
<?
require("constant.php");
if (isset($_POST["thumbAction"])) {
$thumbAction = $_POST["thumbAction"];
} else {
$thumbAction = "default";
}
switch ($thumbAction) {
case "multipleThumbs":
if(isset($_POST["pathid"]))
{
$pathid = $_POST["pathid"] ;
$relative_url = "search.php?idpath=".$pathid;
}
if (isset($_POST["thumb"])) { $thumbarray =
$_POST["thumb"]; }
print_r($_POST["thumb"]);
foreach($thumbarray as $key => $value)
{
$query = "SELECT Path.name AS path,
Thumbnail.name AS filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path
ON Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = '$value') ";
// EXECUTE THE QUERY
$sql->QueryItem($query);
$getResults = $sql->data;
$path = $sql->data["path"];
$file =
$sql->data["filename"];
// CLEAN UP THE PATH INFO
$origpath = "\\". $path
."\\" . $file;
if
(isset($_POST["keyword"]))
{
$keyword =
$_POST["keyword"] ;
if(is_array($keyword))
{
for($k=0; $k<count($keyword); $k++)
{
$cmd = "tpcmd.exe Keyword(\"+$keyword[$k];|d:$origpath\")";
passthru($cmd);
}
}
}
if
(isset($_POST["thumbFTxt"]))
{
$thumbFTxt =
ucwords($_POST["thumbFTxt"]);
$cmd = "tpcmd.exe
Keyword(\"+$thumbFTxt;|d:$origpath\")";
passthru($cmd);
// DEBUGGER
//echo $cmd;
}
}
default:
$thumbid = $_POST["thumb"];
$relative_url = "showdetail.php?thumb=".$thumbid;
$query = "SELECT Path.name AS path, Thumbnail.name AS
filename, Thumbnail.idThumb FROM Thumbnail INNER JOIN Path ON
Thumbnail.idPath = Path.idPath WHERE (Thumbnail.idThumb = '$thumbid') ";
// EXECUTE THE QUERY
$sql->QueryItem($query);
$getResults = $sql->data;
$path = $sql->data["path"];
$file = $sql->data["filename"];
// CLEAN UP THE PATH INFO
$origpath = "\\". $path ."\\" . $file;
if (isset($_POST["keyword"])) {
$keyword = $_POST["keyword"] ;
if(is_array($keyword))
{
for($i=0;
$i<count($keyword); $i++)
{
$cmd = "tpcmd.exe
Keyword(\"+$keyword[$i];|d:$origpath\")";
passthru($cmd);
}
}
}
if (isset($_POST["thumbFTxt"])) {
$thumbFTxt = ucwords($_POST["thumbFTxt"]);
$cmd = "tpcmd.exe
Keyword(\"+$thumbFTxt;|d:$origpath\")";
passthru($cmd);
// DEBUGGER
//echo $cmd;
}
}
header("Location:
http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF'])."/".$relative_u
rl);
?>
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--- End Message ---
--- Begin Message ---
I am trying to get the ability to resume broken downloads with a client
(such as FlashGet, GetRight, etc...) I am able to download the complete
file without resume and everything works properly, but, when using a
download manager, if I break the download then continue, the byte count
never matches up. I am checking for the $_ENV['HTTP_RANGE'] and setting up
my headers based on this info. But, the byte count continues to be
incorrect. Could someone point me in the right direction? Thanks in
advance for any assistance. Below you will find my code....
<?php
session_cache_limiter('public');
session_start();
set_time_limit(0);
$file=$_REQUEST['file'];
$extstart=strpos($file, ".");
$ext=substr($file, $extstart+1);
$dir="d:\\downloadable_courses";
$size=filesize($dir."\\".$file);
header("Accept-Ranges: bytes");
if(isset($_ENV['HTTP_RANGE'])) {
list($a, $range)=explode("=",$_ENV['HTTP_RANGE']);
str_replace($range, "-", $range);
$size2=$size-1;
header("Content-Range: $range$size2/$size");
$new_length=$size2-$range;
header("Content-Length: $new_length");
} else {
$size2=$size-1;
header("Content-Range: bytes 0-$size2/$size");
header("Content-Length: ".$size2);
}
header("Content-Type: application/".$ext);
header("Content-Disposition: inline; filename=$file");
$fp=fopen($dir."\\".$file, "rb");
fpassthru($fp);
exit;
?>
--- End Message ---
--- Begin Message ---
I hav written a php application that will create a direcotory with then name given by
user and upload file into it
it work prefect on my pc server.
but when i upload to the web server........there is error due to my directory
permission
is there any way to control a directory permission with php script??
my webserver is an NT webserver with php enable.
thanx
--- End Message ---