|
IMO echo "*<br />**<br />***<br />****<br />*****<br />*****"; would suffice.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? 59.24% waren verstandig genoeg om NEEN te stemmen; bye bye viaduct.
|
|
|
|
|
I have 2 computer, they are connected together through a switch so i 've got LAN(my system just only 2 computers and has no connect to the Internet( no modem or router))
pc001 I got ip 192.168.1.1
pc002 I got ip 192.168.1.2
on pc001 i install xampp.
I hosting some website at pc001 and have some situation like bellow:
1.All website i created by Joomla work well and i can access these website from another computer(Everything good)
2.I created a forum (using MyBB Forum) , it work well when i access on the local computer(the computer which install xampp).
When i access forum from pc002 the result is not displayed correctly.
Can anybody help me to fixed this.
Thanks and regards
|
|
|
|
|
Check your configuration of your MyBB Forum is using the pc name / ip address as the hostname and not "localhost"
|
|
|
|
|
Thanks !
Have a good time Marc Firth!
|
|
|
|
|
Hey friends I am developing web page for some music production. What I wanted to ask is, there are a lot of links for a lot of lyrics. If I put the lyrics with their file name and when the user presses the link it reads the file and displays on a new page. But this is really bad(too slow). So I decided to do like CODEPROJECT's site did. i.e when we click one question(or answer) on a thread it display the message @ that page with in a fraction of mili second. So can any body help me how to do that so that I can display the lyrics next to the song as CodeProject's thread did?
I hope I will get some helps soon. Thank you
|
|
|
|
|
You need to use javascript and css to show/hide layers.
or use jquery to do it for you:
<!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" />
<title>Untitled Document</title>
</head>
<script type="text/javascript" src="jquery.js"></script>
<script>
$(document).ready(function(){
$('.post').hide();
$(".title").click(function(){
$('.post').show('slow');
return false;
});
});
</script>
<body>
<div class="title">Title
<div class="post">song lyrics</div>
</div>
</body>
</html>
|
|
|
|
|
Thank you dude for your response ...... I am gonna try it ....but
Marc Firth wrote:
@ this line I already have another class ..... so how can I have both classes @ the same time? ...thank you AGIAN
|
|
|
|
|
I presume so. Not really sure what you mean TBH. You could post code so I can see what you mean.
|
|
|
|
|
Don't forget you need to download jquery to try my example.
|
|
|
|
|
why ? ...and what is jquery? ... doesnt it work just by placing it before the body?
|
|
|
|
|
http://jquery.com/[^]
You need to include jquery:
jquery is a javascript library that makes writing javascript easier. download it and include it.
|
|
|
|
|
Ok. got it... if i 've any trouble i will ask you.
Thank you
|
|
|
|
|
I post this 2 questions on web development forum.............I thought if it might be the wrong place ..... so I just put it here ..... here are the questions
Can any body tell me how to send an email to some fixed email address(i.e to the owner of the site) just by collecting message and email address of the sender?
and the other question is
I am developing web page for some music production. What I wanted to ask is, there are a lot of links for a lot of lyrics. If I put the lyrics with their file name and when the user presses the link it reads the file and displays on a new page. But this is really bad(too slow). So I decided to do like CODEPROJECT's site did. i.e when we click one question(or answer) on a thread it display the message @ that page with in a fraction of mili second. So can any body help me how to do that so that I can display the lyrics next to the song as CodeProject's thread did?
I hope I will get some help soon. Thank you
|
|
|
|
|
Hey,
Sending an Email in PHP is rather simple. If you want a user to send an email, design and create a form with the appropriate fields (reply email address, email address subject, email address message/content). Then, when the form is submitted (I use post) you can apply validation and process the email (Regular expressions are useful for the email address, make sure you filter empty fields as well).
An email can then be sent like this:
$To = "webmaster@example-site.com";
$Headers = 'From:' . "<" . $frmEmail . ">" . "\r\n";
$Subject = 'Subject: '.$frmSubject;
$Message = 'Message: '.$frmMessage;
if(mail($To, $Subject, $Message, $Headers))
{
echo "Message Sent!";
}
else
{
echo "Error sending message!";
}
I suggest you use reCaptcha to guard your form (this system can be exploited easily). Also, you might want to pad the input using "\n" ...
I am not quite sure what you are requesting in regards to the music production system but a database driven website seems to be in order.
Regards,
- Calvin
http://www.calvinhartwell.com
|
|
|
|
|
Thankk you ma friend I will try it that ..... but how do i know it reaches to the person before posting the site? ... is there any mechanism to know that?
Thank you agian.
|
|
|
|
|
Hello everybody
I'm searching for a way to get information(name,author,...) out of a documeny(like docx,exc,zip,...)
Does anybody has an idea how i can accomplish this?
Greetz
|
|
|
|
|
|
How can i insert the current system date into MSSQL database using formview in asp.net
|
|
|
|
|
Artakazezs wrote: into MSSQL database using formview in asp.net
with PHP?
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
If you managed to find the PHP forum how the hell did you miss the ASP.NET forum? That makes absolutely no sense.
|
|
|
|
|
hi everybody,
Im new with php, started recently, Im making a registration form for my website and here is the problem. I try to check if email address entered isn't already in use. here is the code Im using:
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$name = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$nickname = $_POST['nickname'];
$password = md5($_POST['password']);
$checkuser = mysql_query("SELECT email FROM users WHERE email='$email'");
$username_exist = mysql_num_rows($checkuser);
if($username_exist > 0){
die('{status:0,txt:"This email address is already registered"}');
unset($email);
include 'register.html';
exit();
$query = "INSERT INTO users (name, lname, email, nickname, password)
VALUES('$name', '$lname', '$email', '$nickname', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
echo "You have successfully Registered";
It does the job, doesnt send data to database if email is registered, but it allways displays error message
{status:0,txt:"This email address is already registered"}, and don't output message that you have been registered. If email address is unique it creates a record in a database, but displays error and doesnt redirect. Its probably something simple, but I cant figure out by my self. Anyone any ideas?
By the way my form includes jQuery and few functions if it makes any difference.
thanx in advance
|
|
|
|
|
wartotojas wrote: die('{status: 0,txt:"This email address is already registered"}');
The die function stops the process from running, so every thing after die is not executed.
wartotojas wrote:
if($username_exist > 0){
die('{status:0,txt:"This email address is already registered"}');
unset($email);
include 'register.html';
exit();
$query = "INSERT INTO users (name, lname, email, nickname, password)
VALUES('$name', '$lname', '$email', '$nickname', '$password')";
mysql_query($query) or die(mysql_error());
mysql_close();
echo "You have successfully Registered";
Why are you using die and exit? Where is the if tag closed? I can see the curly bracket open, but not close.
This should work. Notice that I dont use die or exit (apart from if the query fails):
if ( $username_exist > 0 )
{
mysql_close();
echo 'Email already registered';
include( 'register.html' );
}
else
{
$query = "INSERT INTO users (name, lname, email, nickname, password)
VALUES('$name', '$lname', '$email', '$nickname', '$password')";
mysql_query( $query ) or die( mysql_error() );
mysql_close();
echo "You have successfully Registered";
}
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I used die function few times, and it doesnt kill all process.
here is full php code Im using :
<?php
if(empty($_POST['fname']) || empty($_POST['lname']) || empty($_POST['email']) || empty($_POST['nickname']) || empty($_POST['pass']))
{
die('{status:0,txt:"All the fields are required"}');
}
if(!(preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $_POST['email'])))
{
die('{status:0,txt:"You haven\'t provided a valid email"}');
}
$dbhost = "localhost";
$dbname = "register";
$dbuser = "*******";
$dbpass = "******";
mysql_connect ( $dbhost, $dbuser, $dbpass)or die("Could not connect: ".mysql_error());
mysql_select_db($dbname) or die(mysql_error());
$name = $_POST['fname'];
$lname = $_POST['lname'];
$email = $_POST['email'];
$nickname = $_POST['nickname'];
$password = md5($_POST['password']);
$checkuser = mysql_query("SELECT email FROM users WHERE email='$email'");
$username_exist = mysql_num_rows($checkuser);
if ( $username_exist > 0 ){
mysql_close();
echo 'Email already registered';
include( 'members.php' );
}
else{
$query = "INSERT INTO users (name, lname, email, nickname, password)
VALUES('$name', '$lname', '$email', '$nickname', '$password')";
mysql_query( $query) or die( mysql_error() );
mysql_close();
echo "You have successfully Registered";
}
?>
It is still doesnt work. I used die('{status:0,txt:"You haven\'t provided a valid email"}'); to display error message in error box, before you are redirected, I tought it will work instead of echo statment and it is working with first few fields. Like I said before records are created in database in the way they are supposed to, the only thing is that error message I want to make for email validation. Any suggestion about that, and this might sound realy dumb, but how do I make that after registration and clicking submit button users would be redirected to other page, lets say "members.php"?
thanks for answers and any help
|
|
|
|
|
wartotojas wrote: I tought it will work instead of echo statment
No, read some documentation: php.net[^] W3Schools[^].
wartotojas wrote: It is still doesnt work
Ok. Here is a basic example of how you should do it.
<?php
if ( isset( $_POST[ 'submit' ] )
{
if ( isset( $_POST[ 'name' ] ) && isset( $_POST[ 'age' ] ) )
{
if ( strlen( $_POST[ 'name' ] ) > 0 && strlen( $_POST[ 'age' ] ) > 0 )
{
if ( *something* )
{
header( 'Location: redirect.php' );
exit();
}
else
$result = 'Something went wrong!';
}
else
$result = 'You must fill in name AND age.';
}
else
$result = 'Name and age are not set';
}
?>
<html>
<head>
...
</head>
<body>
...
<!-- Output the result, if one is set. -->
<?php echo $result; ?>
<form action="" method="post">
Name: <input type="text" name="name" />
Age: <input type="text" name="age" />
<input type="submit" name="submit" />
</form
...
</body>
</html>
Notice that the form is processed before anything is output, therefore you can redirect.
To redirect to another page use header( 'Location: members.php' ); . This can only be used before you have output anything to the browser.
Example:
This will work
header( 'Location: members.php' );
echo 'This won\'t be output as it the page will have been redirected.';
This won't work
echo 'This has been output, therefore headers cannot be set.';
header( 'Location: members.php' );
The exit() function is normally used after a redirect.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I always include the form processing at the top to the same page and allow the logic to either load a successful registration page on success or reload the same page with errors marked in the form.
The general form is
<?php
$name_good = true;
if(isset($_POST['reg'])
{
if(isset($_POST['name']))
{
$name = htmlspecialchars($_POST['name'],ENT_QUOTES);
}
else
{
$name = "";
}
if(strlen($name)>0)
{
if( )
{
header("location: http://www.sitename.com/welcome.php');
}
else
{
$name_good = false;
}
}
}
$pg = "<html>\n";
$pg.= "<head>\n";
$pg.= " <title>Register</title>\n";
$pg.= "</head>\n";
$pg.= "<body>\n";
$pg.= "<form action='' method='post'>\n";
$pg.= "Name: <input type='text' name='name'";
if($name_good)
{
$pg.= " class='field_good' title='enter your name' ";
}
else
{
$pg.= " class='field_bad' title='name is in use' ";
}
$pg.= ">\n";
$pg.= "<input type='submit' name='reg' value='Join Now!'>\n";
$pg.= "</form>\n";
$pg.= "</body>\n";
$pg.= "</html>\n";
print $pg;
?>
I often leave the action empty as it will default to the same page.
Hope this helps
|
|
|
|
|