Jump to content

Bricktop

Members
  • Posts

    677
  • Joined

  • Last visited

    Never

Everything posted by Bricktop

  1. Hi Steve, You're not closing the above code with a closing } bracket. Change your code to read: if ($extra["form_attachment"]) { $output .= " <label for='contact-attachment'>*Name:</label> <input type='text' id='contact-attachment' class='contact-input' name='name' tabindex='1001' /> <label for='contact-email'>Attachment:</label> <input type='text' id='contact-attachment' class='contact-input' name='attachment' tabindex='1002' />"; } Hope this helps.
  2. Hi web_master, Unfortunately, you cannot get a client machine's MAC address using PHP.
  3. Hi MDanz, Use the mysql_num_rows() function. For example: $result = mysql_query("select * from stacks where topicid=44"); $num_rows = mysql_num_rows($result); echo $num_rows; Hope this helps.
  4. Hi dose, Using the following will work: if(!empty($_GET['user'])) { if($_GET['user']=='kipu') { exit(); } else { // cache $user = str_replace(" ", "", strtolower($_GET['user'])); // remove spaces and lower } } Or, you could do it using: if(!empty($_GET['user'])) { // cache $user = str_replace(" ", "", strtolower($_GET['user'])); // remove spaces and lower if($user=='kipu') { exit(); } } The first method performs the check on the username as it is fetched using the $_GET command, the second method performs the check once the username has been fetched and has been stored into the $user variable. Hope this helps.
  5. Hi Jamie, I'm sure it's possible but beyond my scope of knowledge as it will need to be a relatively complex Javascript/AJAX call - because Javascript runs on the client and PHP runs on the server, and neither have direct access to each other. I would recommend you post your code in the AJAX help forum and hopefully one of the experts there will give you an answer. Thanks
  6. Hi herghost, Assign a $message variable and then create a new $body variable with the required variables combined. For example: $from = $_GET['email']; $to = "Contact <contact@stockluck.com.au>"; $subject = $_GET['subject']; $message = $_GET['message']; $name = $_GET['name']; $body = "$name\n\n$message\n\n"; Hope this helps.
  7. No problem, if I'm ever in Wales I'll look you up - you can buy me a beer Cheers.
  8. Hi Jamie, Just noticed you are using name= and not value= on your option boxes. Change the relevant code to read: echo"<option value='$ip'>$site</option> "; Otherwise the code I posted won't work.
  9. Hi Jamie, I got your PM - sorry for the delay OK, a simple bit of javascript should do what you need. Add the following to the HTML of the page your PHP code runs from: <script type="text/javascript"> function showSelected(val){ document.getElementById ('selectedResult').innerHTML = "The IP address is - " + val; } </script> Now, amend your PHP code to read: <?php require("confwifi.php"); $ip_form = $_POST['ip']; $extract = mysql_query ("SELECT * FROM site"); $numrows = mysql_num_rows ($extract); echo"Select CAMPUS: <select name='ip' onChange='showSelected(this.value)'>"; while ($row = mysql_fetch_assoc($extract)) { $id = $row['id']; $site = $row['site']; $ip = $row['ip']; echo"<option name='$ip'>$site</option> "; } echo "</select>"; echo "<div id='selectedResult'></div>"; ?> <?php echo "$variable"; ?> The above code will display the IP address when a user selects an option from the dropdown box. Hope this helps.
  10. Hi krystof78, You could the file extenstion like so, using PHP's explode() function: //Create an array of allowed filetypes, add additional filetypes as required, separated by a comma $allow = array("mp3"); //Explode the filename and grab the extension $extension = end(explode('.', $_FILES['uploadedfile']['name'])); //Check to see if the $extension is present in the $allow array, and if not proceed with the error message if (!in_array($extension, $allow)){ if($flag == 0){ $error = "The file you are trying to upload does not contain expected data. Are you sure that the file is an MP3?"; } } Hope this helps.
  11. Hi Razorster, Just to clarify. Do you want $promoimage to always output the same image. Or does it need to output a separate image for every day of the week. Or does it need to output a particular image on a particular date?
  12. Hi Razorster, You're trying to output $promoimage using the following code: echo "<span class='event'><img src='". $promoimage ."'></span>"; What does $promoimage contain? It should contain something like: "images/image.jpg" For your code to work. Hope this helps.
  13. Hi Jnerocorp, Are you receiving an error message? Does the database get populated with the POSTed data? There are two things which obviously stand out in your code: 1. You're not validating or sanitising any of the POSTed data, have a look at Daniel's excellent security tutorial for more information on this. At the very least you need to be using PHP's mysql_real_escape_string() function. 2. Once the data gets put into the database, you have no redirect of any sorts occuring, and no "Success" message. You need to set something up to occur after the data is successfully written to the database. Hope this helps.
  14. Hi krystof78, You've answered your own question. The Type: is audio/mpg but you're only checking for audio/x-mp3 and audio/mpeg. Also, the line which performs this check is doing an AND not an OR. A filename cannot be both types, it can be either one or the other. Amend your code to read: if($mimetype != "audio/x-mp3" OR $mimetype != "audio/mpeg" OR $mimetype != "audio/mpg"){ Hope this helps.
  15. Hi confuzzled, CHange: $num=mysql_num_rows($record); to: $num=mysql_num_rows($result); Hope this helps.
  16. Hi techker, The following should do what you need: $status = (empty($row['status']) ? "active": "not active"; echo $status; Simply replace the "active" and "not active" text with HTML image markup to show an image, e.g.: <img src=\"images/image.jpg\" alt=\"Some Image\" /> The above assumes $row['status'] is the correct format for your query and table, and that you are using 0 and 1 to define active or not active. Hope this helps.
  17. Hi perficut, Change the relevant code to read: echo '<a href="propertyinfo.php">'.$row['Business_Name'].'</a>'; Hope this helps.
  18. Hi contra10, Use urlencode() to do this.
  19. Hi iPixel, You will need to declare the $sql_inject_ext variable as Global, for example: global $sql_inject_ext; Hope this helps.
  20. Hi Jamie, Stick the second conversion into a variable and try again. Change your code to read: $tomorrow = mktime(0,0,0,date("m"),date("d")+5,date("Y")); $tomorrow = date("d/m/Y", $tomorrow); echo "These Passwords are valid until the ".$tomorrow; ini_set("SMTP", "e2k3vs01.internal.uwic.ac.uk"); $to = "jhancock@uwic.ac.uk"; $subject = "WiFi Password"; $headers ="From: WiFi@uwic.ac.uk"; $body = "The new WiFi password for the Conferences SSID is: $string1\n\nThe new WiFi password for the Guest SSID is: $string2\n\n$tomorrow "; mail($to, $subject, $body, $headers); die(); Hope this helps.
  21. Ignore that, the extra " is needed. Doh!
  22. Hi newtomysql, The problem is with the following line: if($Submit){ It's basically saying if $Submit is set, perform the code below, but nowhere is the $Submit variable defined. Even if it was, checking for a $_POST request using this method isn't as effective as using the $_SERVER as some browsers don't process it properly. Change it to read: if($_SERVER['REQUEST_METHOD']=='POST'){ Hope this helps.
  23. Hi postbil.com, I've added a simple if statement to your code to check the filetype being uploaded. If it's .JPG or .GIF the script will continue. If not, it will echo an error message. <?php if ($_FILES['minfil']) //Har brugeren forsøgt at uploade noget? { //Perform a check to see which filetype has been uploaded. If it's a .JPG or a .GIF continue. if( $_FILES["minfil"]["type"] == "image/pjpeg" || $_FILES["minfil"]["type"] == "image/jpeg" || $_FILES["minfil"]["type"] == "image/gif" ) { //Bestem hvor filen skal smides hen og og hvad den skal hedde $destination = "Image/" . $_FILES['minfil']['name']; //Forsøg at flyttede den uploadede fil har dens midlertidige destination til den nye if (move_uploaded_file($_FILES['minfil']['tmp_name'], $destination)) { echo "Filen" . $_FILES['minfil']['name'] . " blevet uploadet"; } else { echo "Der er sket en fejl"; } } //If the filetype being uploaded is not a .JPG or a .GIF then echo the error below. else { echo "Please upload a valid filetype. Valid filetypes are .JPG and .GIF"; } } ?> <form action="eks3.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="100000"> Vælg fil: <input name="minfil" type="file"> <input type="submit" value="Upload fil"> </form> Hope this helps.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.