samarudge 16 Posting Whiz

If you get the word out there, I think you will have a huge amount of requests.

I looked into using a service like this and it can be very expensive. If there is a free version out there, they will use it. A lot. And the fact it is almost instant makes it better.

I agree, this was the idea of making the service the only problem is getting the word out there. When people want thumbnails they instantly think of thumbshots (As used here on daniweb) people very rarely look into a service such as mine and some people can even be put off by the fact it is free. Once I have the javascript thing complete that automaticaly adds thumbnails to links when people move there mouse over them i can start trying to increase the sites popularity

samarudge 16 Posting Whiz

I have tested the script and I can hapily run about 50 copies of the VB script at the same time, if the number is exceeded then the PHP script just uses the sleep command within a loop to pause the request until their is a slot free. I also did not want to run it as a payed service because one I am only 16 and can't be bothered to figure out how to use tax and two I'm only doing it for the fun of it and once I have a reasonable number of requests coming in I was planning on removing the link from the image.

samarudge 16 Posting Whiz

Nope, I am 16 years old, the script is a simple VB script which basicaly opens an IE window at full screen, takes a screen dump and saves it. You can see this (Kind ov) because when you request a page that does not have a cached thumbnail it takes about 30 seconds to display the image (Because it is being generated) then if you refresh the image is displayed almost instantly. Nothing to do with users, this site was designed, set up and run by me alone. Also it can thumbnail any page at all so lots of people would have to create lots of thumbnails. Just try it on any page:
http://getnail.samrudge.co.uk/generate.xml?URL=http://www.daniweb.com/forums/thread198604.html

samarudge 16 Posting Whiz

Hello,

Does that mean can I use my home computer as a webserver with www.xxx.com ??

Theoreticaly yes but it might be better to get a cheep server such as a Dell Poweredge. When I set up my first server I found a very good tutorial similar to this one (But this is for a more recent version of Fedora Linux)
http://www.howtoforge.com/perfect-server-fedora-11-x86_64-ispconfig-2

samarudge 16 Posting Whiz

Hi,
I have spend a while working on a new project called HappyThumbs (Was going to go for IThumbs but then I Googled it :P)(BTW don't Google IThumbs with safe search off) but I was hoping some people could help me test it and feed back on this thread.
The website is http://happythumbs.samrudge.co.uk/
You don't have to sign up and there is currently no javascript component for adding it to your page but I am working on it so it is really more of an API type thing but please get back too me soon.
Regards,
Sam Rudge
P.S. I am aware of the black backgrounds on some images

samarudge 16 Posting Whiz

base64_encode($String)
base64_decode($String)

samarudge 16 Posting Whiz

As a random adition, i did a test on PHPs rand() function to get it to generate eather a 1 or a 2 and found that
1 came out 50.4% of the time
whereas
2 came out 49.6%
Even random numbers such as balls in a bingo machiene are not realy random because if you put every ball in the exact same position with everything about the environment the same, you will get the same result.

samarudge 16 Posting Whiz

1st, have you configured PHP mailer to use your SMTP (Mail) server?
2nd, Are you sure you gave it all the right peramiters
3rd, (If you have done the above) post us some code so we can see what's going on, try the form page and the processor

samarudge 16 Posting Whiz

Solution: buy a cheap hosting package that supports php/MySql etc. Should be plenty to choose from.

Or if you're thinking of setting up a big website or company website it could be cheaper and easier just to buy a cheap server, stick linux on it and run Apache yourself. Then you don't have to worry about anything apart from DNS hosting which isn't that expensive.

samarudge 16 Posting Whiz

Don't try to upload .anything.

Rename the .htaccess file as htaccess.txt

Upload

Rename htaccess.txt to .htaccess

I assume that you have rights to rename files??

Good Idea but I checked on the Yahoo site and they don't allow .htaccess files :(

samarudge 16 Posting Whiz

.htaccess files are only supported by Apache servers and most likely the Yahoo hosting will not use Apace or will have .htaccess disabled. The functions within .htaccess files are designed for use with Apache servers so if your software needs .htaccess it MUST run on an Apache server. You can get quite cheep PHP/Apache hosting that supports .htaccess files, just look it up.

samarudge 16 Posting Whiz

aspell (http://aspell.net/) can be used for spell checking but I have never used it

samarudge 16 Posting Whiz

and copied the relevant code, replacing thier website/pic name with my own

You realise nearly all website code is copyright and your 'Supprise' could be a fine?
Also the function imgSwap() is not shown, please send your JS code as well as your HTML

samarudge 16 Posting Whiz

Hi,
I have this code which is not working

<script type="text/javascript" language="javascript">
<!--
function loadpage() {
	document.getElementById('Loadingindic').style.top = '-500%';
}

function checkfields() {
	if(name()==true){
		if(email()==true){
			if(message()==true){
				return true;
			}
		}
	}
	return false
}

function name() {
	name = document.getElementById('CF_N').value;
	if ( name.length == 0 ) {
		alert('Please enter your name!');
		return false;
	} else {
		return true;
	}
}

function message() {
	name = document.getElementById('CF_M').value;
	if ( name.length == 0 ) {
		alert('Please enter a message!');
		return false;
	} else {
		return true;
	}
}

function email() {
	name = document.getElementById('CF_E').value;
	var validchars = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/;
	if(name.match(validchars)){
		return true;
	}else{
		alert('Please enter a valid email!');
		return false;
	}
}
//-->
</script>

When a form is submitted, checkfields() is run. The first time it is run it runs correctly, picking up on invalid fields but after that it just submits the form without paying attention to the validation. What is wrong?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

In theory this is what needs doing.
1) Run a JS function every 10 seconds.
2) Run an AJAX statement in the function linking to check.php
3) In the check.php run a query to check the number of rows in the table.
4) Use the returned number from PHP in the JS function to check if it is larger than the current number of rows.
5) if it is then you will need to use AJAX once more to retreive a print out of the result from the MySql database.
7) Use JavaScript to replace the current results with the new one.

This would be the best solution

samarudge 16 Posting Whiz

You can as well do it without the onclick event by simply placing the desired javascript code in the href attribute or a the function name containing your code.

/*Example*/

<script type="text/javascript">
function Confirmation()
{
if(confirm('Really delete this document?'))
window.location.href='../../admin/comment-delete.php?id=$id2';
}
</script>
<a href="javascript: Confirmation()">Delete?</a>

Hope it helps

It is probably easer to keep it in the <a /> tag to keep it simple

samarudge 16 Posting Whiz
mysql_select_db($database_profiles, $profiles);

$query_Recordset2 = "SELECT * FROM biodata";
$Recordset2 = mysql_query($query_Recordset2, $profiles) or die(mysql_error());
while ($row = mysql_fetch_assoc($Recordset2)){
//If you want to echo a field called Name
print($row['name']);
//A field called Age
print($row['age']);
//Website
print($row['website']);
}

So find the name of the field you want to output and put that into the $row array value

print($row['MySQL_Field_Name']);

Enjoy

P.S. Please post complete code (Your while loop was not complete) also if it had been a connection problem we wouldn't have known because your Connect statement is not shown!

samarudge 16 Posting Whiz
mysql_select_db($database_profiles, $profiles);

$query_Recordset2 = "SELECT * FROM biodata";
$Recordset2 = mysql_query($query_Recordset2, $profiles) or die(mysql_error());
while ($row = mysql_fetch_assoc($Recordset2)){
//If you want to echo a field called Name
print($row['name']);
//A field called Age
print($row['age']);
//Website
print($row['website']);
}

So find the name of the field you want to output and put that into the $row array value

print($row['MySQL_Field_Name']);

Enjoy

P.S. Please post complete code (Your while loop was not complete) also if it had been a connection problem we wouldn't have known because your Connect statement is not shown!

samarudge 16 Posting Whiz
mysql_select_db($database_profiles, $profiles);

$query_Recordset2 = "SELECT * FROM biodata";
$Recordset2 = mysql_query($query_Recordset2, $profiles) or die(mysql_error());
while ($row = mysql_fetch_assoc($Recordset2)){
//If you want to echo a field called Name
print($row['name']);
//A field called Age
print($row['age']);
//Website
print($row['website']);
}

So find the name of the field you want to output and put that into the $row array value

print($row['MySQL_Field_Name']);

Enjoy
P.S. Please post complete code (Your while loop was not complete) also if it had been a connection problem we wouldn't have known because your Connect statement is not shown!

samarudge 16 Posting Whiz
<?php 
   if(session_is_registered("sesvar")){ 
      echo ("<a href='../../admin/comment-delete.php?id=$id2' onclick='return confirm('Are you SURE you want to delete this comment??')';><img src='../../images/delete.png' align='left' alt='Delete This Comment?'></a>"); 
   } 
?>

try that

samarudge 16 Posting Whiz

There is no way to refresh a page as and when the data is updated (Unless you wanted to set up some sort of AJAX check) but the easiest way of doing this is placing this code:

<?php header('Refresh: 5'); ?>

on the first line of your script (This will refresh every 5 seconds but you can change that)

samarudge 16 Posting Whiz

Look up cURL, It allows posting, cookies and lots of other stuff

samarudge 16 Posting Whiz

Glad to see you figured it out

samarudge 16 Posting Whiz

If you look in your PHP.ini configuration then the default limit for uploads is 2 Meg, a request larger than 2 meg (Including images, files, text, headers) could return that error

samarudge 16 Posting Whiz

Create a simple script such as

<?php
echo $_SERVER['HTTP_USER_AGENT'];
?>

And look at the response. Find something uneque to the IPhone E.G. Safari-Mobile etc. and add that to your script

samarudge 16 Posting Whiz

Hi,
I have created a flash file that requires variables from the HTML page it is embedded in. Now I'm not sure wether this is a Flash problem or a HTML problem but when I view the flash file through the web page with the following embed code

<!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>uTutorial Uploader V 1.3</title>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>

<body>
<center>
<p>
  <object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="380" height="130">
    <param name="movie" value="flash/arcs.swf?testing=test" />
    <param name="quality" value="high" />
    <param name="wmode" value="opaque" />
    <param name="swfversion" value="9.0.45.0" />
    <!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don’t want users to see the prompt. -->
    <param name="expressinstall" value="Scripts/expressInstall.swf" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="flash/arcs.swf?testing=test" width="380" height="130">
      <!--<![endif]-->
      <param name="quality" value="high" />
      <param name="wmode" value="opaque" />
      <param name="swfversion" value="9.0.45.0" />
      <param name="expressinstall" value="Scripts/expressInstall.swf" />
      <!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
      <div>
        <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
        <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
      </div>
      <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
  </object>
</p>
<h6><a href="/browser.php?Do=<?php echo $_GET['Do']; ?>">Switch To Browser Uploader</a> (Older Browsers or No Flash)</h6>
<script type="text/javascript">
<!--
swfobject.registerObject("FlashID");
//-->
</script>
</center>
</body>
</html>
…
samarudge 16 Posting Whiz

the easiest way to do this is

<a href="<?php echo "http://".$_SERVER['HTTP_HOST']; ?>/yourpage.php">Click Me!</a>

but I'm not realy sure thats what you wanted. Do you mean how do you get your home page to be called home.php?

samarudge 16 Posting Whiz

"Hewston, we have a noob"
I don't think you quite understand what PHP is. PHP runs on the server and once that little loading indicator has gone away their aint a whole lot PHP can do to the page. If you want a form to be submitted to the server then you don't necessary need JS at all (Tho it can be used for validation)
First can I ask this question (I will phrase it in terms of a cake shop because everybody likes caked :D)
If your server is the lady behind the counter selling cakes (The cake being the data) and the customer is the browser or client
Do you want the customer to get a cake of the lady, or the lady to give a cake to the customer?
If you gave us this piece of information then we might be able to give you more help

samarudge 16 Posting Whiz

My first website was similar to what you want (It was a site for my parents association) but I decided to use the Joomla CMS system because there are loads of add ons such as calendars. I will admit that joomla is not like a walk in the park and does take some getting used to but it means that once I had made the site I could edit it without having to add a single bit of code

samarudge 16 Posting Whiz

If you uploaded the file to a folder called /powerpoint/ and the file was called presentation.ppt (Or .pptx) and accessed it on a computer with eather Office 2003 (PPT) or 2007 (PPTX) using the path like a regular file:
http://yoursite.com/powerpoint/presentation.ppt
then you should see the presentation but I think this only works in Internet Explorer and it would only work on windows so Mac and Linux users are screwed as well as users of other browsers on Windows (Firefox, Opera etc.)
Regards,
Sam Rudge

samarudge 16 Posting Whiz

This is really quite simple
the www. prefix is irelevant to your site I.E. daniweb.com and www.daniweb.com go to the same server but www. can be treated as a subdomain for example
daniweb.com could go to server1 (IP 123.123.123.0)
BUT!
www.daniweb.com could go to server2 (IP 123.123.123.1)
so
www2.daniweb.com could go to a third server. This method can be used to distribute load among many servers but I don't think this is the best method. I would always use Apache with ether mod_backhand or some other configuration of mod_p-r-o-x-y (Take out the dashes, for some reason my school blocks that word)
So in answer to your question this is a DNS setting but it is not recomended
Regards,
Sam Rudge

samarudge 16 Posting Whiz

I have never used it but I am told that FPDF (http://www.fpdf.org/) is very good. It is a class that allows you to create PDF files through PHP and it seams to have good documentation
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Open terminal (Programs > System > Terminal or something like that)
type in 'su' (This command makes u a 'super user' so you can do anything)
Type in your root password (You should have set this when you install)
now type this command
chmod -R 775 /var/www/
then type
chown apache
and
chgrp apache

Then add yourself to the webserver group:
useradd -G {apache} YOURUSERNAMEHERE

now type exit twice and navigate to/var/www/html/
Right click > create new file
name it test.html and save it (It doesn't need any content its just to check that it works)
now navigate to http://localhost/test.html and see if that works
Regards,
Sam Rudge
This will change the permisions so that Apache can read and write

samarudge 16 Posting Whiz

Avast Pro (Basic is SH*T)

samarudge 16 Posting Whiz

Thanx that worked like a charm

samarudge 16 Posting Whiz

Hi,
I have a shell script that is supposed to change the permission for my WWW folder so that Apache can access them. My current script is

chown apache /var/www/*
chmod 755 /var/www/*

This works fine for /var/www/ but subdirectories of /var/www/ e.g. /var/www/html/ is still owned by samarudge (My FTP user).
How can I change this script so that it automaticaly changes the permisions for the subdirectories for Apache?
Regards,
Sam Rudge

samarudge 16 Posting Whiz

Hi,
I have written the following code that makes the DIV fall down from the top of the page to a certain point E.G. 200 pixels from the top of the page however, I want the DIV to appear 200 pixles from the top of the page wherever the user is on the page E.G. if they had scroled half way down the page and clicked a link to load the DIV then it would appear from the top of their screen and stop 200 pixles from the top;
This is my JS:

function show_diag(elm_id, display, step) {
	
if ( display == 'show' ) {
	if ( step == 1 ) {
		document.getElementById(elm_id).style.top = '-100px';
		setTimeout("show_diag('"+elm_id+"', '"+display+"', 2);", 50);
	}
	if ( step <= 15 && step != 1 ) {
		top = -100 + (20*step);
		document.getElementById(elm_id).style.top = top+"px";
		
		elm_step = step + 1;
		setTimeout("show_diag('"+elm_id+"', '"+display+"', "+elm_step+");", 20);
	}
	
	} else if (display == 'hide') {
	
	if ( step <= 15 ) {
		top = 200 - (20*step);
		width = 400 - (20*step)
		document.getElementById(elm_id).style.top = top+"px";
		
		elm_step = step + 1;
		setTimeout("show_diag('"+elm_id+"', '"+display+"', "+elm_step+");", 20);
	}
	if ( step == 15 ) {
		document.getElementById(elm_id).style.top = '-1000px';
	}
	
	}
	return false; //Stop the link going anywhere
}

And my CSS:

.Layout_Login{
	width:400px;
	height:200px;
	background-color:#CCC;
	border:#000;
	border:double;
	position:absolute;
	left:50%;
	top:-1000px;
	margin-left:-200px;
	margin-top:-100px;
	vertical-align:middle;
	overflow:hidden;
}

Thanx
Sam R

samarudge 16 Posting Whiz

I use Fedora 10 and there is a realy good tutorial for setting up everything you need for a LAMP
http://www.howtoforge.com/perfect-server-fedora-10

nav33n commented: Good link.. +11
samarudge 16 Posting Whiz

I use IBox
Here
I think it is really good and use it a lot

samarudge 16 Posting Whiz

Yer go for eather Wamp or Xampp (But NOT PHP 4, the current version is 5.somthing)

samarudge 16 Posting Whiz

Hi,
I am trying to HTTP Auth protect a directory in my cgi-bin directory. I have a .htaccess file:

AuthUserFile /var/www/cgi-bin/secure/.htpasswd
AuthGroupFile /dev/null
AuthName "uTutorial Console"
AuthType Basic

<Limit GET POST>
require user valid-user
</Limit>

When I put this .htaccess file in an ordinary directory e.g. /var/www/html/site/secure/.htaccess it works fine and asks for the username and password however when I put it in my secure CGI directory (/var/www/cgi-bin/secure/) it doesn't ask for user/pass just shows the script. Is this a common problem or is it something to do with DIR permisions?

samarudge 16 Posting Whiz
samarudge 16 Posting Whiz

Or use
header('Refresh: 1;url=yourpage')
to redirect

samarudge 16 Posting Whiz

You could use UNIX time as it is standerdised in GMT, you can format it into "Pretty Time" using date(format, unix timestamp) (For format see http://php.net/date) and you could do something like
basetimestamp (UNIX) + 3600 (GMT +1) etc.

samarudge 16 Posting Whiz

If you do something like this:

<?php
$Day = date('N');
?>

This would return the number of the day E.G.
Monday = 1
Tuesday = 2
..
Friday = 5
..
Sunday = 7

samarudge 16 Posting Whiz

But that envolves outputing a HTML page and is not as reliable. With a META tag you would have to output a HTML page and the page would have to load first. With the php Header method it is almost instant redirection without the need to output a HTML page.

samarudge 16 Posting Whiz

Lookup Mod_Rewrite (You would need it enabled on your server though so talk to your HP to see if they do this, most do)

samarudge 16 Posting Whiz
header('Refresh: 3;url=yoururl.com');

Although this piece of code is fine it is recomended to always send redirect/refresh requests as absolute E.G. your request should always be in the form of
http://site/page

samarudge 16 Posting Whiz
<?php
sleep(3); //Wait
header('Location: http://yoururl.com/something'); //Redirect
?>

Try that one
(The first suggestion with redirect is probably better as it will use less system time)

samarudge 16 Posting Whiz

Tizag has some realy great beginer tutorials on PHP (They helped me learn in about 1 month)
Tizag PHP Tutorials
Enjoy