Jump to content

wisewood

Members
  • Posts

    226
  • Joined

  • Last visited

    Never

Everything posted by wisewood

  1. Found a fix for this, perhaps there are better methods, but this one works. Firstly, create a shortcut to the application you want to run, and put this shortcut in the windows directory on your webserver... then you just need to run this code in your script to execute the application you want. [code] <? $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run("your_shortcut.lnk", 3, false); ?> [/code] Works well with the local intranet setup we have here, so it'll do for me. Anyone with a better approach to this, feel free to speak up.
  2. currently running apache, and would prefer to find something to work with apache, though could if necessary switch to IIS. i just want to be able to say "if(!$whatever){//launch this application on the server}"
  3. **SOLVED** I know using COM you can run MS Word on the server, but how would i go about running an application on the server such as C:\apps\my_application.exe Any help greatly appreciated.
  4. if you're using a link rather than a form, you want to be using $_GET[variable] not POST. if you had, [a href=\"http://www.yourdomain.com/details.php?variable=123456\" target=\"_blank\"]http://www.yourdomain.com/details.php?variable=123456[/a] $_GET[variable] would have a value of 123456.
  5. dont know if this will be what you're after... but might help [code] <?php foreach (glob("*.jpg") as $filename) { echo "<IMG SRC='$filename' ALT='$filename'><br>"; } ?> [/code] this will select all the .jpg files in the directory and display them as an image.
  6. It's definately possible. Just takes some thinking about because of all the ifs and maths involved.
  7. This will display all files of the type you specify in the directory you specify. Using *.jpg will display all jpg files.. obviously. [code] <?php foreach (glob("/Gallery/thumbs/*.jpg") as $filename) { echo "<IMG SRC='$filename' ALT='$filename'><br>"; } ?> [/code]
  8. basically... Select all players from the golf_league table, and put them in order by their names. Then, for each golfer, select all players from the golf_league in random order. If the golfer they're playing against has the same name as them, leave them off the list, else display the name of their opponent and the week number. [code] <?php $strSQL = "SELECT * FROM golf_league ORDER BY golfers_name ASC"; if ($result = mysql_query($strSQL) or die ("Invalid query")) {     $num = mysql_num_rows($result);     for($i=0;$i<$num;$i++)     {         $golfers_name = mysql_result($result,$i,"golfers_name");     echo "$golfers_name will play against:<br>";     $strSQL2 = "SELECT * FROM golf_league ORDER BY RAND()";     if ($result2 = mysql_query($strSQL2) or die ("Invalid query"))     {         $num2 = mysql_num_rows($result2);         $week = 1;         for($i2=0;$i2<$num2;$i2++)         {                 $golfers_name2 = mysql_result($result,$i,"golfers_name");                  if($golfers_name2!=="$golfers_name"){         echo "Week $week. $golfers_name<br>";}         $week++;         }     }     } } ?> [/code]
  9. firstly, create this table in your database. [code] CREATE TABLE `linkCounter` ( `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , `clicks` INT NOT NULL , `link` TEXT NOT NULL ) TYPE = MYISAM; [/code] You'll want a way to add the links to the database... simple form will do the trick. [code] <?php // save this as add.php if(!$_POST) { echo "<FORM METHOD=POST ACTION=$PHP_SELF>"; echo "<INPUT TYPE=TEXT NAME=input_link>"; echo "<INPUT TYPE=SUBMIT VALUE=Submit>"; echo "</FORM"; } else { $query = mysql_query("INSERT INTO `linkCounter` ( `link` ) VALUES ( '$_POST[input_link]' )"); echo "$_POST[input_link] has been added to the database"; echo "<a href=$PHP_SELF>Click here to add another link</a>"; } ?> [/code] Just noticed the time... no time to flesh this out in full... sorry. Next, run a mysql query to list all the links that are in the linkCounter table "SELECT * FROM linkCounter" For each link, have it like this; <a href=out.php?link=$the_link_from_the_database&id=$the_id_from_the_database>$the_link_from_the_database</a> Set out.php so that it updates the clicks field of the linkCounter table where id is the id from the address bar ($_GET[id]) and add one to the number already there... then redirect the visitor to the page they selected. To list top100 by popularity, most popular first; SELECT * FROM linkCounter ORDER BY clicks DESC LIMIT 100 To list the 20 newest links... SELECT * FROM linkCounter ORDER BY id DESC LIMIT 20 Sorry i dont have time to be specific...
  10. i sent you a PM with the answer, but came up with this instead. [code] <?php if(!$_POST) {     echo "<FORM METHOD=POST ACTION=$PHP_SELF>";     echo "<TEXTAREA NAME=my_textarea COLS=30 ROWS=5></TEXTAREA><BR>";     echo "<INPUT TYPE=SUBMIT VALUE=Submit>";     echo "</FORM>"; } else {     $entries = explode( "\n", $_POST[my_textarea]);     $x=0;     foreach($entries AS $entry)     {         if($entry!=="")         {         // YOUR INSERT QUERY GOES HERE         echo "$entry added to database<br>";         $x++;         }     } } ?> [/code]
  11. Put the marquee into the while loop. This way, each result will get its own marquee. [code] <?php $queryF = "SELECT * FROM Products"; $result=mysql_query($queryF) or die (mysql_error() . "\nActual query: " . $query); $num=mysql_numrows($result); $i=0; while ($i < $num) { $ProductName=mysql_result($result,$i,"ProductName"); $main = "Products-Returned-From-Result"; echo "<MARQUEE BEHAVIOUR=SCROLL>$main</MARQUEE>"; $i++; } ?> [/code]
  12. do you have write access to the folder you're uploading to?
  13. The title doesn't really do justice the the question to be honest. I have an array, which is loaded up with all the filenames of files in a given directory. Now, what i want to do, is create a drop down list using <SELECT>, which will let me specify which types of file i would like to view... ie .bmp, .php, .jpg, .asp, .txt etc etc. I have ALOT of files in this directory, and want to be able to narrow it down somewhat by choosing what file types i want to browse. I know i can use a substr() function to get the extension of the files, but can i then create an array only containing one entry for each of the file types, so i would end up with something like; <SELECT> <OPTION>asp</OPTION> <OPTION>bmp</OPTION> <OPTION>gif</OPTION> <OPTION>jpg</OPTION> <OPTION>php</OPTION> <OPTION>txt</OPTION> </SELECT> I've already checked out the php.net/array pages and can't find anything that seems to be pointing me in the right direction.
  14. You need to submit the form so that it will pass the data over to your edit page. Unless you're prepared to use AJAX, which makes it a whole lot more work.
  15. when you use a valid image, this script does work. I've just tested it with an image thats on my own domain... from my local machine. [code] <?php $img_name = "http://www.wisewood.org/blog/images/burger.jpg"; $max_width    = 100; // maximum x aperture  in pixels $max_height   = 100; // maximum y aperture in pixels $size=GetImageSize($img_name); $width_ratio  = ($size[0] / $max_width); $height_ratio = ($size[1] / $max_height); if($width_ratio >=$height_ratio) {    $ratio = $width_ratio; } else {    $ratio = $height_ratio; } $new_width    = ($size[0] / $ratio); $new_height   = ($size[1] / $ratio); Header("Content-Type: image/jpeg"); $src_img = ImageCreateFromJPEG($img_name); $thumb = ImageCreateTrueColor($new_width,$new_height); ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width-1),($new_height-1),$size[0],$size[1]); ImageJPEG($thumb); ImageDestroy($src_img); ImageDestroy($thumb); ?> [/code]
  16. assign the empRef as the name of the checkbox, as from what i can tell that should be a unique reference number, so can easily be used to call that record from your table. PS. you have $row[empRef] twice in your while loop. :)
  17. an input box as in <TEXTAREA> or <INPUT TYPE=TEXT> ??
  18. post the code.
  19. i would use this; echo "<td align=left><a href=student.php?id=$_GET[id]>$_GET[id]</a></td>"; My prefered way to echo data. The " and ' aren't really necessary in the html you've got there, so might as well just leave it out.
  20. $headers .= "From: \"".$senders_email."\" <".$senders_email.">\n"; mail($recipient, $subject, $message, $headers); hope this helps.
  21. you'll have to excuse my not explaining how this work... its something i put together about 18 months ago and have never gotten around to using properly. It's all pretty straight forward... $album is the subfolder within the images directory $image is the filename of the image you want to work with Both of these are to be specified in the URL. However, you can just ditch that and use the $img_name variable to specify it directly. Hope this helps, sorry i can't be of any further use. [code] <?php $album = $_GET['album']; $image = $_GET['image']; $img_name = "images/$album/$image"; $max_width    = 150; // maximum x aperture  in pixels $max_height   = 150; // maximum y aperture in pixels $size=GetImageSize($img_name); $width_ratio  = ($size[0] / $max_width); $height_ratio = ($size[1] / $max_height); if($width_ratio >=$height_ratio) {    $ratio = $width_ratio; } else {    $ratio = $height_ratio; } $new_width    = ($size[0] / $ratio); $new_height   = ($size[1] / $ratio); Header("Content-Type: image/jpeg"); $src_img = ImageCreateFromJPEG($img_name); $thumb = ImageCreateTrueColor($new_width,$new_height); ImageCopyResampled($thumb, $src_img, 0,0,0,0,($new_width-1),($new_height-1),$size[0],$size[1]); ImageJPEG($thumb); ImageDestroy($src_img); ImageDestroy($thumb); ?> [/code]
  22. I just gave it a quick test... included various web-pages from various places... but when i tried including [a href=\"http://www.w3schools.com/asp/default.asp\" target=\"_blank\"]http://www.w3schools.com/asp/default.asp[/a] it came up with nothing. I dont think you'll be able to do it... but someone will probably prove me wrong. It is picking up the title of the page though, just not the content. I have also tried require() and that does the same thing
  23. You have: while ($row = mysql_fetch_array($query)) { // Do whatever } But... $row hasn't been specified anywhere, so doesnt exist yet, or at least has an value of "" (nothing). you should have: $row = mysql_fetch_array($query); which will enable you to use the $row[db_field_name] style variables... then you need the while loop... but you need to specify something for the while loop to work with, such as: $x=0; while($x<mysql_numrows($query)) { // Do something $x++; }
  24. I came up with a script to export data from a mysql database, and to create an Excel spreadsheet containing the required data. This Excel sheet is saved to a specific location on the webserver. If you want me to send over the script, let me know and i'll comment it up so its easy to modify for you. I use it for creating a mail-merge source file for when we want to send a letter to multiple clients... have a simple form where you can select the clients who are due to receive the letter, click a submit button and it transfers their details from the database and generates a .xls file with the content in it. It's pretty straight-forward really... but took me ages to get it working as i wanted.
  25. Try using this... [code] $query = mysql_query("SELECT * FROM accommodation WHERE $type = 'select_type' && $sleeps = 'select_sleeps' && $board = 'select_board' && $pets_allowed = 'select_pets_allowed'"); $x=0; while ($x<mysql_numrows($query)); { $row = mysql_fetch_array($query); type=$row["select_type"]; $sleeps=$row["select_sleeps"]; $board=$row["select_board"]; $pets_allowed=$row["select_pets_allowed"]; print ("this is for $type, and $sleeps and $board and $pets_allowed"); $x++; } //below this is the function for no record!! if (!$type) { print ("$XX"); } [/code] (sorry... there was an error that i just fixed)
×
×
  • 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.