Borzoi 24 Posting Whiz

Can you elaborate on what you mean by "the string works" please? Do you mean that the $profileurl variable is having the video URL placed in it?

I'm pretty sure that isn't correct code for embedding YouTube URL's. Looking at the code that YouTube itself gives when you select the embed option, it's an iframe:

<iframe width="560" height="315" src="//www.youtube.com/embed/0aaAX_TYwl4" frameborder="0" allowfullscreen></iframe>

That would make your embed script something like:

<iframe width="560" height="315" src="<?php echo $profileurl;?>" frameborder="0" allowfullscreen></iframe>

You would need to change the way the video URL is stored in the database though to include the /embed/ part.

Borzoi 24 Posting Whiz

To save on the amount of database queries being run as the end user types, you may want to pull all possible options form the database and put them in to an array and query that array instead of the database.

Borzoi 24 Posting Whiz

As mattster said, you need to add session_start() at the top of the file. You can't add it after anything else. It needs to be before even the doctype declaration:

<?php session_start(); ?>
<!DOCTYPE ...>
[Rest of content]
Borzoi 24 Posting Whiz

I don't think the error you're getting is due to the additional backslashes. Make sure there's a semicolon (;) after the SQL query.

You could try using the HTML reference instead of the backslash but I don't think that will work because the data in the database has a backslash.

The HTML reference for a backslash is &#92; so the query would be:

UPDATE messages SET `text` = REPLACE( `text` , '&#92;r' OR '&#92;n' OR '&#92;r&#92;n')
Borzoi 24 Posting Whiz

Using your original code which is removing the n but not the \\, all you need to do is escape the backslash with another backslash.

`UPDATE messages SET `text` = REPLACE( `text` , '\\r' OR '\\n' OR '\\r\\n') `
Borzoi 24 Posting Whiz

If you're only seeing the code on the site and in the view source then your hosting doesn't have PHP enabled. Check with your hosting provider to make sure PHP is enabled on the hosting.

Borzoi 24 Posting Whiz

If you're on a shared hosting solution, you likely won't have access to a php.ini file. You can see what the upload limit is set to by uploading a PHP Info file. The contents of the file would just be this:

<?php phpinfo(); ?>

I tend to save that as simply phpinfo.php. Upload that to your FTP space then browse to that file. You will see an entry in there which says "upload_max_filesize" with a value. That value is the limit.

Borzoi 24 Posting Whiz

I think you've posted this in the wrong forum. This doesn't seem to be related to web development.

To answer your question, the Windows command prompt can only display up to a certain amount of lines so when you reach that amount, you won't be able to scroll back further.

Borzoi 24 Posting Whiz

Do you know what the returned message states? I see you have specified a From address in the script so the bounce would be returned there.

Borzoi 24 Posting Whiz

This line:

$mail->Host = "ssl://smtp.indonusa.net.id";

...should not contain ssl:// at the beginning. I'm fairly certain it should simply be:

$mail->Host = "smtp.indonusa.net.id";

If not, specity http:// at the beginning. The reason I believe you don't need it is because this line:

$mail->SMTPSecure = '';

...is what determines if it uses an SSL connection or a standard connection.

Borzoi 24 Posting Whiz

This isn't a clean fix (someone may be able to provide a better one) but you could loop through the array, placing each entry of the array into an appended variable.

$newvariable = ""; //create the variable

for ($i= 0; isset($result[$i]); $i++)
{
    $newvariable .= $result.", "; //Add the current array entry to the variable, appended with a comma and space.
}

The problem with this is that there will be a trailing comma and space at the end.

Borzoi 24 Posting Whiz

Have you tried storing the results of print_r to a variable?

$newvariable = print_r($result);

I've not tried that myself but the theory here would be that the output is stored in the variable, which you can then pass to the database.

Borzoi 24 Posting Whiz

You shouldn't have a colon after the if queries and you aren't using braces. I'm also pretty certain that the value for a box to be unchecked is actually just blank, not "unchecked". I suggest trying this:

<td>FooterMenu</td>
<td><input type="checkbox" name="FooterMenu" value="1" checked="<?php if($FooterMenu == 1){echo "checked";}else{echo "";} ?>" /></td>
Borzoi 24 Posting Whiz

I don't know if your login code on that thread is complete but I cannot see a session being started in there. You will need to put the session_start(); command at the top of that page too. Anything you put into a session variable on a page where no session has been started won't be set.

Borzoi 24 Posting Whiz

The exit part needs to be in the if statement:

if(!isset($_SESSION['username']))
{
  header("location:index.php");
  exit;
}

Having it outside of the if will prevent all content below it being displayed.

Borzoi 24 Posting Whiz

The header(); function also needs to be before any output to the browser, if I'm not mistaken.

You basically just wamt to move the PHP in your code (lines 46-58 in the code you've given) to the top of the page, before the <!DOCTYPE> declaration.

I also recommend you put exit; after the header, within the same if statement because without it, the rest of the code will still run.

Borzoi 24 Posting Whiz

-You have no opening <head> tag.
-Remove the opening <body> tag on line 13.
-Move lines 15-33 into the body tag lower in the page.
-Move line 37 up so that is is in the <head> tag.

Just looking through the rest of it for any more errors.

Borzoi 24 Posting Whiz

Post the code you have now, with all the modifications.

Borzoi 24 Posting Whiz

I'm pretty sure session_start() should be before anything is outputted. You also have two <html> tags. Your first few lines should be like this:

<?php 
  session_start();
  error_reporting(E_ALL);
?>
<?xml version="1.0" encoding="UTF-8"?>
<!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" xml:lang="en" lang="en">
<?php include("includes/connection.php");?>
<title>PRIMA PAGINA</title>
Borzoi 24 Posting Whiz

You've commented out all the code, that's why. Line 5, remove the /*.

/* is the start of a multi-line comment. To end it, you need to put */ at the end. If you want to comment a single line, you should use //.

Borzoi 24 Posting Whiz

Most servers place index.html above index.php so if you've made your home page as index.php and the host automatically puts an index.html page up, then it'll be displaying index.html. Have a look on your host and see if there is an index.html file and if so, delete it so that index.php is the one that gets called upon.

Borzoi 24 Posting Whiz

Using &nbsp; like that would only make it align correctly for the screen size you're viewing on. One thing you could do is wrap each part in it's own <p> tag and use CSS to set them all to the top of the div that they are already in then set each one's alignment.

Like this:

<div class="footer">
  <p style="position: absolute; top: 0px; width: 100%; text-align: left">&copy;Copyright 2011</p>
  <p style="position: absolute; top: 0px; width: 100%; text-align: center">Person McPerson</p>
  <p style="position: absolute; top: 0px; width: 100%; text-align: right">email@address.com</p>
</div>
Borzoi 24 Posting Whiz

I'll have another look through your code for you and try to spot anything I may have missed.

Borzoi 24 Posting Whiz

I am happy to flag any spam I come across but I don't want a reward so I won't be PMing you the link to the post I flag. It's a nice idea to offer it to get newer members to start flagging bad posts though.

Borzoi 24 Posting Whiz

Try replacing line 32 with

$result1 = mysql_query($sql1) or die(mysql_error());

and see if that causes an error message. Looking at your code, I can't see anything wrong with it but I get the feeling I'm missing something fairly obvious. Hopefully this will provide an error message and say what is wrong.

Borzoi 24 Posting Whiz

I believe you have found your problem. You do need the space after print. I am going to look through your code in detail though to see if I can find any other errors that may cause it.

Borzoi 24 Posting Whiz

Could you post the PHP that calls the variables to be placed in the values? We could probably help if we saw the supposed problem code.

Borzoi 24 Posting Whiz

If it's in your place of work, contact your IT department. It's likely they're using the default SMTP port but you will need to ask them as they may have changed it.

Borzoi 24 Posting Whiz

I am also looking for a Domain Name Registrar with no extras. I don't need the technical support and I know how to set up my server exactly how I want. I'm currently using a free .co.cc domain until I can find a good one. The service .co.cc provides is pretty much what I want but I want a more known extension (.co.uk).

Borzoi 24 Posting Whiz

"The kilobyte is often considered to be 1024 (210) bytes in some fields of computer science and information technology. This use has been discouraged by the major standards organizations and a new prefix system was defined by the International Electrotechnical Commission, which defines the kibibyte for this binary multiple and affirms the kilobyte as 1000bytes. However, the new standard has not entered common usage, and has been actively resisted by some in the fields of computer science and information technology because of aesthetic objections to the new prefixes."

http://en.wikipedia.org/wiki/Kilobyte

I think you'll find that bandwith usage is still measured like that. Also, Google says 1,024: http://www.google.co.uk/#sclient=psy&hl=en&safe=off&q=1kB+in+bytes&aq=f&aqi=g1&aql=&oq=&gs_rfai=&pbx=1&fp=957dcd876369ec41 but that's besides the point.

Either way, bandwidth isn't measured in kilobytes/megabytes etc, it's measure in kilobits/megabits. Kbps = Kilobits per second (1,000 bits), KBps = Kilobytes per second (8,192 bits if we're saying 1 KB = 1,024 bytes and 8,000 if we're saying 1 KB = 1,000 bytes).

Borzoi 24 Posting Whiz

Are you sure that huge number is bytes and not bits?

Borzoi 24 Posting Whiz

8 bits = 1 byte (B)
1024 bytes = 1 Kilobyte (KB)
1024 Kilobytes = 1 Megabyte (MB)

If you have the amount of KB and you want to convert it to MB, you just divide by 1024.

I'm not sure what you're doing with all those other numbers.

Borzoi 24 Posting Whiz

It shouldn't cause problems but it is good practice to use entities (things like &gt; ). Refer to the link I provided earlier for a list.

Borzoi 24 Posting Whiz

Just tested it and I am also getting missing words. If you remove the height: 2em under .left ul a in your CSS and it works. What's happening is the extra words are going on to the next line and since you specify a height for it, it's going out of it's box, so to speak.

Also, I retract what I said before about the width: 600px; being changed. You might as well just remove it as it isn't doing anything. I tried it myself changing it to min-width but it breaks the menu and removing it or setting it to max-width made no change so it isn't needed.

Borzoi 24 Posting Whiz

When I get home I will try to replicate the problem by via a copy/paste of the code.

Borzoi 24 Posting Whiz

Just so you know, you shouldn't use characters such as > and & etc as text. I.e.:

Replace:

<p>You are in: <a href="index.htm">Home</a> > Visual impairments </p>

With:

<p>You are in: <a href="index.htm">Home</a> &gt; Visual impairments </p>

You can find a reference table here: http://www.w3schools.com/tags/ref_entities.asp

Also, in your CSS you have two widths:

.right {
width: 600px;
float: right; 
width: 85%;
text-align: left;
}

I'm assuming what you want to do there is make is so the site is expandable to 85% of the screen width but won't go smaller than 600px. If that is the case then replace width: 600px; with min-width: 600px; .

Other than that, I can't actually see anything wrong with the code. If the site is live somewhere, could you link us to it? I'm not at home right now but when I get there, I can check the site using Linux and will be able to come to a solution easier. I have Fedora Core 8 though so results may differ.

Borzoi 24 Posting Whiz

Looking at your code for the page, you have </p> after each link in that menu but you don't have an opening <p> tag.

You have:

<p class="text1">
  <a href="whoweare.php">Who We Are</a></p>
  <a href="events.php">Events</a></p>

  <a href="newsletter.php">Newsletter &amp; News</a></p>
  <a href="AwardNominations.php">Award Nominations</a></p>
  <a href="videos.php">Video Library</a></p>
  <a href="jobs.php">Jobs</a></p>
  <a href="links.php">Links</a></p>

  <a href="discounts.php">Discounts</a></p>
  <a href="volunteers.php">Call for Volunteers</a></p>
  <a href="societies.php">Society Websites</a></p>
  <a href="bylaws.php">By-laws</a></p>
  <a href="http://www.ieee.org/portal/index.jsp?pageID=corp_level1&amp;path=membership&amp;file=coa.xml&amp;xsl=generic.xsl">Update
  IEEE profile and email address</a></p>
  <a href="other.php">Other Events</a></p>

  <a href="http://www.ieee.org/fap"><img border="0" src="images/fap.jpg" width="120" height="60"></a>
</p>

Try this:

<p class="text1">
  <p><a href="whoweare.php">Who We Are</a></p>
  <p><a href="events.php">Events</a></p>
  <p><a href="newsletter.php">Newsletter &amp; News</a></p>
  <p><a href="AwardNominations.php">Award Nominations</a></p>
  <p><a href="videos.php">Video Library</a></p>
  <p><a href="jobs.php">Jobs</a></p>
  <p><a href="links.php">Links</a></p>
  <p><a href="discounts.php">Discounts</a></p>
  <p><a href="volunteers.php">Call for Volunteers</a></p>
  <p><a href="societies.php">Society Websites</a></p>
  <p><a href="bylaws.php">By-laws</a></p>
  <p><a href="http://www.ieee.org/portal/index.jsp?pageID=corp_level1&amp;path=membership&amp;file=coa.xml&amp;xsl=generic.xsl">Update IEEE profile and email address</a></p>
  <p><a href="other.php">Other Events</a></p>
  <p><a href="http://www.ieee.org/fap"><img border="0" src="images/fap.jpg" width="120" height="60"></a></p>
</p>
daviddoria commented: Thanks for catching my mistake! +4
Borzoi 24 Posting Whiz

I thought that a robots.txt file was just to prevent search engines from crawling through folders they shouldn't. I don't think it will increase web traffic. I could be wrong though but that's my understanding of it.

Borzoi 24 Posting Whiz

Disabling centre click won't stop them from scrolling across.

It's very likely you have some content on your page which is stretching it wider than you want. Also, the url in the background image should have quotes:

background-image: url('../images/bg-home.jpg');
Borzoi 24 Posting Whiz

You are welcome. Remember to mark the thread as solved.

Borzoi 24 Posting Whiz

That's a good point Borzoi, but can you indicate a situation where float: left would not work when used on divs?

I cannot indicate any situation where it wouldn't work but I was referring to the internal <div> tags which wouldn't be floating, not the wrapping one.

Try both of these codes to see what I mean:
(use one of the w3schools "TryIt" pages if you want).

<html>
  <head>
    <title>banana</title>
    
  </head>
  
  <body>
     <div style="float: left; color: #5555ff;">
       <div>Element 1</div>
       <div>Element 2</div>
       <div>Element 3</div>
     </div>
     <p>This will be the content of the site.</p>
  </body>
</html>
<html>
  <head>
    <title>banana</title>
    
  </head>
  
  <body>
     <div style="float: left; color: #5555ff;">
       <div style="display: inline;">Element 1</div>
       <div style="display: inline;">Element 2</div>
       <div style="display: inline;">Element 3</div>
     </div>
     <p>This will be the content of the site.</p>
  </body>
</html>

You probably don't even need the internal <div> tags and just need the element itself, whether it's image or text. As long as they're coded without a <br /> or without their own positioning of some sort, they should be displayed on the same line. The second code I provided would display the same as:

<html>
  <head>
    <title>banana</title>
    
  </head>
  
  <body>
     <div style="float: left; color: #5555ff;">
       Element 1
       Element 2
       Element 3
     </div>
     <p>This will be the content of the site.</p>
  </body>
</html>

The float: left; would probably be better left out if it's for a menu bar of some sort so that the content is automatically placed beneath it.

<html>
  <head>
    <title>banana</title>
    
  </head>
  
  <body>
     <div style="color: #5555ff;"> …
Borzoi 24 Posting Whiz

<div> tags are naturally display: block; so if you're going to use peachy0685's method, you should use either <span> or in the class of the <div> put display: inline; otherwise you might get each element on a new line. There are some things that <div> supports that <span> doesn't. For example, positioning.

cguan_77 commented: thanks i don't know that css got inline command +0
Borzoi 24 Posting Whiz

Why do you want to disable centre click? All it does is scroll or open links in a new tab.

Borzoi 24 Posting Whiz

Is it just text you're aligning or are they images or other elements?

Have you tried just coding them inline?

I.e.:

<!-- Assuming you're using images -->

<img src="images/image1.jpg" alt="image 1" /> | <img src="images/image2.jpg" alt="image 2" /> | <img src="images/image3.jpg" alt="image 3" />
Borzoi 24 Posting Whiz

You want to add pt, not px.

<style type="text/css">
body { color: <?php print $_POST["color"] ?>;
font-family: <?php print $_POST["font"] ?>;
font-size: <?php print $_POST["font-size"] ?>pt;
}
</style>

</head>
<body>

<?php print $_POST["box"] ?>
Borzoi 24 Posting Whiz

If you want "Username" to be the same as "userNAME" instead of them being 2 different users (I.e.: you don't need to type your username exactly how you did when you signed up) you should use the toupper(); function:

if(toupper($result["username"]) === toupper($username))
{
  //user exists
}
else
{
  //user doesn't exist
}
Borzoi 24 Posting Whiz

text-align: justify; is correct and valid.

http://www.w3schools.com/css/css_text.asp

Borzoi 24 Posting Whiz

Your CSS looks fine.

Make sure the CSS file has the file extension .css and not .txt or anything else.

What is the code in your HTML file that you've used to link to the CSS file?

Borzoi 24 Posting Whiz

To make CSS "external" as you call it, cut and paste it into it's own file with no other HTML, not even the <script> tags and call it whatever you want with the extension .css. You would then replace where it was in the page code to this:

Assume the stylesheet you saves is called style.css

<link rel="stylesheet" type="text/css" href="foldername/style.css" />

if it's in the same folder then you just need style.css an no folder name. Just like other links, use relative links.

Borzoi 24 Posting Whiz

When linking to images or other pages, you should always use relative links. Only use absolute links when linking to external sites.

<!-- Using relative links means that if your domain changes, you wouldn't have to change the code. -->
<a href="index.html">Home Page</a>
<img src="images/picture.jpg" />

<!-- While not necessarily incorrect, if your domain changes, you would have to manually change the link. -->
<a hred="http://mywebsite.com/index/html">Home Page</a>
<img src="http://mywebsite.com/images/picture.jpg" />

Depending on the setup of your server, you may need to put ./ at the beginning of the link to tell it to search the current folder. If you wish to go up a folder, prefix the link with ../ .

If the current page is in the "Banana" folder and the image you want is in the "images" folder for example:

<!-- The ../ tells the server to go up one folder. -->
<img src="../images/picture.jpg" />

If the current page is in the "Apple" folder which is within the "Banana" folder then you would use this:

<!-- The ../../ tells the server to go up two folders. -->
<img src="../../images/picture.jpg" />