Jump to content

ghqwerty

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Posts posted by ghqwerty

  1. thanks mjdamato and dink i will add i lloop when i finish the code so it will do it for a infinite amount of letter/numbers :)

     

    thanks mjdamato although i'd really rather write it myself too learn from it however i will read yours and then try and make mine similiar to yours to see how it works. thanks :)

  2. well it is supposed to echo what you inputted and how many attempts it took to get this by trial and error

     

    so it checks a, if it is not a, it checks b and so on.

     

    then say it was z it would echo z and

    It took 26 attempts to get the correct word

     

    however if you try input 1 you get

    01

    It took 1000 attempts to get the correct word.1

    It took 28 attempts to get the correct word. 

     

    whereas it shoudl just be the bottom one

  3. you could add your $emails into a session and then justuse $_SESSION['emails'] when you need them :)

     

    edit : can you not read my post ????

     

    just do

    <?php
    $_SESSION['email'] = $emails;
    $_SESSION['cc'] = $cc;
    $_SESSION['bcc'] = $bcc;
    ?>
    

     

    and then on your popup page to save you having to write $_SESSION['email'] every time you need it just run

    $emails = $_SESSION['email'] ;
    $cc = $_SESSION['cc'];
    $bcc = $_SESSION['bcc'];
    

  4. ok so i was bored and decided to write a prgram that will be able to work out what you typed in and then say how many attempts it took to get this answer

     

    this is what i have so far

     

    <?php	
    	$letter = array(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, '0', '1', '2', '3', '4', '5', '6', '7', '8', '9');
    	for($a=0; $a < 36; $a++){			
    		if($letter[$a] == $_POST['text']){
    			echo $letter[$a];	
    			$time = $a+1;
    			echo "<br>It took ". $time ." attempts to get the correct word.";			
    		}else{
    
    			for($b=0; $b < 36; $b++){
    				$stringa = $letter[$a]."".$letter[$b];
    				if($stringa == $_POST['text']){					
    					echo $stringa;
    					$time1 = (36*($a+1))+($b+1);
    					echo "<br>It took ". $time1 ." attempts to get the correct word.";
    				}
    			}
    		}  
    	}
    
    ?>

    however if you check out the site

    www.blisswars.net23.net/skills.php

    and enter 1-9 it will come out all funny.

     

    as far as i can tell i think most of the rest works fine.

     

    can anyone see the problem ???

     

    Edit : the link actually redirects to the right bit now

  5. i use this formula for my users page :)

     

    $prev_page = $users - 1;
    
    
    							echo "<tr><td colspan='3'>";
    
    									if($prev_page >= 1){
    										echo "<b><< <a href=users.php?users=$prev_page>Prev.</a></b>"; //if you are on page 2 or more display a previous  link
    									}
    								if($totalpages <= 3){
    									//this is the pagination link										 
    									for($i = 1; $i <= $totalpages; $i++){ 
    										echo "<a href='users.php?users=$i'> $i </a>| ";//if there are less than 3 pages just show 1|2|3
    									}
    
    								}else{
    									$twobefore = $users-2;
    									$onebefore = $users-1;
    									$oneafter = $users+1;
    									$twoafter = $users+2;
    									//i prefer using a nested version as i understand it easuier you could just as easily use an elseif formula
    									if($twobefore >= 1){
    										echo "<a href=users.php?users=1> 1 </a>";
    										echo "<a href=users.php?users=$twobefore> $twobefore </a>";//if you are on page 3 or more show a link to the previous 2 pages
    										if($onebefore >= 1){
    											echo "<a href=users.php?users=$onebefore> $onebefore </a>";//if you are on page 2 or more show a link to the previous page
    											echo "<a href=users.php?users=$user> $user </a>"; // show the link for the page you are currently on 
    											if($oneafter <= $totalpages){
    												echo "<a href=users.php?users=$oneafter> $oneafter </a>";// if you are more than 1 page off max pages show link to next page
    												if($twoafter <= $totalpages){
    													echo "<a href=users.php?users=$twoafter> $twoafter </a>";// if you are more than 2 page off max pages show link to the next 2 pages
    													if($twoafter < totalpages){
    														echo "...<a href=users.php?users=$totalpages> $totalpages </a>";//show a link to the last page
    													}
    												}
    											}
    										}
    									}
    
    									$next_page = $users + 1;
    									if($next_page <= $totalpages) {
    									   echo"<a href=users.php?users=$next_page><b>Next</b></a> <b>>></b>";//next link										   
    									}
    							}

  6. i am soo confused. i am trying to devise a formula to work out how many minutes are in a lengthof time and store that in a variable and then store the leftover as a variable

     

    eg

    $timetowait = 621;

    //work out how many minutes (lots of 60) are in it in this case 10

    $minutes = 10;

    //work out leftover

    $seconds = 21;

     

     

    however i cant think of a way to do this

  7. changed to

     

    $last_time = mysql_query("select last_extortion from members where id = '".$_SESSION['id']."'") or die(mysql_error());
    												$last_time1 = mysql_fetch_array($last_time);
    												$last_time2 = $last_time1['last_extortion'];
    												$last_time = strtotime($last_time2);													
    												$length = 10;
    												$seconds_gap = $length * 60;													
    												if((time() - $last_time) > $seconds_gap){

     

     

    but now whenever i try and extort someone i get

     

    'You can only extort once every 10 minutes. You have to wait 1225107713 seconds.'

  8. now that the servers are back up i now have a 3rd problem lol

     

    im getting this error whenever i 'extort' someone

     

    Warning: strtotime() expects parameter 1 to be string, resource given in /home/a2350935/public_html/extortion.php on line 95

     

     

    this is how im using it

     

    $last_time = mysql_query("select last_extortion from members where id = '".$_SESSION['id']."'") or die(mysql_error());
    												$last_time = strtotime($last_time);													
    												$length = 10;
    												$seconds_gap = $length * 60;

  9. when i go to my login page i get this error

     

    Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'mysql4.000webhost.com' (4) in /home/a2350935/public_html/conn.php on line 10

     

    however i havent changed it for ages and it has been working fine up to now.

     

    this is line 10

        $dblink = mysql_connect ("$servername","$dbuser","$dbpassword")or die('CONNECTION ERROR: Could not connect to MySQL');

     

    and this is the whole code

     

    <?php
    //conn.php
    $servername='mysql4.000webhost.com';
    $dbusername='why should i say ?';
    $dbpassword='not telling you !';
    $dbname='stop being so nosy!';
    
    function connecttodb($servername,$dbname,$dbuser,$dbpassword){
        global $dblink;
        $dblink = mysql_connect ("$servername","$dbuser","$dbpassword")or die('CONNECTION ERROR: Could not connect to MySQL');
        mysql_select_db("$dbname",$dblink) or die ('Could not open database'.mysql_error());
    }
    
    connecttodb($servername,$dbname,$dbusername,$dbpassword);
    
    ?>

  10. i have another problem now

     

    when drawing on that information in the table how to i put it in date() format ?

     

    so i could do

    if((date('y-m-d H:I:S') - $last_time) > $seconds_gap)

     

    if yes then do extortion if no then show an error message like - "You can only extort once every x minutes. You have to wait y more minutes/seconds"

  11. i know how to do that but when i do

     

    mysql_query("update members set last_extortion = ". date('Y-m-d H:i:s') ." where id = '". $_SESSION['id']."'");

    then it doesnt change anything.

  12. as you might no i am setting up a limit on how many times a user can extort someone in a given time.

     

    i have added the column 'last_extortion' however whenever i try and update it to the current timestamp it wont change.

     

    could someone please show me how to update it ? whether using time() or date()

  13. so add a column to my database and then when they try and do an extortion it checks that time so say do the current time - last action and if that is less than the time i want say echo " please wait x mor minutes"

     

    is the time measured in seconds or miliseconds again ?

     

  14. so im wanting to add a bit of reality to my website and i dont know what to use or where to look for decent tutorials on it

     

    what im wanting to do is have a limit on stuf, say extortions so that a user can only do it 1 every , say, 24 hours

     

    could someone please explain to me what i ahve to learn and show me a good site for a tutorial of this

     

    thanks a million

    Matty

  15. ive just got a new freehost called freewebhostingpro.com but am having problems getting databases and everything in sync. on my first page

     

    http://ghqwerty.freewebhostingpro.com/checklogin.php

     

    if you use username as brandy and pass as bob it comes up with

     

    Access denied for user 'vhostswww'@'localhost' (using password: NO)

     

    however i have no vhostswww in my scripts and i cant see any problems. does anyone know how to fix it, i think it may be to do with the site setup

  16. hmm i found out the problem its because i had id-'buy' not name='buy' but now i keep getting

    Unknown column 'ak47' in 'where clause'

     

    im guessing that is reffering to this line

    $costofitem = mysql_query("select sum(moneybad) from itemstats where item in($itemname)") or die (mysql_error());

    and $itemname is

    $itemname2 = $_POST['buy_items'];
    									$itemname = implode(",", $itemname2);

    so i cant see why it isnt working i think it is part of the implode as it isnt showing the whole array on there

×
×
  • 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.