samarudge 16 Posting Whiz

Why not just do

function toSafeString($string) { 
   $string = preg_replace('/[\r\n]/s', '<br/>', $string); 
     return $string; 
   }

Instead of converting \r\n to \n then \n to <br/>?

samarudge 16 Posting Whiz
echo "formObj.servicedesc.value = '".str_replace("\n", "<br/>", toSafeString($inf["servicedesc"]))."';\n";

Might do the trick

samarudge 16 Posting Whiz

Have you tried using jQueryUI? It already has the functionality you need
http://jqueryui.com/demos/autocomplete/#remote

But the problem could be that you define a function with two input variables but only pass one to it when you run it
Maybe change

<input style="width: 200px;" id="name" onKeyUp="getInfo(this.value)" type="text" />
<div id="autoSuggestionsList"></div>

to

<input style="width: 200px;" id="name" onKeyUp="getInfo(this.value, this.value.length)" type="text" />
<div id="autoSuggestionsList"></div>
samarudge 16 Posting Whiz

Even I faced the same problem, searched net for hours but could not find the solution. Thank you very much for pointing out Wamp.

Wamp is working great. Its very good alternative.

Thanks a lot again.

As a note, WAMP is generaly considered to be unsecure and should NOT be used for production sites or anything accessible from outside your network. Apache/PHP are not natively compatible with Windows and should be run from Linux/Unix systems for anything going live. If you want to run your site of windows you should consider IIS on Windows Server with PHP running through FastCGI

samarudge 16 Posting Whiz

PHP timestamp format is a number representing the number of seconds passed since 1970-01-01 00:00:00
you can't substract a mysql timestamp from a php one. It's like adding 2 pears + 4 apples = 6 WHAT? peapples

EPIC COMPARISON
*stolen* =)

samarudge 16 Posting Whiz

have you tried

time_stamp(time());

And made sure that $session_time is a properly formatted UNIX timestamp?

samarudge 16 Posting Whiz

Whats the issue? That works fine except that for compatability you might want to change the opening script tag to

<script type="text/javascript" language="javascript">
samarudge 16 Posting Whiz

Can you please post the HTML and JS code

samarudge 16 Posting Whiz

Seperate them like normal functions e.g.

<input onblur="function1(); function2(); function3();" />

You can also use standard JS like

<input onblur="this.value = 'somevalue' />
samarudge 16 Posting Whiz

On your HTML form have you included return within the on-submit? I.E.

<form name="" action="" target="_self" onsubmit="return checkForm()">
<!--Form Stuff-->
</form>

=)

samarudge 16 Posting Whiz

Yep its a realy simple problem and a simple solution. Even though its part of a PHP script you need to refference it as an image I.E.
Create a file 'op_image.php' and add the code

<?php
require_once "CaptchaSecurityImages.php";

$width = '120';
$height = '40';
$characters = '6';

$captcha = new CaptchaSecurityImages();
$img = $captcha -> Captcha($width,$height,$characters);
?>

(Removing that code from the form)
then in the form set the image link to

<img src="op_image.php" />
samarudge 16 Posting Whiz

The easiest way is just using a standard URL call
In AS3 it can be done with

var url:String = "javascript: your_js_function();";
	var request:URLRequest = new URLRequest(url);
	navigateToURL(request, '_blank');

It's different for AS2 but if you Google it I'm sure you can find it

samarudge 16 Posting Whiz

Javascript itself cannot write on the server however AJAX would be a good way to do this, the AJAX tutorials at Tizag.com, they are very good.

As for doing it through AS, you would need to create a javascript function and call it from within AS

samarudge 16 Posting Whiz

Try

$ArrayLength = rand(0,100);//The array will be between 0 and 100 entries
$i = 0;//Incremental
$RandArray = array();
while ( $i <= $ArrayLength ) {//Until the array length is reached
     $RandArray[$i] = rand(1,100);//Set a value between 1 and 100
     $i++;//Add to the increment
}
echo "<pre>";//Create an output for plain text
print_r($RandArray);//Print out the array with formatting
echo "</pre>";//Close output

Is that what you needed?

samarudge 16 Posting Whiz

Ahhh I see now, every time it loops its resetting the variable.
Try this code instead:

<?php


mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");

$letter = htmlentities($_GET['search']); 
$user = mysql_query("SELECT DISTINCT keywords FROM Stacks WHERE keywords LIKE '$letter%' ORDER BY keywords")or die (mysql_error());  
 
$keyword = '';
$name = '';
while($rowz = mysql_fetch_array($user)){
$keyword .= $rowz['keywords'];
 $name .= $rowz['name'];                                         
$bad = mysql_query("SELECT * FROM Stacks WHERE keywords LIKE '$letter%' ORDER BY keywords")or die (mysql_error()); 
$num_rows = mysql_num_rows($bad)or die (mysql_error());  
}

if ($num_rows == 0)
{
echo "<font face='Courier New' font size=18px font color=#FF9900>$letter</font><br /><br />";
echo "<font face='Courier New' font size=3px font color=#FBB917>No Stacks</font><br>";
}
else 
{

	


	

echo "<font face='Courier New' font size=18px font color=#FF9900>$letter</font><br /><br />";

	

	

echo "<font face='Courier New' font size=3px font color=#FBB917><a href='stack.php?search=$keyword&submit=Go!' style='text-decoration: none';>$keyword</a></font><br>";

	

}

?>

The key bit here is that I defined the variables outside the loop

$keyword = '';
$name = '';

then used the dot-equals syntax to add to the variables

$keyword .= $rowz['keywords']." ";
 $name .= $rowz['name']." ";

See if that helps

samarudge 16 Posting Whiz

Not sure but the

print_r()

Command is useful to print out the contents of an array, the best usage is

echo "<pre>";
print_r($ArrayName);
echo "</pre>";
samarudge 16 Posting Whiz

Could you include the contents of your php.conf (Or wherever your PHP is configured in httpd.conf)

samarudge 16 Posting Whiz

Try
http://php.net/
It tends to be quite useful when learning the PHP language, this is a forum for HELPING people with problems, come back in a few months and we can HELP you rather than TELL you what to do

samarudge 16 Posting Whiz

i dont have to reset it ,net even change the setting but access internet without port 80

The internet (HTTP) runs on port 80 for example Google can only be accessed via port 80

The only way to access the internet without that port would be setting up a dedicated HTTP Tunnle server outside your network but that is extremely complicated and would require a dedicated server as well as at least a few years experience with UNIX/Linux.

The best solution would rather be to reset the router or if that is not an option contact your ISP/Router manufacturer

samarudge 16 Posting Whiz

i have internet connected in all my computers but i have bloced net surfing by blocking port80 from the router.
could anyone suggest a way to change the settings of one computer temporarly to access the net. i can only use internet explorer.(no extra program to be installed)
thankx

What make/model is the router?

If you know the router password you can usualy change this setting on the routers configure page (192.168.0.1 if Netgear, 192.168.0.11 if Belkin, others vary)
If you do not know your password then the router will have to be hard (Factory) reset

samarudge 16 Posting Whiz

This is a good tutorial on Advanced AJAX with MySQL
http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php

samarudge 16 Posting Whiz

The request URL would have _GET varaibles in, just create the file action.php with the contents

<?php
print_r($_GET);
?>

and view the output in Firebug (XHTML requests section)

samarudge 16 Posting Whiz

ok so i am an avid php developer and i am starting to get into ajax so i can keep file sizes and code down to a minimum.

i am looking in the w3schools ajax examples but i am a little lost at how to send through a variable to the page i am using to process.

what i would like to do is send through an id that is being recalled from the database to tell it what to save over.

any help would be very helpful. thanks in advance

ajax

function action()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.myForm.time.value=xmlhttp.responseText;
  }
}
xmlhttp.open("POST","action.php",true);
xmlhttp.send(null);
}

html form

<form action="#" method="post"> 
        <button name="save" type="submit" value="Save" onclick="action();">Save</button>
<input type="text" name="address" />
</form>

Sending data:
The easiest way to send data to your server from the form is using _GET variables
You can take the variables from your form and add them to your string like this

function action()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.myForm.time.value=xmlhttp.responseText;
  }
}
var textfielddata = document.getElementByID('a_field').value;
xmlhttp.open("GET","action.php?Value="+textfielddata);
xmlhttp.send(null);
}

And this would be your new HTML

<form action="#" method="post"> 
<input id="a_field" name='SomeField' type='text' />
        <button name="save" type="submit" value="Save" onclick="action();">Save</button>
<input type="text" name="address" />
samarudge 16 Posting Whiz

If you only have basic FTP access I don't think its possible, some admin panels will let you do it (if you have one) but other than that no ideas so sorry =(

samarudge 16 Posting Whiz

Several ways to run a PHP script outside browser:
CLI (Command Line Interface)
Call your script like #php /path/to/your/script.php from terminal/CMD
Telnet/SSH (Same as above)
Crond
On *NIX systems there is something called CROND which allows you to execute scripts according to a schedule E.G. every hour, every day, the first monday of each month etc.
Look up CROND tutorials on Google and use the above CLI example as your script
#!
Not sure if this works but you may be able to run it by adding the line #! /etc/php to the first line of your script then run it by double clicking (Only on Unix/Linux)
If I have not answered your question just say but those are the main ways of running scripts outside browser

samarudge 16 Posting Whiz

Firefox, Netscape Navigator and Opera will allow target to eather be an id= or a name= whereas IE only allows name= so I have both to cover all browsers

samarudge 16 Posting Whiz
<form id="form1"  action="#" method="post" enctype="multipart/form-data" runat="server" target="myframe">
    <input type="file" id="myfile"   accept="image"  runat="server"/>
    <input type="submit" value="upload"  runat="server" />
    </form>
    <iframe id="myframe" name="myframe">
    </iframe>

Does that work now?

Dhaneshnm commented: Thanks ... +1
samarudge 16 Posting Whiz

There are a few options
1st would be JoomlaXplorer if you are running a Joomla system
This is a very good method of editing files and includes pritty syntax highlighting which makes it much easyer to edit
2nd Dustin Minnich's Simple PHP File Editor
http://www.dminnich.com/files/php_simple_fileed.tar.gz (Download)
or
http://www.hamburgernecklace.com/dm/demo/php_simple_fileed (Demo)
Never used it but told its quite good

samarudge 16 Posting Whiz

See the contents of your variable with

print_r($row);

This prints out all the values in an array

samarudge 16 Posting Whiz

This is nothing to do with PHP, its all to do with the browsers trying to "URL Encode" the strings.

samarudge 16 Posting Whiz

Try this one out
http://pmsys.sourceforge.net/
Its open source :D

samarudge 16 Posting Whiz

You meen something like the PM system here at Daniweb?
I'm sure there will be loads of systems out there prebuilt for you

samarudge 16 Posting Whiz

Try start>accessories>system tools>system restore and select a date when you didn't have a problem. If that doesn't work post bak on the result/error

samarudge 16 Posting Whiz

Glad to see you figured it out

samarudge 16 Posting Whiz

Create a simple script such as

<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>

And look at the response. Find something uneque to the IPhone E.G. Safari-Mobile etc. and add that to your script

samarudge 16 Posting Whiz

Avast Pro (Basic is SH*T)

samarudge 16 Posting Whiz

Tizag has some realy great beginer tutorials on PHP (They helped me learn in about 1 month)
Tizag PHP Tutorials
Enjoy

samarudge 16 Posting Whiz

There are many problems with that.
1 - Unless you spacificaly tell it, PHP will wait till the end of the script before sending ANY information to the browser so that script would not be sent till after 3 seconds.
2 - If it was shown then header() would not work as headers need to be sent before any data.
3 - Most browsers (IE, Netscape/firefox etc) only update the display every 100bites or so

Try this

<?php
header("Refresh: 3;URL=movie_registration.php");		
echo "Your username and password do not match our records";
?>

This will display the page but tell the browser to refresh after 3 seconds to the new page
Regards,
Sam Rudge

JimD C++ Newb commented: Perfect solution to my problem. Thank you! +1
samarudge 16 Posting Whiz

Also you should insert some security as users could SQL inject into your database.

samarudge 16 Posting Whiz

Mail PHP Function
(You would need to be running your own SMTP/Email server though)

samarudge 16 Posting Whiz

I don't think you can use network backup drives in anything other than business/ultimate. Might need an OS upgrade :(

samarudge 16 Posting Whiz

sorry shoud have refreshed the page !

Just a note I would not have two entries using the same host name.

Yer soz, i wrote that during a Geography lesson and I wasn't thinking propperli :D

samarudge 16 Posting Whiz

Open Notepad/Wordpad and navigate to
<Your Windows Drive (C:/)>/windows/system32/drivers/etc/hosts
(You might need to change Text Document (*.txt) to all files to see it)
It should look something like this:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

Add this line to the bottom of the file:

127.1.1.1 localhost
so your hosts should look like this:

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one …
samarudge 16 Posting Whiz

Check to see if the other server has PHP GD installed

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

.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

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

When you post your form you need to tell it to post the form to the frame called _top, the frame _top is always the main browser window E.G. everything displayed in the browser.
You need to add a tag to your <form> tag telling it the frame:

<form action="/post.php" method="post" name="Form" target="_top">

So your complete form would look something like this:

<form action="/post.php" method="post" name="Form" target="_top">
  <label>Name
  <input type="text" name="Name" id="Name" />
  </label>
  <br />
  <label>Email Address
  <input type="text" name="Email" id="Email" />
  </label>
  <p>
    <label>
    <input type="submit" name="post" id="post" value="Submit" />
    </label>
  </p>
</form>

You can also use the target= tag to specify a Frame or IFrame name, if you enter the ID of the frame then the form will change the URL of the frame and not the whole page E.G.

<iframe id="Frame1" width="100px" height="100px" name="Frame1" src="Page.html" />
<form action="/post.php" method="post" name="Form" target="Frame1">
</form>

and your form would post to the frame called Frame1 and the main URL would stay the same.

Hope this helps, if you have any more probs then reply to this and I will put an example on my site.
Regards,
Sam Rudge