Jump to content

Kristian_C

Members
  • Posts

    246
  • Joined

  • Last visited

Everything posted by Kristian_C

  1. Kristian_C

    Update DB help

    And a verry verry smart thing you should start useing is :$update = mysql_query("Update studios set tour = '$tour', studio = '$studio', address = '$address' where id = '$_GET[edit]'") or die('Error : ' .mysql_error());remember when i got that tip and it has helped my alot so use it ->Kristian_C.
  2. I use Dreamweaver MX from 2004 and i love it. If it whould be another edit "prog" then it whould be notepad but ever since i started with MX2004 the codeing has gone as a dream ->Kristian_C
  3. Kristian_C

    Countdown?.

    hey ppl. anyone here that knows what the best way to make a countdown timer based on a time thats was inserted to sql? like with the normal time() function, its for a spam stopper so ppl must wait 30-40 seconds before they can send a new message... and i want it to be live countdown not just a timer that changes when you update page..anyone that can help me with this. IF the script must be js pleace explain it good so i dont copy and paste without learning. well my countdown function is like this but is it not live : function mekktid($last){$tidno = time(); if($last>$tidno){ $ord = $last-$tidno; while($ord >= 60){ $ord = $ord-60; $ordleft++; } while($ordleft >= 60){ $ordleft = $ordleft-60; $ordlefth++; } if($ordleft == 0){$ordleft = "";} else {$ordleft = "$ordleft Minutes"; } if($ordlefth == 0){ $ordlefth = ""; } else { $ordlefth = "$orderhleft Hours"; }return "$ordlefth $ordleft $ord seconds";}} ->Kristian_C
  4. Im not so verry good with round functions and things like that yet so im sorry but i cant help you on this one.. But if you just let the post be here for a few hours or post a new one in the php forum im sure that someone that knows how to create or find a good and stylish poll will reply there ...->Kristian_C
  5. If you chould post the code you have now, it whould be much easyer to help. But dropdown exaple :<?if($_POST['test'] && $_POST['test2']){$test=$_POST['test2'];if($test=audi){$ans="Kristian";$play="w3schools";}elseif($test=bmw){$ans="Isabell";$play="css";}elseif($test=ford){$ans="Kim";$play="html";}mysql_query("INSERT INTO names(id,name,field)VALUES('','$ans','$play')") or die('Error : ' .mysql_error());echo"Test";}?><body><form action="" method="post" name="form"><table width="35%" border="1" cellspacing="1"> <tr> <th scope="col"><select name="test2"> <option value="audi" selected>audi</option> <option value="bmw">bmw</option> <option value="ford">ford</option> </select></th> </tr> <tr> <td><input name="test" type="submit" id="test" value="test"></td> </tr></table></form></body> Dont know if thats what you wanted tho if you just want to update a table in the db you chould : <?if($_POST['test'] && $_POST['test2'] && $_POST['navn']){$test=$_POST['test2'];$navn=$_POST['navn'];if($test=audi){$play="w3schools";}elseif($test=bmw){$play="css";}elseif($test=ford){$play="html";}mysql_query("UPDATE names SET field=$play WHERE navn='$navn'") or die('Error : ' .mysql_error());echo"Test";}?><body><form action="" method="post" name="form"><table width="44%" border="1" cellspacing="1"> <tr> <td width="38%" scope="col">name <input name="navn" type="text" id="navn"></td> <td width="19%" scope="col"><div align="left">w3schools : <input name="test2" type="checkbox" id="test2" value="audi"> </div></td> <td width="17%" scope="col">css : <input name="test2" type="checkbox" id="test2" value="bmw"></td> <td width="26%" scope="col">html : <input name="test2" type="checkbox" id="test2" value="ford"></td> </tr> <tr> <td colspan="4"><input name="test" type="submit" id="test" value="test"></td> </tr></table></form></body> hope it helps.->Kristian_C
  6. to create a poll yourself you need to be into php/sql, becouse it is alot of round() functions... So if you dont know anything about php, then you should try to find one insted of trying to make one.->Kristian_C.
  7. i allways use strlen to have limmits of posts/usernames ++..may be useing it tho check lenght in the new forum im makeing tho but now i just use for limmits.->Kristian_C.
  8. i dont know if css is able to do it, but javascript is. Script<script language="JavaScript" type="text/javascript"> // This script was supplied free by Hypergurl // http://www.hypergurl.com <!-- // JavaScript to interpolate random images into a page. var ic = 6; // Number of alternative images var xoxo = new Array(ic); // Array to hold filenames xoxo[0] = "http://www.yoursite.com/graphic1.gif"; xoxo[1] = "http://www.yoursite.com/graphic2.gif"; xoxo[2] = "http://www.yoursite.com/graphic3.gif"; xoxo[3] = "http://www.yoursite.com/graphic4.gif"; xoxo[4] = "http://www.yoursite.com/graphic5.gif"; xoxo[5] = "http://www.yoursite.com/graphic6.gif"; function pickRandom(range) { if (Math.random) return Math.round(Math.random() * (range-1)); else { var now = new Date(); return (now.getTime() / 1000) % range; } } // Write out an IMG tag, using a randomly-chosen image name. var choice = pickRandom(ic); // --> </script> Body code : <script LANGUAGE="JavaScript">document.writeln('<TD'+'><IMG SRC="'+xoxo[choice]+'" HEIGHT=184 WIDTH=120 BORDER=0 ><'+'/TD>');</SCRIPT> copyd from :http://www.hypergurl.com/randomimage.htmlNot sure thats what you want dident read so much but looks like the right thing ->Kristian_C.
  9. Sleepy head Jonas, :)Just posting here insted of makin a new post, how can i make <select> froms more stylish? dont know what that goes under in css, if it is possible at all, background i have but etc the arrow "thing" and borders, i have white borders and normally they are really silverwhite so i think borders work, just need the arrow thing and im happy..->Kristian_C.
  10. I think you should explain abit more on functions like strlen and ereg, etc on the strlen function you chould explain not just how to return the lenght but also how to stop the lenght of the post etc if i want to have a shoutbox or something but i dont want my visitors to write more then 200-600 characters then you chould explain how to do that, or how to have a minimum limit of characters. It should not be a problem for a coder to figure out that himself but if a neewbie like me dident know how the he** i chould do it, then it whould be great to just go onto w3schools and read about it.And on ereg you chould write like how i chould use ereg with numbers like ^0-9 or just normal ^A-Za-z if you understand what i meen... not that you should write down every thing for us but just explain abit more, maybe you have it somewhere but i havent found it yet and i whould love to know hehe...->Kristian_C
  11. I remember when i first try to make a site, and every simple one in the forum screamed palette palette all day and all night, seems like you got the palette thing right.Im shure that you have updated the site alot here now, before i got to answer and i think its a verry nice site -> Kristian_C
  12. i dont know actually, but maybe its becouse else if chould use elseif and you chould also remove or and set || insted, and you chould maybe remove the two (( at the start and have one. like <?php // beginning of switch_theme $theme_switch_hour = date(G); // look at the local time from 0 to 23 // if it's between 7 am and 8 pm show day else show night, if unknow show unknow if ($theme_switch_hour>=7 AND $theme_switch_hour<20) { echo "this is the day"; } elseif ($theme_switch_hour >= 0 AND $theme_switch_hour < 7 AND $theme_switch_hour >= 20 AND $theme_switch_hour < 23){ echo "this is the night"; } else { echo "I don't know!"; } // ending of switch_theme?> but like i said i really dont know -> Kristian_C
  13. now it dont do anything actually.->Kristian_C
  14. i allways use single when i use variables but i dont have anything more then etc :echo"<a href='?page=forum&forum=main&post=$id'>read</a>";allways thought it was okay to use single why is it like that? should be made more easy (A)
  15. Aha thanks for beeing verry verry helpfull .. I think i should turn down the codeing speed and try to understand things abit more before i use it, just hate reading about things like to test it myself and just ask for help if i need it but reading should be a think i must start with soon... Have tried to use the php manual 1000times when i need some questions answerd but the answers i get from there i cant understand so really dont know what to do hehe...so thanks again ->Kristian_C
  16. Well fixed it, but still dont work :sif you have any more ideas of whats wrong feel free to tell Code now : <?phpif($_POST['slettsel']){$delete_ids = $_POST['delete_ids'];if (is_array($delete_ids) && count($delete_ids) > 0){ $id_list = ""; foreach ($delete_ids as $id) { if ($id_list != "") $id_list .= ","; $id_list .= $id; }$utkom=count($delete_ids); mysql_query("DELETE FROM inkom WHERE id IN ($id_list)");echo"$utkom messages deleted";}}?><table width="82%" border="1" align="center" cellspacing="0" bordercolor="010101"> <tr> <th background="grad.jpg" colspan="4" scope="col"><strong>Inbox </strong></th> </tr> <tr> <td background="link.jpg" width="31%">Title</td> <td background="link.jpg" width="32%">From</td> <td background="link.jpg" width="22%">Time sent </td> <td background="link.jpg" width="15%">Delete</td> </tr></table><?$mysql1 = mysql_query("SELECT * FROM `inkom` WHERE `til`='$brukernavn' AND `lagra` ='no' ORDER by tid DESC");$antall =mysql_num_rows($mysql1);if ($antall == "0"){echo "<table with='60%' hight='15' bordercolor='000000' border='1' cellspacing='0' align=center><tr><td background=link.jpg><font color='ffffff'>You have no mail.</font></tr></td></table>";}else{while($inkom = mysql_fetch_object($mysql1)){$t++;$n++;?><table width='82%' border='1' align='center' cellspacing='0' bordercolor='010101'> <tr> <td background='link.jpg' width='31%'><? if($inkom->lest=="no"){echo"Unread :"; } echo"<a href=?side=lesmeld&meld=$inkom->id>$inkom->tittel</a>"; ?> </td> <td background='link.jpg' width='32%'><? echo" $inkom->fra"; ?> </td> <td background='link.jpg' width='22%'><? echo" $inkom->tid"; ?> </td> <td background='link.jpg' width='15%'><? echo "<input type='checkbox' name='delete_ids[]' value='$inkom->id'>"; ?></td> </tr></table><?}}?><?if($_POST['slett']){mysql_query("DELETE FROM inkom WHERE lest='yes' AND lagra='no' AND til='$brukernavn'") or die('Error :' .mysql_error());echo"All messages deleted";}if($_POST['save']){mysql_query("UPDATE inkom SET lagra='yes' WHERE til='$brukernavn'") or die('Error :' .mysql_error());echo"All messages saved";}?><form name="form1" method="post" action=""> <table width="38%" border="1" align="center" cellspacing="0" bordercolor="010101" bgcolor="121212"> <tr> <th scope="col"><input name="slett" type="submit" class="button" id="slett" value="Delete all"> <input name="save" type="submit" class="button" id="save" value="Save all"> <input name="slettsel" type="submit" class="button" id="slettsel" value="Delete Selected"></th> </tr> </table></form> ->Kristian_C.
  17. hehe, yeah i found it out have verry little time to create the game so many problems comes up but i allways get good help here so i think ill make it before deadline
  18. My include files is the files i have on every page, those are the ones that keeps my game goin, like the connection to the db and and most of the time functions that must go on again after they've stopped, "game missions" that i have made for users who plays more then others is include files and stuff like that, in that case i only use include_once"file.php";or include "file.php"; and ive never had a problem with that.. but what do you meen with the save thing?
  19. Thanks, but how do i do it like :i have a textfield and i write : 1,2,3,4,5,6,7,8,9,10,23 in there. then click add to list should that be $id_list[] = $_POST['id'];or whould it be better for me to make like 5 - 10 extra textfileds that i can use if i want just use js to make it look better for my users. so they write like 12 in a filed then it popsup 12 extra fileds whould i then use $id_list[] = $_POST['id1'];$id_list[] = $_POST['id2'];$id_list[] = $_POST['id3'];$id_list[] = $_POST['id4'];$id_list[] = $_POST['id5'];$id_list[] = $_POST['id6'];$id_list[] = $_POST['id7'];$id_list[] = $_POST['id8'];$id_list[] = $_POST['id9'];$id_list[] = $_POST['id10'];$id_list[] = $_POST['id11'];$id_list[] = $_POST['id12'];but as i am just a neewbie in this world i then whould need to do like :if($extra=="2"){$id_list[] = $_POST['id1'];$id_list[] = $_POST['id2'];$id_list[] = $_POST['id3'];elseif($extra=="3"){$id_list[] = $_POST['id1'];$id_list[] = $_POST['id2'];$id_list[] = $_POST['id3'];$id_list[] = $_POST['id4'];+++++++if you now understand what i meen? whould that be better for me you think? thanks for helping me out all the time guys ->Kristian_CEdit :wow now i really feel stupid dident see the inplode or what you had there.. thanks :)But what do the :$id_list[] = 7;$id_list[] = 10;$id_list[] = 1337;meen? is that like the max thing? ->Kristian_C
  20. ok, if you are trying to select the User from one db, and the rest from another db.have to files db_connect.php db2_connect.phpand have a include_once"db_connect.php"; include_once"db2_connect.php";on all pages. Inside db_con you have the con codes.never used that so dont know if it works. but tryin to help ->Kristian_Cedit:Whoops wrong post lol.
  21. Thanks, will test it out, if you chould explain abit to it whould be great ..->Kristian_C
  22. Hehe, if you are makeing 3sites you can use all three, but if you just are makeing 1 site one database is enough, you can have unlimited tables in a db so you can create like 10000 functions on one db.the limit of 3 databases is just if you want to make 2 other sites or if you want to separate some things, i like to separate all my admin login/logs ++ tables from the normal db i use for my game. So yeah one db is enough hehe.. ->Kristian_C.------------Edit:Ops dident see the limited db before now, hmm, never heard about a limited db :s.. so then i really dont know .-> Kristian_C.
  23. Okay, now im getting verry confused, at the start it dident work, then i got some help here to get it work. But i opend one of my old files, did as before so it was like before when it worked again, but i dont work :sCode: if ($_POST['bøff']){$suc = $chance[$radiobutton];$ran = rand(0,6);if ($ran <= $suc){if ($radiobutton == "0"){ $success = $chance[0]; $faa=rand(0,6); $biler=array('Volvo 240','Subaru Impresa','Skyline','Farrari','Hummer H1','TransAm','Mini Cooper');}elseif ($radiobutton == "1"){ $success = $chance[1]; $faa=rand(0,6); $biler=array('Volvo 240','Subaru Impresa','Skyline','Farrari','Hummer H1','TransAm','Mini Cooper');}elseif ($radiobutton == "2"){ $success = $chance[2]; $faa=rand(0,6); $biler=array('Volvo 240','Subaru Impresa','Skyline','Farrari','Hummer H1','TransAm','Mini Cooper');}if($biler[$faa]=="Volvo 240"){$pris=rand(7000,12000);$skade=rand(13,23);}if($biler[$faa]="Subaru Impresa"){$pris=rand(7000,15000);$skade=rand(13,32);}if($biler[$faa]=="Skyline"){$pris=rand(7000,19000);$skade=rand(13,55);}if($biler[$faa]="Farrari"){$pris=rand(7000,22000);$skade=rand(15,55);}if($biler[$faa]="Hummer H1"){$pris=rand(7000,26000);$skade=rand(12,59);}if($biler[$faa]="TransAm"){$pris=rand(8000,30000);$skade=rand(19,44);}if($biler[$faa]="Mini Cooper"){$pris=rand(13000,60000);$skade=rand(10,23);}$bilidss=$biler[$faa];$time= time() + rand(50,400);mysql_query("INSERT INTO `biler`(`id`,`bil`,`skade`,`pris`,`sted`,`eier`,`status`,`flyttetid`,`fra`)VALUES('','$bilidss','$skade','$pris','$info->land','$brukernavn','0','','$info->land')") or die('Error :' .mysql_error()); Found the problem, just forgot to add the elseif again hehe..->Kristian_C.
  24. Found the problem <?session_start();include_once"includes/kontakt.php";[b]From here :[/b]if(isset($_POST['regg'])){ $brukernavn=$_POST['brukernavn'];$kjonn=$_POST['######'];$ref=$_POST['ref'];$land=$_POST['land'];$email=$_POST['email'];$email2=$_POST['email2'];$sjekkbrukernavn=mysql_query("SELECT brukernavn FROM brukere WHERE brukernavn='$brukernavn'");$sjekkemail=mysql_query("SELECT email FROM brukere WHERE email='$email'");$brukernavnsjekk=mysql_num_rows($sjekkbrukernavn);$emailsjekk=mysql_num_rows($sjekkemail);if($brukernavnsjekk > 0){echo"That username is allready in use";exit(); [b]To here it is fine. [/b] Here i added [b] } [/b] And now it works :p i hate that error :p if($emailsjekk > 0){echo"That email is allready beeing used";exit();}if (ereg('[^A-Za-z^0-9]', $brukernavn)) { echo "Username can only contain letters!";}if (strlen($brukernavn) <= 5 || strlen($brukernavn) >= 18){echo "The username is to big or to small!";}else{
×
×
  • Create New...