CodingA database for my data

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  ANT_THOMAS   
 To:  ALL
35356.21 
I've looked further into things and I think the PHP command "exec" is what I might need to use, but, I can't figure out how to get it to work as a link :C

0/0
 Reply   Quote More 

 From:  Dan (HERMAND)  
 To:  ANT_THOMAS      
35356.22 In reply to 35356.21 

WIthout reading the thread much (on mobile) exec lets you run a command on the server (as opposed to the client).

 

To do it as a link just pass a variable through. sanitise it though, to stop people running anything on your server.

0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Dan (HERMAND)     
35356.23 In reply to 35356.22 
Ah, not what I want then. Command needs to be run client side.

0/0
 Reply   Quote More 

 From:  steve  
 To:  ANT_THOMAS      
35356.24 In reply to 35356.23 
PC Format coverdisks used to use some form of magic to make the browser run an .exe installer without complaining. It was discussed on the first Delphi PCF forum.

HTH :$

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ALL
35356.25 
Oooh - investigate HTA - that lets you execute shell commands and also connect to servers.

Assuming uni machines don't block it.
0/0
 Reply   Quote More 

 From:  empathy  
 To:  ANT_THOMAS      
35356.26 In reply to 35356.23 
Write a tiny program (c, vb, whatever) that can open a certain file extension, say .ant and which then simply runs

c:\Program Files\SpinWorks\SpinWorks.exe Z:\Docs\Uni\MPhil\NMR\2008-10-21-AB-26\10\fid

or whatever. You could either have the .ant file contain the correct directory to use in the call. Then associate .ant files with the application on the client computer, and get your web app to produce the appropriate .ant files. Bit of effort involved but at least it will work seamlessly.
0/0
 Reply   Quote More 

 From:  Ally  
 To:  empathy     
35356.27 In reply to 35356.26 
But add a crapload of security to check what it's trying to do. Otherwise you're leaving a huge security hole on the computer... not one that's likely to be exploited but still bad practise.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  ALL
35356.28 

I gave up on the getting things to open in Spinworks idea since it seems way more hassle than it's worth right now, but with what I've decided to do I've come across a problem.

 

When I open a full entry to show the full set of data I want to click a link to show any of the spectra as a PNG or JPEG. I want this image to load underneath the main content area, in an extra DIV. Is this possible easily? Or is the alternative an iframe? (which I was trying to avoid)

 

Also, are there are any batch converters for PDF to PNG/JPEG? I tried irfanview but it was being an arse not being able to recognise PDFs properly even after installing the relevant plugins.


0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  ANT_THOMAS      
35356.29 In reply to 35356.28 
Oh, I want this DIV to be invisible until the image link is clicked.

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
35356.30 In reply to 35356.29 
You don't need an extra div nor an iframe. Just plonk an image there onclick.

If you provide the current HTML you've got, I can give you the appropriate script. :)
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
35356.31 In reply to 35356.30 
Which bit of the HTML?

0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
35356.32 In reply to 35356.30 

If you want the actual PHP file then I'll C&P the code.

 

Don't shout at me though.


0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
35356.33 In reply to 35356.31 
I'm not sure. :S

You mentioned something about the main content, and also about the full details - my brain can't figure out how you've got things setup.

With jQuery, you can do something along the lines of:
code:
<a href="spectra1.jpg" onclick="$j('img#spectra').attr('src','spectra1.jpg').show(); return false">view spectra</a>


And then under the content you have
code:
<img id="spectra" src="" alt="" style="display:none;"/>


Which isn't perfect but should work.
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
35356.34 In reply to 35356.32 
quote:
Don't shout at me though.


Is that your way of saying the code is really terrible? :P


If ^that^ stuff doesn't work then you can provide the PHP and I'll give you an exact solution in the morning. Goodnight. :)
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
35356.35 In reply to 35356.33 
That just seems to open the image directly.

http://wakeupbomb.no-ip.org/full.php?id=5

PHP code:
<html>
<head>
<title>NMR Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
 
<?php
mysql_connect("localhost","xxxxxx","******");
mysql_select_db("nmr");
$tableid = $_GET['id'];
$query  = "SELECT id,code,labbookref,contents,solvent,elements,servercode,time,machine,year,month,nmre1,nmrn1,nmre2,nmrn2,nmre3,nmrn3,nmre4,nmrn4,nmre5,nmrn5 FROM nmr WHERE id=$tableid";
$result = mysql_query($query);
 
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    echo "
 
 
		<table border='0' width='auto' style='margin-left: 0px;'>
		<tr>
		<td class='fulltop' width='50px'>{$row['code']}</td>
		<td class='fulltop' width='50px'>{$row['labbookref']}</td>
		<td class='fulltop' width='680px' align='right'>{$row['contents']}</td>
		</tr>
		</table>
 
		<div class='fullmain'>
		{$row['solvent']}<br />
		{$row['elements']}<br />
		{$row['year']}<br />
		{$row['month']}<br />
		<a target='_blank' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.pdf'>{$row['nmre1']}</a><br />
		<a target='_blank' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn2']}/pdata/1/email_{$row['servercode']}_{$row['nmrn2']}_1.pdf'>{$row['nmre2']}</a><br />
		<a target='_blank' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn3']}/pdata/1/email_{$row['servercode']}_{$row['nmrn3']}_1.pdf'>{$row['nmre3']}</a><br />
		<a target='_blank' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn4']}/pdata/1/email_{$row['servercode']}_{$row['nmrn4']}_1.pdf'>{$row['nmre4']}</a><br />
		<a target='_blank' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn5']}/pdata/1/email_{$row['servercode']}_{$row['nmrn5']}_1.pdf'>{$row['nmre5']}</a><br />
		{$row['servercode']}
<br />
<br />
		<a target='image' href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.png'>{$row['nmre1']}</a><br />
                <a href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.png' onclick='$j('img#spectra').attr('src','./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.png').show(); return false'>{$row['nmre1']} #2</a>
		<img id='spectra' src='' alt='' style='display:none;'/>
                </div>
                <iframe name='image' width='780px' height='550px' frameborder='0' class='fullimage' ></iframe>
 
 
 
 
 
         ";
}
 
 
 
 
?>
</body>
</html>

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
35356.36 In reply to 35356.35 
Ah, I forgot to explicitly mention the bit where you need to add jQuery library to the page.

Download this file, put it in the same dir as the stylesheet and then insert this code just before the </head>
code:
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">$j = jQuery.noConflict();</script>




And yes, that code is terrible. :P

You could at least save yourself some headache by doing:

PHP code:
$prefix = "./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/";


Just before the echo, after the opening brace.

And then replacing the start of all your links with {$prefix} to make things a bit more readable.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
35356.37 In reply to 35356.36 
Thank you, and good idea. I'll give that a go.

0/0
 Reply   Quote More 

 From:  ANT_THOMAS   
 To:  Peter (BOUGHTONP)     
35356.38 In reply to 35356.36 
I've stuck these lines in...

PHP code:
<script type="text/javascript" src="jquery-1.2.6.min.js"></script>
<script type="text/javascript">$j = jQuery.noConflict();</script>

(between the head tags)

then

PHP code:
<a href='./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.png' onclick='$j('img#spectra').attr('src','./nmr/{$row['machine']}/{$row['year']}/{$row['month']}/data/AB/nmr/{$row['servercode']}/{$row['nmrn1']}/pdata/1/email_{$row['servercode']}_{$row['nmrn1']}_1.png').show(); return false'>{$row['nmre1']} #2</a>
<br />
<img id='spectra' src='' alt='' style='display:none;'/>


But it just opens the image directly instead of within the page.

0/0
 Reply   Quote More 

 From:  Ally  
 To:  ANT_THOMAS      
35356.39 In reply to 35356.38 
Two possibilities:

  • The js is erroring out before it gets to return false- therefore it'll just go ahead and follow the link. It might then also wipe the JS error console and you won't get to see what the problem is. Try just doing a href to # to test it.
  • return false isn't actually a terribly reliable way of stopping things from happening. I forget the details now but in MooTools you'd call e.stop() to stop all event bubbling. But Peter made you use jQuery, so he can bloody well sort out his own mess, can't he?
0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  ANT_THOMAS      
35356.40 In reply to 35356.38 
Firstly, make sure you're testing in Firefox, and have Firebug installed, as it makes debugging much easier.

Then, you can either:
1) switch the href to # like Ally says
2) rename it to xhref which is a little simpler

And then look in Firebug's console to see what it says about the error.
0/0
 Reply   Quote More 

Reply to All  
 

1–20  21–40  41–60  …  141–158

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats