TomBullock
-
Posts
35 -
Joined
-
Last visited
Posts posted by TomBullock
-
-
Hi,
Is it possible to add PHP code into a TPL file?
Ive tried adding my code in as standard PHP and also tried it with the {php}.....{/php} tags but it still doesnt work.
Any help appreciated!
Thanks
Tom
-
Awesome! Ill keep a note of that site!
Another, more manageable way of doing this is to use an array containing the nav items. Then loop through to produce the html. That way, when you add new items you need only update the array, and not copy/paste code all over the place.
Thanks! Ill give it a go
-
Managed to sort it!
©
-
Another issue that has arrised (nothing to do with the above code) is with a footer include.
The include code is:
<body> <html> <p> Copyright © 2010 <a href="http://www.company.co.uk">Company</a> · Design by <a href="http://www.designer.co.uk">Designer</a></p>
When I view this in a browser, it gives me:
Copyright © 2010 Company · Design by Designer
I remember reading before that I need to put something before the © and the - but Im not sure if thats the correct way?
-
Off the top of my head, maybe:
$page = basename($_SERVER['PHP_SELF']);
Then something like this for every link:
<?php $class = ($page == 'index.php') ? 'current' : ''; <li><a class="<?php echo $class; ?>" href="index.php">Home</a></li>
Ahh, thank you! Worked a treat!
-
Hi
Ive only just started using PHP so go easy
I have a PHP include for a menu on a site I run.
<body> <html> <ul class="avmenu"> <li><a class="current" href="index.php">Home</a></li> <li><a href="about.php">About</a></li> <li><a href="services.php">Services</a></li> <li><a href="projects.php">Projects</a> <ul> <li><a href="highcroft_house.php">Highcroft House</a></li> <li><a href="barn_conversion.php">Barn Conversion</a></li> <li><a href="sunroom_extension.php">Sunroom Extension</a></li> <li><a href="dance_school.php">Dance School</a></li> </ul> </li> <li><a href="testimonials.php">Testimonials</a></li> <li><a href="offers.php">Special Offers</a></li> <li><a href="links.php">Links</a></li> <li><a href="contact.php">Contact</a></li> </ul>
As you can see, on the first link, the index link, it has the class="current" property which displays a little tab next to the menu to show what link is currently selected.
With using the include, obviously the class="current" is passed on to every page.
Is there a way that I can tell the include file to change according to what page its on?
Any help appreciated!
Thanks
Tom
-
Hello
Ive created a little code thats logs you into the site an external page.
Is there a way I can make it submit to more than one php login form?
So for example, I could login to 2 forums with 1 form?
My code so far is here: http://sackthis.co.uk/test/autoproxy.php
Would appreciate any help
Thanks
Thomas
-
Hello
I have this script, but i only want it to be able to upload music files, such as mp3, wma and wav.
<?php //set where you want to store files //in this example we keep files in folder upload //$HTTP_POST_FILES['ufile']['name']; = upload file name //for example uploads file name cartoon.gif . $path will be uploads/cartoon.gif $path= "uploads/".$HTTP_POST_FILES['ufile']['name']; if($ufile !=none) { if(copy($HTTP_POST_FILES['ufile']['tmp_name'], $path)) { echo "Successful<BR/>"; //$HTTP_POST_FILES['ufile']['name'] = file name //$HTTP_POST_FILES['ufile']['size'] = file size //$HTTP_POST_FILES['ufile']['type'] = type of file echo "File Name :".$HTTP_POST_FILES['ufile']['name']."<BR/>"; echo "File Size :".$HTTP_POST_FILES['ufile']['size']."<BR/>"; echo "File Type :".$HTTP_POST_FILES['ufile']['type']."<BR/>"; echo "<img src=\"$path\" width=\"150\" height=\"150\">"; } else { echo "Error"; } } ?>
Can anyone help me so if they try to upload anything apart from the music files i mentioned, they get an error.
Thanks
Tom Bullock
-
Ohh ive got it
Thanks for your help
-
Can i put that code on the same page under the current script?
-
Hello
This is part of my script:
{ echo "online"; } else { echo "offline"; }
As you can see, there is the word 'online' and 'offline'.
How do i make the word 'online' green and the word 'offline' red?
Thanks
-
Haha, what a poor insult.
You tell me whats so hard about this:
$server = "000.000.000.000"; // IP Address Of Shoutcast Server. $port = "000"; // Shoutcast Port $online = "/images/online.gif"; // Online Image $offline = "/images/offline.gif"; // Offline Image
Maybe your the big idiot.
-
Well if you had a brain, thats what ive come to ask you.
Thats basically what i said wasn't it?
Cheers anyway.
^^^ I think that means ive found my answer.
Theres no need to cry bud
-
Can anyone help me change this script from images to text?
$server = "212.72.165.23"; // IP address to your shoutcast server. $port = "8681"; // port of your shoutcast server $online = "http://www.streamsolutions.co.uk/scripts/status_img/online.gif"; // Online Gif image $offline = "http://www.streamsolutions.co.uk//scripts/status_img/offline.gif"; // offline gif image
-
Thats basically what i said wasn't it?
Cheers anyway.
-
I dont know, the transfer from the i.p or something.
-
Right, what im looking for is a code that i can put into my site. When the Shoutcast server is broadcasting there is a bit of text saying Online in green and when the Shoutcast server isn't broadcasting there is a bit of text saying Offline in red.
-
With i script.
Ive seen it on many sites so i know it can be done.
-
Hello
Has anyone got a script that shows weather a shoutcast server is on or off.
Im looking for one that says 'Online' in green when on and 'Offline in red when its off.
Can anyone help?
Thanks
-
How I do is with a form that posts to an external file, then the file routes you to different files depending on whether it was a successful submission.
Here's my form code. Put something like this on your form page, looks like you have it up there. Your action should be the other file example: action="feedback.php"
<form name="form" method="post" action="feedback.php"> <p class="bodymd">Your Name<br> <input type="text" name="name"> </p> <p class="bodymd">Your Bands Name<br> <input type="text" name="bname"> </p> <p class="bodymd">Your Email (for us to get back to you)<br> <input type="text" name="email"> </p> <p class="bodymd">Additional Stuff To Add?<br> <textarea name="comments" rows="5" cols="40"></textarea> </p> <p class="bodymd"> <input type="submit" name="Submit" value="Submit" class="mainoption"> <input type="reset" name="Reset" value="Clear Form" class="liteoption"> </p> </form>
Now the external file:
<?php // ------------- CONFIGURABLE SECTION ------------------------ // $mailto - set to the email address you want the form // sent to, eg //$mailto = "youremailaddress@example.com" ; $mailto = 'admin@metalhead.tc' ; // $subject - set to the Subject line of the email, eg //$subject = "Feedback Form" ; $subject = "Band Forum Request" ; // the pages to be displayed, eg //$formurl = "http://www.example.com/feedback.html" ; //$errorurl = "http://www.example.com/error.html" ; //$thankyouurl = "http://www.example.com/thankyou.html" ; $formurl = "http://www.metalhead.tc/heavy-metal-bands-forum.php" ; $errorurl = "http://www.metalhead.tc/contact-error.php" ; $thankyouurl = "http://www.metalhead.tc/contact-thanks.php" ; $uself = 0; // -------------------- END OF CONFIGURABLE SECTION --------------- $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $name = $_POST['name'] ; $bname = $_POST['bname'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } if (empty($name) || empty($email) || empty($bname)) { header( "Location: $errorurl" ); exit ; } if ( ereg( "[\r\n]", $name ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } // composing the message to be sent to you $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "Your Name: $name\n" . "Bands Name: $bname\n" . "Email: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; mail($mailto, $subject, $messageproper, "From: \"$name\" <$email>" . $headersep . "Reply-To: \"$name\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.08" ); header( "Location: $thankyouurl" ); exit ; ?>
You'll have to add variables to your feedback file depending on the fields in your form. Make sure your form is right first...
If i used this and added my fields to the form, would i have to add more script into the php script?
-
Hello
Im starting my own hosting company and i am offering my client to customize thier own packages.
I have this code, and i want all the information from it to go to my email.
<!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=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <form id="form1" name="Custom Quote Form" method="post" action=""> <u>Contact Information</u><br /> <br /> Name:<br /> <label> <input name="Name" type="text" size="20" /> </label> <br /> E-Mail:<br /> <label> <input name="E-Mail" type="text" size="20" /> </label> <br /> Address:<br /> <label> <input name="Address" type="text" size="20" /> </label> <br /> <label></label> Town:<br /> <label> <input name="Town" type="text" size="20" /> </label> <br /> County:<br /> <label> <input name="County" type="text" size="20" /> </label> <br /> Post Code:<br /> <label> <input name="Post Code" type="text" size="20" maxlength="6" /> </label> <br /> Country:<br /> <label> <input name="Country" type="text" size="20" /> </label> <p><u>Package Information<br /> <br /> </u>Webspace:<br /> <label> <input name="Webspace" type="text" size="15" /> </label> MB<br /> Transfer:<br /> <input name="Transfer" type="text" size="15" /> MB<br /> E-Mail Boxes:<br /> <input name="E-Mail Boxes" type="text" size="15" /> <br /> Sub-Domains:<br /> <input name="Sub-Domains" type="text" size="15" /> <br /> SQL Databases:<br /> <input name="SQL Databases" type="text" size="15" /> <br /> FTP Accounts:<br /> <input name="FTP Accounts" type="text" size="15" /> </p> <p> <label> <input type="submit" name="Submit" value="Submit" /> </label> </p> </form> <p> </p> </body> </html>
Can anyone tell me where to go from here?
Thankyou
Tom Bullock
-
Thank you very much
I really apreciate it
Thanks again
-
<?php $server = "127.0.0.1"; $port = "80"; $timeout = "10"; if ($server and $port and $timeout) { $verbinding = @fsockopen("$server", $port, $errno, $errstr, $timeout); } if($verbinding) { echo "<img src='./images/on.gif'>Website is online<br>"; } else { echo "<img src='./images/off.gif'>Website is offline<br>"; } fclose($verbinding); ?>
Yes that is exactly what im looking for except instead of having images to display the status, i need it to be text.
Many thanks
Tom Bullock
-
Yes, the same principal, but just a script where i can enter the i.p address and port number of my server into the script and when the server is online it says 'Online' in green and when it is offline is says 'Offline' in red.
Many thanks
Tom Bullock
PHP Include Problem
in PHP Coding Help
Posted
As a follow up to this, I tried to use the same code method on another site but the class="current" won't work.
Here is the code:
One thing I did notice is that before adding the inlcude to where the menu would go, the class was set to class="active". I did try changing the all the "current" in the code to "active" but with no joy?