Borzoi 24 Posting Whiz

I'm trying to get my computer to output audio in mono but despite selecting the option within the Ease of Access centre to enable mono audio, my audio is still coming out stereo.

The reason I need mono audio is because I need to hear all of some audio tracks I have. Parts of the audio are only available from the left channel and some only the right but my left earpiece no longer works.

In addition to enabling mono audio in the Ease of Access centre, what else do I need to do?

Borzoi 24 Posting Whiz

I'll try the pliers method. Need to buy some first.

Borzoi 24 Posting Whiz

I've already tried Google but they all relate to damaged screws or screws stuck in wood.

Borzoi 24 Posting Whiz

I got a new case (Thermaltake View 27) and I'm having trouble undoing the screw on the PCI shield thing where the GPU should be. I can undo all the other screws except this one.

Can anyone provide tips on how I can go about getting it loose so I can unscrew it?

Borzoi 24 Posting Whiz

I'm currently using JQuery but my client doesn't want any JQuery or Javascript on the site which is a pain.

In regards to the scripts failing, they sometimes fail due to the information being generated on the pages taking too long. It's not common for it to fail and I don't have the necessary permissions to try to fix that problem myself.

In case anyone comes accross this trying to find out how to do this using JQuery, the JQuery I am using (which does work) is:

<script type="text/javascript">
    $(document).ready(function() {$('#insert-file').load('./test.php');});
</script>

And the associated HTML:

<div id="insert-file"></div>
Borzoi 24 Posting Whiz

So I'm having a huge brain fart here and I know for a fact I am going about this the wrong way. Unfortunately, I can't refer to previous work I've done where I have done this correctly as I no longer have access to them.

I have my index page grabbing information from different PHP pages then displaying them on screen. The reason why it's grabbing them from different PHP pages is because some times, these scripts will fail. If this was all in the same page, it would cause the whole page to fail so I want to call each bit individually so if one fails, it doesn't cause the whole thing to fall over, only that part fails. This works with both object and iframe like so:

<object data="./include.php" type="text/html">
    <p>There was a problem loading the record.</p>
</object>

<iframe src="./include.php">
    <p>There was a problem loading the record.</p>
</iframe>

While this does work, the problem is that neither iframe nor object has a dynamic height. Using PHP include or require will display the content at an effective dynamic height but the problem there is that with require, if the included file fails the whole page fails and with include, if there's an error then the rest of the page will stop loading.

The ideal solution (which I think would be using JSON?) would work similar to include but load it asynchronously and if it returns an error (500 or otherwise) display a friendly message like above. The height needs …

Borzoi 24 Posting Whiz

I have had a look online but can't seem to find what I want. I can find RDP clients for Linux but that is not what I want. I am looking for some software so that a Linux server can be used as a relay or proxy.

The idea is that the Windows server is on a local network and has no direct access to the internet. It all goes through this Linux server which is acting like a hardware firewall and proxy for other things. When people want to connect to the Windows server, the idea is that they would connect to the IP of the Linux server which would then relay the request to the Windows server, meaning the end user logs in via RDP to the Windows server through the Linux server.

To try explaining it visually, the connection would look similar to this:

Client --> Linux --> Windows

I want to make is so the client doesn't have to do anything special, just simply connect to the IP as they normally would for RDP. The Linux server would basically be receiving the request (on port 3389) and simply forwarding it all to the Windows server.

I'm not sure if I've explained myself well enough so if anything needs clarifying, please let me know.

Borzoi 24 Posting Whiz

Using the IP address is not a suitable solution. That would rely on there being no staff changes and having only one person use that particular computer.

Your other solution is basically just logging in. The idea is so they just go to the page in their browser and they're logged in.

Borzoi 24 Posting Whiz

Looks like everyone will have to type in login details then.

Thanks.

Borzoi 24 Posting Whiz

I have been tasked with making some internal software (as you can probably tell from the section I'm posting in, it's PHP based). I have been asked to make it so the user is automatically logged in and doesn't need to have another password for another piece of software. The trouble is, I'm not sure if this would be possible in PHP.

The software is purely internal and would have absolutely no outside access.

I know that all the end users would be on Windows computers and all the usernames are in the same format so all I would need is to somehow be able to check what user is logged in.

The idea is that an employee (we'll call him John Doe) comes in and logs on to his computer. The idea is that he can just open his web browser and go to the internal URL and it would see that the current Windows user accessing the page is "john.doe" (or possibly "DOMAIN\john.doe") so it will automatically log him in and give him access to what he is allowed/needs access to.

So basically my question is this: Is it possible to check the Windows username of a visitor to a page?

I'm not sure if I've described it well enough (or overdescribed it) so let me know if you want clarification.

Borzoi 24 Posting Whiz

So yes, I was missing something obvious. Going to change it to:

file("file.txt",FILE_IGNORE_NEW_LINES);

Thank you.

Borzoi 24 Posting Whiz

I think I am missing something obvious here but I can't see what.

I am pulling information from another file using file(); which works as expected - putting each line in to an array. The file contains some HTML tags but is just a text file (not a full web page). After pulling the information, the array looks like this:

array
(
    0 => '<h1>'
    1 => 'Header text'
    2 => '</h1>'
    3 => '<p>'
    4 => 'Lots of text to make up a paragraph'
    5 => '</p>'
    6 => '<p>'
    7 => 'More text to make up a paragraph'
    8 => '</p>'
 )

I know that array_search(); will only return the first key which matches the search. In this case, I want to find the first entry of <p> so my search looks like this:

array_search("<p>",$file); //$file is the variable containing the above array.

I would expect this to return a value of 3 as that is the first entry in the array which contains <p> however it is returning nothing. I also tried searching for "Header text" (making sure that the case matches) but this also returns nothing. Using strict doesn't help either.

Contents of the pulled file (we'll just call it "file.txt"):

<h1>
Header Text
</h1>
<p>
Lots of text to make up a paragraph
</p>
<p>
More text to make up a paragraph
</p>

The PHP file trying to get the key:

<?php
    $file = file("file.txt"); //Pull the file in to an array. …
Borzoi 24 Posting Whiz

The reason I am looking for a terminal editor is so I don't have to keep downloading the files to other locations to edit while coding/scripting.

I don't need extra features, it's just the syntax highlighting I need. I am currently using vim but I keep forgetting to go to insert mode when I open it.

Borzoi 24 Posting Whiz

As the title suggests, I'm looking for a command line text editor with syntax highlighting. I don't have a GUI installed and I don't intend to install one which is why I need a command line one.

I usually use nano for my text editing but this doesn't come with syntax highlighting (if it does, I don't know how to enable it). Others I have tried are Vim/Vi and Emacs. Neither of which I like.

Does anyone have any recommendations or am I going to have to settle for Vim?

Borzoi 24 Posting Whiz

For an immediate solution to the above, you need to delete the MySQL socket file and restart MySQL.

To remove the socket file:

rm /var/lib/mysql/mysql.sock

To restart MySQL:

/etc/init.d/mysqld restart

If you are using shared hosting, this is something your web host will need to fix.

This usually happens when MySQL is killed or not shut down properly.

Borzoi 24 Posting Whiz

That has done just what I need. Thank you. I wanted all instances so I removed and Data[2]='running' and just replaced SSDP Discovery with the service I was looking for.

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

That does sound like what I want but which box do you put it in?

Edit: I should clarify that the only boxes which I can see which can be typed in are User, Computer and EventID.

Borzoi 24 Posting Whiz

I've been trying to find a way to filter the Event Viewer in Windows by the description instead of the event type/source etc. I figure that i need to use the XML tab to customise it as there is no option in the basic filtering for what I want.

One reason why I want to do this is to find when I service was started. The sytem logs show when services stop and start but they all have the same event ID, Event Type and Source.

The "description" I'm referring to is the text you see in the "General" tab. It would read something like:

The [service name] service entered the stopped state.

I'm looking to just search the event viewer for the service name. I've looked online for tips on how to do this using the CML tab in the filter but I can only find information on how to filter it by the basic options using the XML tab which seems pointless when I can just tick the box in the filter tab anyway.

Borzoi 24 Posting Whiz

What is the ouput of these lines?

echo "session_var = {$_SESSION['session_var']}<br>\n";
echo "session_var2 = {$_SESSION['session_var2']}<br>\n";

It's better practice to have the variables outside the quotes like this (although this shouldn't affect the output):

echo "session_var = {".$_SESSION['session_var']."}<br>\n";
echo "session_var2 = {".$_SESSION['session_var2']."}<br>\n";
Borzoi 24 Posting Whiz
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

On line 3 you are setting $offset to 0. I think you're intending to get this from the URL so the line should be:

$offset = $_GET['offset'];

This will get whatever value is in the URL. You'll want to force it to 0 if it's not set with an if statement:

if (isset($_GET['offset'])) //check if the URL has anything set for "offset"
{
    $offset = $_GET['offset']; //set it to the URL value if it is set
}
else
{
    $offset = 0; //Set to 0 if it is not set.
}
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 $dataArray is a variable then your session token should be $_SESSION[$dataArray] without the quotes in the square brackets.

Borzoi 24 Posting Whiz

You have the following if statment in your volunForm.php page:

if(!isset($_SESSION['sess_user_id']) || (trim($_SESSION['sess_user_id']) == '')) {
        header("location: login.php");
        exit();
}

This is redirecting anyone who doesn't have the session cookie sess_user_id set. Make sure this is being set when the user logs in.

Borzoi 24 Posting Whiz

If the script is working on another server but not yours then your firewall may be the problem, blocking the connection. Pinging smtp.gmail.com will not tell you if the port is blocked. What is the error you are getting?

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

Can you let us know what the error is you are getting when you run this? Do you have a form passing to your $_POST variables? If nothing is passing to the $_POST variables, there would be nothing to add to the database.

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

Do you have any foreach loops before line 124? While line 124 is the one with the reported error, the cause of the error could be before it.

Borzoi 24 Posting Whiz

Your syntax is incorrect. To specify the password, you use the -p flag, you don't type password.

mysql -u root -p password

This will log you in to MySQL from the command line.

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

Using the CSS display: none will mean that it will always be hidden. It sounds like you're looking for a solution which will require Javascript or JQuery. If it was a case that you just wanted it display for as long as the mouse button is clicked, you could use the tag.class:hover CSS feature.

I tend to avoid Javascript and JQuery unless it's absolutely necessary so I wouldn't be the best person to ask for a working solution here.

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

Do you want the div to be displayed for the duration the mouse button is clicked or do you want it to stay displayed after a single click?

Borzoi 24 Posting Whiz

Why would you want to use a regular expression instead of str_replace? Not only is it a more complicated way to do a simple task but regular expressions require more resources for the same task.

Borzoi 24 Posting Whiz

If you want to input the current time (at the time of the insert) then you can use the now(); function. What gets stored is dependant on the field type. If it's just a date field, you get the date (I believe it will be yy default in a YYY-MM-DD format), if it's a datetime field then you'll get the date and time (again, I think the default is a YYYY-MM-DD hh:mm:ss format),

Borzoi 24 Posting Whiz

You'll need an entry in the database which marks the message as read or unread. From your code, I can see that you only have four entries in the database: from_stu_username, to_stu_username, messages, date. Just add another column to hold the record of whether it is read and then mark the message as such if it is.

Borzoi 24 Posting Whiz

W3 Schools is one I've used and sometimes still reference. If you're looking for PHP specific things, PHP.net is a good reference but it's not a tutorial site. It's mainly a list of functions and what they do with examples.

Borzoi 24 Posting Whiz

Just a note but your if statement has an error.

if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['submit']) == 'POST')

You're checking if a variable is set and then if the result is POST. You will need either:

isset($_POST['submit'])

Or

$_POST['submit'] == 'POST'

My recommendation would be the first.

The isset(); function can only return either TRUE or FALSE but you are checking to see if it has the value of POST. By just having isset($_POST['submit']) in the if statement, you are checking to see if it is set to TRUE. To check if it is false, you would change it to !isset($_POST['submit']).

The error log will be more precise as to the cause of the 500 error message. I don't think the error in the if statement would have caused a 500 error.

Borzoi 24 Posting Whiz

You may find that Yahoo! have blocked the server the mail is being sent from, bouncing it back or just refusing it. The mail log on the server sending the mail will be able to tell you this.

I've seen it a lot where the server sending the mail has mis-matched hostname and reverse DNS or a hostname which doesn't resolve properly. A lot of mail providers, Yahoo! included, will not accept mail from a server which hasn't been set up properly.

Borzoi 24 Posting Whiz

SFTP is FTP over SSH. It uses SSH protocols to upload/download files and browse the remote server. This would also use the SSH port (default 22).

FTPS is secure FTP (usually over TLS but sometimes SSL). The most basic description would be a secure FTP connection. A normal FTP connection, as JorgeM describes, is just an unencrypted connection.

Borzoi 24 Posting Whiz

That's a good point which I didn't think of.

Borzoi 24 Posting Whiz

I meant marking multiple posts/users in the thread as contributing rather than just a single post/user. I agree that most often there are multiple users which contribute to the solution so marking just the one will not be suitable for the Daniweb community.

I'll try an example of what I mean.

Question asker: I have a problem with XXX. Here is my [code]
Poster 1: You have an error on line 5. Try changing to [code]
Poster 2: In addition to Poster 1's suggestion, you could also try [code]
Poster 3: What Poster 1 said

At the moment, all three posters would get credit for contributing but Poster 3 didn't actually contribute.

What I'm proposing is that since Poster 1 and Poster 2 contributed to the solution, the question asker, when marking the thread as solved would mark those two users as contributing.

I just want to clarify that this is only a suggestion, not a bug or complaint.

Borzoi 24 Posting Whiz

I think it would be a good idea for the question asker to mark the posts or the users who contributed to finding the answer to their query. The reason for this is because I occasionally see that post such as "What [previous user] said" which isn't in any way contributing to the solution yet when the thread gets marked as solved, they get credit for contributing to the solution.

Borzoi 24 Posting Whiz

I am looking for a calendar I can embed on my website which will have a list of events I will be holding/attending/etc for all to see. I have had a look at a few solutions but none of them seem to do what I want.

What I want from the calendar is the ability to display in the viewer's local time zone or at least have a drop down or other option menu where the user can select their time zone so that the event times display in their local time.

Of the calendars I have tried, Google has come closest but unfortunately, it only displays in the time zone I set with no option for the end user to view it in another time zone.

Before I start making one myself, does anybody know of a calendar or similar solution which can do this for me?