Sorry Kip15, try to copy and paste your code into a post
hwoarang69 commented: kind of worked +0
diafol commented: good catch +14
Sorry Kip15, try to copy and paste your code into a post
Get rid of all the whitespace in the img src property - also, make sure the img tag is closed.
<img src=\"get.php?image_id=$lastid\"></img>
where are we getting _GET[image_id]?
this will pull the value from the querystring, ie: get.php?image_id=
$user_id = $_SESSION['user_id']; or _request?
I would think Session, unless you are passing the user_id to the page somehow
try adding quotes around your image source
<img src ="get.php?image_id = $lastid">
dont forget to escape them in the php though
echo "Image upoaded.<p />your image:<p />
<img src = \"get.php?image_id = $lastid\">
";
also, if you are passing the image_id
to the get.php page, why aren't you using it to select the image?
eg:
mysql_query("SELECT * FROM image WHERE image_id = $_GET['image_id']");
the array looks ok to me.
eval("var " + key + " = " + value);
it might be to do with the eval'd code not having a semicolon, but i'm really just guessing at this point.
eval("var " + key + " = " + value + ";");
Maybe its a restriction of jQuery or the for-each loop... sorry, I'm not particularly a jQuery expert. :(
line 4 (above) of get.php should be echo base64_decode($image);
and the header
needs to be set first, or it wont work.
oh, I also just noticed that you are getting the image_id
via last insert id, but you are selecting based on the user_id
in get.php
no, as long as image_id
is an autoincrement field, this is the correct way to handle it.
According to the table schema you provided in the original post, there are 2 fields at the end you are not providing values for. Either you need to add values for these fields (null can be used if this is acceptable by the schema) OR you need to specify the columns list for which you are providing data.
the problem lies in the difference between browsers interpretations of the box model. Unfortunately, until all browsers decide to conform, universally, to the w3 standards, this is a frustration we all have to work with.
There are ways (css hacks) to add styling that is only interpreted by specific browsers. Many different methods can be found by googling depending on your specific needs. If you post your css code here someone may be able to recognise and point out one that will work for you.
I would probably add this, and then insert as per your original insert query.
$image = base64_encode(file_get_contents($_FILES['fileupload']['tmp_name']));
then, yes, you call the base64_decode()
when you want to display the image.
not sure what you are getting at with that user/password query, do you need to check the users login? Generally it is good practice to call mysql_real_escape_string()
on any text input by a user before executing it on your database, as it can help prevent injection atacks as well as sql errors.
I believe you can do it like this:
eval("var " + key + " = " + value);
I also use notepad++, and I like Programmers Notepad as well. There is also PSPad.
For online editing, some editors have ftp capability or addons (I know notepad++ does) that let you edit files locally that reside on a remote server.
Also check out these links
http://sourceforge.net/projects/ontext/ (now defunct, but you can still download it)
http://www.tinymce.com/
http://ckeditor.com/
http://www.catswhocode.com/blog/10-useful-online-code-editors
of course there are more if you are willing to pay for them.
@azareth: you don't need to specify the column names in an sql insert statement so long as you include values for all columns in the table in the order specified in the table schema.
The problem is that your binary data (ie: image content) contains characters that are invalid in a mysql string.
Take a look at the LoadFile function if you have the image file available on the server, or you can escape the string in PHP prior to passing it to the mysql query.
Alternately, you could manually encode the binary data to base64, but you will need to ensure you also decode it when you read the data from the database.
yes, so what diafol is referring to is the display.php
page code - this is the actual page that displays data dynamically based on the url parameters.
Are you able to post the code you have in display.php ??
Hi all,
I'm looking for a good tool for analysing Windows Server Event Logs. Basicaly, I want to be able to filter by types of entries or content, and search. If it has some smarts built in for things like highlighting suspicious behaviour that would be great too. I need to be able to monitor/review IIS activity and Active Directory access.
Any recommendations?
cheers
/H
I have a site that does exactly this.
.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
./index.php
<?php
/** Tells WordPress to load the WordPress theme and output it. */
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wordpress/wp-blog-header.php');
?>
Sorry Dani... still unable to reproduce any crash-like behaviour for you. Tried following some links from your twitter as mentioed above.
The new ad-hover-background is much more responsive in FF than the striped one was. I did notice that at one point it stopped appearing when hovering over the right hand ad - but then I scrolled and it came back (haven't been able to reproduce, and no errors reported in js console)... weird.
Yeah, the post variable will always be set, but the print_r call will show you if it contains any values and what they are, or if it is empty.
Cheers :)
Never mind.... I figured out how to do it with window.open()
It just requires the right number and escaping of the right types of slashes, and well formed tags and script code embeded in the right place in the page. Very finicky, but it works. Again IE only.
Would love if someone had a way to make this work cross-browser, but at least its functional.
I can observe that the background fading happens a lot slower on FF than in other browsers. not sure if that will help you or not :/
You should still be able to use books that reference VS web developer edition. VS Pro includes more features, but should encompass everything in the web dev version. The general methodologies, tools and techniques used for building ASP.NET pages will be the same.
I don't have many 3rd party addons installed
I'm completely on Windows 7 at the moment. Maybe its an issue in XP or another platform?
Just installed the v13 beta... no problems, I'm writing this post in it now.
I get this, doesn't seem to cause an actual problem though.
--
[13:36:09.444] Use of getAttributeNodeNS() is deprecated. Use getAttributeNS() instead. @ http://www.daniweb.com/
With the number of different versions of firefox available over the last 12 months, it could be specific to any one of them. I am running v10 and v12 and have not experienced any issues viewing the site.
I'm not sure what level of detail you are getting in your logs, but if you can narrow it down to 1 or more versions of FF or and OS platform, I'm sure there are folks on here that would be willing to help test on the applicable systems for you.
Is there any chance it could be an alternative browser, like from a mobile platform or some such, that might be a fork or derivative and reports as FF to the webserver?
OK, firstly, the number of fields does not match up to your insert query. Looks like you are missing the email
field out of the insert.
Sencondly, I assume user_id
is an autoincrement key field. In order to make it work properly you need to insert NULL
not and empty string.
"INSERT INTO user VALUES(NULL, '$firstname', '$lastname', '$username', '$password', '$email', '$dob', '$gender')"
You will need to make sure you grab the email from the post data, as it looks like you missed that (or I just can't see it)
It's also advisable to check the data for single quotes '
and other characters that may cause errors in the mysql and escape or remove them.
$firstname = str_replace("'","\'",$firstname);
etc.
also, your DOB variable is $dob_db
, so check that in your insert statement.
Kane this is not a C# string as such, that I was tring to maintain. It is an SQL string, and the @q is actualy a local SQL variable. It seems there is just an issue with the SQLDataSource that misinterprets this query representation.
As I mentioned, the query runs perfectly as is when executed directly on the database. Its just that ASPNET can't parse it properly.
I worked around the solution by executing the 'construction' subquery first in code, and assembling the full query string manually, then passing it to the data source and manually databinding. Not as elegant as I like, but it works.
I will leave this question open, in the event that someone stumbles accross it with an answer. I'd still be interested to figure it out for future reference.
Thanks Pritaeas, that will work although less eligant than I like.
I guess the ultimate answer to my question, as my far as research has shown anyway, is that there is no way to not short-circuit boolean operations in javascript.
Kind of limiting if you ask me, but eh.
OK, let me preface this by stating that this is for an internal application only, so security is not a major concern and we can/do have a fair amount of control over the users browser, operating environment and configuration.
I am currently generating some hyperlinks, like this:
<a title="L7489" id="MainContent_GridView1_lnkFolderR_1" style="display: inline;" href="file:///W:\SYD\L\L7489">
These links do work, and the user can open the directory by clicking the link as expected. (This only works in IE, but as it is internal use only and a controlled environment, this is acceptable)
Now they want the application to automatically create the directory if it doesn't exist, and then link to it. I thought about trying this in javascript, but obviously there are design/security restrictions on accessing client side file system through javascript.
I can convert the anchor tag to an aspnet link button, and perform the directory check and creation on the server side. However, I am at a loss as to how I push the open folder command back to the browser.
In previous instances I have been able to dynamicaly generate an print a window.open()
javascript call, but this doesn't work for local file paths.
no problem, glad I could help. :)
actually... I may have just spotted it.
at line #114 above, on completion of processing a successful post you are redirecting the browser to the same page. This will clear the previously posted data and rerun the same script
header('Location: register.php');
It is also redundant as they will already be on the register page, and redirecting will override any messages you wish to display to the user. I suggest removing this line and try it again, you may find it has been working the whole time. ;)
...
update... just tested this theory on my server, and I get the "dead" path executed with no post data as you have described. I will almost guarantee that this redirect is your root cause
hmm... seems very strange. I have run and tested your code above and I get all the POST data correctly, and your isset($_POST['submit'])
check is successful.
I can only conclude that the problem is not in this code file. Can you post what is in the included connect.php
file?
Is there any parent code (such as templates or CMS stuff) that might be affecting / intercepting the code?
Check the session_start()
call like I said before as it may be resetting the POST variable.
Also, not sure if this may be causeing a problem or not, but all your html input tags are poorly formed having no close. ie:
<input type="submit" name="submit" value="Register">
should be
<input type="submit" name="submit" value="Register" />
// see tag close here .. ^
In my experience a named submit button should be available in PHP via the POST variable, and should have the value assigned to the button (ie: its display text) in this case, it should be true that $_POST['submit'] == "Register"
It is possible that naming the button 'submit'
may also be an issue, although I doubt it, but this is an easy thing to test.
Another thought... clear your browser cache and make sure you use ctrl+F5
to force a full refresh of the page (clear cookies as well to ensure you get a fresh session) as empty POST data can sometimes be caused by browser or proxy caching the POST request.
yes, it would seem so.
I wonder if your call to session_start()
or something in that include
file is resetting/clearing the POST variable?
maybe try something like this and see if you get your post data
if (!isset($_SESSION)) {
session_start();
}
<form action="" method="post">
Don't you still need to specify the current page address for the postback to work?
disclaimer: it's entirely possible I'm wrong...
Also, for debugging purposes you could add print_r($_POST)
to the top of the page to see what the actual post data contains on submit.
so, you want to move the background image to the right?
background-position-x: 5px;
and try background-position: 50px 200px;
on your body background to move the image lower and to the right.
Let me preface this by saying; who wouldn't want to work at Google?
Though its been a while since I was an undergrad, I find it interesting that so few had inspiration to travel or work abroad. This was always a goal for me, and part of what influenced my career choice. Technology is one of the most portable careers, and in high demand most places. Of course it helps if you are demonstrably good at what you do.
Having said that the market is also flooded by often minimally skilled technicians/coders who work very cheaply. This I imagine supports the idea that most of us wont work for free - there are plenty of freelance or casual jobs for students or recent graduates to "get their chops", and many companies are more willing to hire and train inexperienced Techies, rather than say inexperienced lawyers. Also, you know, geeks tend to be lazy and require motivation to stop playing WoW and do some f###ing work.
As to the desire to get straight into work, I assume for most students who are following IT career paths its because they have a passion for technology of one sort or another. This was/is true for many of my friends and I. Yes, we are the geeks, and proud. Personally, I was also broke by the time I graduated and desperately needed to get onto a steady paycheque. That may have had something to do with it too.
You should be able to check for the HTTP response code, either via an exposed property/function return of the WebBrowser control itself, or manually in the page headers. If the response code is an error (say 400, page not found) you could navigate "about:blank"
or whatever else you want to do.
those two outputs would be quite different.
given an example; id=1, type='X', name='test', location='here':
"\n\t<li><a href=\"posts.php?ID={$arr['id']}+{$arr['type']}+{$arr['name']}\">{$arr['name']} {$arr['location']}</a></li>";
"
<li><a href="posts.php?ID=1+X+test">test here</a></li>"
"<a href='posts.php?id='".$arr['id']."&type=".$arr['type']."'>".$arr['name']." ".$arr['location']."</a>";
"<a href='posts.php?id='1&type=test'>test here</a>"
It all depends on your desired result, but I see nothing wrong with your orriginal link code.
Allow me to point out, however, that your SQL statement does not in fact SELECT anything called 'id'
... and this may be the root of your problem.
Ok... so I will use your image as an example of what we could do.
First lets add an index parameter to your function.
<?php function ARG_FF($index) {?>
<tr>
<!--AIR RESTRICTION GAUGE-->
<td><select name="gauge[<?php echo $index; ?>]">
<option value="8">8</option>
<option value="11">11</option>
<option value="15">15</option>
<option value="22">22</option>
<option value="25">25</option>
</select></td>
<!--FUEL FILTER-->
<td><select name="filter[<?php echo $index; ?>]">
<option value="20">20%</option>
<option value="40">40%</option>
<option value="60">60%</option>
<option value="80">80%</option>
</select></td>
</tr>
<?php }?>
Then we create a loop in the form to call the function and print the select controls.
<table>
<tr><th>Air Restriction Guage</th><th>Fuel Filter</th></tr>
<?php for ($i = 1; $i <= 8; $i++) {
ARG_FF($i);
} ?>
<!-- I'm not sure what your table footers are, but you can add a row here -->
</table>
This produces output like the following:
<table>
<tr><th>Air Restriction Guage</th><th>Fuel Filter</th></tr>
<tr>
<!--AIR RESTRICTION GAUGE-->
<td><select name="gauge[1]">
<option value="8">8</option>
<option value="11">11</option>
<option value="15">15</option>
<option value="22">22</option>
<option value="25">25</option>
</select></td>
<!--FUEL FILTER-->
<td><select name="filter[1]">
<option value="20">20%</option>
<option value="40">40%</option>
<option value="60">60%</option>
<option value="80">80%</option>
</select></td>
</tr>
<tr>
<!--AIR RESTRICTION GAUGE-->
<td><select name="gauge[2]">
<option value="8">8</option>
<option value="11">11</option>
<option value="15">15</option>
<option value="22">22</option>
<option value="25">25</option>
</select></td>
<!--FUEL FILTER-->
<td><select name="filter[2]">
<option value="20">20%</option>
<option value="40">40%</option>
<option value="60">60%</option>
<option value="80">80%</option>
</select></td>
</tr>
<tr>
<!--AIR RESTRICTION GAUGE-->
<td><select name="gauge[3]">
<!-- etc.... (cropped for brevity) -->
Then we just need to put your page code into a loop to process the mysql for each iteration.
for ($i = 1; $i <= 8; $i++) {
$gauge=$_POST['gauge'][$i];
$filter=$_POST['filter'][$i];
$gaugeFilter="INSERT INTO abc (ARG,Fuel_Filter) VALUES ('$gauge','$filter')";
if (!mysql_query($gaugeFilter,$con))
{
die('Error: ' . …
Treasure Note
-> Map
you could use arrays in the element names ... eg: <select name="filter[0]">
access via $_POST['filter'][0]
etc.
Immidiately, I can see that the endforeach
needs a semicolon. Also, lines 7-11 look like they need to be inside a <?php ... ?>
block. Outside of these observations, are you getting any specific error messages?
QWERTY by necessity of using laptops, not to mention phones and other devices. My GPS frustrates the hell out of me that its on-screen keys are in alphabetic order.
Although I do like the theory behind the DVORAK, after so many years of programming myself to qwerty I'm affraid its too late for me to change. It still annoys me that microsoft moved the insert
key on this one I'm using now.
agreed...
My preference would be to disable it and use the tooltip to explain why. Removing items can cause general confusion as the interface layout dynamically changes - generally try to keep things as consistent as possible. In my experience message boxes have a tendency to become annoying especially if the user forgets they can't do a thing.
candle -> [in the] wind
... not really an Elton fan, it's just what came to mind ...
Does anyone know a good way to force javascript to evaluate all operands in a boolean expression?
In particular, what I am tring to do is essentially this:
return isValid(a) && isValid(b) && isValid(c);
while this technically does work, the function is responsible for highlighting invalid areas on the form for user attention. Since the &&
operator short circuits, it will only ever highlight the first invalid expression, possibly requiring the user to go through several rounds of correcting input data.
Any ideas?
I believe that Natural Joins are more akin to inner joins than left joins.
Have a read of the Natural Join section here and in particular note the dangers described as modifying table structure will result in differences in output.
Listing the tables in a from clause, as I understand it, will always join every row in table1 to every row in table2 regardless of the data.
It is not difficult, though a little finicky as you have to use the DirectoryEntry
and/or DirectorySearcher
objects.
here is the official guide: http://msdn.microsoft.com/en-us/library/ms180906(v=vs.80).aspx
And some other examples to get you started;
http://stackoverflow.com/questions/7915145/get-all-users-from-a-group-in-active-directory