Menster 38 Junior Poster

Hi All,

I'm having a bit of a problem with a service I'm developing. I have a CGI script sitting on my server (Ubuntu 10.0.4) which obviously receives it's requests on port 80, and the incoming requests arrive on port 8083 which is out of my control. So I have set up a datapipe-static which forwards all the data to port 80, and the solution is working perfectly for my first script, but somehow no requests are reaching my second script.

What I've tried:
- Accessing the script through a browser works (even on port 8083)
- Tcpdumps on every port and IP conceivable, which only points out that no replies are being given to the requests on 8083, and no requests are being made on port 80.
- Changing the datapipe to work with internal, external and the loopback IP.

Any advice or help is greatly appreciated!

Thanks,
Menster

Menster 38 Junior Poster

Hi Guys,

I'm in the process of developing an ActiveX control which is designed to check the status of an installation and the config of that installation if it is there.

I'm 5/6ths of the way there, but in one of my steps, I rely on a 3rd party DLL's functions to check the config of the install. Now I'm not 100% sure but I think that these functions are trying to access the registry, and I'm not sure if ActiveX is allowed to do this (or if it is, then how it should be set up to do this).

If anyone know how to check if a control is trying to access the registry, please let me know so that I can find out -or- if you're familiar with referencing dlls from ActiveX controls, are there any major pitfalls i should be avoiding?

Many thanks in advance!

Menster 38 Junior Poster

Hi guys,

Bit of a strange problem here. I've been working on a CMS for a client where they can preview work that they've done in a div-tag which is inside the "Admin" template for the back-end.

My problem is this: After the user styles all of their content accordingly using CKEditor and they save it, when the content is then previewed, the stylesheet for the "Admin" template applies itself within that div-tag and overwrites their styles. Is there any way to stop this from happening?

I realise I could just make the preview occur in a popup window, but that won't work for other (in this context irrelevant) reasons.

Many thanks in advance

Menster 38 Junior Poster

Hi guys,

I am trying to create an application to serve on the web which is an integration of a java application and some php for mostly presentation functionality.

Has anybody here successfully done anything like this before, and if so how?

Please help. In dire need here.

Thanks in advance

Menster 38 Junior Poster

The browser won't accept that sort of url because the browser will treat the /../ as a folder called ..

I'm sorry, but that's just plain false. It is possible to access other folders on a server (even below/above the root directory if they aren't protected properly). I've done it before, and I've just double-checked that it can be done on our servers. You need to filter request headers for '..' and '.' for this specific reason.

Menster 38 Junior Poster

Thanks Shawn,

Got it working :)

Menster 38 Junior Poster

Hi there,

I'm busy trying to build an interface where users can create a sort of collage with images that they upload. I know it is possible to get the position of a DHTML element relative to the screen, the problem is I need the coordinates relative to a main div tag so that I can "compile" the collage and then when it gets served it will look the same regardless of screen size.

Thanks in advance for any help

Menster 38 Junior Poster

Hi there peoples,
This is a currency converter, built with a combination of javascript and php, which uses an XML feed from http://www.ecb.int/ to get up to date exchange rates. I know the xml handling is not very elegant, but it is functional :) Additions/comments/corrections welcome

Menster 38 Junior Poster

Seen on t-shirt:
Front: Only you can prevent forest fires!
Back: Which is great, because I've got other stuff to do.

Menster 38 Junior Poster

My record is 4. But you can only use multiple computers if you have multiple lengthy tasks to do, such as uploading multiple websites using ftp or doing s/w installations.

Menster 38 Junior Poster

Whats Up!!!

Menster 38 Junior Poster

Hi there,
In php.ini, change both "max_execution_time" and "max_input_time" to 0. This removes the limit & lets them run indefinitely. Alternatively you could set them dynamically from inside your script using ini_set().

Menster 38 Junior Poster

I do pHp in South Africa :)

Menster 38 Junior Poster

Hi there,
You could try the following function:
imagefill ( resource $image , int $x , int $y , int $color );
Where $x and $y are the top left coordinates where the filling starts, and just fill the image with white.

Menster 38 Junior Poster

Well, not really. You need to handle the intitial request (the client clicking on the button/link) with a javascript or other client side scripting language. You can not call a php function directly from that event, if you need to run a php function, you'll need to write an AJAX function (which is javascript, but in a unique methodology) to request that function be run by the server.

Menster 38 Junior Poster

Hi there,

The problem is that php is pre-processed, ie all of the php code is run before a page is served to the client and therefore, you cannot add interactivity to a page (like with the onXXXX event handlers of html elements) with php. You need to use a client side scripting language like Javascript. If you really need to use server side stuff to do the job, then you'll have to use AJAX to handle the request.

Menster 38 Junior Poster

leviathan is right, this would be easiest to do with a simple javascript function:

function disableCheckBox(checkbox1, checkbox2)
{
if (document.getElementById(checkbox1).checked == true)
{
document.getElementById(checkbox2).disabled = true;
} else {
document.getElementById(checkbox2).disabled = false;
}
}

and then for your checkboxes:

<input type="checkbox" id="chk1" onchange="disableCheckBox('chk1','chk2')" />
<input type="checkbox" id="chk2" onchange="disableCheckBox('chk2','chk1')" />
Menster 38 Junior Poster

Hi there,
I think the problem probably lies with your sanitizing methods.
When you insert (or update) the data into the database, make sure that you run the function "addslashes()" on the text from the editor before putting it into your sql. And then when you retrieve it from the database, run the "stripslashes()" method on the text.
That should sort your problem out.

Menster 38 Junior Poster

no


have you ever checked out wolfram alpha?

Menster 38 Junior Poster

Hi there,
I think the problem might be that you never assign values from the $_POST array into your variables ($login, $passwd, etc.) Unless you do this in your include('../vars.php'). But other wise your variable will always be empty.

Menster 38 Junior Poster

I still use Google for all of my own searches (research etc.) but when we do SEO reports for our clients, they like to see their rankings on Google, Bing and Yahoo. So we sort of have to use it from time to time.

Menster 38 Junior Poster

None that I know of. Pretty much anything that grows in less than a year, will die (and in this case turn into a brown ooze) in less than a year unless you preserve it somehow.

Menster 38 Junior Poster

I agree with VernonDozier, if you are a perfectly normal and healthy individual, you aren't going to commit suicide over getting you cellphone confiscated/ scolded for taking a call. And if you do, I don't think that its likely that you were going to last too long anyway.

Menster 38 Junior Poster

Hi there,
What you need is a little javascript to make this work, the following is an example:

var value1 = document.getElementById('list1').options[document.getElementById('list1').options.selectedIndex].value;
var value2 = document.getElementById('list2').options[document.getElementById('list2').options.selectedIndex].value;
var value3 = value1 + '--' + value2 + '-';
document.getElementById('text_box).value = value3;

Just put this code between some script tags at the top of your page, correct the element ID's to match your html and call the function from your second "select" element's onchange attribute.

Menster 38 Junior Poster

lay
play
splay
day
slap
pay
slay
lisp

margarita :)

Menster 38 Junior Poster

No prob job :)

Menster 38 Junior Poster

Hi there,
Enclose the phrase post_text in single quotes, like this:

echo $rows['post_text'];

That should sort out your error :)

Menster 38 Junior Poster

In where i live in florida, rents are really cheap, i pay 464 dolars per month for a single bedroom apartment. move to usa man!

Dude, in South Africa, I share a 3 bedroom house with some people from work, rent per month is ZAR 5300 per month (for the entire house, not per person) , which is by todays exchange rate: USD 688.89. You can't just say it's cheap to live somewhere because the rent is cheaper, the costs of living vary greatly for various reasons all over the world.

Menster 38 Junior Poster

Hi there, in order to set the action of the form in response to a user selecting something from the drop down list, you will need to use javascript, try this :

$sql = "SELECT prodMFG FROM productDetail WHERE prodMFG != '' GROUP BY prodMFG"; // (1)
$result = mysql_query($sql);
echo "<form action='' id='myForm'method='POST'>"; // (2)
echo "<select name='category' onchange='setFormAction(this)'>"; // (3)
while($nt=mysql_fetch_array($result)) 
{
echo "<option value=$nt[prodMFG]>$nt[prodMFG]</option>";
}
echo "</select>";

And now the javascript to manage the onchange event:

<script>
function setFormAction(object)
{
//Get the selected value
    var get_param = object.options[object.oprions.selectedIndex].value;
var form = document.getElementById('myForm');
//set the form's attribute
form.action = 'search.html?var='+get_param+'';
}
</script>
Menster 38 Junior Poster

Just gave it a bash and it worked fine. There are a couple of other little errors in your code that you'll need to clean up though.
Good Luck :)

Menster 38 Junior Poster

Hi there,
I'm not too experienced with the gd libraries so forgive me if i'm wrong, but I think the problem is that the libraries can not spawn a picture out of nothing (unlike the php functions for files like fopen())
I would recommend creating the three .png images first, even just as blank 1px by 1px images, so that the code has something to open and manipulate.

Menster 38 Junior Poster

No prob job :)

Menster 38 Junior Poster

Well, the way your code is structured (in the first snippet), if $_POST == 'Login', the user will always be redirected to myaccount.php, if you only want that to happen if the login fails, then you must put it into and else statement like this:

if ($_POST['Submit']=='Login')
	{
		$md5pass = md5($_POST['pwd']);
		$sql = "SELECT user_pwd FROM users WHERE user_name = '$_POST[user_name]'"; 
		$result = mysql_query($sql) or die (mysql_error());
		$row = mysql_fetch_array($result);
		$password_in_db = $row['user_pwd'];
		
			if ($password_in_db == $md5pass) 	
			{ 
		 	  	// A matching row was found - the user is authenticated.
			   	session_start();
		     	list($md5pass,$user_name) = mysql_fetch_row($result);
		     	// this sets variables in the session
		      	$_SESSION['user_name']= $user_name;

                        echo "Logged in..."; 
	      	      } else {
  			   header("Location: myaccount.php");
               		   exit();
                      }
                   //Carry on with what would happen after a succesful login here
	  }
Menster 38 Junior Poster

Hi there,
The problem is where you are checking your $result against the $md5Pass, what you are doing is running the query and storing the result set in $result, but we aren't done yet, that $result only contains a pointer to a result set in memory and not the actual results (data). You need to add this to your code:

$md5pass = md5($_POST['pwd']);
$sql = "SELECT user_pwd FROM users WHERE 
            user_name = '$_POST[user_name]'"; 
			
$result = mysql_query($sql) or die (mysql_error());
$row = mysql_fetch_array($result);
$password_in_db = $row['user_pwd'];
    if ( $password_in_db == $md5pass ) 
	{ 
   // A matching row was found - the user is authenticated.

P.S remember, when comparing values in an if expression always use two (sometimes three) equals signs, using a single equals sign will assign one value to the other and not compare them.

Menster 38 Junior Poster

Hi there, you could use a regular for loop like this:

$max = ceil(count($Forms,$sharedForms);
for ($i = 0; $i < $max; $i++)
{
$outstring1.= " $(\"#shareform".$Forms[$i]['Form']['id']."\").hide();
         $(\".Share".$Forms[$i]['Form']['id']."\").click(function(){
         $(\"#shareform".$Forms[$i]['Form']['id']."\").toggle(\"show\");
    });";

$outstring2.= " $(\"#shareform".$sharedForms[$i]['Form']['id']."\").hide();
        $(\".Share".$sharedForms[$i]['Form']['id']."\").click(function(){
                $(\"#shareform".$sharedForms[$i]['Form']['id']."\").toggle(\"show\");
         });";
}

echo $outstring1;
echo $outstring2;
Menster 38 Junior Poster

Hi there, it can't be done solely with php, you need javascript to pull the actual resolution initially, but after that you can store it in a cookie and use php to access it
Put this script on your home page

<script language="javascript">
window.location.href = "resolution.php?width=" + screen.width + "&height=" + screen.height;
</script>

And put this script into a file called resolution.php

<?php
$width = $_get['width'];
$height = $_get['height'];

echo "You are using a $width x $height screen resolution";
// And set them into cookies as well.
//And then redirect to the page of the correct resolution
?>
Menster 38 Junior Poster

Um a little skewed.

Heres the breakdown:
You have a number of "SUPER GLOBALS" in php which are superglobals because they can be accessed from anywhere in the scope of your script. The 3 i'm gonna focus on here are $_POST, $_GET, and $_REQUEST because they are relevant to your question.

$_GET: is an array of all your "GET" variables, these include all the variables which are appended to the url of the page you are trying to access: e.g: index.php?getvar=value
You can then access the variable as follows:

$mygetvar = $_GET['getvar'];

$mygetvar will now be set to "value".
. As well as any data coming from a form whose method is set to get (as opposed to post).

$_POST: is much the same except that you cannot "post" data by appending the variables to the url, they all come from fields nested in a form whose method is set to "post".

$_REQUEST: is sort of a combination of the two, any vars in either $_GET or $_POST will appear in $_REQUEST. However, most experienced programmers will warn you against using this for various reasons, rather just stick to $_GET and $_POST.

As for the page to which the data is sent, that is controlled by your form's action attribute, or your link's href attribute (which you can use to send "get" variables)

Hope I helped clear up your dilemma, if you are still confused checkout php.net

Menster 38 Junior Poster

Take a look at this

Menster 38 Junior Poster

I think I know the anger of which you speak, I too get furious over trivial things especially people who don't understand why their e-mail isn't working when their mailbox is full, and many other similar examples of not only ignorance but complete lack of a will to learn (this becomes apparent the 4th or 5th time the same person calls in with the exact same problem)

Menster 38 Junior Poster

The only way you can do that is with computations, rest easy though, the computer takes care of the actual math for you:

$bytes = $_FILES['my_file']['size']; //Size of file in bytes
$kbytes = $bytes / 1024;
$mbytes = $kbytes / 1024; //Size in Mega bytes

Nice and simple :)

Menster 38 Junior Poster

Dude, do you regularly browse the internet with no other cause except to find something interesting? Much Respect.

Menster 38 Junior Poster

Hi there, I'm not sure if what you're asking for is possible. The way I understand it to work is if you take a page (index.html) and reload it, it also reloads all of it's child elements including the iframe and the page to which the iframe is linked.

A workaround for this would be putting your music player in the top-level page, and then making your users work inside an iframe in that page, because when the go to the next page from the iframe, only the iframe will reload and your top-level page will stay the same (ie keep on playing the song).

Menster 38 Junior Poster

Yes (Only a single strip down it's side ... so not really)

Can you juggle?

Menster 38 Junior Poster

If thats a vegetarian version of Marmite, then I can think of few things worse... but haven't tried it.

4 cheese (Cheddar, Mozarella, Feta, Haloumi) Pizza

Menster 38 Junior Poster

By the looks of things, you aren't connecting to your database correctly, try the following:
Replace your db connection initialisation with the following

mysql_connect(localhost,$username,$password) or die( "Unable to connect to database");
mysql_select_db($database) or die( "Unable to select database");

I just removed the @ from the second line since that could be the original error causing the second two, and I added a die statement to the first line, in case thats where the problem is.

Try it, and then double check your details (username, pwd etc.).
Let me know if you come right :)

Menster 38 Junior Poster

Hmm, didn't even know that such a thing was possible/necessary till I saw this thread.

Menster 38 Junior Poster

Hi there,
I would have done this earlier if I new this forum existed. But I didn't,
so here it is.

My name is Duncan, i'm a php/javascript/mysql developer in sunny South Africa, and I joined DaniWeb in thanks to all of the various forums and posts that Google found for me to help me do my job :)

Menster 38 Junior Poster

I think everyone should just revert to DOS 6.1.
I mean, can you honestly recall the last time your pc crashed/froze/failed while running DOS 6.1? :) Exactly

jbennet commented: seriously, DOS is horiffic. -7
Menster 38 Junior Poster

fun
fair
air
frau (if german's allowed)

xylophone

Menster 38 Junior Poster

Full moon.

What type of wood is Ron's original wand (handed down from some brother, broke in 2nd book)?