Jump to content

redarrow

Members
  • Posts

    7,306
  • Joined

  • Last visited

Everything posted by redarrow

  1. this is a example how to add a number to the database when you go to the new page. UPDATE Adding_Table SET Adding_column=Adding_column+1 WHERE SPECIAL_NUMBER="WHAT_EVER";,
  2. YOU HAVE A LITTLE THINK AND ILL REST LOL, WHEN YOU NEED MORE HELP COME BACK OK.
  3. NO MONEY JUST FRIENDS, IF U WANT TO DONATE MENTION ME OK LOL expanded a little more <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123"=>"www.gogle.com","456"=>"www.yahoo.com","789"=>"www.msn.com"); if(preg_match("/([A-Za-z])/",$_POST['num'])){ echo "<b>Sorry stop trying to use stupid letters, you no the rules dude! </b><br />"; } foreach($number_array as $val=>$number_wanted){ if($_POST['num']=="$val"){ header("location: http://$number_wanted?add=1"); break; }else{ echo" It not there"; break; } } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form> all you need to do is adjust the urls in the array to your pages.php and change the correct numbers.(the url should be named as the advert campain) when the number is entered in the form ,your go to your new page. all you need to do is say this to update the database. <?php if($_GET['add']=="1"){ //update the database ,where the name of the database column is the same as the page we are on, and add 1 to the adding row of the database. } ?>
  4. expanded a little more <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123"=>"www.gogle.com","456"=>"www.yahoo.com","789"=>"www.msn.com"); if(preg_match("/([A-Za-z])/",$_POST['num'])){ echo "<b>Sorry stop trying to use stupid letters, you no the rules dude! </b><br />"; } foreach($number_array as $val=>$number_wanted){ if($_POST['num']=="$val"){ header("location: http://$number_wanted"); break; }else{ echo" It not there"; break; } } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form>
  5. this is a example only you want more advanced then ask... <?php /** * @author john boy * @copyright 2012 */ if($_POST['submit']){ $number_array=array("123","456","789"); if(in_array($_POST['num'],$number_array)){ echo "It in there"; }else{ echo" It not there"; } } ?> <br /> <br /> <form method="POST" action=""> <b>Please enter you secuity number.</b> <br /> <br /> <input type="password" name="num"> <input type="submit" name="submit" value="submit"> </form>
  6. a hidden solution using a 3rd part application and php exec http://www.scriptftp.com/reference.php?go=topic123 once you master this send million's daily.
  7. This code allow a user to use a drop box and select a name then the code compares two arrays and then if a match sends a email to the user via the named array key. any body do it in a shorter way cheers. <html> <title></title> <?php if($_POST['submit']){ $switch_array=array("john"=>"john@hwat_ever.com", "bob"=>"bob@what_ever.com","petter"=>"petter@what_ever.com", "paul"=>"paul@what_ever.com","kevin"=>"kevin@what_ever.com", "chris"=>"chris@what_ever.com","tom"=>"tom@what_ever.com"); foreach($switch_array as $key=>$posted_match){ if($_POST['posted_people']=="$key"){ $to = ".$posted_match."; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if(mail($to, $subject, $message, $headers)){ echo "A email was sent to ".$posted_match.""; break; }else{ echo("Sorry no email sent out"); break; } break; } } } ?> <?php $people_array=array("john","bob","petter","paul","kevin","chris","tom");?> <center> <form method="POST" action=""> <select name="posted_people"> <?php foreach($people_array as $people){ echo"<option value='$people'>$people</option>";} ?> </select> <br /><br /> <input type="submit" name="submit" value="submit"> </form> </center> </html>
  8. use a database, then secure there info , then pull it out for security checks then let them in,also add a capture code to prevent database injections
  9. read this. http://uk3.php.net/manual/en/ref.array.php you asked for this from your last question, but you study the code from the link. do a trail show us your understanding php, we can program for you but you wont learn will yaa http://uk3.php.net/manual/en/function.array-unique.php
  10. not a solution but will work. <?php ob_start(); session_start(); //all code here ob_flush(); ob_end(); ?>
  11. that because there both set as 0, set one as 1 add a entry to one of them your see!
  12. I think your in trouble, as i no word is not just binary it also has it own architecture so it imposable to work with as a flat file. dont hold me to that but i am kind of 50% sure i am right. good luck
  13. Your trying to check two different condition's, so the if statement only needed but twice. <?php $pickdone = mysql_query("SELECT * FROM fights WHERE event='$viewevent' AND id NOT IN (SELECT fight_id FROM betting WHERE user_id='$user->id')"); $nofights = mysql_query("SELECT * FROM fights WHERE event='$viewevent'"); if ( mysql_num_rows( $nofights ) == 0 ){ echo "<table class='thinline' cellpadding='0' cellspacing='0' width='85%'> <tr> <td class='Tableheading'><font color='#ff8a00'><b>There are currently no scheduled fights for this event, please check back soon.</b></font></td></tr></table> <BR>"; } if ( mysql_num_rows( $pickdone ) == 0 ){ echo "<table class='thinline' cellpadding='0' cellspacing='0' width='85%'> <tr> <td class='Tableheading'><font color='#ff8a00'><b>You have completed your picks for this event, please check back after '$fetch->date' to see your score.</b></font></td></tr></table> <BR>"; } ?>
  14. read this mate will help. http://tuxradar.com/practicalphp/3/12/4 ? <<<<< if : <<<<< else
  15. In my PHP class my professor said php and phtml were the same thing your professor must of fort, when you load php from scratch, the extension settings are set as phtml and not .php when you download a copy of php, sometimes the extension settings are set to all sorts of settings. maybe the professor, should teach the internal settings of php and Apache. also looking at your code, i think if the teacher used upper case, for xhtml then others can identify html from php quicker. also where the comments to show what the code doing. If your going to learn php, html, mysql, and ajax and JavaScript plus css, might as well do it Wright. what the course price dont tell me £3.ooo plus only 10 sittings/lessons
  16. use a input and give it a id. <?php $id="example"; ?> <input type="text" name="id" value="<?php echo $id; ?>"> Get me. <?php if($_POST['id']=="example"){ echo "cheers mate good idea"; }else{ echo"Bad idea"; } ?>
  17. once the driver is added then that it alter Wamp directory with the modules
  18. Sorry but paypal use there own encryption method, and no you can not write it your self sorry. paypal got a grate forum there self, and there very friendly ok. read this please. http://www.stellarwebsolutions.com/en/articles/paypal_button_encryption_php.php
  19. afther a good read on the net for you. works on 2005 aswell Apache 2.2.14 /PHP 5.2.12/MS-SQL 2008 integration * Download Apache 2.2.14 for Windows Installer package 2008 32 bit httpd DOT apache DOT org/download.cgi --> apache_2.2.14-win32-x86-no_ssl * follow the defaults when installing Apache * stop Apache 2.2 service * Download PHP 5.2.12 Windows Zip package for Windows 2008 32 bit; (VC6 Thread Safe version needed for PHP used as an Apache module). windows DOT php DOT net/download/ --> php-5.2.12-Win32-VC6-x86.zip - Extract the archive to C:\PHP - Verify the installation: C:\PHP>php -v - set the Environment Variable PHPRC=C:\PHP - Rename 'C:\PHP\php.ini-recommended' to 'C:\PHP\php.ini' - Edit C:\PHP\php,ini file: modify: extension_dir = "C:\PHP\ext" uncomment: extension=php_mssql.dll * Add the lines below to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf" PHPIniDir "C:/PHP/" LoadModule php5_module "C:/PHP/php5apache2_2.dll" AddHandler application/x-httpd-php .php * Add the lines below to "C:\Program Files\Apache Software Foundation\Apache2.2\conf\mime.types" application/x-httpd-php php application/x-httpd-php-source phps * Ensure that phpinfo.php file with the content: is in the folder C:\Program Files\Apache Software Foundation\Apache2.2\htdocs * Start Apache 2.2 service * Verification of Apache/PHP integration: http://localhost/phpinfo.php --> 'PHP Version 5.2.12' info shows up * Verification whether mssql' module is loaded: c:\php\php -m All works like a charm ... no additional steps needed.
  20. Well done nice web site, you got nice space there on home page and disclaimer to earn some revenue. absence from goggle and afflicts from Amazon
  21. some think like this i am NOT sure. SELECT * 2. FROM what ever 3. WHERE date >= 'year(10)' AND RegDate <= 'now()' your have to play with it (lol) sorry.
  22. Can we see the database schema please. just show us the way you have written the database format. also what the name of the notes from the database. http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html look this link up try and use interval or other good luck.
  23. Use cmod and unlink it a file permission problem. <?php @chmod( $entry, 0777 ); @unlink( $entry ); ?>
  24. redarrow

    Help

    try this for me might work?????? <?php error_reporting(-1); ini_set('display_errors', 1); $db = mysql_connect("localhost", "user", "password"); $basedados = "bd" ; mysql_select_db($basedados, $db) ; $jornada = $_POST['jornada'] ; $liga = $_POST['liga'] ; $jogo = $_POST['jogo'] ; $codfechjogo = $_POST['codfj'] ; $qec = mysql_query("SELECT IDEquipaC FROM calendario WHERE Jornada = '$jornada', Liga = '$liga', Jogo = '$jogo' ", $db) ; while($ab = mysql_fetch_array($qec)) { $equipac = $ab['IDEquipaC'] ; } $qef = mysql_query("SELECT IDEquipaF FROM calendario WHERE Jornada = '$jornada', Liga = '$liga', Jogo = '$jogo' ", $db) ; while($ac = mysql_fetch_array($qecf)) { $equipaf = $ac['IDEquipaF'] ; } if($codfechjogo == "2011jogo") { echo "Password correcta; <br>" ; $queryjf = mysql_query("SELECT fechado FROM Jogo WHERE Jornada = '$jornada', Liga = '$liga', Jogo = '$jogo' ", $db) ; while($aa = mysql_fetch_array($queryjf)) { $jogofechado = $aa['fechado'] ; } if($jogofechado == "1") { setcookie("errofj", "Erro : O Jogo já foi fechado....", time() + 20) ; header('Location: www.ocfdo.com/fecharjogoespecial.php') ; } else { echo "O jogo nunca foi fechado; <br>" ; $querysc = mysql_query("SELECT Saldo FROM Equipa WHERE IDEquipa = '$equipac' ", $db) ; while($ad = mysql_fetch_array($querysc)) { $saldoc = $ad['Saldo'] ; } if($saldoc < "0") { setcookie("errofj", "Erro : A Equipa da casa, $equipac , tem saldo negativo....", time() + 20) ; header('Location: www.ocfdo.com/fecharjogoespecial.php') ; } else { echo "A equipa da casa não tem saldo negativo; <br>" ; $querysf = mysql_query("SELECT Saldo FROM Equipa WHERE IDEquipa = '$equipaf' ", $db) ; while($ae = mysql_fetch_array($querysf)) { $saldof = $ae['Saldo'] ; } if($saldof < "0") { setcookie("errofj", "Erro : A Equipa de fora, $equipaf , tem saldo negativo....", time() + 20) ; header('Location: www.ocfdo.com/fecharjogoespecial.php') ; } else { echo "A equipa de fora não tem saldo negativo; <br>" ; for($nmber = 1; $nmber <= 18; $nmber + 1) { $queryjc = mysql_query("SELECT IDJogador, Dado, Lesao, Cartao, Valor FROM Jogo_Det WHERE Liga = '$liga', Jornada = '$jornada', Jogo = '$jogo', IDEquipa = '$equipac', Numero = '$nmber' ", $db) ; while($ff = mysql_fetch_array($queryjc)) { $jogc = $ff['IDJogador'] ; $jogcd = $ff['Dado'] ; $jogcl = $ff['Lesao'] ; $jogcc = $ff['Cartao'] ; $jogcv = $ff['Valor'] ; } if($jogcd < 3 && $jogcd > 0) { $jogcnv = $jogcv - 1 ; } else { if($jogcd > 4) { $jogcnv = $jogcv + 1 ; } else { $jogcnv = $jogcv ; } } $queryjcv = mysql_query("UPDATE Jogadores SET Valor = '$jogcnv' WHERE IDJogador = '$jogc' ", $db) ; $queryjcs = mysql_query("SELECT Suspensao FROM Jogadores WHERE IDJogador = '$jogc' ", $db) ; while($po = mysql_fetch_array($queryjcs)) { $jogcsusp = $po['Suspensao'] ; } if($jogcc == "1" || $jogcc == "5") { if($jogcsusp == "L") { $jogcnsusp = "A" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogcnsusp' WHERE IDJogador = '$jogc' ", $db) ; } else { $jogcnsusp = "AA" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogcnsusp' WHERE IDJogador = '$jogc' ", $db) ; } } else { if($jogcc == "10") { $jogcnsusp = "V" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogcnsusp' WHERE IDJogador = '$jogc' ", $db) ; } else { echo "$jogc C continua sem cartões. <br>" ; } } $ultimaj = $jornada - 1 ; $queryjud = mysql_query("SELECT Dado FROM Jogo_DET WHERE Liga = '$liga', Jornada = '$ultimaj', Jogo = '$jogo', IDEquipa = '$equipac', IDJogador = '$jogc' ", $db) ; while($ds = mysql_fetch_array($queryjud)) { $jogud = $ds['Dado'] ; } if($jogcd == $jogud) { $queryud = mysql_query("UPDATE Jogadores SET Lesao = 'S' WHERE IDJogador = '$jogc' ", $db) ; } else { echo "$jogc C não está lesionado <br>" ; } echo "O Jogador $nmber casa foi actualizado; <br>" ; } echo "Os jogadores da casa foram actualizados; <br>" ; for($num = 1; $num <= 18; $num + 1) { $queryjf = mysql_query("SELECT IDJogador, Dado, Lesao, Cartao, Valor FROM Jogo_Det WHERE Liga = '$liga', Jornada = '$jornada', Jogo = '$jogo', IDEquipa = '$equipaf', Numero = '$num' ", $db) ; while($ff = mysql_fetch_array($queryjf)) { $jogf = $ff['IDJogador'] ; $jogfd = $ff['Dado'] ; $jogfl = $ff['Lesao'] ; $jogfc = $ff['Cartao'] ; $jogfv = $ff['Valor'] ; } if($jogfd < 3 && $jogfd > 0) { $jogfnv = $jogfv - 1 ; } else { if($jogfd > 4) { $jogfnv = $jogfv + 1 ; } else { $jogfnv = $jogfv ; } } $queryjfv = mysql_query("UPDATE Jogadores SET Valor = '$jogfnv' WHERE IDJogador = '$jogf' ", $db) ; $queryjfs = mysql_query("SELECT Suspensao FROM Jogadores WHERE IDJogador = '$jogf' ", $db) ; while($po = mysql_fetch_array($queryjfs)) { $jogfsusp = $po['Suspensao'] ; } if($jogfc == "1" || $jogfc == "5") { if($jogfsusp == "L") { $jogfnsusp = "A" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogfnsusp' WHERE IDJogador = '$jogf' ", $db) ; } } else { $jogfnsusp = "AA" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogcnsusp' WHERE IDJogador = '$jogf' ", $db) ; } if($jogfc == "10") { $jogfnsusp = "V" ; $queryjogsusp = mysql_query("UPDATE Jogadores SET Suspensao = '$jogfnsusp' WHERE IDJogador = '$jogf' ", $db) ; } else { echo "$jogc f continua sem cartões." ; } } $ultimaj = $jornada - 1 ; $queryjud = mysql_query("SELECT Dado FROM Jogo_DET WHERE Liga = '$liga', Jornada = '$ultimaj', Jogo = '$jogo', IDEquipa = '$equipac', IDJogador = '$jogf' ", $db) ; while($ds = mysql_fetch_array($queryjud)) { $jogud = $ds['Dado'] ; } if($jogfd == $jogud) { $queryud = mysql_query("UPDATE Jogadores SET Lesao = 'S' WHERE IDJogador = '$jogf' ", $db) ; } else { echo "$jogf f não está lesionado" ; } echo "O Jogador $numf casa foi actualizado; <br>" ; } echo "Os jogadores de fora foram actualizados; <br>" ; $qdadosjogo = mysql_query("SELECT ReceitaC, ReceitaF, GolosC, GolosF FROM Jogo WHERE Liga = '$liga', Jornada = '$jornada', Jogo = '$jogo' ", $db) ; while($tu = mysql_fetch_array($qdadosjogo)) { $receitac = $tu['ReceitaC'] ; $receitaf = $tu['ReceitaF'] ; $golosc = $tu['GolosC'] ; $golosf = $tu['GolosF'] ; } $qsaldoc = mysql_query("SELECT Saldo FROM Equipa WHERE IDEquipa = '$equipac' ", $db) ; while($ti = mysql_fetch_array($qsaldoc)) { $saldoc = $ti['Saldo'] ; } $nsaldoc = $receitac + $saldoc ; $actsaldo = mysql_query("UPDATE Equipa SET Saldo = '$nsaldoc' WHERE IDEquipa = '$equipac' ", $db) ; $imovfinf = mysql_query("INSERT INTO Mov_Fin VALUES ('RJ', '$equipaC', '$receitaC', 'Receita Jornada $jornada') ", $db) ; echo "O saldo da equipa da casa foi actualizado; <br>" ; $qsaldof = mysql_query("SELECT Saldo FROM Equipa WHERE IDEquipa = '$equipaf' ", $db) ; while($ti = mysql_fetch_array($qsaldof)) { $saldof = $ti['Saldo'] ; } $nsaldof = $receitaf + $saldof ; $actsaldo = mysql_query("UPDATE Equipa SET Saldo = '$nsaldof' WHERE IDEquipa = '$equipaf' ", $db) ; $imovfinf = mysql_query("INSERT INTO Mov_Fin VALUES ('RJ', '$equipaf', '$receitaf', 'Receita Jornada $jornada') ", $db) ; echo "O saldo da equipa de fora foi actualizado; <br>" ; if($golosc == $golosf) { $pontosc = 1 ; $pontosf = 1 ; } else { if($golosc > $golosf) { $pontosc = 3 ; $pontosf = 0 ; } else { if($golosc < $golosf) { $pontosc = 0 ; $pontosf = 3 ; } else { echo "ERRO COM OS PONTOS ; PROBLEMA GRAVE; A EXECUÇÃO CONTINUOU ;" ; } } } $qdadosclass = mysql_query("SELECT Jogos, JogosC, GolosM, GolosS, Pontos, SaldoGol, PontosC, GolosMC, GolosSC FROM Classificacao WHERE IDLiga = '$liga', IDEquipa = '$equipac' ", $db) ; while($ut = mysql_fetch_array($qdadosclass)) { $jogosc = $ut['Jogos'] ; $jogoscc = $ut['JogosC'] ; $golosmc = $ut['GolosM'] ; $golossc = $ut['GolosS'] ; $saldogc = $ut['SaldoGol'] ; $tpontosc = $ut['Pontos'] ; $tpontoscc = $ut['PontosC'] ; $golosmcc = $ut['GolosMC'] ; $golosscc = $ut['GolosSC'] ; } $njogosc = $jogosc + 1 ; $njogoscc = $jogoscc + 1 ; $ngolosmc = $golosmc + $golosc ; $ngolossc = $golossc + $golosf ; $npontosc = $tpontosc + $pontosc ; $saldojc = $golosc - $golosf ; $nsaldogc = $saldogc + $saldojc ; $npontoscc = $tpontoscc + $pontosc ; $ngolosmcc = $golosmcc + $golosc ; $ngolosscc = $golosscc + $golosf ; $qupclass = mysql_query("UPDATE Classificacao SET Jogos = '$njogosc', JogosC = '$njogoscc', GolosM = '$ngolosmc', GolosS = '$ngolossc', SaldoGol = '$nsaldogc', Pontos = '$npontosc', PontosC = '$npontoscc', GolosMC = '$ngolosmc', GolosSC = '$ngolossc' WHERE IDLiga = '$liga', IDEquipa = '$equipac' ", $db) ; echo "Dados da classificação da equipa da casa actualizados; <br>" ; $qdadosclass = mysql_query("SELECT Jogos, JogosF, GolosM, GolosS, Pontos, SaldoGol FROM Classificacao WHERE IDLiga = '$liga', IDEquipa = '$equipaf' ", $db) ; while($ut = mysql_fetch_array($qdadosclass)) { $jogosf = $ut['Jogos'] ; $jogosff = $ut['JogosF'] ; $golosmf = $ut['GolosM'] ; $golossf = $ut['GolosS'] ; $saldogf = $ut['SaldoGol'] ; $tpontosf = $ut['Pontos'] ; } $njogosf = $jogosf + 1 ; $njogosff = $jogosff + 1 ; $ngolosmf = $golosmf + $golosf ; $ngolossf = $golossf + $golosc ; $npontosf = $tpontosf + $pontosf ; $saldojf = $golosf - $golosc ; $nsaldogf = $saldogf + $saldojf ; $qupclass = mysql_query("UPDATE Classificacao SET Jogos = '$njogosf', JogosF = '$njogosff', GolosM = '$ngolosmf', GolosS = '$ngolossf', SaldoGol = '$nsaldogf', Pontos = '$npontosf' WHERE IDLiga = '$liga', IDEquipa = '$equipaf' ", $db) ; echo "Dados da classificação da equipa de fora actualizados; <br>" ; $fecharjogo = mysql_query("UPDATE Jogo SET Fechado = 1 WHERE Liga = '$liga', Jornada = '$jornada', Jogo = '$jogo' ", $db) ; echo "O Jogo foi fechado; <br> " ; } } } else { setcookie("errofj", "Erro : Password Incorrecta....", time() + 20) ; header('Location: /fecharjogoespecial.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.