[PHP] HTTP Headers

2001-11-09 Thread Mike Harvey

Is it possible to redirect to an IP address but have the browser address bar
show an URL?

Mike H.
http://ibiz-tools.com http://vestudiohost.com



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: post variables to MySQL fields

2001-11-12 Thread Mike Harvey

This isn't the code you were talking about but it's something I wrote and
use all the time. update_table() requires a "where" variable which is an
array which needs to be declared before the function is called. The $where
array is only 2 parts with the column name as [0] and the condition as [1].
It would be declared something like: $where=array("name","George");  They
both require $db as the database pointer and $db_name as the database name.
insert_table() has the option of using a second database ($db_name2, $db2)
if desired. I haven't needed this feature in update_table() yet so I didn't
add it in. It wouldn't be hard to take the code from one to the other if
needed.


function update_table($table,$where){
 GLOBAL $db,$db_name,$HTTP_POST_VARS;
 $fields = mysql_list_fields($db_name, $table, $db);
 $columns = mysql_num_fields($fields);
 for ($i = 0; $i < $columns; $i++) {
  $colnames[$i]= mysql_field_name($fields, $i);
 }
 foreach($HTTP_POST_VARS as $key=>$value){
  if(in_array($key,$colnames) AND $value!="~NULL~"){
   $value=addslashes($value);
   $save.="$c $key='$value'";
   $c=",";
  }
 }
 $update="UPDATE $table SET $save WHERE $where[0]='$where[1]'";
  mysql_query($update,$db);
}
~~~
function insert_table($table,$db_name2="",$db2=""){
 GLOBAL $db,$db_name,$HTTP_POST_VARS;
  $db1=$db;
  if($db2!="")$db1=$db2;
  $db_name1=$db_name;
  if($db_name2!="")$db_name1=$db_name2;
 $fields = mysql_list_fields($db_name1, $table, $db1);
 $columns = mysql_num_fields($fields);
 for ($i = 0; $i < $columns; $i++) {
  $colnames[$i]= mysql_field_name($fields, $i);
 }
 $cols="(";
 $save="(";
 foreach($HTTP_POST_VARS as $key=>$value){
  if(in_array($key,$colnames) AND $value!="~NULL~"){
   if($value==" ")$value="";
   $value=addslashes($value);
   $cols.="$comma$key";
   $save.="$comma'$value'";
   $comma=",";
  }
 }
 $cols.=")";
 $save.=")";
 mysql_query("INSERT INTO $table $cols VALUES $save",$db1);
}
~
"Rory O'Connor" <[EMAIL PROTECTED]> wrote in message
20011109191732.B783@jacktasty">news:20011109191732.B783@jacktasty...
> A while back somebody answered a question about some PHP code that would
> take the $HTTP_POST_VARS and create the SQL that would write them to a
> MySQL table  (provided the posted var names matches the MySQL
> fieldnames).
>
> Does anyone have info on that project?  The PHP searchable archive is
> down, otherwise I wouldn't be asking on the list.
>
> Thanks,
> Rory



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: Form Name Attribute

2001-11-12 Thread Mike Harvey

I would use a  field and look for that variable.

--
 Mike
~~~
   MICHAEL R. HARVEY 
   Web Creation - http://vestudiohost.com
   Internet Business Tools - http://ibiz-tools.com
   Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com
http://jewelry-by-mrh.com http://craft-by-mrh.com
   New Product Innovations and Development. Ph: 845-279-8295
"Kal Amry" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Hi guys, If I have a code in file1.php such as:
>
> 
> code..
> code..
> 
>
> And
>
> 
> code..
> code..
> 
>
> Now in file2.php, I need to check which form I am receiving!! How do I
> check!!
>
> In other words, let's assume we only have the form names "formName1" and
> "formName1" - What code I can use in file2.php to get the name of the
> calling form. I just want to know how can I get the name of the form (in
the
> above case, formName1 or formName2)
>
> Thanx
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: pass javascript variable to php without submit or reload

2001-11-12 Thread Mike Harvey

If you are trying to collect things like monitor size or other user data you
could try putting the JS in the head and then put a  tag with
time period of 0. I haven't actually tried this but it might work.

--
 Mike
~~~
   MICHAEL R. HARVEY 
   Web Creation - http://vestudiohost.com
   Internet Business Tools - http://ibiz-tools.com
   Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com
http://jewelry-by-mrh.com http://craft-by-mrh.com
   New Product Innovations and Development. Ph: 845-279-8295
"Phieu Huynh" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
>
> 
> function changebuilding (which) {
>  sel_var = which.selectedIndex
>  $sql_query = "select distinct room
>  from general.room_info
>  where building='$variable' group by level asc";
>
>$sql_result = mysql_query($sql_query) or die (" Can't execute the
> query");
>
>$i=0;
>while ($row = mysql_fetch_array($result_sec_level))
>  print ("ar[".$i++."] = \"".$row[0]."\";\n");
>  ?>
> for (i=0; i < ar.length; i++) {
> option = new Option(ar[i])
> document.myform.room.options[i]=option
>}
> }
> 
> 
> 
> Building :   
>  1
> 2
>   3
>  
> Room :   
>  
> 
> 
>
>
> I can pass the variable in building to $variable by submit button
> but I want to pass the sel_var variable to $variable and dynamic update
> the content in room.
>
> --
>
> phil



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] Re: executing another php.script

2001-11-12 Thread Mike Harvey

Just "include(script2.inc)" in your loop.

--
 Mike
~~~
   MICHAEL R. HARVEY 
   Web Creation - http://vestudiohost.com
   Internet Business Tools - http://ibiz-tools.com
   Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com
http://jewelry-by-mrh.com http://craft-by-mrh.com
   New Product Innovations and Development. Ph: 845-279-8295
"David Tod Sigafoos" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> I am sure that I am just .. missing this ..
>
> From one script I wish to 'execute' another script.  How is this done?
>
> Setting a link and clicking is not the answer .. one script loops
> through all the 'selected' rows and I want to 'execute' another script
> for each row .. can this be done?
>
> thanks
>
> DSig
> David



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Using PHP for directory indexing

2001-11-12 Thread Mike Harvey

Here's one from my function collection:
~~~
function list_dir($basedir,$type="",$filter=""){
//echo $basedir;
 $handle=opendir($basedir);
 $filelisting=array();
 while ($file = readdir($handle)) {
  if ($file!="." AND $file!=".."){
   switch($type){
case "file":
 if(strstr($file,"."))$filelisting[]="$file";
 break;
case "dir":
 if(!strstr($file,"."))$filelisting[]="$file";
 break;
default:
 $filelisting[]="$file";
   }
  }
 }
 closedir($handle);
 $out=$filelisting;
 if($filter!=""){
  unset($out);
  $fcount=count($filelisting);
  $count=0;
  while($count<=$fcount){
   if(strstr($filelisting[$count],$filter))$out[]=$filelisting[$count];
   $count++;
  }
 }
 sort($out);
 return $out;
}
~
$basedir - the directory you want to list
$type - optional - "" will give you evything, "file" will give you all
files, "dir" will give you all directories
$filter - optional - allows you to specify a file type ie: "gif"
--
 Mike
~~~
   MICHAEL R. HARVEY 
   Web Creation - http://vestudiohost.com
   Internet Business Tools - http://ibiz-tools.com
   Sculpture, Craft, Jewelry - http://sculpture-by-mrh.com
http://jewelry-by-mrh.com http://craft-by-mrh.com
   New Product Innovations and Development. Ph: 845-279-8295
"Rudolf Visagie" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> function GetFiles ($DataPath, &$files, &$nfiles) {
>
> // Reads a directory and puts filenames into a sorted array
>
> $handle=opendir($DataPath);
> if ($handle) {
> $nfiles = -1;
> while (false!==($file = readdir($handle))) {
> if ($file != "." && $file != "..") {
> $nfiles++;
> $files[$nfiles] = $file;
> }
> }
> sort($files);
> closedir($handle);
> }
> return 0;
> }
>
> Rudolf Visagie
> Principal Software Developer
> Digital Healthcare Solutions
> Tel. +27(0)11 266 6946
> Fax. +27(0)11 266 5080
> Cell: +27(0)82 895 1598
> E-mail: [EMAIL PROTECTED]
>
>
> -Original Message-
> From: Kevin Garrett [mailto:[EMAIL PROTECTED]]
> Sent: 12 November 2001 03:08
> To: [EMAIL PROTECTED]
> Subject: [PHP] Using PHP for directory indexing
>
>
> Hi All,
>
> I am wondering if anyone can help me with this.  I want people
> accessing my
> site to see a list of HTML reports but I don't want to turn on Directory
> indexing on my Apache webserver, seeing as the directory path is present.
> What I'm looking to do, is to write a basic php script which will read the
> files in a certain directory & create links to be presented to the user.
> Has anyone ever done this before?  Can someone give me an example or a
> headstart on this.
>
> Thanks in advance
> Kev
>
> _
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]