Jump to content

mattal999

Members
  • Posts

    692
  • Joined

  • Last visited

Everything posted by mattal999

  1. it the download.php in a folder and then the userdownloads/myfile in a folder called userdownloads in that folder... ??? confusing, let me re-phrase - download.php - userdownloads (folder) - myfile.csv that is the directory tree. try it with those 3 files unchanged
  2. I have a record in a database which contains 'The Enter Key' (moving down a line) in it a couple of times. when i fetch it and echo it on a page, it is like it has changed them for spaces... can anyone give me code to re-HTML it? Thanks
  3. $get = "INSERT INTO trips (id, username, tripname, date, story) VALUES (NULL, " . $username . ", " . $tripname . ", " . $date . ", " . $story . ")"; mysql_query($get); it doesn't work...
  4. omfg my internet laggin like mad! my pages wont even load!!! can you tell me if the errors go now?
  5. alright try register now with ../hi in the username, it wont work
  6. hi, i dont quite understand what the problem is now... can you please rephrase it?...
  7. <?php // path to remote file $remotefile = '/path/to/the/file/i/want/to/download/my_file.cfg'; $localfile = 'mylocalfile.txt'; // open some file to write to $handle = fopen($localfile, 'w'); // set up basic connection $connid = ftp_connect($ftpserver); // login with username and password $loginresult = ftp_login($connid, $ftpusername, $ftpuserpass); // try to download $remotefile and save it to $handle if (ftp_fget($connid, $handle, $remotefile, FTP_ASCII, 0)) { echo "successfully written to $localfile\n"; } else { echo "There was a problem while downloading $remotefile to $localfile\n"; } // close the connection and the file handler ftp_close($connid); fclose($handle); ?> try that
  8. im not quite sure whats heppened there but it looks like the one on http://www.php.net/ftp_fget will work. try copying that code and edit it to your variables
  9. <select name="status" class="db_list_text"> <option value="All" <?php if(isset($_POST['status']) && $_POST['status'] == "All") { echo "selected"; } ?>>All</option> <option value="True" <?php if(isset($_POST['status']) && $_POST['status'] == "True") { echo "selected"; } ?>>Active</option> <option value="False" <?php if(isset($_POST['status']) && $_POST['status'] == "False") { echo "selected"; } ?>>Inactive</option> </select> try that
  10. never mind, i sorted it: $content = $get3[content]; $content2 = substr($content, 0, 100); lol that returns the first 100 characters
  11. Hi, I remember there was a topic here before but i couldn't find it about this... anyways, how can i make some text that i have shortened to 50 characters, add a ... at the end and then a read more link? cheers
  12. hi, how would i make it so that the $file variable is not allowed to have ../ or ./ in it? <?php error_reporting(0); session_start(); $user = $_SESSION['userName']; $file = $_POST['file']; $CurDir = dirname(__FILE__); if($_POST['folder'] != '') { $user = $user . '/' . $_POST['folder']; } else { $user = $user; } $NewDir = "$CurDir/$user"; $filepath = $NewDir."/".$file; if (!file_exists($NewDir) && !is_dir($NewDir) ) mkdir($NewDir, 0755); if( is_dir($NewDir) ) { if (is_writable($NewDir)) { if($_POST['folder'] != '') { $folder = $_POST['folder']; } else { $folder = ''; } if (!$handle = fopen($filepath, 'x+')) { echo "<center><font face='verdana' size='2'>The file $file already exists, edit it <a href='writenew.php?file=" . $folder . "" . $file . "' style='border-bottom: dotted #000000 1px; text-decoration: none;'><font color='000000'>here</a>"; exit; } echo "<center><font face='verdana' size='2'>Success, made a new file $file, edit it <a href='writenew.php?file=" . $folder . "" . $file . "' style='border-bottom: dotted #000000 1px; text-decoration: none;'><font color='000000'>here</a>"; fclose($handle); } else { echo "<center><font face='verdana' size='2'>The file $file could not be made"; } } ?> thanks
  13. how could you edit this script to make it so it would only let the users folder be edited, and nowhere else? <?php error_reporting(0); session_start(); $user = $_SESSION['userName']; $file = $_POST['file']; $CurDir = dirname(__FILE__); if($_POST['folder'] != '') { $user = $user . '/' . $_POST['folder']; } else { $user = $user; } $NewDir = "$CurDir/$user"; $filepath = $NewDir."/".$file; if (!file_exists($NewDir) && !is_dir($NewDir) ) mkdir($NewDir, 0755); if( is_dir($NewDir) ) { if (is_writable($NewDir)) { if($_POST['folder'] != '') { $folder = $_POST['folder']; } else { $folder = ''; } if (!$handle = fopen($filepath, 'x+')) { echo "<center><font face='verdana' size='2'>The file $file already exists, edit it <a href='writenew.php?file=" . $folder . "" . $file . "' style='border-bottom: dotted #000000 1px; text-decoration: none;'><font color='000000'>here</a>"; exit; } echo "<center><font face='verdana' size='2'>Success, made a new file $file, edit it <a href='writenew.php?file=" . $folder . "" . $file . "' style='border-bottom: dotted #000000 1px; text-decoration: none;'><font color='000000'>here</a>"; fclose($handle); } else { echo "<center><font face='verdana' size='2'>The file $file could not be made"; } } ?> thanks
  14. yea, those last 4 errors could be the biggest problem, people defacing my site... alrite ill update and tell u when to try again.
  15. <form action="<?php echo $_SERVER[php_SELF] ?>" method="POST"> um incorrect syntax?... <form action="<?php echo $_SERVER[php_SELF]; ?>" method="POST"> u needed a semi-colon... try it
  16. well, looking at the source code of your page: Define (BANNER, "images/top.jpg"); <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Home Page</title> <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link rel="stylesheet" href="stylesheets/CMS.css" type="text/css"> </head> <body> <div id="PageTitle"> <img src="BANNER" alt="Banner"> //defaults.inc </div> <div id="menu"> <ul id="tabnav"> <li>Home</li> <li><a href="page2.php">Page 2</a></li> </ul> </div> <div ID="w3c"> <IMG src="images/w3c.gif" alt=""><br><IMG src="images/css.gif" alt=""> </div> <div id="PageContent"> <p>This is sample page 3</p> </div> </body> </html> are you using <?php Define (BANNER, "images/top.jpg"); ?> // or just missing out the <?php and ?>
  17. right, can you post the FULL code so we can fully analyse the script...?
  18. Hi, Can you BETA test the site: http://www.games4uonline.com/sites/ please? and Please Dont Waste Bandwidth... Thanks
  19. do you have session_start(); on both pages?
  20. so make it all 1 script: <?php ///my flash variables $_POST["repsName"] . $_POST["clientsName"]. $_POST["clientsPhone"]. $_POST["clientsUrl"]. $_POST["shortDescroption"]. $_POST["longDescription"]; $folder = "./files/".$_POST["clientsName"]."/"; if(!is_dir($folder)) mkdir($folder, 0755); $mode = file_exists($folder.'user_input.txt')?'a':'w'; // append if file exists otherwise create it $fp = fopen($folder.'user_input.txt',$mode); // open file foreach($_POST as $K => $V) { fwrite($fp,"$K = $V\r\n"); // dump the contents of the $_POST array to the file } fclose($fp); //create the directory if doesn't exists (should have write permissons) //move the uploaded file move_uploaded_file($_FILES['Filedata']['tmp_name'], $folder); chmod($folder."".$_FILES['Filedata']['name'], 0777); ?> i havent tested it (duh) but i think it should work...
  21. im sorry, i dont quite understand, what exactly is the problem here?
  22. pretty sure: <?php $page = $_GET['page']; $query = $_POST['query']; $targetb = $_POST['menuFilesDMA']; $targetb = str_replace(' ','_', $targetb); mysql_connect("localhost","xxx","xxx"); mysql_select_db("real") or die("Unable to select database"); // check to see if $page is set if (!$page) { $page = 1; } // Change $query to a request super global after the first page. if($page > 1){ $query = $_GET['query']; } //set up some limits $limit = $page * 5; $limit = $limit - 5; //get the count from the database table $targetb = mysql_real_escape_string($targetb); $type = mysql_real_escape_string($_POST['Type']); $keywords = preg_split("/[\s,]+/", trim($_POST['keyword'])); $keys = ""; foreach($keywords as $K) { $keys .= "AND (Abstract LIKE '%$K%' OR town LIKE '%$K%')"; } $sql_num = "SELECT * FROM jobs WHERE (country='$targetb' OR continent='$targetb') AND (type='$type' OR alltype='$type') $keys"; $result = mysql_query($sql_num)or die(mysql_error()); $num = mysql_num_rows($result); // query your database for the final results $sql_results = "SELECT * FROM jobs WHERE (country='$targetb' OR continent='$targetb') AND (type='$type' OR alltype='$type') $keys ORDER BY id DESC LIMIT $limit,5"; $resulta = mysql_query($sql_results)or die(mysql_error()); if($num < 5){ $through = $num; } else { $through = $limit + 5; } if ($through > $num){ $through = $total; } if($page > 1){ $from = $limit +1; } else { $from = $limit; } if($from == 0){ $from = $from +1; } echo "<p align=\"center\">"; if ($page > 1) { echo "<a href=\"$PHP_SELF?query=$query&page=".($page -1)."\">Previous</a> "; } if (($num > 5) && (($limit + 5) < $num)) { echo "<a href=\"$PHP_SELF?query=$query&page=".($page +1)."\">Next</a>"; } // Build the list from the $sql query above and display results while($row = mysql_fetch_array($resulta)) { $Country = $row['country']; $Type = $row['type']; $More = $row['id']; $Title = $row['Title']; $Abs = $row['Abstract']; $Auth = $row['town']; echo "<p align=\"left\"><table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td width=\"14\" height=\"28\" background=\"line_left_corner_top.png\"> </td> <td height=\"28\" colspan=\"4\" background=\"line_top.png\"> </td> <td height=\"28\" background=\"line_right_corner_top.png\"> </td> </tr> <tr> <td width=\"14\" rowspan=\"3\" background=\"line_left.png\"> </td> <td width=\"250\" height=\"21\"><span class=\"style42\">$Title</span></td> <td width=\"154\" height=\"21\"> </td> <td width=\"14\"> </td> <td width=\"128\" height=\"128\" rowspan=\"3\"><img src=\"/searchthumbs/$Country$Type.png\" width=\"128\" height=\"128\" /></td> <td width=\"14\" rowspan=\"3\" background=\"line_right.png\"> </td> </tr> <tr> <td height=\"86\" colspan=\"2\"><span class=\"style41\">$Abs</span></td> <td width=\"14\"> </td> </tr> <tr> <td width=\"250\" height=\"19\"><span class=\"style43\">$Auth</span></td> <td width=\"154\" height=\"19\" align=\"left\" valign=\"bottom\"><span class=\"style39\">>></span> <span class=\"style40\"><a href=more2.php?id=$More>Read More</a> </span> <span class=\"style39\">>></span></td> <td width=\"14\"> </td> </tr> <tr> <td width=\"14\" height=\"19\" background=\"line_left_corner.png\"> </td> <td height=\"28\" colspan=\"4\" background=\"line_base.png\"> </td> <td width=\"14\" height=\"19\" background=\"line_right_corner.png\"> </td> </tr> <tr> <td width=\"14\" height=\"19\"> </td> <td height=\"21\" colspan=\"4\"> </td> <td width=\"14\" height=\"19\"> </td> </tr> </table><p align=\"center\">"; } if ($page > 1) { echo "<a href=\"$PHP_SELF?query=$query&page=".($page -1)."\">Previous</a> "; } if (($num > 5) && (($limit + 5) < $num)) { echo "<a href=\"$PHP_SELF?query=$query&page=".($page +1)."\">Next</a>"; } ?> should work, try it.
×
×
  • 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.