1,075,628 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by nonshatter which have been Voted Up

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

I have never seen that problem before. You said you were using ubuntu?

From a bare-metal install, all I ever had to do to enable LDAP was:

# sudo apt-get install apache2
# a2enmod authnz_ldap
# /etc/init.d/apache2 restart

Did you install Apache via apt-get or did you build everything manually?

From my experience, I've never had to configure httpd.conf to enable the modules for me as a2enmod does it for you. You could try removing your edits from this file then re-enabling the mods.

Inside the folder /etc/apache2/mods-enabled/ we will find all the enabled modules. Here we will find symlinks to the files from mods_available for all the enabled modules. Only the modules found in this folder will be enabled at run time.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

Try using:

sudo apt-get install libapache2-mod-auth-cas

then use the command below to enable the module

a2enmod auth_cas

restart the apache server

/etc/init.d/apache2

and you should be golden

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

I think it's because your db connection code is only being called in the first else condition.

Move include('db.php'); near the top of the file (outside of any if/else condition)

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

For those who may be interested,

I never found out the cause of the problem, but I uninstalled MySQL 5.1 and went back to 5.0 which sprung it into life again.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

All,

I have been trying to debug this problem all weekend but I haven't been able to get any closer to the solution...

I have just upgraded Mysql to 5.1 from 4.1 on a Red Hat 4 box. Everything is fine. I can connect to the database using the shell, I can connect to the database using a Perl script using DBI (also from the shell), However I cannot connect to the database using a Perl/CGI (inside Apache).

All I get is this error:

Bad handshake at line 123

That line is actually referring to the DBI->connect function.

my $dbh = DBI->connect('DBI:mysql:test:'.get_db(), 'root', '') or die $DBI::errstr;

I have scoured the internet looking for solutions, but I haven't found anything of much help. My original thought was that it was something to do with the DBD::mysql driver. But usually the mysql-shared-compat rpm takes care of that for me... Does anyone know any of the modules/packages I'd need to recompile?

Any help is greatly appreciated.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

use dd for creating a large backup, otherwise just use a simple cp command,

Copy /homedirectory/filename to /yourflashdrive/filename:

cp /home/filename /media/sdb1/filename
nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

1. I use Gnome, but KDE is just as good. I personally don't prefer one over the other.
2. The partitioning software on disk will work fine. Just make sure you know a bit about the partitioning formats to use for linux and windows as some provide more benefits over others. Fedora partition will probs use ext3. Decide how much space you want for each partition. Windows (NTFS/FAT), Linux(EXT3), Linux Swap Space. You could even use a FAT32 partition for sharing data between Windows and Linux.
3. Pretty much any linux distro will run faster than windows. I wouldn't be too concerned about this.
4. Here's a good link to read if you want to know more...
http://www.thpc.info/dual/win7/dualboot_win7+fedora11_grub_on_win7.html

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

You have a couple of options here.

1. Cygwin - a collection of tools which provide a Linux look and feel environment for Windows. This runs on top of windows as a linux OS. (I'd probably start with this).

2. VirtualBox - run a number of virtual machines inside windows.

3. Get a Live CD - depending on what linux distro you want, you can get Live CDs or USBs that run a Linux OS on your system without having to physically install anything to your hard drive.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

g++ is a C compiler. Use this command through your terminal to install it.

sudo apt-get install build-essential
nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

If your using a virtual machine, I'd use Orcale VirtualBox instead of VMWare - I think it's far better!

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

Isn't ereg_replace() deprecated now? Take a look into using preg_quote() instead.

Here's an example:

<?php
// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.

$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/" . preg_quote($word) . "/",
                          "<i>" . $word . "</i>",
                          $textbody);
?>

This should work the same with asterisks as it does for double quotes

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

This is a multi-dimensional array. The parent index (ddc) is an associative array and the child (price) is also associative. This would have a single value assigned to it:

$_SESSION['ddc']['price'] = "144";

Note: Unlike a real PHP array, $_SESSION keys at the root level must be valid variable names.

<?php 
$_SESSION[1][1] = 'cake'; // fails

$_SESSION['v1'][1] = 'cake'; // works
?>
nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

This might be a long shot, but try:

. configure

instead of

./configure

I had a similar hiccup with a recent version of Ubuntu

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

Ohhhh apologies. I see what you're doing now...

Shouldn't it be odbc_result() instead of odbc_results() ?

Also leave the single quotes around the variables in your query otherwise mysql will enter them literally

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

I would suggest staying away from Iframes as many browsers don't have good support for them. Instead I would recommend using html <div> tags to display each 'section'. Then each topic has a hyperlink that references content.php with an added topic variable.

Eg:

Topics:
<a href="content.php?topic=12">Global Warming</a>
<a href="content.php?topic=13">Child Labour</a>

Each link has a topic ID (?topic=12) - which links to each article in your database.

Then on content.php, get the value of the URL topic variable and dynamically fetch the corresponding topic content.

<?php
$topic = $_GET['topic'];
$get_topics = mysql_query("SELECT article FROM topics_table WHERE topic_id = '$topic'") or die(mysql_error());
$result_topic = mysql_fetch_assoc($get_topics);
?>

<div id = "article">
   <?php echo $result_topic['article']; ?>
</div>

I assume you're using a database for your topics and articles?! This way, your site will be much more scalable :)

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

You could use CSS display:none; or in HTML: <style="display:none;"> tag if you simply want to hide the image. I expect you're using a submit button to remove the image?

<?php
   if(isset($_POST['remove']))
   {
       ?>
             <div id="image" style="display:none;">
                  //image here
             </div>
       <?php
   }
   else
   {
        ?>
             <div id="image">
                  //image here
             </div>
        <?php
   }
?>

Otherwise, If you want to remove the image completely from the upload directory, you could maybe try using unlink()? Note:- I've not used this function before. Alternatively, you can delete a whole directory if necessary, by using rmdir()

<?php
   if(isset($_POST['remove']))
   {
       $File = "'memberFiles/'. $newname";
       unlink($File);
   }
?>

You may also want to delete the image path from the database if you're using one. Also make sure that users have the correct permissions to delete files from the server!

Just found this on the php man page:
"careful with unlink...
"very unlikely" is not "impossible" : granted, it will happen.

1) "expected" : a typo and you'll get : unlink('/')
2) "very likely" : some of your files are writeable by anyone.
3) "possible" : you're backup drive is mounted and preserves the authorizations of the original files
4) "very unlikely" : that particular day, at that particular moment, the unlink function decided to work recursively"

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

You can have a look at this function I used a while ago to determine the file extension:

//--- DETERMINES IMAGE EXTENSION ---//
function getExtension($str) {
	$i = strrpos($str,".");
		if (!$i) {
			return "";
		}
	$l = strlen($str)-$i;
	$exten = substr($str,$i+1,$l);
	return $exten;
}

                $errors = 0;
                $filename = stripslashes($_FILES['image']['name']);
                $extension = getExtension($filename);
		$extension = strtolower($extension);
			
		if (($extension == "php") || ($extension == "phtml") || ($extension == "html") || ($extension == "js")) {
			$errors = 1;
			echo 'wrong extension';
		}
                if($errors >= 1) {
			echo 'There was a problem';
                        die(1);
		}

I can post the whole thing if you need it - it might make more sense that way. Just let me know :D

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

You need to change 'else' to 'elseif' for each of the statements.

as hielo suggested, Quotation marks are required around the remark values

Also 'totalg' needs the '$' prefix! It is a variable.

nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0

The easiest way to check if the path is correct is to right click where the broken image is displayed, then 'copy Image URL', then paste the shortcut which will tell you whether the path is output correctly.

If it looks correct, but still doesn't display the image, then try adding the full path to the location. E.g.

<img src=<?php echo "C://xampp/htdocs/images/". $thumbnail ?> >
nonshatter
Posting Whiz
377 posts since Nov 2009
Reputation Points: 39
Solved Threads: 64
Skill Endorsements: 0
 
© 2013 DaniWeb® LLC
Page rendered in 0.1252 seconds using 2.68MB