Jump to content

wildteen88

Staff Alumni
  • Posts

    10,480
  • Joined

  • Last visited

    Never

Everything posted by wildteen88

  1. Have you restarted Apache? Apache must be restarted in order for the changes in the httpd.conf to come into effect. Also you pust append the port number too on to your computers address eg: http://your-computers-ip-address:8000 example: http://192.168.2.1:8000 If you don't provide the port number then the default poit used will be port 80.
  2. Make sure that the directory that the file is in has write permissions too.
  3. Only the start tag should be <?php not the ending tags. Ending tags should be just ?> Correct syntax: <?php // your code here ?> The following is incorrect <?php ?php>
  4. Yes that is ok. However you can combine all the IndexIgnore directives into one Options +Indexes IndexIgnore +file.exe test.html log.txt *.php
  5. libmysql.dll is the mysql client. both extension uses this library in order for PHP to communicate to the MySQL server.
  6. Have you restarted the server? When making any changes to the php.ini the server will need to be restarted. Also why does register_globals need to be enabled? Also another thing PHP4 is also at the end of its life. I suggest you to use PHP5 instead and to not use register_globals. If its a PHP script you're installing then either see if a more update version exists or find a different script which does not rely on register globals.
  7. they both are extensions. php_mysqli.dll is the MySQL Improved extension with comes with PHP5 and provides more functionally when using PHP with MySQL. It is recommended to the mysqli extension with PHP5 and MySQL5 Read the manual to see difference between mysqli and mysql extensions.
  8. EDIT: Ken beat me You only need to declare the get_POST function once. You do not need to keep redeclaring the function everytime your go to use it. use: <?php function get_POST($field_name) { $field_value = NULL; if (isset($_POST[$field_name])) { $field_value = mysql_real_escape_string($_POST[$field_name]); } return $field_value; } $username = get_POST('username'); $password = get_POST('password'); if(!empty($username) && !empty($password)) { // do whatever with the username and passwprd } else { echo 'Username or Password not set!'; } ?> EDIT: Ken beat me
  9. No that query is wrong. You should use if(isset($_GET['id']) && is_numeric($_GET['id'])) { $id = $_GET['id']; $result = mysql_query("SELECT * FROM downloads WHERE id = '$id'"); if(mysql_num_rows($result) > 0) { $row = mysql_fetch_assoc($result); echo '<pre>' . print_r($row, true) . '</pre>'; } else { echo $id . ' does not exist!'; } }
  10. implode is a standard PHP function which has been available since php4. Have a read of the manual on Implode.
  11. You need to save your file with the .php file extension not .html Also ensure you saving your php files in Apache'ss htdocs folder (eg C:/[path/to/Apache]/htdocs) and that you are going to http://localhost to run your scripts. You cannot load PHP files directly in to your web browser like you can with HTML files.
  12. Use IndexIgnore +yourfile.ext change yourfile.ext the actual file you want to hide from the directory listing. Or If you have a bunch of files you want to hide but has the same file extension then use IndexIgnore +*.ext IndexIgnore Manual
  13. Yes use file_put_contents $number = trim(file_get_contents('c.txt')); echo 'NUMBER: ' . $number; $new_number = $number + 6; // whatever you want to add to the number file_put_contents('c.txt', $new_number);
  14. If the file only contains just a number use file_get_contents. $number = trim(file_get_contents('c.txt')); echo 'NUMBER: ' . $number;
  15. Not sure what your problem is as I'm not understanding you, but whenever you are doing any type of arithmetic within a string your should wrap it in quotes: echo "for i : 1.." . $length . "<br />"; if($_POST['orient'] == "vert"){ echo $_POST['type'] . "_x(i,1) := " . ($_POST['s_x'] * 25 + 2) . "<br />" . $_POST['type'] . "_x(i,2) := " . ($_POST['s_x'] * 25 * $length + 27) . "<br />" . $_POST['type'] . "_y(i,1) := i * 25 + " . ($_POST['s_y'] * 25 + 2) . "<br />" . $_POST['type'] . "_y(i,2) := i * 25 + " . ($_POST['s_y'] * 25 + 27); }elseif($_POST['orient'] == "hori"){ echo $_POST['type'] . "_x(i,1) := i * 25 + " . ($_POST['s_y'] * 25 + 2) . "<br />" . $_POST['type'] . "_x(i,2) := i * 25 + " . ($_POST['s_y'] * 25 + 27) . "<br />" . $_POST['type'] . "_y(i,1) := " . ($_POST['s_x'] * 25 + 2) . "<br />" . $_POST['type'] . "_y(i,2) := " . ($_POST['s_x'] * 25 * $length + 27); } echo "<br />end for";
  16. Are you sure the home directory in account/admin has the correct permissions for writing files? EDIT: I have modified your code slightly: if($do=="add") { echo "Checking files...<br/>"; $baseDir = '../account/' . $user; $dir = $baseDir . $user . '/' . $type; $dirTemplate = "../template/" . $type; $fileList = $dirTemplate . "/files.txt"; $passwords = md5($user); $passwords = $passwords . ".txt"; $indexfile = $dirTemplate . "/index.html"; echo "Files Intact... Copying files... <br/>"; echo "Creating directory: $dir<br/>"; if(!mkdir($dir)) { echo "Fatal Error. Directory did not create"; exit; } else { echo "Directory Created.<br/>"; } echo "Template Exists... Copying Files...<br />"; $fileList = file($fileList); foreach($filesList as $file) { $sourceFile = $dirTemplate . '/' . trim($file); $targetDest = $dir . '/' . trim($file); if(is_writable($dir)) { if(!copy($sourceFile, $targetDest)) { echo "<br />Failed to copy $fileT to $fileD"; exit; } else { echo "Copy file: $fileT. Success!"; } } else { exit($dir . ' is not writable! Unable to copy files!'); } } }
  17. Apply the following css to the first td: white-space: nowrap;
  18. When using an JOIN you'll need to use GROUP BY to prevent duplicate results. So use: $function_match = mysql_query( "SELECT * FROM components, bom_dimwheel_white WHERE `components`.`part_num` = `bom_dimwheel_white`.`manufacturer_num` GROUP BY `components`.`part_num`" ) or die("SELECT Error: ".mysql_error());
  19. Just use PHP to categories the results in to the correct days. Run your standard SELECT query: SELECT * FROM csit_actioned WHERE entry_date BETWEEN '2008-05-01' AND '2008-05-31' ORDER by entry_date Now to categories the times, do $prev_date = 0; while($row = mysql_fetch_assoc($result)) { if($prev_date != $row['entry_date']) { echo '<h1>' . $row['entry_date'] . '</h1>'; $prev_date = $row['entry_date']; } echo $row['username'] . ' - ' . $row['function_name'] . ' - ' . $row['total_aht'] . '<br />'; }
  20. Nothing has changed to do with loop between PHP or MySQL versions. It is actually to do with your logic which is incorrect. mysql_fetch_array does not return all results. Each time you call mysql_fetch_array it'll return one row from the result set. Your code cleaned up <?php function DB($db) { $query = "select * from $db"; $result = mysql_query($query) or die(mysql_error()); // start HTML Table echo '<table border="1" cellspacing="1" cellpadding="5">' . "\n <tr>\n"; // display field name as headings // get the number of fields in the table $f = mysql_num_fields($result); // loop through the number of fields in the table for($i = 0; $i < $f; $i++) { // display table heading echo ' <th>' . mysql_field_name($result, $i) . "</th>\n"; } echo " </tr>\n"; // close table row // now display the data from the table // mysql_fetch_rows returns an array while($row = mysql_fetch_row($result)) { // we are using implode to extract the data from the $row array into sperate table cells echo " <tr> <td>" . implode("</td>\n <td>", $row) . "</td>\n </tr>\n"; } echo '</table>'; // close the table } ?>
  21. Try the following (untested) code: <?php $uploaddir1 = 'uploads/'; $uploaddir2 = 'uploads/thumbs/'; $uploadfile1 = $uploaddir1 . $_FILES['upfile']['name']; $uploadfile2 = $uploaddir2 . $_FILES['upfile']['name']; if(file_exists($_FILES['upfile']['tmp_name'])) { if( copy($_FILES['upfile']['tmp_name'], $uploadfile2) && move_uploaded_file($_FILES['upfile']['tmp_name'], $uploadfile1)) { echo 'Image uploaded successfully'; } else { echo 'Error image uploaded unsuccessfully'; } } ?>
  22. Have a look at the code I posted here
  23. Who's code you trying?
  24. The manual is a good place too.
  25. I have installed AMP on vista with no problems. Make sure you run Apache under Windows XP Service Pack 2 compatibly mode along with administrator privileges. When installing Apache and MySQL you should right click the installer files and selecting Run as Administrator.
×
×
  • 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.