samarudge 16 Posting Whiz
samarudge 16 Posting Whiz
You need PHP GD to do this
Just add
<?php
if (ini_get('display_errors') == 1) {
ini_set('display_errors', 0);
}
?>
to the start of the file. That will turn of error display
The easiest way is
#Enable URL Rewriting
RewriteEngine on
#Flag [QSA] adds any additional URL paramiters to the call
#Home Page
RewriteRule ^onefile.html$ /onefile.php [QSA]
So
onefile.html will redirect to onefile.php
and
onefile.html?get=foo redirects to onefile.php?get=foo
If anyone is interested I have put together a list of common MIME types formatted in CSV and XML
You can get them at
http://www.cake-spoon.com/pdt/2010-03-12/csv-list-of-mime-types
or via the attached .zip folder containing both =)
Even I faced the same problem, searched net for hours but could not find the solution. Thank you very much for pointing out Wamp.
Wamp is working great. Its very good alternative.
Thanks a lot again.
As a note, WAMP is generaly considered to be unsecure and should NOT be used for production sites or anything accessible from outside your network. Apache/PHP are not natively compatible with Windows and should be run from Linux/Unix systems for anything going live. If you want to run your site of windows you should consider IIS on Windows Server with PHP running through FastCGI
<table width="100%"> <tr> <td>Content</td> <td width='*'>More Content</td> </tr> </table>
Brilliant - why didn't I think of that =)
Hey,
I have a table defined like
<table width="100%">
<tr>
<td>Some Content</td>
<td>More Content</td>
</tr>
</table>
This table displays something like
|------------------------|------------------------|
|Some Content | More Content |
|------------------------|------------------------|
The columns of the table will automatically resize based on there content however I want the first collumn to only be the width of its content however much content is in the first or second column I.E.
|------------|-------------------------------------|
|Some Content| More Content |
|------------|-------------------------------------|
|------------|-------------------------------------|
|Some Content| a |
|------------|-------------------------------------|
How is this done?
Regards,
Sam Rudge
PHP timestamp format is a number representing the number of seconds passed since 1970-01-01 00:00:00
you can't substract a mysql timestamp from a php one. It's like adding 2 pears + 4 apples = 6 WHAT? peapples
EPIC COMPARISON
*stolen* =)
have you tried
time_stamp(time());
And made sure that $session_time is a properly formatted UNIX timestamp?
Whats the issue? That works fine except that for compatability you might want to change the opening script tag to
<script type="text/javascript" language="javascript">
Can you please post the HTML and JS code
Hey,
Unfortunately when just loading a plain sound file there is no way of managing the errors (Its a browser error)
The only thing I would sugest is using some sort of Flash framework and refferencing it through JS. Or if you are feeling adventurous you could play about with <HTML5>
Seperate them like normal functions e.g.
<input onblur="function1(); function2(); function3();" />
You can also use standard JS like
<input onblur="this.value = 'somevalue' />
Does anyone know anything about Oracle Roles & privileges. An application on 9i has multiple roles assigned to each user. I am getting permissions problems, I think because there are conflicting privileges within the roles. EG:
Role1 has SELECT, UPDATE on table1.
Role2 has SELECT, INSERT on table1.
User Default is set as (Role1,Role2).
I thought it would accumulate all the permissions for table1 but it appears to be overwriting Role1 with Role2 so I lose the UPDATE privilege.
Thanks,
=)
.htaccess files use regular expressions to redirect so a URL like
http://mysite.com/somefile/user/hello.html
could be redirected to
http://mysite.com/index.php?file=somefile&arg2=user&arg3=hello
using the .htaccess file
#Enable URL Rewriting
RewriteEngine on
RewriteRule ^/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+)/([0-9a-zA-Z_-]+).html$ //index.php?file=$1&arg2=$2&arg3=$3 [QSA]
so in your example you just need somethingl ike
#Enable URL Rewriting
RewriteEngine on
RewriteRule ^/([0-9a-zA-Z_/-]+)$ //index.php/$1 [QSA]
I haven't tested that code but it should be OK
On your HTML form have you included return within the on-submit? I.E.
<form name="" action="" target="_self" onsubmit="return checkForm()">
<!--Form Stuff-->
</form>
=)
Yep except with MySQLi you need link identifyer I.E. when you connect you do something like
$Connection = mysqli_connect(...);
you would just need to use that in your insert query like
mysqli_query($Connection, "INSERT INTO MY_TABLE (NAME, EMAIL, PHONE) VALUES('bob', 'bob@bobssite.com', '555-222-111')") or die(mysqli_error($Connection));
$InsertID = mysqli_insert_id($Connection);
or if using the variable type class use
$Connection->query("INSERT INTO MY_TABLE (NAME, EMAIL, PHONE) VALUES('bob', 'bob@bobssite.com', '555-222-111')");
$InsertID = $Connection->mysql_insert_id();
=)
You can use the mysql_insert_id() function. Run an insert query like this
//Connect to MySQL etc.
mysql_query("INSERT INTO MY_TABLE (NAME, EMAIL, PHONE) VALUES('bob', 'bob@bobssite.com', '555-222-111')") or die(mysql_error());
$InsertID = mysql_insert_id();
now $InsertID
will contain the PRIMARY_KEY from the table insert.
=)
Yep its a realy simple problem and a simple solution. Even though its part of a PHP script you need to refference it as an image I.E.
Create a file 'op_image.php' and add the code
<?php
require_once "CaptchaSecurityImages.php";
$width = '120';
$height = '40';
$characters = '6';
$captcha = new CaptchaSecurityImages();
$img = $captcha -> Captcha($width,$height,$characters);
?>
(Removing that code from the form)
then in the form set the image link to
<img src="op_image.php" />
The easiest way is just using a standard URL call
In AS3 it can be done with
var url:String = "javascript: your_js_function();";
var request:URLRequest = new URLRequest(url);
navigateToURL(request, '_blank');
It's different for AS2 but if you Google it I'm sure you can find it
Hi Samarudge,
Thanks for that. I have heard differing reports about which file format is smaller the PNG or the Jpeg. Some people say that the PNG file format is bigger in size to the comparable Jpeg format.
The website im working on im looking to improve the loading times on the web pages so need to reduce the size of the images whilst maintaining the quality of them and so this is why i need this help. And I just wanted to know if there is any other way of reducing the loading times of web pages whilst keeping the same amount of images on the page.
Many thanks.
There are many ways to increase page load time, most of them are described in the Yahoo developer docs at http://developer.yahoo.com/performance/rules.html
There is no 'legal' issue although from the point of politeness you should provide attribution and if possible check with the website owner
Its also worth noting that API-password authentication is being phased out over the next 18 months so you are much better off setting up an application using the o-auth API
There is no official "Best" format but most people preffer .PNG (Allows transparency also small file size)
Its between PNG and JP(E)G but its more up to personal prefference
Try
$ArrayLength = rand(0,100);//The array will be between 0 and 100 entries
$i = 0;//Incremental
$RandArray = array();
while ( $i <= $ArrayLength ) {//Until the array length is reached
$RandArray[$i] = rand(1,100);//Set a value between 1 and 100
$i++;//Add to the increment
}
echo "<pre>";//Create an output for plain text
print_r($RandArray);//Print out the array with formatting
echo "</pre>";//Close output
Is that what you needed?
OK then try changing this code
// send
mail($para, $asunto, $mensaje, $headers);
echo"Message sent to <br> $para <br>";
?>
to
// send
if ( !mail($para, $asunto, $mensaje, $headers) ) {
echo "An error occurred, your message was not sent";
} else {
echo"Message sent to <br> $para <br>";
}
?>
If you are still getting "Message sent to..." in your output then the PHP is fine and it could be a problem with the person you are trying to send the email to, the mail server or something else on the server.
When storing data in a MySQL table with PHP you are best off converting it to Unix Time
(See http://php.net/time)
From there you can convert it into any function as well as running functions like
$StartTime = time();
$EndTime = time()+60*60*60;
echo date('H:i:s', $StartTime-$EndTime);//Returns 1:00:00
Try adding the line
ini_set('display_errors', 1);
(This turns on error reporting)
and see what errors you get back
Ahhh I see now, every time it loops its resetting the variable.
Try this code instead:
<?php
mysql_connect("localhost", "Master", "pword");
mysql_select_db("db");
$letter = htmlentities($_GET['search']);
$user = mysql_query("SELECT DISTINCT keywords FROM Stacks WHERE keywords LIKE '$letter%' ORDER BY keywords")or die (mysql_error());
$keyword = '';
$name = '';
while($rowz = mysql_fetch_array($user)){
$keyword .= $rowz['keywords'];
$name .= $rowz['name'];
$bad = mysql_query("SELECT * FROM Stacks WHERE keywords LIKE '$letter%' ORDER BY keywords")or die (mysql_error());
$num_rows = mysql_num_rows($bad)or die (mysql_error());
}
if ($num_rows == 0)
{
echo "<font face='Courier New' font size=18px font color=#FF9900>$letter</font><br /><br />";
echo "<font face='Courier New' font size=3px font color=#FBB917>No Stacks</font><br>";
}
else
{
echo "<font face='Courier New' font size=18px font color=#FF9900>$letter</font><br /><br />";
echo "<font face='Courier New' font size=3px font color=#FBB917><a href='stack.php?search=$keyword&submit=Go!' style='text-decoration: none';>$keyword</a></font><br>";
}
?>
The key bit here is that I defined the variables outside the loop
$keyword = '';
$name = '';
then used the dot-equals syntax to add to the variables
$keyword .= $rowz['keywords']." ";
$name .= $rowz['name']." ";
See if that helps
Not sure but the
print_r()
Command is useful to print out the contents of an array, the best usage is
echo "<pre>";
print_r($ArrayName);
echo "</pre>";
Could you include the contents of your php.conf (Or wherever your PHP is configured in httpd.conf)
I think this is more a Flash problem, do you mean that you want to find out how far the video has played already or how long the video is or how long it will take to load?
If you want to play videos then rather than developing an entire flash streaming system try YouTube's chromeless player.
The API is avaliable for Javascript:
http://code.google.com/apis/youtube/js_api_reference.html
or Actionscript:
http://code.google.com/apis/youtube/flash_api_reference.html
Try
http://php.net/
It tends to be quite useful when learning the PHP language, this is a forum for HELPING people with problems, come back in a few months and we can HELP you rather than TELL you what to do
Graphix is right, also you should consider using URL encoding on your URL I.E
indexblank.php?course=C LANGUAGE
Should become
indexblank.php?course=C+LANGUAGE
originally it stood for Personal Home Page
That's since changed.
Yer that's what I thought, it would seem logical and it was originally intended to be a less advanced version of PERL although it has now overtaken and become more popular.
Hmm... this is an interesting one isn't it though because PHP stands for
PHP Hypertext Preprocessor
Which doesn't really explain what PHP stands for, I think they had HP and just needed another letter so they added a P and couldn't think of anything for it to stand for which effectively leads to the recursive definition:
PHP stands for:
PHP Hypertext Preprocessor stands for:
PHP Hypertext Preprocessor Hypertext Preprocessor stands for:
PHP Hypertext Preprocessor Hypertext Preprocessor Hypertext Preprocessor stands for:
etc.
So you see how the problem happens =P
Hi,
I have a page with four primary DIVS layed out like:
http://wp-media.samrudge.co.uk/2010/01/1.png
using the CSS
body{
background-color:#CCC;
}
#container{
width:300px;
height:auto;
background-color:#00F;
padding:10px;
}
#header{
width:300px;
margin:5px auto;
background-color:#0FF;
font-size:24px;
}
#left{
width:200px;
height:auto;
background-color:#90F;
float:left;
}
#right{
width:100px;
height:auto;
background-color:#CF0;
float:right;
}
#footer{
width:300px;
background-color:#0F0;
float:none;
Using the HTML
<div id="container">
<div id="header">I am a header</div>
<div id="left">Left Column</div>
<div id="right">Right Column</div>
<div id="footer">I am a footer</div>
</div>
However when I add more content to eather the left column or the right column they overlap the footer
http://wp-media.samrudge.co.uk/2010/01/2.png
http://wp-media.samrudge.co.uk/2010/01/3.png
How can I make it so that the footer and container divs expand to fit the height of whichever is the longer div?
Thanx,
Sam
Hey,
I have a home network consiting of 4 PCs and 2 Wireless Routers
D-Link Router
(xxx.xxx.1.1)
NetGear Router
(xxx.xxx.1.2)
-----------------------------
Media Centre Upstairs w/ Windows XP MCE sp3 & Windows 7
(xxx.xxx.1.3
Netbook w/ Windows XP sp3
(xxx.xxx.1.4)
Meida Centre Downstairs w/ Windows XP MCE sp3
(xxx.xxx.1.5)
Laptop w/ Windows Vista sp2
(xxx.xxx.1.6)-----------------------------
The 2 Media Centres are each connected to a router, and the routers are connected to each other via ethernet port 1
D-Link router is primary, and has internet connection.
it has DHCP turned on allocating IP address from xxx.xxx.1.3The Netgear router has DHCP turned OFF
Using this configuration i am able to have 2 Access points and expand the wifi area allowing the portable computers access from upstairs Or downstairs on seperate access points.
This has been working fine for me so far, however...
I am not sure where the problem lies, but for some reason the Media Centre downstairs (xxx.xxx..1.5) can not access the files from the one upstairs (xxx.xxx.1.3), but the the upstairs machine can access files shared by the one downstairs...all other PCs can access all files, on all PCs
when the network was first created i had to enter the username and passwords for the PCs each PC trys to access as is normal, however on xxx.xxx.1.3 there are 2 operatng systems, and the 2nd was added AFTER the network was first created. …
I think we need to define some basic keywords
all new
Not compatible with earlier versions.
computer expert:
Someone who has not read the instructions, but who will nevertheless feel qualified to install a program and, when it does not function correctly, pronounce it incompatible with the operating system.
clicklexia
A disorder often suffered by novice computer users in which they have a tendency to double-click on items which only require one click, often resulting in two items opening instead of just one.
egosurfing
Typing your own name into google to see who’s talking about you.
FAQ
Frequently Avoided Questions. A company's attempt to answer commonly asked questions such as, "How do I get technical support?"
feature
A hardware limitation, as described by a marketing representative.
flow chart
A graphic representation of a bowl of spaghetti.
freelance
To collect unemployment.
hardware
The parts of a computer which can be kicked.
inbox
A catch basin for everything you don't want to deal with, but are afraid to throw away.
instruction manual
An explanation of how to use something written in a way that is easily understood only by the author.
mouse
An input device designed to make computer errors easier to generate.
Windows
The most expensive way of generating suicidal tendency in yourself.
UNIX
Software designed to …
What system are you using?
If you are using Apache with Windows you need to open your services pannel (Start>Run>services.msc), right click Apache *.*, account then check "Allow service to interact with desktop"
That should help if you are on Windows, if you are on Linux or UNIX that script should work so if it doesn't then it may be an issue with Apache/Linux rather than PHP itself
My cousin asked if I could upgrade her laptop to web 2.0 =)
I have decided to set up the website www.cake-spoon.com with the intention of it being a random, nerdy blog covering everything from photography to games consoles to films. Only problem is that me writing a blog all by myself is a bit boring and won't get much promotion so what I'm looking for is a team of 5-10 bloggers (Its probably best if you know how to use Wordpress although it is very easy to learn) to write, promote and enjoy the blog. Even if your only going to write one post a month I'm not complaining. At the moment the website is advert free (So non-profit) however if it started getting good hits then I was thinking of implementing a simple system where when people look at your posts they would see your Google Adsense code although (I.E. the more you post, the more hits you will get so the more you will earn)
If you are interested please reply on the forum and I will get in touch via DM to get your email securely etc.
If you are interested please post the sort of things you would write about (You will not be restricted to these or expected to write about them its just for interest)
Thanx,
Sam Rudge
DM me with private queries
So the other day I found an AMAZING website
Do you get tired of idiots on forums asking stupid questions?
Do you wish there was a way to get rid of the idiots?
Introducing http://www.lmgtfy.com/
Possibly the best use of flashvars ever =)
(I don't own this site and I wasn't asked to do this I just think its a pretty cool website =D)
Yep that worked thanx =)
Hi,
I have created dynamic text on a button. How can I get the text to display the hand tool instead of the arrow tool. I have made the text not selectable and given it an instance name then used
itbl_text.buttonMode = true;
it is all contained inside a movie clip called iTunes and in the main stage I have the code
iTunes.buttonMode = true;
How can I make the hand tool come up?
Hi,
I have created a Flash MP3 player with a timeline, at the moment you have to click on the place in the timeline to move to but I would like people to be able to click and drag the time slider.
The code I have for setting the position in the time slider is
function setNewProgress(e:MouseEvent):void {
var p:int = sndObject.length * e.currentTarget.mouseX / 166;
chaObject.stop();
chaObject = sndObject.play(p);
this.btnPlay.visible = false;
this.btnPause.visible = true;
}
which is called by
this.progressbar.addEventListener(MouseEvent.CLICK, setNewProgress);
How do I make it click and drag
Thanx,
Sam Rudge
This cannot be done in PHP,
You need to open the source code of your player (.fla) and edit it in there.
The only thing you could do in PHP is stop the whole player from loading but the MP3 won't start playing until the player has loaded.
Open the flash source file and post the main AS code from the "Actions" layer, frame 1. That is easy enough to do in Flash and takes about 2 minutes and a couple of lines of code =)