|
Well you could always include the google translate script somewhere in the page. That way users can change the language of the contents with just one click, as described at Google translate tools[^].
As to creating your custom translate engine, that would be a lot of work including:
- scraping or buying multiple dictonaries for every language
- linking words in dictionaries accross the various languages
- finding a way to stem words to the basics
- building a correct matching algorithm to match one word or group of words to another
And even if you do all that (which is a lot of work) it will still probably work crappy. Though google translate is nice to sorta now what a page tells me (if it is in a foreign language) it is far from perfect. In fact most of the time the translations are more likely to be funny and wrong then right.
|
|
|
|
|
|
Hi...!!
I am beginner of PHP.
I want to make registration page which displays user name after the successful registration.
I have made three files :
register.html ==> to make form and enter the data which redirects to another file called submit.php
submit.php ==> to enter the values to the database and redirects to the home.php
home.php ==> This must display " Welcome registering user name !" message.
how to retrieve the name in the last file ??
|
|
|
|
|
It depends on how you are submitting your form for the username and password. If you are using POST, then something like:
$username = $_POST['username'];
$password = $_POST['password'];
Otherwise, if you use GET:
$username = $_GET['username'];
$password = $_GET['password'];
The "username" and "password" names are whatever you named your username and password input boxes in the html form.
Let me know if this helps
|
|
|
|
|
Hi,
You can post the username with the redirecting url, and from that page you can access
the name by
Let the redirecting URL should be like this,
URL: http://localhost/home.php?user='Sunu'
<pre lang="PHP">
$user_name = $_REQUEST['user'];
</pre>
Cheers
|
|
|
|
|
After the post you cn also asign user information to a session variable so you do not need to repost it from page to page.
To do this just assign the post to a session variable like...
$_SESSION["uname"]=$_POST["uname"];
To set and use the session values you must start your pages with...
<?php
session_start();
...the rest of your script below.
This brings up an important topic too. You must scrub your input from users so you can avoid sql injection (if you are storing your data in a database). Please be sure to read up on this topic in any live code you make.
Chris J
www.redash.org
|
|
|
|
|
|
Apply Sessions or Cookies.
|
|
|
|
|
When trying to run a simple PHP test form using a Windows CE 5 or 6 device I'm getting errors...
Page cannot be displayed / Cannot find server or DNS error
Internet explorer
The test PHP page does execute correctly from a PC. Any know issues with Windows CE running on a Motorola MC3000 series handheld, or CE specifically?
Test php code...<pre lang="PHP">
<html>
<head></head>
<body>
<?php
if(isset ($_POST['submit']))
{
$name = $_POST['name'];
echo "You submitted the form and typed : <b> $name </b>";
echo "<br>Enter new text.";
}
?>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="text" name="name"><br>
<input type="submit" name="submit" value="Submit Form"><br>
</form>
</body>
</html>
</pre>
|
|
|
|
|
It's not a question of whether the device is "running" the php code. PHP is a server-side scripting language, meaning that when you go to a page with a ".php" extension, the server looks at the php code with an interpreter, and the php script generates html code which gets sent to your browser. In fact, you could name any static html file with a ".php" extension, or any other extension, and your browser wouldn't care. The only thing that matters is that the server tells your browser (through the headers) that the file that is being sent back is HTML text. If you really wanted, you could set up a server and have it tell browsers that ".bmp" files are html files and you could create a file with a .bmp extension and it be treated by any browser just like it had a .html extension.
Quote: Page cannot be displayed / Cannot find server or DNS error
It sounds like you have an incorrect setting with the browser. Can you access any other web page, such as google?
|
|
|
|
|
I agree and everything is fine when using desktops with IE or Chrome. It seems like the CE devices have trouble only when variables are invovled when the desktop browers don't?
The CE devices will display the following PHP test correctly...
<pre><html>
<head></head>
<body>
<?php phpinfo(); ?>
</body>
</html></pre>
|
|
|
|
|
Hi
I just have that stupid problem and hoping that you can help me on it.
I try to take specific value (user ID for selected user name) from my database to deal with it.
but it's seems that nothing happen !
the code is:
$query2 = MYSQL_QUERY("SELECT userid FROM users WHERE username LIKE '" . $username . "'") ;
while ($result2 = MYSQL_FETCH_ARRAY($query2)) {
$found2 = '1'; $userid2 = $result2['id']; }
echo $userid2;
|
|
|
|
|
Try changing your query to:
$query2 = MYSQL_QUERY("SELECT userid FROM users WHERE username='$username';") ;
I also think you need to SELECT the username as well, since that is what you are comparing:
$query2 = MYSQL_QUERY("SELECT userid,username FROM users WHERE username='$username';") ;
|
|
|
|
|
I solved my problem
As i write, it's a stupid one :$
I replace this
$userid2 = $result2['id'];
by this one
$userid2 = $result2['userid'];
thanks anyway !!
|
|
|
|
|
I debug sql queries by these methods...
1)
echo the sql to a browser so I can test in the Mysql Query Browser to make sure that all variables are set as expected and the query is good. I also include page, line # and the mysql error message in the die command. So if any query is bad you will know where and what and why (<--most of the time).
example:
$sql = "select uid from users where uname='".$user_name."'";
$rst = mysql_query($sql) or die("<br>PG: ".__FILE__."<br>LN: ".__LINE__."<br>ER: ".mysql_error()."<br>Q: ".$sql."<br>");
Note: I usually do this as a function call inside the die so I can set a value for local debug and a live production messages. This is because the above information should be used for the developer and not something a user should ever see. Users should have a simple error message if you can not recover from the error in code.
2)
if your code crashes out after the mysql_query, then find out what you query is returning...exactly.
example:
<?php
.. other code above
echo "<pre>";
while($row=mysql_fetch_assoc($rst))
{
print_r($row);
}
echo "</pre>";
?>
That should give you more info.
Also keep in mind that if you develope on windows and move to linux you will see some error with the case of table and column names make sure you check that. Windows can be lax on case, while linux is not.
Chris J
www.redash.org
|
|
|
|
|
www.esp.com.cn[^]
=======================
i in the browser type that URL,,,just no abnormal,,but..i in "search engine"click the site,,,it will be jumpother site....i have seen it's source code,but no find out how does it jump? in advance thanks~ - -
"
|
|
|
|
|
Your english is not clear
But read the link[^] it will help you to understand.
your probable question:
When you type the url on address bar it behave normally. but when you click in the link in the page it creates a new window. Why?
|
|
|
|
|
search for html a tag and read up on the target attribute....my guess to what you are asking.
Chris J
www.redash.org
|
|
|
|
|
Hi,
WARNING: ultimate noob!
Let's say if I have this function
void CallMeSunny( void )
{
}
I want to callback to it from a shared library. How do I do that? (I just need something simple that works)
I tried to implement some of the snippets online. But, all were to simplified that I couldn't understand them.
Platform: Linux
Language: C
|
|
|
|
|
Creating a shared library may be an advanced topic for a "noob". You may want to begin with simply including external files, or object code. Either way, here is a good link:
Link
Note: You can include code files as external resources instead of using a library. #include "whatever.c"
|
|
|
|
|
Unfortunately, this doesn't apply to what I need : (((
I will try to explain what I am trying to do better:
void functionA()
{
}
void functionB()
{
}
void functionC()
{
}
void functionSL()
{
}
So, instead of writing three callback functions.
I did the following:
void functionABC()
{
functionA();
functionB();
functionC();
}
Therefore, unfortunately, even if I would create a shared library, and place functionA(), functionB() functionC() inside it, I will still have create Callback functions for the functions that are called from within functionA/B/C() ><
Furthermore, this is not my code. I am trying to add some simple functionality there. I did it on windows, and now I need to test it on Linux. But, I can't seem to get the right syntax for callback functions there.
Any ideas on "Callback functions to a function that is inside an executable?"
Thanx!
|
|
|
|
|
You would need to pass a pointer to the function into the library function that is to make the call back. The chances are that you can rethink your design and make things a lot simpler for yourself by just using variables between your executable and library function.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I appreciate the suggestions. But, for MANY circumstances, I NEED to write it that way. I added some more detail to my post, could you kindly view it?
|
|
|
|
|
Yes, I understood what you are trying to do, which is why I made the comments that I did. However, in order to achieve this you need to pass a function pointer into the function of the shared library, just the same as in Windows.
Define your shared library function something like:
void func(void (*callback)())
{
}
changing the return type and other parameters as necessary. Then you can call your function with a pointer to your callback routine as follows:
func(functionA);
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
which is best linux os for making media server in web browser
|
|
|
|