Jump to content

Carterhost

Members
  • Posts

    60
  • Joined

  • Last visited

    Never

Everything posted by Carterhost

  1. Wouldn't it help if you echoed out the data? This <font size="2" class="cattext" color="0E0E0E"><b>Users Online</b></font></td> </tr> <tr> <td class="windowbg2" bgcolor="F6F6F6"><table width="98%" cellpadding="3" align="center"> <tr> <td valign="top" align="left"><font size="1"> <?php $host1="fdb1.awardspace.com"; $username1="**"; $password1="**"; $database1="**"; $conn = mysql_connect("$host1","$username1","$password1"); if (!$conn) die ("Could not connect MySQL"); mysql_select_db($database1,$conn) or die ("Could not open database"); $mysql2 = "SELECT * FROM forumusers ORDER BY id DESC LIMIT 1"; $result2=mysql_query($mysql2); $staff = array(); $members = array(); $num_staff = 0; $num_members = 0; $num_guests = 0; $num_hidden = 0; while($row = mysql_fetch_assoc($result2)){ $usertype = $row['usertype']; $username = $row['username'];//also assuming you have some field for the username $hidden = $row['hidden'];//and perhaps a separate field for their hidden status if($usertype == "staff" && $hidden != 0){//this may be a number representing staff rather than the text staff $staff[] = $username; $num_staff++ }elseif($usertype == "member" && $hidden != 1){ $members[] = $username; $num_members++; } //you get the picture } ?> </font></td> </tr> shows the "Users online", and then a row with nothing in it?
  2. You haven't got any <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=windows-1250"> <meta name="generator" content="PSPad editor, www.pspad.com"> <title></title> </head> before your <?PHP have you? That would case that. Also, Read this: http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
  3. Not sure if this will work, but try while instead of foreach.
  4. Try replacing this mysql_query("INSERT INTO tracking(id, username, date, ipaddress, filename, filetype, filesize) VALUES ('$id', '$_SESSION['username']', '$today', '$ip', '$filename', '$filetype', '$filesize')"); with this $username = $_SESSION['username']; mysql_query("INSERT INTO tracking(id, username, date, ipaddress, filename, filetype, filesize) VALUES ('$id', '$username', '$today', '$ip', '$filename', '$filetype', '$filesize')"); the single quote in your $_SESSION['username'] is breaking the SQL string I think.
  5. Oh, can you slect from the middle of a date field in SQL then?
  6. The design is gorgeous. Clean lines, good fonts. A couple of things: As s0c0 said, not too sure about the orange & green (!) but it's fairly low-key so it's not too stark! I'm sure the menus are about twice as wide as they need to be, I think the text size could be a medium between the green and orange menus and the same size for both?
  7. I think I have it, I'm going to break it down within the database: ID | START_DAY | START_MONTH | START_YEAR | END_DAY | END_MONTH | END_YEAR | COMMENTS Then I can select each busy block per month/year, and output the day as a class change on my calendar CSS. If noone can see any problems, I'll give it a go!
  8. What about using an Array? Instead of having player's names as variables: $john $steve $frank $jeff you would have: $player[1] $player[2] $player[3] $player[4] Disclaimer: it's quarter past midnight here, syntax may not be correct. Check the PHP man pages for array usage...
  9. I've been racking my brains over this one, searched t'interweb countless times, and keep coming up with things that are too complicated. I want to build a calendar display page, with dates "blocked out" to signify that i'm busy. I want to be able to select sate ranges that i'm busy, and to be able to delete blocks if my schedule frees up. What I can't figure out is the best database design for this. How would it be best to insert a date range into a database, and pull it out again? I was thinking along the lines of: ID START END For which each field contains a block of unavailable dates. If I want to display say, 3 months, how would I select just the date blocks within those months?
  10. [quote author=Nameless12 link=topic=123904.msg512983#msg512983 date=1169705705] There is a bug when you login and click logout it says "you have been successfully logged out but in the top right hand corner it says you are logged in until you refresh the page [/quote] Oh yeah...! Fixed.
  11. Okay, I'd like some experienced testing on my site. It's just an upload/management script for online file storage. [url=http://file-city.co.uk]http://file-city.co.uk[/url] Username: testone Password: test There is also a separate photo storage system where you can upload photos and make them public or private. If they're public then they appear in a public gallery at http://file-city.co.uk/username. If they're private, then only you can send the links to them out. I plan on implementing Zipfile unzipping, and maybe multiple photo uploads. Cheers!
  12. Nothing, really, apart from now I have to write a little script to modify my DB contents instead of just adding a few chars to an SQL statement. I was just curious as to whether there was an easier way!
  13. I've searched the oracle(Google) and come up with nothing, so I'm trying here: Can you use regex within a SQL statement? I have a table, with a column that contains a filename. Can I order an SQL statement by the extension of the filename (could be .jpg, or .jpeg) without storing the extension as a separate column? [code]SELECT * FROM files ORDER BY.....?[/code]
  14. Eek, Should have engaged brain first! Apologies.
  15. You could use include? [code] <?php include ("footer.php"); ?> [/code]
  16. That's a great idea. It never even crossed my mind. Thanks muchly!
  17. I have the following code to parse my web server log file and display results for specific files. I tried to run this the other day for a .gif that had over 5K hits, and ran into problems with memory_limit (i.e. the script had exceeded it) How would I get around this. Would it be a case for [b]ob_flush()[/b]? if so, Where? This is what I have so far: [code]<?php if (isset($_GET['file'])){$ss="/files/".$_GET['file'];} $pageid= "Log Access"; // Full path to access log file on server: $log="access_log"; // attempt to open the log file: $lines=file($log) or die("Cannot open logfile");    // page title: $pageTitle="Transfer.carterhost.co.uk/logs"; // total lines: $totalLines=count($lines); // will hold lines according to status field of log line: $all=$status_200=$status_404=$status_304=$status_other=array(); // will hold first and last times in log: $firstTime=$lastTime=""; // START MAIN EXECUTION ############### // Do the do: parseLog_status($lines); pageOpen(); doResults($all, $user); pageClose(); // END MAIN EXECUTION #################################### ///////////// // FUNCTIONS ///////////// #################################### /****************************************************** * Function Name : pageOpen * * Task : build the page * * Arguments : none * * Returns : none * ******************************************************/ function pageOpen() {     global $ss,$pageid,$all,$status_200,$status_404,$status_304,$status_other,             $totalLines,$firstTime,$lastTime,$pageTitle,$log; ?> <!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>     <title>       Access logs for       <?=$ss?>     </title>     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />     <meta name="keywords" content="transfer,online,storage,free,webspace,webhosting,web,hosting,upload" />     <meta name="description" content="Upload and Transfer files and photos, for free!" />     <meta name="author" content="rob.j.carter" />     <meta name="revisit-after" content="1 days" />     <link rel="stylesheet" type="text/css" href="http://transfer.carterhost.co.uk/style.css" /> <script type="text/javascript" language="javascript"> var newWindow = null; function closeWin(){ if (newWindow != null){ if(!newWindow.closed) newWindow.close(); } } function popUpWin(url, type, strWidth, strHeight){ closeWin(); if (type == "fullScreen"){ strWidth = screen.availWidth - 10; strHeight = screen.availHeight - 160; } var tools=""; if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,scrollbars=no,menubar=no,Width="+strWidth+",Height="+strHeight+",top=0,left=0"; if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0"; newWindow = window.open(url, 'newWin', tools); newWindow.focus(); } </script>   </head>   <body>     <p>       Reports for       <span class="good">         <b>           <?php echo($_SERVER['HTTP_HOST'].$ss) ?>       </span></b>     </p>     <!--<p>Access logfile: <?php //echo $log ?> </p>-->     <p>       Period:       <?php print("<b>$firstTime</b> to <b>$lastTime</b>") ?>     </p> <?php        print("<p>");     print("404 pages (page not found):        ".count($status_404)."<br>");     print("200 pages (successful request):    ".count($status_200)."<br>");     print("304 pages: (page not changed):     ".count($status_304)."<br>");     print("other pages:                       ".count($status_other)."<br>");     print("Lines in Log:                      ".count($all)."<br>");     print("</p>");     ?> <?php } // end func /****************************************************** * Function Name : parseLog_status($lines) * * Task : parse each logfile line into array depending on status * * Arguments : $lines - lines from logfile * * Returns : none * ******************************************************/ function parseLog_status($lines) {     global $ss,$all,$status_200,$status_404,$status_304,$status_other,$firstTime,$lastTime,$totalLines;     // inc counter - used to check if first or last item in logfile:     $count=0;     // parse each line:     foreach($lines as $line){         // trim spaces just in case:         $line=trim($line);         // split each line of log file at spaces - assumes log file fields are space delimited:         $fields=split(" ", $line);         // SERVER SPECIFIC:         // LAST FIELD IN $FIELDS IS PID, POP THIS OFF STACK:         array_pop($fields);         // and assign each field a readable name:         $host=$fields[0];         $ident=$fields[1];         $uname=$fields[2];         $dateLong=substr($fields[4],1,strlen($fields[4]));         // get time strings:         $tmp=split(":", $dateLong);         $date=array_shift($tmp);         $UKtime=join(":", $tmp);         $UKhr=($tmp[0])%24 ;         $UKhr=str_pad($UKhr, 2, "0", STR_PAD_LEFT);         $UKtime= $UKhr.":".$tmp[1].":".$tmp[2];         $dateOffset=substr($datelong, 0, 5);         $requestType=substr($fields[6], 1);         $requestURI=$fields[7];         $uaProtocol=substr($fields[8], 0, -1);         $status=$fields[9];         $bytes=$fields[10];         $referer=substr($fields[11], 1, -1);            $ua=implode(" ", array_slice($fields, 12));         // create array of fields for this line:         $result=array(                         $host,                         $ident,                         $uname,                         $date,                         $UKtime,                         $requestType,                         $requestURI,                         $uaProtocol,                                                    $bytes,                         $referer,                         $ua, $status         );         // Push $result onto an array depending on $status:             if (stristr($result[6], $ss) and !stristr($result[6], "log.php")){             if (!stristr($result[6], "images")){ switch($status){             case "200":                 array_push($status_200, $result);                 break;             case "304":                 array_push($status_304, $result);                 break;             case "404":                 array_push($status_404, $result);                 break;             default:                 array_push($status_other, $result);                 break;         } //push results into $all array array_push($all, $result); }}         // check if first or last line - if so get start/end time for period         switch($count){             case 0:                 // track first timestamp in log:                 $firstTime=$dateLong;                 break;             case $totalLines-1:                 // track last timestamp in log:                 $lastTime=$dateLong;         }         // increment counter:         $count++;     } } // end func /****************************************************** * Function Name : doResults($title, $results) * * Task : display a table of results/log lines * * Arguments : string $title - title of result table                 array $results - array of lines to show * * Returns : none * ******************************************************/ function doResults($results,$user) {     global $ss,$filter;         isset($filter)?"":$filter="All";     if(!empty($results)){         // print out results:     ?>     <br>     <table class="style3" border="1" cellpadding="2" cellspacing="1">     <tr>     <th> Remote IP </th>     <th> Usr </th>     <th> Date/Time </th>     <th> URI </th>     <th> Protocol </th>     <th> Bytes </th>     <th> Referrer </th>     <th> User Agent </th>     <th> Status </th> </tr>     <?php     foreach($results as $result) { ?> <tr>     <td><?php echo $result[1]; ?></td>     <td><?php echo $result[2]; ?></td>     <td><?php echo $result[3]."<br>(".$result[4].")"; ?></td>     <td><?php echo wordwrap($result[6], 35, "<br />\n",true); ?></td>     <td><?php echo $result[7]; ?></td>     <td><?php echo $result[8]; ?></td>     <td><a href="<?=$result[9]?>" target="_blank"><?php echo wordwrap($result[9], 35, "<br />\n",true); ?></a></td>     <td><?php echo $result[10]; ?></td>     <td><?php echo $result[11]; ?></td> </tr> <?php         }         print("</table>");     } else {         print("<p class='error'><b>There are no log entries for ".$ss."</b></p>");     } } // end func doResults($title, $results) /****************************************************** * Function Name : pageClose() * * Task : close page - ending html tags * * Arguments : none * * Returns : none * ******************************************************/ function pageClose() {       ?>       <p>         <a href="javascript: self.close();">Click here to close this window</a>       </p>   </body> </html> <?php } ?>[/code]
  18. [quote]I am with phpnet.us but this only has file upload limits of 2M and no php zip file commands work on it.[/quote] Have you looked in your Terms and Conditions? Can't you just run a local php.ini?
  19. Try Changing your SQL to: [code]$sql= "UPDATE stockdata ( location = '$location_name', valid = '$valid' WHERE  part_number= '$part_number'  "; [/code] That's the only thing I can suggest.
  20. What happens if you change it to: [code]if ($IMG_WIDTH <= 750) { [/code]
  21. Do you have a part_number field in your DB that has the value 0000 ? If not, maybe you should enter one manually?
  22. There's nowhere I can see that you passed the part_number variable across. Does it come from apage previous to this? if it does, you should put the [code] $part_number = $_GET['part_number'];[/code] before [code]$action = 'show_form'; [/code] and include [code]<input type="hidden" name="part_number" value="<?=$part_number?>" />[/code] in your form and [code]$part_number=$_POST['part_number'][/code] after [code]if($action== 'process_data')  { [/code]
  23. Yes, you could, but you really seem to want the variables passed in the URL...?
×
×
  • 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.