Jump to content

DeathStar

Members
  • Posts

    529
  • Joined

  • Last visited

    Never

Posts posted by DeathStar

  1. Hello I'm busy making an disk usage graph.

     

    I know how to do the Image generation, basicly i know how to do everything, just a complication with some calculations.

     

    Based on my knowledge:

    8 bits in a byte.

    1024 bytes in a kilobyte.

    1024 kilobytes in a megabyte.

    1024 megabytes in a gigabyte.

    1024 gigabytes in a terabyte.

     

    What would be the best formula to divide the units from eachother.

    I can display and work with the total amount of bytes that php displays.

    But i have a section where you can look at the mb, gb, tb.

     

    Any help ?

  2. It is Internet.

     

    And how do you want to display the calender?

    You can use a simple loop:

    
    while($data = mysql_fetch_array($query)){
    if ($data['blocked'] == TRUE){
    echo '<p class="red">' . $data['time'] . '</p>'; 
    } 
    else {
    echo '<p class="normall">' . $data['time'] . '</p>';  
    }
    }

     

    Or you could just edit that structure into a week and change the loop a bit:

    
    while($data = mysql_fetch_array($query)){
    echo '<tr><td>' . $data['time'] . '</td><td>' . $data['time2'] . '</td><td>' . $data['time3'] . '</td><td>' . $data['time4'] . '</td><td>' . $data['time5'] . '</td><td>' . $data['time6'] . '</td><td>' . $data['time7'] . '</td>'; 
    }

     

    Just put the if statements in.

  3. The header tags is used for things like captcha and things you do not want the users browser to save.

     

    The reason people do not use it on normal pages is so that the images and things get cached, and saves them valuable bandwidth.

     

    So it really isn't secure/non-secure if you ask me.

  4. Hello.

     

    Well it is vacation, meaning I have nothing to do.

    So I am offering to do work for free.

     

    I have 9 months of knowledge in PHP and MySQL.

     

    I will not work if it is just a simple script you need.

    I will not work if you have a 'PuNkY' attitude, I simply deal with people who know what they want.

     

    My Contact E-Mail address is mrhapl0v9.6@gmail.com.

    My MSN is narco-tic@hotmail.com, please just attach a message about this when sending invitation.

     

  5. Firstly, No one is a 'noob' they are simply beginners. :)

     

    for the counting you can do COUNT or num rows.

     

    Example of Count:

    $query = 'SELECT COUNT(row) FROM table_name WHERE cat=' . $cat;
    $do = mysql_query($query);
    echo $do['row'];
    // Output: 5

    Example of num rows:

    $query = 'SELECT row FROM table_name WHERE cat=' . $cat;
    $get_rows = mysql_num_rows($query);
    echo $get_rows;

     

    The IP based system could be bypassed, many people use proxies these days.

     

    Hope that helps.

  6. Well, I have been trying to make an ajax loading screen, I have it working, just not automatticly loading.

    I got it closing, Just need it to load.

    Here is the ajax(its from a tutorial, then edited):

    var LoadingScreen = {
    
    hide: function() {
    	var div = document.getElementById('loading_message');
    	if (div == null || div == '' || typeof(div) != 'object') { return false; }
    
    	document.body.removeChild(div);
    },
    
    moving_dots: function() {
    	var div = document.getElementById('loading_message');
    	if (div == null || div == '' || typeof(div) != 'object') { return false; }
    
    	var html = div.innerHTML;
    
    	// Add dot or start over?
    	var num_dots = html.split('.').length-1;
    	if (num_dots > 6) {
    		div.innerHTML = '<b>Please wait.</b><br />Loading';
    	} else {
    		div.innerHTML = html + '.';
    	}
    
    },
    
    
    set_position: function () {
    	var div = document.getElementById('loading_message');
    	if (div == null || div == '' || typeof(div) != 'object') { return false; }
    
    	var scrollTop = LoadingScreen.f_scrollTop();
    	var scrollLeft = LoadingScreen.f_scrollLeft();
    	var clientWidth = LoadingScreen.f_clientWidth();
    
    	// Calculate left position
    	var left = clientWidth - div.offsetWidth;
    	left = scrollLeft + left;
    
    	// Set position
    	div.style.position = 'absolute';
    	div.style.left = left + 'px';
    	div.style.top = scrollTop + 'px';
    },
    
    create_div: function () {
    	var div = document.createElement('DIV');
    	div.id = 'loading_message';
    
    	div.innerHTML = '<b>Please wait.</b><br />Loading';
    
    	var css = "border: 1px solid black;"
    	css += "font-size: 10px;"
    	css += "font-family: Tahoma;"
    	css += "width: 100px;";
    	css += "padding: 10px;";
    	css += "background-color: #FFFFFF;";
    	css += "color: black;";
    	css += "font-weight: none;";
    
    	div.style.cssText = css;
    
    	document.body.appendChild(div);
    
    	return div;
    },
    
    f_clientWidth: function () {
    	return this.f_filterResults (
    		window.innerWidth ? window.innerWidth : 0,
    		document.documentElement ? document.documentElement.clientWidth : 0,
    		document.body ? document.body.clientWidth : 0
    	);
    },
    
    f_scrollLeft: function () {
    	return this.f_filterResults (
    		window.pageXOffset ? window.pageXOffset : 0,
    		document.documentElement ? document.documentElement.scrollLeft : 0,
    		document.body ? document.body.scrollLeft : 0
    	);
    },
    
    f_scrollTop: function () {
    	return this.f_filterResults (
    		window.pageYOffset ? window.pageYOffset : 0,
    		document.documentElement ? document.documentElement.scrollTop : 0,
    		document.body ? document.body.scrollTop : 0
    	);
    },
    
    f_filterResults: function (n_win, n_docel, n_body) {
    	var n_result = n_win ? n_win : 0;
    	if (n_docel && (!n_result || (n_result > n_docel)))
    	n_result = n_docel;
    	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
    },
    
    addEventHandler: function (oTarget, sEventType, fnHandler) {
    	if (oTarget.addEventListener) {
    		oTarget.addEventListener(sEventType, fnHandler, false);
    	} else if (oTarget.attachEvent) {
    		oTarget.attachEvent("on" + sEventType, fnHandler);
    	} else {
    		oTarget["on" + sEventType] = fnHandler;
    	} 
    }
    
    }
    function load_show(){
    	// Create Loading div
    	LoadingScreen.create_div();
    
    	// Set initial position				
    	LoadingScreen.set_position();
    
    	// Attach event handler to onScroll to keep in position
    	LoadingScreen.addEventHandler(window, 'scroll', LoadingScreen.set_position);
    
    	// Start the moving dots
    	setInterval(LoadingScreen.moving_dots, 500);
    }

     

    To start I use the load_show() function.

    To hide, LoadingScreen.hide()

  7. Hello there,

     

    I am currently busy making an shoutbox.

    But here is my problem.

    I have the whole system working great, put in bccodes etc.

     

    But I am now adding an future that you will be able to delete the shout/post.

    Here is how it must work:

    Search for a string within the text file, then remove the line that the string is in and and put back the other contents.

    The text files contents is formatted like this:

    1:Name:%3Cb%3EWelcome to your shoutbox!%3Cb%3E
    2:Name:%3Cb%3EWelcome to your shoutbox2!%3Cb%3E
    

     

    My best attempt is this:

     

    <?php
    $var['id'] = addslashes($_GET['id']);
    /* Get Post id. */
    $fc=file("chat.txt");
    //open same file and use "w" to clear file
    $f=fopen("chat.txt","w");
    //loop through array using foreach
    foreach($fc as $line)
    {
    list($id, $name, $message) = explode(':',$line);
          if ($id = $var['id']){
           $string = $id . ':' . $name . ':' . $message;
    	$do = str_replace($string,'',$line);
          fputs($f,$line);
          header('Location: chat.php');
    } 
    else{
    	echo 'None dound.';
    }
    }
    fclose($f);
    

     

    If there is a way i can edit aswell please also let me know.

     

    Thank you.

    DeathStar

  8. The Sort function will not work with what i have here.

     

    As for the limit.

     

    It displays an error.

    Warning: Invalid argument supplied for foreach() in C:\**\**\**.php on line 128

     

    $lines = file('file.txt');
    if(!is_array($lines)) die("File could not be opened");
    $i=0;
    $max=20; 
    
    foreach($line as $line) {
    list($a, $b, $c, $d, $e, $f) = explode(',', $line);
    $b = urldecode($b);
    $b = addslashes($b);
    while ($i < $max) {
    ?>
    <tr>
    	<td><?php echo $f; ?></td>
    <td><a href="<?php echo $a; ?>.php"><?php echo $b; ?></a></td>
    <td><a href="">None</a></td>
    <td><?php echo $points; ?></td><td><?php echo $d; ?></td><td><?php echo $e; ?></td>
    </tr>
    <?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.