samarudge 16 Posting Whiz

OK then, i've looked at it and the URL rewriting rule is working fine (Its redirecting to the right page) and the server is clearly running as there is an error document being displayed. I think you may have an error in your PHP script causing the server to be unable to display it. I think we have solved the original problem but stumbled upon another one by mistake. You could test this theory out.
Make a copy of leftproducts.php (Or whatever you are redirecting to) and replace the contents of the origonal with

<?php echo $_GET['c_id']; ?>

(This will output the c_id variable we get from the HTML file)
so

http://yoursite.com/shopping/leftproducts.php?c_id=hello

should output:

hello

Tell me the results of this plz,
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hmm, it dont look like a missing module in apache as the error outputs the redirect URL

something/mysite/shopping/leftproducts.php?c_id=5

Try asking your webhost but other than that im stumped, sorry :(

Shanti C commented: Thank You Somuch..... +3
samarudge 16 Posting Whiz

This isn't such a crazy idea, its done all the time as a matter of fact.
I presume your familiar with javascript,
create a function that runs on the click of a link e.g.

<a href="#" onclick="form();">Contact</a>
<br/>
<span id="Contact">&nbsp</span>
function form() {
     return false;
     action = 'process.php'; //Where the form should go
     form = '<form action="'+action+'" method="post"><textarea style="width: 200px; height: 200px;">Hi</textarea><input type='submit' value="Send" /></form>';
}
     document.getElementById('Contact').innerHTML = form;
     
}

Now you would just need some AJAX to send the data and a similar function to change the contact span to whatever message you want
Regards,
Sam Rudge

samarudge 16 Posting Whiz

.htaccess files can go in any directory but if you are putting your rewrites in a .htaccess you should have it in the topmost directory. However you can put it anywhere you like as long as the links are relative E.G. you might be better off changing your rewrite rule to

RewriteEngine on
RewriteRule ^leftproducts/([A-Za-z0-9]).html$ leftproducts.php?c_id=$1 [L, QSA]

Now place your .htaccess file in the shopping directory.
I am presuming you access /shopping/ from
http://yoursite.com/shopping/
so you should get the page at
http://yoursite.com/shopping/leftproducts/page.html
Hope this helps
Sam Rudge

samarudge 16 Posting Whiz

OK then,
Try this:

RewriteEngine on
RewriteRule ^shopping/leftproducts/([A-Za-z0-9]).html$ /shopping/leftproducts.php?c_id=$1 [L, QSA]

I will explain the bits of this for you
1stly you need to put the ^ charictar at the start of the string to redirect not just the wildcard

2ndly you should realy just set your variable section to a selection of leters, the way you had it if anyone was smart enough they could enter something like:

/shopping/leftproducts/C:/private_stuff/mybankdetails.doc

And pull up all your lovely private information. The way it is set up there it will redirect

shopping/leftproducts/page.html,
shopping/leftproducts/bob.html,
shopping/leftproducts/margret.html

But not

shopping/leftproducts/bob/dog/smily_face.html

I have also added the QSA flag wich is query string append (Or ammend or something :-/ ) so

shopping/leftproducts/page.html?Do=Make a cup of tea

would call

/shopping/leftproducts.php?c_id=page&Do=Make a cup of tea

Any more probs just say (I havent tested this so not 100% sure it will work)
Regards,
Sam RUdge

samarudge 16 Posting Whiz

Try using time(), it produces a number value that is different every second and would never repeat. You could also add a rand() command to add a random number on the end so even if two people created a product at exactly the same time there would be a slim chance that it would be the same;

$ID = time() . rand(0,9); //Unix Time & A random number between 0 and 9

if you wanted to be almost certain not to create any duplicates you could increase the second number in the rand() command

Hope this helps,
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Right then,
this should work (If it doesn't then i'm out of ideas)

<?php
include('config.php'); //Include the config file

if($send_back_to_form == "yes") {

$redirect_to = $form_page_name."?done=1";
} else {
$redirect_to = $success_page;
}
//Output a page that sends the parent page to somewhere (Not the IFrame)
//This page has no content other than standard HTML and JS
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
<!--
function outsideframe() {
	opener.location = '<?php echo $redirect_to; ?>';
}
//-->
</script>
</head>

<body onload="javascript:outsideframe()">
<!-- In the rare case a user don't have javascript -->
<a href="<?php echo $redirect_to; ?>" target="_parent">Click To Continue</a>
</body>
</html>

Copy that code onto Process_form.php (Backup the original though) and see how that works. I wonder if this would count towards my IT GCSE :D
Hope that works for you,
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Its OK now, thankyou for your help but i use the google/youtube API and found it much easier than searching and opening

samarudge 16 Posting Whiz

With subdomains you could pritty much have anything you want. www. is not required for nearly all web browsers and you can do quide a few subdomains (If your hosting provider allows it)
E.G.
google.com
gives the same result as
www.google.com
but there may be a backup server running on
www1.google.com
incase the main server goes down
its sort of like server 1, server 2 etc.
You could have a subdomain like
www.bob.homer.boris.yourdomain.com
and send it to a different server to
yourdomain.com

Hope at least some of that made sense :$

samarudge 16 Posting Whiz

I think you could also use opener.location instead of parent.window.location, that might work better.
Rgds (Again :-/ ),
Sam Rudge

Um, i feel kinda stupid as i have answered this post twice already but you actualy need
self.parent.location=
in the javascript not parent.window.location or opener.location

Rgds (Yes again :icon_rolleyes: )
Sam Rudge

samarudge 16 Posting Whiz

you should be able to do it with a bit of javascript
<?php
echo '<script type="text/javascript">';
echo"parent.window.location = $success_page";
echo'</script>';
?>
that should work or you could send a link that the user would have to click on with a target of _top
<?php
echo"<a href=\"$success_page\" target=\"_top\">Click Here</a>";
?>
Hope that works
Rgds,
Sam Rudge

I think you could also use opener.location instead of parent.window.location, that might work better.
Rgds (Again :-/ ),
Sam Rudge

samarudge 16 Posting Whiz

you should be able to do it with a bit of javascript

<?php
echo '<script type="text/javascript">';
echo"parent.window.location = $success_page";
echo'</script>';
?>

that should work or you could send a link that the user would have to click on with a target of _top

<?php
echo"<a href=\"$success_page\" target=\"_top\">Click Here</a>";
?>

Hope that works
Rgds,
Sam Rudge

samarudge 16 Posting Whiz

I want to get the contents of the div and set it as a variable to use in my own script

samarudge 16 Posting Whiz

Sory the info i want 2 get from youtube is in a span not div and the class is description not the id,
Well i think that first post was highly successful and accurate :$
Sam Rudge

samarudge 16 Posting Whiz

Hi,
Is there any way to retrieve the contents of a DIV from another website,
E.G.
there is a div on Youtube with the ID description, how would i get the contents of that DIV?
Thanx
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have a website and I want to have a background that is 200 pixles down but 100% of the width of the page. I do not want the background to repeat. I use photoshop for my image so if there is something I have to do in that then that is OK.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

-1040

samarudge 16 Posting Whiz

Use this to generate a form and script
http://www.tele-pro.co.uk/scripts/contact_form/
Make sure you have set up your SMTP server in your PHP.ini
(See HERE)
Rgds,
Sam Rudge

samarudge 16 Posting Whiz

Yes but when sending to most email addresses there is an error returned which normaly says something like
"We generaly do not accept incoming mail from dynamic IP addresses"

samarudge 16 Posting Whiz

Hi,
I have a server with Windows 2003 on, I currently use Virgin Media ADSL as my ISP but they provide dynamic IP addresses so I cant use SMTP and need Dynamic DNS etc.
Can someone please provide me with a link to a tutorial as to how I can set up my own internet conection with a static IP. I think they do this at my school but they may use Red Hat Linux (Which I also have) so I could use a Linux tutorial but would prefer a windows one.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I want to set a function that will count how long a button is held down for however when the button is released I need to run another function that will pass the length of time and a variable passed by the button on to a script usin AJAX. Now im fine with the AJAX once I have my variables but its the bit about setting the variable to the length of time the button was down

Im guessing it will be something like this:

//When button is pressed
function button_down('direction') {
//The variable for counting the time
var Time
//Code for counting
}

//Button up
function button_up() {
//Ajax that sends the variable direction and Time to a script
//Dont bother writing this bit I am OK with it
}

Thanx,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have managed to set up HTTPS on my server. I wish to host two different websites over https so I used this code for two virtual hosts:

<VirtualHost *:443>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/wm/"
ServerName www.wm.freeform.ath.cx:443
ServerName wm.freeform.ath.cx:443
ServerAdmin samarudge@freeform.ath.cx
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.cert"
SSLCertificateKeyFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog "E:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>  

<VirtualHost *:443>
DocumentRoot "E:/Program Files/Apache Software Foundation/Apache2.2/htdocs/phproxy/"
ServerName www.pp.freeform.ath.cx:443
ServerName pp.freeform.ath.cx:443
ServerAdmin samarudge@freeform.ath.cx
SSLEngine on
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCertificateFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.cert"
SSLCertificateKeyFile "E:/Program Files/Apache Software Foundation/Apache2.2/conf/ssl/pp.key"
<FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
</FilesMatch>
<Directory "E:/Program Files/Apache Software Foundation/Apache2.2/cgi-bin">
    SSLOptions +StdEnvVars
</Directory>
BrowserMatch ".*MSIE.*" \
         nokeepalive ssl-unclean-shutdown \
         downgrade-1.0 force-response-1.0
CustomLog "E:/Program Files/Apache Software Foundation/Apache2.2/logs/ssl_request.log" \
          "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>

That seems OK but when I restart Apache I get this error:
[warn] _default_ virtual host overlapping on port 443, the first has precidence

And both of the URLs go to the first Virtual Host
How do I fix this?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have created a site in Fireworks CS3, i go to export and export the file as HTML.
If I open the file from my hard drive in Firefox it works fine however if I open it in http://localhost/ the dropdown menus dont work. I get exactly the same problem in IE and Opera. Am I doing something wrong with my export?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

There is no number or anything on the activation screen just the message that i have already activated?
I think i will stick to linux in future :)
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Change your mail command to
$status=mail($to,$subject,$message,"From:<from@email.com>");
This will show the email coming from from@email.com but you can change that to what you want.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have a windows server 2003 machiene but when i try to log on i get the error
This copy of Windows must be activated with Microsoft. You cannot log on until you activate windows. Do you want to activate now?
I click yes and the activation appears but says
Windows is already activated. Click OK to exit.
I click ok and it logs me off again.
What do i do to get round this error?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Have a look at http://www.hscripts.com/scripts/php/usersOnline.php and play about with that code.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi all,
I have just got Windows Server 2003 working. I used to use RedHat linux for my server and the SMTP server allowed me to relay emails to another server as I have a dynamic IP so most email providers will not let me deliver my emails. Is there any way to get Windows SMTP to relay the emails to my ISPs SMTP server?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

PHP would be best, its easyer to learn and you can have a PHP server for free but you can find some realy good tutorials for both PHP and ASP at http://www.tizag.com/
P.S. I dont work 4 tizag or anything but it helped me learn both PHP and ASP

samarudge 16 Posting Whiz

You could just use clever PHP to edit the virtualhosts.conf file and set the Apache restart as a scheduled task for windows at midnight or something.

samarudge 16 Posting Whiz

Hi,
I have got a script to refresh a single image but I want the user to be able to change the refresh rate of the picture by clicking a link. I have tryed the following code:

<p><IMG src="http://rc-xbot.ath.cx/webcam.jpg" width="320" height="240" border="1" name="refresh">
  <SCRIPT language="JavaScript" type="text/javascript">
      <!--
	  function Change(t) {
	  var t = 2
      image = "http://rc-xbot.ath.cx/webcam.jpg"
      function Start() {
      tmp = new Date();
      tmp = "?"+tmp.getTime()
      document.images["refresh"].src = image+tmp
      setTimeout("Start()", t*1000)
      }
      Start();
	  }
      // -->
      </SCRIPT>
</p>
<p><a href="javascript:Change('2')">2</a> <a href="javascript:Change('10')">10</a></p>

But that refreshes the image once when the user clicks on the link.
Thanx in advance
Sam Rudge

samarudge 16 Posting Whiz

Could You Explain This More.
Regards,
Sam Rudge

samarudge 16 Posting Whiz


2.Or do it the "right way":
Leave the code as is right now (that is remove the body "onload function call" - as I said in my previous post) and append this function call hidebox() to your external js file, right after the "function hidebox()" end.]

Right i have done that but now the box doesn't disappear at all
This is my javascript from logbox.js

// Javascript for showing the log in box:

//Hide
function hidebox() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('LoginBox').style.visibility = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.LoginBox.visibility = 'hidden';
}
else { // IE 4
document.all.LoginBox.style.visibility = 'hidden';
}
}
}

hidebox();

//Show
function LoginBox() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('LoginBox').style.visibility = 'visible';
}
else {
if (document.layers) { // Netscape 4
document.LoginBox.visibility = 'visible';
}
else { // IE 4
document.all.LoginBox.style.visibility = 'visible';
}
}
}

Regards,
Sam Rudge

samarudge 16 Posting Whiz

Well Sam,
Remove: onload="javascript:hidebox()" from your BODY element and you're OK to go.

(the part i red of the following html code in your document) <body onload="javascript:hidebox()"> Cheers

But then it is still there. I probably should explain the problem better. I want the login box to appear when the user clicks on the LogIn link in the account tab but unless the user has clicked on LogIn I want the div to be invisible.
Regards,
Sam Rudge
P.S. Thanks for helping

samarudge 16 Posting Whiz

Hi,
I have created a login box that appears on the click of a button that says login (Obviously) but when I load the page the div appears until the page loads. How do I get the div to appear immediately?
You can see the page here or http://freeform.ath.cx

Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have set up a URL rewriting rule for my website:

RewriteRule ^([A-Za-z]+)/([A-Za-z]+)\.html$ /main.php?Area=$1&Page=$2

Which works fine if I request a page like
http://mysite.com/folder/something.html
it would show
http://mysite.com/main.php?Area=folder&Page=something
but I want to also be able to pass the rest of the query string so something like
http://mysite.com/folder/something.html?Bob=Jim
would pass the query string onto the main.php page like
http://mysite.com/main.php?Area=folder&Page=something&Bob=Jim
Is there a way to do this.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

I dont know much about IIS but I know that on XP Pro you get IIS but it is limited to 5 connections at the same time. You could probably install XP pro as a partition on your mac and run an FTP server on the windows side. This should let them communicate with each other but I dont know.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I wish to set up a wireless network using only my laptop. I can set up an Ad-Hoc network but this is very slow to connect and the clients need lots of things to be set up before they can get on the internet. Is there any way to set up a proper wireless network using just a windows laptop that allows users to connect to it?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

I presume you are using PHP but there is a function called include(); which can include the contentse of a PHP file into your page. look at http://php.net/include to find out more about it or you can get a good tutorial at http://www.tizag.com/phpT/include.php

samarudge 16 Posting Whiz

Hi,
I am running Apache 2.2 with PHP5. All my files are written in PHP so they have the .php extension however I want to remove this extension in the same way google do (http://somurl.com/file), I can do this leaving the trailing slash on (http://someurl.com/file/) but I want to remove this end slash, how would I do this.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

You will have to use PHPMailer for an SMTP with autentication as PHP does not let you add authentication for the basic mail() command.

samarudge 16 Posting Whiz

Right i see,
The problem is on the processor there is a command which says:

if (!isset($_POST['email']))

so if email post is not set it will send you back to the form i presume however on the form the field is called Email which PHP will treat as a diferent post variable to email:
Basicaly as PHP is a sort of UNIX language a capital at the start of Email on the form will be diferent to the variable email in the processor
change the if line to:

if (!isset($_POST['Email']))

And try that
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Thanks, That worked fine

samarudge 16 Posting Whiz

Have you set up the SMTP setings in the PHP settings file?

samarudge 16 Posting Whiz

Is there any way to name a variable after another variable, I sort of made up this bit of code which I thought might work but it didn't

<php
$V_Name = 'variable';
$"$V_Name" = 'Hello';
print($variable);
?>

Bit of a long shot I know but I thought it might work,
Any other ideas, I wondered if there was a command like setvariable(); where you could set the variable name as a string but I couldnt find anything.
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,

I have tried

system("psexec -i -d -s C:/WINDOWS/notepad.exe");

and when I execute the script from my browser ( IE and FireF@x ) the page does not load. When i looked in the Apache Error log there are the lines:

[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] PsExec v1.94 - Execute processes remotely\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Copyright (C) 2001-2008 Mark Russinovich\r
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] Sysinternals - [url]www.sysinternals.com\r[/url]
[Mon May 26 17:51:12 2008] [error] [client 127.0.0.1] \r

but notepad.exe does not open.

I have also tryed this in PHP as well as perl and the command psexec -i -d -s C:/WINDOWS/notepad.exe runs exactly as desired when I run it in CMD

Regards,
Sam Rudge

I have sorted this, If anyone wants to know you need to open the service properties for apache 2.2 in services.msc and go to the LogOn tab and allow the service to interact with the desktop

samarudge 16 Posting Whiz

On second thoughts I think there might be a way but it might be tricky.

If you used $_SESSION variables you could probably do it but you would have to reload the main page.

On the main page insert this PHP along with the IFrame HTML:

<?php
session_start();
if ( !isset($_SESSION["Resize"]) ) {
/* This is what happens the first time the person visits the page */
$Hight = "100px";
$Width = "120px";
} else {
/* This is if the Session has been set */
$Hight = "20px";
$Width = "50px";
};
?>

<iframe frameborder="1" scrolling="no" height="<?php print($Hight); ?>" width="<?php print($Width); ?>" src="/page.php" />

Then on page.php (The page requested in the IFrame) put in this code:

<?php
session_start();
$_SESSION["Resize"] = "1";
?>
<a href="/page_with_iframe_on.php" target="_top">Some Link</a>

When the user clicks on the link there main browser will be sent to the same page but the $_SESSION variable 'Resize' would be set so it would use the second set of dimensions.

Regards,
Sam Rudge

P.S. You would probably get more help if you posted this in the PHP forum on this site.

samarudge 16 Posting Whiz

Hi,

I didn't really know what you ment by this question so I have answered the two possibility's to the best of my knowledge.

You could just add PHP tags into your IFrame tag:

<iframe frameborder="0" scrolling="no" height="<?php print($Hight); ?>" width="<?php print($Width); ?>" src="/page.php" />

And add in some variables earlier in the page.

If you wanted to resize the IFrame from inside It I don't think you could do that.

Regards,
Sam Rudge

samarudge 16 Posting Whiz

You could do something like this:

<?php
$Name = $_POST["Name"];
$Email = $_POST["Email"];
echo"Thank you $Name,<br/> Your question was sent and we will reply to the email address $Email";
?>

That is obviously a very simple bit of code but you can expand on that and add HTML tags to the Echo statement.

Regards,
Sam Rudge

samarudge 16 Posting Whiz

Dreamweaver can be a bit touchy about some PHP code, The method I use is:

<?PHP
$Date = date(l);
$Date .= " the ";
$Date .= date(dS);
$Date .= " of ";
$Date .= date(F);
$Date .= " ";
$Date .= date(Y);
print($Date);
?>

As you can see I have added things like 'the' and some spaces so the full date will look like this:
Tuesday the 27th of May 2008
And you could add in a refresh tag if you wanted it to stay updated properly.
The insert date function in Dreamweaver just inserts the date at the time you enter it not dynamically.
You could do what hivenk sugests and write some AJAX or Javascript but that would display the clients date where as the date() command will always show the server date so you can make sure it is always correct.

Regards,
Sam Rudge