Jump to content

Hughesy1986

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by Hughesy1986

  1. If I was to create something like this I would use CURL to post the data that was posted to the first form. http://php.net/manual/en/book.curl.php
  2. For all those that get this error aswell, I needed to add wordwrap to the content to make sure that there where no lines over 1000 long. Glen
  3. Hiya guys, Have just developed a new mass mailing system for a client, they are getting some emails sent back to them saying that this error has occured: returning message to sender 500 Line too long I've googled this and found some information on it relating to a certain amount of characters have been passed in one line, and this is something to stop hacking attempts. What command can I use on the code to stop this? The content contains HTML and CSS. Hope someone can help me on this! Thanks alot! Glen
  4. Hi Guys, I am making a zip file site for making and unzipping files. I have coded the ZIP parts no problem but I cannot find any information in using TGZ and TAR files. Does anyone know how I would go about this within PHP? Glen
  5. It should be making a error as $timeout = $currentTime - timeoutSeconds; Should be $timeout = $currentTime - $timeoutSeconds; Other then that the code looks ok, I have made a whos online script before and what people where saying above about sessions etc is not needed, and the methods you are using are fine.
  6. Sorry please ignore this i solved it all it was i wasnt declaring the value in the function.
  7. Hi Guys, I am writing a ajax application which gets the user info from hover on the user image, now i have it all working except for the value being sent from the onmouseover, i am new to ajax so please be gentle LOL. Heres the code. <script type="text/javascript"> function getuser(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 3) { player.innerHTML = "<img src='loading.gif'/>"; } if(ajaxRequest.readyState == 4){ var player = document.getElementById('player'); player.innerHTML = ajaxRequest.responseText; } } var member_id = document.getElementById('member').value; var queryString = "?id=9"; ajaxRequest.open("GET", "roster.php" + queryString, true); ajaxRequest.send(null); } </script> <?php /* **Roster processor */ /** SECURITY MOD **/ //(!defined('IN_SCRIPT') ? exit(0) : null); //*****// include("config.php"); if (!$_GET['id']) { $result = mysql_query("SELECT * FROM members ORDER BY rand()") or die (mysql_error()); $total = mysql_num_rows($result); $lim = 8; $i = 0; while ($i < $total and $i < $lim) { $username = mysql_result($result, $i, 'username'); $member_id = mysql_result($result, $i, 'id'); $avatar = mysql_result($result, $i, 'avatar_link'); if (!$avatar || empty($avatar)) { $avatar = "images/roster_image.jpg"; } ?> <img src="<?php echo $avatar; ?>" alt="<?php echo $username; ?>" id="member" width="48" height="53" onMouseOver="getuser('<?php echo $member_id; ?>')" value="<?php echo $member_id; ?>"/>&nbsp <?php $i++; } } if ($_GET['id']) { $id = clean($_GET['id']); if (!$id || empty($id)) { echo "Error with the id"; }else{ $result = mysql_query("SELECT * FROM members WHERE id = '$id'") or die (mysql_error()); $row = @mysql_fetch_array($result); if (!$row) { echo "cannot find member"; }else{ $username = $row['username']; $location = $row['location']; $game = $row['game']; // get the users flag if ($location == "dontknow") { $flag = "uploads/flags/unknown.gif"; } if ($location == "usa") { $flag = "uploads/flags/um.gif"; } if ($location == "argentina") { $flag = "uploads/flags/ar.gif"; } if ($location == "australia") { $flag = "uploads/flags/au.gif"; } if ($location == "belgium") { $flag = "uploads/flags/be.gif"; } if ($location == "brazil") { $flag = "uploads/flags/br.gif"; } if ($location == "canada") { $flag = "uploads/flags/ca.gif"; } if ($location == "china") { $flag = "uploads/flags/cn.gif"; } if ($location == "croatia") { $flag = "uploads/flags/cr.gif"; } if ($location == "czech_republic") { $flag = "uploads/flags/cz.gif"; } if ($location == "denmark") { $flag = "uploads/flags/dk.gif"; } if ($location == "england") { $flag = "uploads/flags/england.gif"; } if ($location == "france") { $flag = "uploads/flags/fr.gif"; } if ($location == "finland") { $flag = "uploads/flags/fi.gif"; } if ($location == "germany") { $flag = "uploads/flags/de.gif"; } if ($location == "greece") { $flag = "uploads/flags/gr.gif"; } if ($location == "india") { $flag = "uploads/flags/in.gif"; } if ($location == "iran") { $flag = "uploads/flags/ir.gif"; } if ($location == "iraq") { $flag = "uploads/flags/iq.gif"; } if ($location == "ireland") { $flag = "uploads/flags/ie.gif"; } if ($location == "israel") { $flag = "uploads/flags/il.gif"; } if ($location == "italy") { $flag = "uploads/flags/it.gif"; } if ($location == "jamaica") { $flag = "uploads/flags/jm.gif"; } if ($location == "japan") { $flag = "uploads/flags/jp.gif"; } if ($location == "mexico") { $flag = "uploads/flags/mx.gif"; } if ($location == "netherlands") { $flag = "uploads/flags/nl.gif"; } if ($location == "newzealand") { $flag = "uploads/flags/nz.gif"; } if ($location == "northkorea") { $flag = "uploads/flags/nc.gif"; } if ($location == "norway") { $flag = "uploads/flags/no.gif"; } if ($location == "pakistan") { $flag = "uploads/flags/pk.gif"; } if ($location == "poland") { $flag = "uploads/flags/pl.gif"; } if ($location == "portugal") { $flag = "uploads/flags/pt.gif"; } if ($location == "romania") { $flag = "uploads/flags/ro.gif"; } if ($location == "russia") { $flag = "uploads/flags/ru.gif"; } if ($location == "southafrica") { $flag = "uploads/flags/sa.gif"; } if ($location == "spain") { $flag = "uploads/flags/sn.gif"; } if ($location == "sweden") { $flag = "uploads/flags/se.gif"; } if ($location == "switzerland") { $flag = "uploads/flags/ch.gif"; } if ($location == "turkey") { $flag = "uploads/flags/tr.gif"; } if ($location == "uk") { $flag = "uploads/flags/england.gif"; } if ($location == "wales") { $flag = "uploads/flags/wales.gif"; } ?> <img src="<?php echo $flag; ?>" alt="<?php echo $location; ?>" /> <?php echo ucfirst($username); ?> "<span style="color:#03A7FF; text-decoration:underline;"><?php echo $game; ?></span>" <?php } } } ?> <div id="player"> Click a player to get information </div>
  8. Hi, I am trying to get started on making a script to query some exteranl sites, like google page rank, alexa rank, yahoo indexed pages etc. How would I go about doing this actually querying the sites and what urls do I need to goto to do this. Thanks
  9. Couldnt edit the post ??? Anyway heres the login information Username: huggy1 Password: 123456
  10. Hi Guys, I have just completed a cms for a client which he is going to be giving to clans he sponsors. Can some of you eagle eyed and skilled programmers cast your eye over the site, and let me know any problems, bugs, security lapses? Thanks Alot Glen Link: http://www.hughesy1986.com/team21/
  11. Hi guys, I am developing a cms for a clan web site. I am having trouble getting the video to load. I am using the object tags to load the video. Here is the script. /* Clan CMS Team221 v1.0 Member System Control Panel */ // print the menu ?> <a href="index.php?page=media&action=add">Add new media file</a> | <a href="index.php?page=media">View all media</a> <?php // set the action $action = addslashes(strip_tags($_GET['action'])); // now we make the form to add if ($action == "add" and !$_POST['add']) { // check the login include("inc/login_check.php"); ?> <h1>Add new media file</h1> <form action="" name="add" method="post"> <p>Media Title: <input type="text" name="title" class="form"/></p> <p>Media Link: <input type="text" name="link" class="form"/></p> <p>Category: <select name="category" class="form"> <option name="General">General</option> <option name="Clan">Clan</option> <option name="Random">Random</option> </select></p> <p>Comments:<br /> <textarea name="comments" rows="10" cols="50%" class="form"></textarea> </p> <p><input type="submit" name="add" value="Add new media file" class="form"/></p></form> <?php } if ($_POST['add']) { $title = addslashes(strip_tags($_POST['title'])); $link = addslashes(strip_tags($_POST['link'])); $category = addslashes(strip_tags($_POST['category'])); $comments = addslashes(strip_tags($_POST['comments'])); // defaults $added = date("D d, M H:s"); // error check if (!$title || !$link || !$category) { echo "<div class='error'>Please make sure all fields are complete</div>"; }else{ $query = "INSERT INTO media (comments, title, approved, link, added, category, author) VALUES ('$comments', '$title', '1', '$link', '$added', '$category', '$cms_logged')"; mysql_query($query) or die (mysql_error()); echo "<div class='error'>New media $title has been added, you will need to wait for a site admin to approve the media file, once this is complete your new file will be shown on the media page</div>"; echo "<meta http-equiv='refresh' content='4; url=index.php?page=media'>"; } } if (!$action) { $query = "SELECT * FROM media WHERE approved = '2' ORDER BY added DESC"; $result = mysql_query($query) or die (mysql_error()); $total = @mysql_num_rows($result); // error check if ($total == 0) { echo "<div class='error'>No media has been added yet</div>"; }else{ $i = 0; while($i < $total) { $title = mysql_result($result, $i, 'title'); $added = mysql_result($result, $i, 'added'); $link = mysql_result($result, $i, 'link'); $id = mysql_result($result, $i, 'id'); $category = mysql_result($result, $i, 'category'); $author = mysql_result($result, $i, 'author'); ?> <div class="media_view"> <a href="index.php?page=media&action=show&id=<?php echo $id; ?>">View <?php echo $title; ?></a> Added on <strong><?php echo $added; ?></strong> by <strong><?php echo $author; ?></strong><br /> </div> <?php $i++; } } } // get the show action if ($action == "show") { $id = addslashes(strip_tags($_GET['id'])); // error check if (!$id) { echo "<div class='error'>Error in the ID Field</div>"; echo "<meta http-equiv='refresh' content='2; url=index.php?page=media'>"; }else{ $query = "SELECT * FROM media WHERE id = '$id'"; $result = mysql_query($query) or die (mysql_error()); $row = @mysql_fetch_array($result); if (!$row) { echo "<div class='error'>Error in the ID Field</div>"; echo "<meta http-equiv='refresh' content='2; url=index.php?page=media'>"; }else{ $title = $row['title']; $link = $row['link']; $id = $row['id']; $author = $row['author']; $category = $row['category']; $comments = $row['comments']; $added = $row['added']; ?> <div class="media_block"> <h1><?php echo $title; ?></h1> Added by <strong><?php echo $author; ?></strong> on <strong><?php echo $added; ?></strong><br /> <object width="425" height="350"><param name="movie" value="<?php echo $link; ?>"></param><param name="wmode" value="transparent"></param><embed src="<?php echo $link; ?>" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object><br /> Comments:<br /> <?php echo nl2br($comments); ?><br /> </div> <?php } } } // set the default ?> Heres the link http://www.hughesy1986.com/team21/index.php?page=media&action=show&id=3 Also I made a test page with just the video and it works striaght away. http://www.hughesy1986.com/team21/test Does anyone have any experience with this, any help will be greatly appreciated.
  12. How are you checking the login? Is it from a mysql table or is this built into the script. A real simple login would work like this. Login.php <?php session_start(); ?> <h1>Please Login</h1> <form action="" name="login" method="post"> <p>Username <input type="text" name="username"/></p> <p>Password <input type="password" name="password"/></p> <p><input type="submit" name="login" value="Login"/></p> </form> <?php $username = "username"; $password = "password"; if ($_POST['login']) { $user = addslashes(strip_tags($_POST['username'])); $pass = addslashes(strip_tags($_POST['password'])); // error check if (!$user || !$pass) { echo "Please make sure all fields are complete<br />"; }else{ if ($username == $user and $password == $pass) { $_SESSION['logged'] = $username; echo "Login complete thankyou.."; echo "<meta http-equiv='refresh' content='2; url=index.php'>"; }else{ echo "Wrong username or password<br />"; } } } ?> check.php <?php session_start(); $logged = $_SESSION['logged']; if (!$logged) { echo "<meta http-equiv='refresh' content='0; url=login.php'>"; exit; } ?> I havent tested this but it should work, you may need to edit your php.ini file to set register_globals = on If you need to do this, open a new text file place this in there register_globals = on save it as php.ini Glen
  13. You are making it complicated. Just use something like this you will need to adapt it to match yours. <?php if ($_POST['submit']) { // get the posts and check errors if (!$_POST['field'] || !$_POST['field1']) echo "The fields are empty"; }else{ // do the code } } ?>
  14. I added that into the css rules, and it still wont work. I have fixed some stuff but there is still a problem with the bg image on the right side. I really hate firefox lol
  15. Wow that is strange lol, I just run it and got the same result. If i take away the 0 before the number it works. Glen
  16. Hughesy1986

    FF error

    Hi Guys, Im coding this new template for a friend, I am still learning this new coding in tabless and css, I have a problem I can get the site to work and look fine in ie7, but in FF it looks very bad. I am very confused. I would really appreciate if anyone could help. Site: http://www.hughesy1986.com/ashley/ CSS: http://www.hughesy1986.com/ashley/style.css Many Thanks Glen
  17. Thye are most likely using a mysql database. Glen
  18. Have you got any code you can show us? Glen
  19. If you are just looking to remove the html then strip_tags is the best option as you can allow certain tags aswell. <?php $var = "<script type='text/javascript'>window.location(http://www.ebay.co.uk)</script><b>Hi</b>"; $var = strip_tags($var, '<b>'); echo $var; ?>
  20. Would be better to write a switch. Like: <?php $var = ""; // this is the value switch ($var) { case "1": require_once('queryrenewal/query1.php'); break; case"2": require_once('queryrenewal/query2.php'); break; case"3": require_once('queryrenewal/query3.php'); break; case "4": require_once('queryrenewal/query4.php'); break; case "5": require_once('queryrenewal/query5.php'); break; } ?>
  21. You should contat your web host on this and find out if they have the function setup. Glen
  22. I would just use this. It will strip html tags and slash out any sql injetions <?php function clean($var) { $var = addslashes(strip_tags($var)); return $var; } ?>
  23. Just use the @ before the querys. Like: $query = @mysql_query($query);
  24. As long as your saving the file name in the mysql, you could use a simple file check to see if its there, if it is show it otherwise dont. <?php $query = "SELECT * FROM video WHERE type = 'public'"; $result = mysql_query($query) or die (mysql_error()); $total = @mysql_num_rows($result); // error check if ($total == 0) { echo "None to show"; }else{ $file = "link to the folder they are in" . $row['file'] . ".fla"; if (file_exists($file)) { // show the flash file } } ?>
  25. Try this, I always escape from php when im ouputting alot of information. and then just echo the values. <?php $conn = mysql_connect("localhost","user","user") or die ( mysql_error() ); $db = mysql_select_db("ACCU") or die ( mysql_error() ); $search=$_POST["search"]; $result = mysql_query("SELECT * FROM phonelist"); $num = mysql_num_rows($result); if ($num == "0"){ echo "Please revise your search."; }else{ while($r=mysql_fetch_array($result)) { $phoneid=$r["idphonelist"]; $name=$r["name"]; $ext=$r["ext"]; $dept=$r["department"]; $cell=$r["cellphone"]; ?> <table width="515" border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF"> <tr> <td><table width="515" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="178"><?php echo $name; ?></td> <td width="40"><?php echo $ext; ?></td> <td width="212"><?php echo $dept; ?> </td> <td width="85"><?php echo $cell; ?></td> </tr> </table></td> </tr> </table> <?php } } ?>
×
×
  • 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.