Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. create a multidimensional array...each element contains a subarray that contains all of your items...then just serialize it and save it to the file. [code]<?php $formresults = unserialize(file_get_contents("formresults.dat")); $formresults[$clientname_or_some_other_identifier] = $_POST; $open = fopen("formresults.dat", 'w'); fwrite($open, serialize($formresults)); fclose($open); ?>[/code]
  2. It is, without a doubt, at best - a guess by php using the mysql_field_type function.  MySQL has several data types...like int, tinyint, bigint, and so forth...that mysql_field_type will generalize into one...in the listed examples, they area all listed as "int". Here is the exact C code from the php source code: [code]switch(field_type) { case FIELD_TYPE_STRING: case FIELD_TYPE_VAR_STRING: return "string"; break; #ifdef MYSQL_HAS_TINY case FIELD_TYPE_TINY: #endif case FIELD_TYPE_SHORT: case FIELD_TYPE_LONG: case FIELD_TYPE_LONGLONG: case FIELD_TYPE_INT24: return "int"; break; case FIELD_TYPE_FLOAT: case FIELD_TYPE_DOUBLE: case FIELD_TYPE_DECIMAL: #ifdef FIELD_TYPE_NEWDECIMAL case FIELD_TYPE_NEWDECIMAL: #endif return "real"; break; case FIELD_TYPE_TIMESTAMP: return "timestamp"; break; #ifdef MYSQL_HAS_YEAR case FIELD_TYPE_YEAR: return "year"; break; #endif case FIELD_TYPE_DATE: #ifdef FIELD_TYPE_NEWDATE case FIELD_TYPE_NEWDATE: #endif return "date"; break; case FIELD_TYPE_TIME: return "time"; break; case FIELD_TYPE_SET: return "set"; break; case FIELD_TYPE_ENUM: return "enum"; break; #ifdef FIELD_TYPE_GEOMETRY case FIELD_TYPE_GEOMETRY: return "geometry"; break; #endif case FIELD_TYPE_DATETIME: return "datetime"; break; case FIELD_TYPE_TINY_BLOB: case FIELD_TYPE_MEDIUM_BLOB: case FIELD_TYPE_LONG_BLOB: case FIELD_TYPE_BLOB: return "blob"; break; case FIELD_TYPE_NULL: return "null"; break; default: return "unknown"; break;[/code] As you can see, it is a guess.  The only way to get a 100% accurate answer as to what type of field it is is to use "SHOW COLUMNS FROM tablename" and see what the "type" column in the result contains. If you still don't beleive me, use this SQL: [code]CREATE TABLE `proof` (   `a` varchar(255) default NULL,   `b` tinyint(4) default '0',   `c` text,   `d` date default NULL,   `e` smallint(6) default '0',   `f` mediumint(9) default '0',   `g` int(11) default '0',   `h` bigint(20) default '0',   `i` float default '0',   `j` double default '0',   `k` decimal(10,0) default '0',   `l` datetime default NULL,   `m` timestamp NULL default NULL,   `n` time default NULL,   `o` year(4) default NULL,   `p` char(255) default NULL,   `q` tinyblob,   `r` tinytext,   `s` blob,   `t` mediumblob ) ENGINE=InnoDB DEFAULT CHARSET=latin1;[/code] Once you have that table in your db, execute this php code: [code]$conn = mysql_connect("hostname", "username", "password"); mysql_select_db("dbname"); $query = "SELECT * FROM proof"; $result = mysql_query($query); $fields = mysql_num_fields($result); $rows  = mysql_num_rows($result); $table  = mysql_field_table($result, 0); echo "<pre>Your '" . $table . "' table has " . $fields . " fields and " . $rows . " record(s)\n"; echo "The table has the following fields:\n"; for ($i=0; $i < $fields; $i++) {   $type  = mysql_field_type($result, $i);   $name  = mysql_field_name($result, $i);   $len  = mysql_field_len($result, $i);   $flags = mysql_field_flags($result, $i);   echo $type . " " . $name . " " . $len . " " . $flags . "\n"; } $query = "SHOW COLUMNS FROM proof"; $result = mysql_query($query); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { print_r($row); }[/code] Which will return: [code]Your 'proof' table has 20 fields and 0 record(s) The table has the following fields: string a 255 int b 4 blob c 65535 blob date d 10 binary int e 6 int f 9 int g 11 int h 20 real i 12 real j 22 unknown k 11 datetime l 19 binary timestamp m 19 unsigned zerofill binary time n 8 binary year o 4 unsigned zerofill string p 255 blob q 255 blob binary blob r 255 blob blob s 65535 blob binary blob t 16777215 blob binary Array (     [Field] => a     [Type] => varchar(255)     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => b     [Type] => tinyint(4)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => c     [Type] => text     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => d     [Type] => date     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => e     [Type] => smallint(6)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => f     [Type] => mediumint(9)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => g     [Type] => int(11)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => h     [Type] => bigint(20)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => i     [Type] => float     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => j     [Type] => double     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => k     [Type] => decimal(10,0)     [Null] => YES     [Key] =>     [Default] => 0     [Extra] => ) Array (     [Field] => l     [Type] => datetime     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => m     [Type] => timestamp     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => n     [Type] => time     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => o     [Type] => year(4)     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => p     [Type] => char(255)     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => q     [Type] => tinyblob     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => r     [Type] => tinytext     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => s     [Type] => blob     [Null] => YES     [Key] =>     [Default] =>     [Extra] => ) Array (     [Field] => t     [Type] => mediumblob     [Null] => YES     [Key] =>     [Default] =>     [Extra] => )[/code]
  3. Your software could be doing a lot of things with the xml files...it could be generating them to store data, they could be used to store user settings for example.  It may use XSL to display data back to you.  The creator could have used the xml files in place of a database if he/she wanted.
  4. [quote author=madspof link=topic=106220.msg425000#msg425000 date=1156971789] so if a file was called joe blogs.mp3 it come out like this joe on it own when it should be joe%20blogs.mp3 [/quote] Use urldecode to get rid of the %20 and such...http://www.php.net/urldecode
  5. You have a syntax error on this line: [code]echo"<br><span class="subtitle">Upload Error</span>"; [/code] Here is a cleaner version of your code: [code]<?php if ($_SERVER['REQUEST_METHOD'] != 'POST') { $me = $_SERVER['PHP_SELF']; echo ' <form name="form1" method="post" action="' . $me . '" enctype="multipart/form-data"> <table width="500" border="0" cellspacing="3" cellpadding="0"> <tr> <td width="256" height="30" align="right" valign="middle"><p align="right"><span class="style1">Comment for Photo</span></p></td> <td width="344" align="left"><input name="textfield" type="text" size="40" /></td> </tr> <tr> <td height="30" align="right" class="style1">Website Link </td> <td align="left"> <input type="text" name="textfield2" /> <span class="style1">ie. www.google.com</span> </td> </tr> <tr> <td height="30" align="right"><span class="style1">Photo </span></td> <td align="left"><input type="file" name="imagefile" /></td> </tr> <tr> <td>&nbsp;</td> <td align="left"><input name="Submit" type="submit" value="Submit" /></td> </tr> </table> </form>'; } else { if (isset($Submit)) { $file = $_FILES['imagefile']['name']; $filetype = substr($file,-4); if ($filetype=="jpeg") { copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".jpg") { copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".png") { copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else if ($filetype==".gif") { copy($_FILES['imagefile']['tmp_name'],"UploadImg/".$_FILES['imagefile']['name']) or die("Could not copy"); echo "<br>Upload Complete"; echo "<br>Name:&nbsp;".$_FILES['imagefile']['name'].""; echo "<br>Size:&nbsp;".$_FILES['imagefile']['size'].""; echo "<br>Type:&nbsp;".$_FILES['imagefile']['type']."<br>"; } else { echo "<br><span class=\"subtitle\">Upload Error</span>"; echo "<br>Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>"; } } } ?>[/code]
  6. If you are connecting to a MS ActiveDirectory controller and you are doing password resets, then the person changing the password must be an administrator for the domain.  If the user is changing their own AD (windows) login password, then they are able to change it by supplying their current password and their new password, however, there is no point in it since it's easier to do ctrl-alt-del and click "change password". Anyway, did you try google? http://www.google.com/search?hl=en&lr=&q=ldap+change+password+php&btnG=Search
  7. A brief google search yeilded this: http://www.sibsoft.net/xupload.html
  8. To my knowledge, using only PHP, the only way to change how large a file you can upload is in php.ini. The file is actually sent by the html form to the server, so it is sent as one large part that php then processes.  You may be able to change this using a java plugin to do the uplaoding (not javascript, java), but I'm not familiar with that.
  9. What is contained in these variables for the output that is being commented out: $imageURLL $modObj->longName $data['shortname'] ?
  10. http://www.php.net/manual/en/ini.php
  11. [quote]is thier a way for the <BR>'s to be hidden in edit script script but the still work?[/quote] That doesn't make sense
  12. check your php.ini to see what the max file upload size is.
  13. http://www.php.net/str_replace Use an array of all the characters you want to replace for the first arguement.
  14. if your link looks like this: [quote]viewforums.php?fid=1?pid=1[/quote] then it's wrong.  It should be: [code]viewforums.php?fid=1&pid=1[/code]
  15. http://us3.php.net/manual/en/function.strrev.php
  16. [code]<?php $query = "SELECT COUNT(*) FROM table"; $result = mysql_query($query) or die(mysql_error()); $count = mysql_result($result, 0); echo ' <table border="1"> <tr> <th>Number</th> <th>&nbsp;</th> </tr>'; for ($i = 1; $i <= 10; $i++) { $n = pow(2, $i); echo ' <tr> <td>' . $n . '</td>'; if ($count >= $n) { echo ' <td style="background-color: red;">&nbsp;</td>'; } else { echo ' <td>&nbsp;</td>'; } echo ' </tr>'; } echo ' </table>'; ?>[/code]
  17. Unless you reload the page after the selection is made, it's done entirely in javascript.
  18. Your query isn't returning a valid result.  Put it into your MySQL admin-tool-of-choice and make sure that it is working correctly. You are using a class to connect to your db and query it...those can vary widely on how they return data...so without knowing how it returns the data, then we can't give you a definate answer. It could return the mysql resource that contains the query results.  It could contain an array of the results as a single dimensional array, or a multidimensional array in several different formats.
  19. Without knowing what class you are using to interact with your database, we can't tell you how to print the result in a table.  However, since you say it's returning an array, just use print_r to see the contents of the array... change: [code]echo $total_this_month;[/code] to: [code]echo "<pre>" . print_r($total_this_month, true) . "</pre>";[/code]
  20. Seems to not escape the quotes correctly to add the 1 to $last. [code]$query = "SELECT DISTINCT LH.[Employee Number], LH.[Lmo], LH.[Lda], LH.[LYR], LH.[Hours], LH.[Leave Code], M2.[HRYRAT], M2.[EMPNO], M2.[MANLAP], M2.[MANLAC], M2.[MANLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[NAMEMI], M2.[NAMEL], M2.[NAMEF] FROM LEAVHST LH INNER JOIN MASTERL2 M2 ON LH.[Employee Number] = M2.EMPNO WHERE M2.[EMPNO] = '" . $_POST['employeenumber'] . "' AND ((LH.[LYR] = '$last' AND LH.[Lmo] >= '07') OR (LH.[LYR] = '" . $last + 1 . "' AND LH.[Lmo] < '07')) ORDER BY LH.[LYR] desc, LH.[Lmo] desc, LH.[Lda] desc"; $result = mssql_query($query);[/code]
  21. it means that the directory doesn't have proper permissions to create files
  22. So, just to be sure...you are storing the date for leave in three seperate columns...Lya, Lda, and Lmo? If so, then you should be able to do something like: [code]SELECT DISTINCT LH.[Employee Number], LH.[Lmo], LH.[Lda], LH.[LYR], LH.[Hours], LH.[Leave Code], M2.[HRYRAT], M2.[EMPNO], M2.[MANLAP], M2.[MANLAC], M2.[MANLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[MSKLAB], M2.[MSKLTC], M2.[NAMEMI], M2.[NAMEL], M2.[NAMEF] FROM LEAVHST LH INNER JOIN MASTERL2 M2 ON LH.[Employee Number] = M2.EMPNO WHERE M2.[EMPNO] = '" . $_POST['employeenumber'] . "' AND ((LH.[LYR] = '$last' AND LH.[Lmo] >= '07') OR (LH.[LYR] = '" . $last + 1 . "' AND LH.[Lmo] < '07')) ORDER BY LH.[LYR] desc, LH.[Lmo] desc, LH.[Lda] desc[/code]
  23. change: [code]while ($a_row = mysql_fetch_row( $results )) {[/code] to: [code]while ($a_row = mysql_fetch_array( $results )) {[/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.