-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
<?php // Workout the time since the last turn change function lastturn($time){ $rs = mysql_connect( "localhost", "ace_ACE", "*****" ); $rs = mysql_select_db( "ace_cf" ); // SQL query for all entries in descending order $sql = "UPDATE `cf_info` SET lastturn = " . $time . ""; $rs = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error()); } // Workout the time until the next turn change function nextturn(){ $rs = mysql_connect( "localhost", "ace_ACE", "*****" ); $rs = mysql_select_db( "ace_cf" ); // SQL query for all entries in descending order $sql = "SELECT `lastturn` FROM `cf_info`"; $SQLq = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error()); $rss = mysql_fetch_assoc( $SQLq ); $lastturntime = $rss['lastturn']; // grab time since last turn change $lastturnchange = $lastturntime; //[0]; // get the current time $currenttime = time(); // get the difference between last turn change and the current time $dif = $currenttime - $lastturnchange; // workout how many minutes until the next turn : part 1 $nextturnmin = ceil($dif/60); //round up (remove the seconds) // workout how many minutes until the next turn : part 2 $nextturn = 60 - $nextturnmin; // if the time until the next turn is less then zero, set the time till next turn to 0 if ($nextturnmin < 0) { $nextturnmin = 0; } // return the time until next turn change return $nextturnmin; }
-
maybe <?php include("config.php"); if( !isset($_GET['photo_id']) ){ $msg .= "No photo selected! Please <a href=\"gallery.php\">choose an album</a> you would like to view."; // Display error message displayPage($msg); die(); } // get picture details $con; $id = (int)$_GET['photo_id']; $sql = "SELECT photo_title, photo_id, photo_location, album_id FROM photos WHERE photo_id = $id"); $result = @mysql_query($sql) or die("Error retrieving record: " . mysql_error()); $num_rows = mysql_num_rows($result); if($num_rows == 0) { $sql = "SELECT photo_title, photo_id, photo_location, album_id FROM photos WHERE photo_id = 1"); $result = @mysql_query($sql) or die("Error retrieving record: " . mysql_error()); } while($row = @mysql_fetch_array($result)) { $photo_title = $row['photo_title']; $photo_loc = $row['photo_location']; $album = $row['album_id']; } ?>
-
[SOLVED] to use insert query in a javascript function?
MadTechie replied to chanchelkumar's topic in PHP Coding Help
this is a AJAX problem, please explain what you mean by "controls get lost" as a note i had a problem where i update the page including the textbox for seaching.. and the javascript wouldn't run after the first run.. my solution was to have 2 div's #1 controls (the search textbox) #2 results (with a form) (no javascript linked to these) then the ajax would only update the results, thus not lossing the link from JS to Search (text box) hope this helps -
No, because it can only be solved with parsed data which the output from PHP and will need to be formatted for the browser which is HTML.. so to sum up its NOT a PHP question!
-
Just wondering whats the field type in the database ? as if its timestamp your need to format the date/time (ie 2007-10-04 11:00:00)
-
Ahh beat me OK option 2 $query=mysql_query("SELECT MAX(id) as maxID FROM `table` LIMIT 1"); $row=mysql_fetch_array($query); echo $row['maxID']; BUT i think you MAYBE doing something bad here if you want the last ID entered after an insert use mysql_insert_id() mysql_query("INSERT INTO mytable (product) values ('kossu')"); printf("Last inserted record has id %d\n", mysql_insert_id()); (assuming ID is an AUTO_INCREMENT ) as if 2 members insert at the same time your get a problem using the highest
-
OK.. well thats not a PHP question!! maybe the freelance section
-
[SOLVED] ftp_put - Adds empty lines between every line on upload.
MadTechie replied to haaglin's topic in PHP Coding Help
i had a problem before with uploads but that was an access right problem, i see what i can come up with.. -
[SOLVED] ftp_put - Adds empty lines between every line on upload.
MadTechie replied to haaglin's topic in PHP Coding Help
Hummm, i use ProFTPD as well, i could have a play when i'm at home (in the office at the moment), other things to play with would be Passive FTP.. (mainly when a firewall cause problems) -
T&C refers to many thing but in this case i mean "Terms & Conditions", from a "quick" look i don't see any on their site.. so i would assume thiers no Terms or Conditions for use.. so to grab the data you could use cURL BUT.... you can only lookup 10 IP's a day unless your register but then its 50..
-
try this <?php // Workout the time since the last turn change function lastturn($time) { $rs = mysql_connect( "localhost", "@@@@@@", "@@@@@" ); $rs = mysql_select_db( "@@@@" ); // SQL query for all entries in descending order $sql = "UPDATE `cf_info` SET lastturn = " . $time . ""; $rs = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error()); } // Workout the time until the next turn change function nextturn() { $conn = mysql_connect( "localhost", "@@@@@", "@@@@@" ); $sdb = mysql_select_db( "@@@@" ); // SQL query for all entries in descending order $sql = "SELECT `lastturn` FROM `cf_info`"; $SQLq = mysql_query( $sql ) or die('Query:<br />' . $sql . '<br /><br />Error:<br />' . mysql_error()); $RS = mysql_fetch_assoc( $SQLq ); $lastturntime = $RS['lastturn']; // grab time since last turn change $lastturnchange = $lastturntime; // get the current time $currenttime = time(); // get the difference between last turn change and the current time $dif = $currenttime - $lastturnchange; // workout how many minutes until the next turn : part 1 $nextturnmin = $dif/60; // workout how many minutes until the next turn : part 2 $nextturn = 60 - $nextturnmin; // if the time until the next turn is less then zero, set the time till next turn to 0 if ($nextturnmin < 0) { $nextturnmin = 0; } // return the time until next turn change return $nextturnmin; } PS remove some details from your last post EDIT: reposted (posted old code)
-
you missing fetch from the MySql
-
your need to check the T&C's, if its free to scrape, but if you code it badly they probably block your server.. LOL, i don't think i would add my "solved topics"..
-
[SOLVED] How to extract from one table into another
MadTechie replied to bri4n's topic in PHP Coding Help
try this $query = "INSERT INTO vote (`charity`) VALUES ('".$row['charity']."') or die ("Could not execute query"); -
either use the bold font from the verdana family or emulate it
-
your missing the break; for one.. and as i said whats the goal of this?
-
personally i would use imagestring for all the text, as for changing the font you need to use imageloadfont() or imagettftext, but i don't think you can justify the text (i think not)..your best best is probably padding
-
try this (note don't echo the headers) <?php $message = ""; include "connect.php"; $username = $_POST["user"]; $password = $_POST["pass"]; if (!$username) { header("Location: statuscheck.php?check=4"); exit; } if (!$password) { header("Location: statuscheck.php?check=4"); exit; } $password = MD5($password); $issuchusername = mysql_query("SELECT * FROM members WHERE Gamertag = '$username'"); $usernamelogin = mysql_num_rows($issuchusername); if ($usernamelogin == 1) { $issuchpassword = mysql_query("SELECT * FROM members WHERE Gamertag = '$username' AND Password = '$password'"); $passwordlogin = mysql_num_rows($issuchpassword); if ($passwordlogin == 1) { $time = time(); $cookie_data = $username.'-'.$password; if(setcookie ("cookie_info",$cookie_data, $time+1800)==TRUE) { } else { $message .= "You computer does not support cookies. <BR> To view other pages after logged in you need to have cookies enabled.<BR>"; } } else { $message .= "your password/username is incorrect"; exit; } } else { header("Location: statuscheck.php?check=5"); exit; } ?> <html> <head> <meta name="Microsoft Theme 2.00" content="Slate 011"> <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 11"> <meta name=Originator content="Microsoft Word 11"> <link rel=File-List href="index_files/filelist.xml"> <link rel=Edit-Time-Data href="index_files/editdata.mso"> <title>Xxxxx Clan</title> <style> <!-- /* Font Definitions */ @font-face {font-family:Verdana; panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-family:swiss; mso-font-pitch:variable; mso-font-signature:-1593833729 1073750107 16 0 415 0;} @font-face {font-family:Halo; panose-1:0 0 0 0 0 0 0 0 0 0; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:-2147483645 0 0 0 1 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0cm; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:Verdana; mso-fareast-font-family:"Times New Roman"; mso-bidi-font-family:"Times New Roman"; color:white;} h1 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:1; font-size:16.0pt; font-family:Verdana; mso-bidi-font-family:Arial; color:white; mso-font-kerning:16.0pt; font-weight:bold;} h2 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:2; font-size:14.0pt; font-family:Verdana; mso-bidi-font-family:Arial; color:white; font-weight:normal;} h3 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:3; font-size:13.0pt; font-family:Verdana; mso-bidi-font-family:Arial; color:white; font-weight:normal;} h4 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; page-break-after:avoid; mso-outline-level:4; font-size:14.0pt; font-family:Verdana; color:white; font-weight:normal;} h5 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; mso-outline-level:5; font-size:13.0pt; font-family:Verdana; color:white; font-weight:normal;} h6 {mso-style-next:Normal; margin-top:12.0pt; margin-right:0cm; margin-bottom:3.0pt; margin-left:0cm; mso-pagination:widow-orphan; mso-outline-level:6; font-size:11.0pt; font-family:Verdana; color:white; font-weight:normal;} a:link, span.MsoHyperlink {color:#B6B04D; text-decoration:underline; text-underline:single;} a:visited, span.MsoHyperlinkFollowed {color:#707849; text-decoration:underline; text-underline:single;} p {font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} p.style1, li.style1, div.style1 {mso-style-name:style1; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:black;} p.style2, li.style2, div.style2 {mso-style-name:style2; mso-margin-top-alt:auto; margin-right:0cm; mso-margin-bottom-alt:auto; margin-left:0cm; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman"; color:white;} span.style11 {mso-style-name:style11; color:black;} span.style21 {mso-style-name:style21; color:white;} @page Section1 {size:612.0pt 792.0pt; margin:0cm 90.0pt 72.0pt 90.0pt; mso-header-margin:35.4pt; mso-footer-margin:35.4pt; mso-paper-source:0;} div.Section1 {page:Section1;} .style1 {color: #FFFFFF} .style3 {font-size: 24pt} --> </style> </head> <body bgcolor=white background="index_files/image001.gif" lang=EN-US link="#B6B04D" vlink="#707849" style='tab-interval:36.0pt'> <div class=Section1> <p class=MsoNormal style='margin-right:-54.0pt'><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <div align=center> <table class=MsoTableTheme border=1 cellspacing=0 cellpadding=0 style='margin-left:.65pt;border-collapse:collapse;border:none;mso-border-alt: solid #989898 .25pt;mso-yfti-tbllook:480;mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-border-insideh:.75pt solid #989898;mso-border-insidev:.75pt solid #989898'> <tr style='mso-yfti-irow:0;mso-yfti-firstrow:yes;height:141.0pt;background-image:url("index_files/header_short.jpg");'> <td colspan=2 valign=top style='width:680.0pt;border:solid #989898 1.0pt; mso-border-alt:solid #989898 .25pt;mso-border-bottom-alt:solid #989898 .75pt; padding:0cm 5.4pt 0cm 5.4pt;height:141.0pt'> <p class=MsoNormal align=center style='margin-top:0cm;margin-right:-9.75pt; margin-bottom:0cm;margin-left:-4.45pt;margin-bottom:.0001pt;text-align:center; text-indent:-9.0pt'><![if !vml]><![endif]><span lang=EN-GB style='mso-ansi-language: EN-GB'><![if !vml]><![endif]><o:p></o:p></span></p> <p class=MsoNormal align=center style='margin-top:0cm;margin-right:-9.75pt; margin-bottom:0cm;margin-left:-4.45pt;margin-bottom:.0001pt;text-align:center; text-indent:-9.0pt'><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p class=MsoNormal><span lang=EN-GB style='font-size:10.0pt;font-family:"Times New Roman"; color:windowtext;mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p class=MsoNormal align=center style='text-align:center'><strong><span lang=EN-GB style='font-size:10.0pt;color:windowtext;mso-ansi-language:EN-GB'>XXXXXX</span></strong><span lang=EN-GB style='font-size:10.0pt;font-family:"Times New Roman";color:windowtext'> </span><strong><span style='font-family:Verdana'><o:p></o:p></span></strong></p> <p align=center style='text-align:center'><o:p> </o:p></p> <p align=center style='text-align:center'><span lang=EN-GB style='font-size: 10.0pt;mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p align=center style='text-align:center'><strong><span lang=EN-GB style='font-size:10.0pt;mso-ansi-language:EN-GB'>Here to Finish the fight </span></strong><span lang=EN-GB style='font-size:10.0pt;mso-ansi-language:EN-GB'><o:p></o:p></span></p> </td> </tr> <tr bgcolor="#FFFFFF" style='mso-yfti-irow:1;height:14.5pt'> <td colspan=2 valign=top style='width:680.0pt;border:solid #989898 1.0pt; border-top:none;mso-border-top-alt:solid #989898 .75pt;mso-border-top-alt: .75pt;mso-border-left-alt:.25pt;mso-border-bottom-alt:.75pt;mso-border-right-alt: .25pt;mso-border-color-alt:#989898;mso-border-style-alt:solid;background: #000000;padding:0cm 5.4pt 0cm 5.4pt;height:14.5pt'> <p class=MsoNormal align=right style='text-align:right'><b style='mso-bidi-font-weight: normal'><span lang=EN-GB style='mso-ansi-language:EN-GB'><a href="index.html"><span style='color:white'>Menu</span></a> <a href="members.php"><span style='color:white'>Members</span></a> <a href="video's.php"><span style='color:white'>Video’s</span></a> <a href="pictures.php"><span style='color:white'>Pictures</span></a><span class=style21> </span></span></b> <a href="login.html" class="style1">Login</a> <a href="video's.php"><span class=style21><o:p> </o:p></span></p> </td> </tr> <tr style='mso-yfti-irow:2;height:467.7pt'> <td width=747 valign=top style='width:549.75pt;border:solid #989898 1.0pt; border-top:none;mso-border-top-alt:solid #989898 .75pt;mso-border-alt:solid #989898 .75pt; mso-border-left-alt:solid #989898 .25pt;padding:0cm 5.4pt 0cm 5.4pt; height:467.7pt' background="index_files/bk2.jpg"> <p class=MsoNormal style='margin-right:-9.1pt;text-indent:-4.75pt'><![if !vml]><![endif]><span lang=EN-GB style='mso-ansi-language: EN-GB'><!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:562.5pt;height:466.5pt'> <v:imagedata src="index_files/image003.jpg" o:title="halo-3"/> </v:shape><![endif]--><![if !vml]><![endif]><o:p></o:p></span></p> <p><span class="style3"><span class="MsoNormal"><span lang=EN-GB style='mso-ansi-language: EN-GB'> <?php //message echo $message; ?> </span></span></span><span style='font-size:10.0pt'><o:p><span class="MsoNormal"> </span></o:p></span></p> </td> <td width=202 valign=top style='width:120.9pt;border-top:none;border-left: none;border-bottom:solid #989898 1.0pt;border-right:solid #989898 1.0pt; mso-border-top-alt:solid #989898 .75pt;mso-border-left-alt:solid #989898 .75pt; mso-border-alt:solid #989898 .75pt;mso-border-right-alt:solid #989898 .25pt; padding:0cm 5.4pt 0cm 5.4pt;height:467.7pt'> <p class=MsoNormal align=center style='margin-left:-14.4pt;text-align:center; text-indent:9.15pt'><u><span lang=EN-GB style='mso-ansi-language:EN-GB'>Clan Pictures<o:p></o:p></span></u></p> <p class=MsoNormal style='margin-top:0cm;margin-right:-5.4pt;margin-bottom: 0cm;margin-left:-6.75pt;margin-bottom:.0001pt'><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> <p class=MsoNormal style='margin-left:-14.4pt;text-indent:9.15pt'><u><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p><span style='text-decoration: none'> </span></o:p></span></u></p> </td> </tr> <tr style='mso-yfti-irow:3;mso-yfti-lastrow:yes'> <td colspan=2 valign=top style='width:680.0pt;border:solid #989898 1.0pt; border-top:none;mso-border-top-alt:solid #989898 .75pt;mso-border-alt:solid #989898 .25pt; mso-border-top-alt:solid #989898 .75pt;padding:0cm 5.4pt 0cm 5.4pt'> <p class=MsoNormal><span lang=EN-GB style='font-size:9.0pt;mso-ansi-language: EN-GB'>About us - Contact us - Copyright 2007<o:p></o:p></span></p> </td> </tr> </table> </div> <p class=MsoNormal><span lang=EN-GB style='mso-ansi-language:EN-GB'><o:p> </o:p></span></p> </div> </body> </html>
-
http://www.phpfreaks.com/forums/index.php/topic,161803.msg707750.html#msg707750
-
can be 100, but it will be a waste.. MD5 32 chars EDIT: remember your need to re-enter the passwords as the current one are only 10 chars long thus invalid
-
try this <?php header("Content-Type: image/jpeg"); $im = @imagecreatefromjpeg("test.jpg"); imagestring($im, 1, 5, 5, "A Simple Text String", $text_color); imagejpeg($img); ?>
-
Ah yeah will do that is none are found try this <html> <head> <link href="interface design/css.css" rel="stylesheet" type="text/css"> </head> <body class="bg"> <?php $datein=$_POST['check-in-date']; $dayin=$_POST['check-in-day']; $r_type=$_POST['r_category']; $pac=$_POST['special']; $checkin = "$datein-$dayin" ; $nyt=$_POST['nyts']; $id=$_COOKIE['ID']; mysql_connect('localhost', 'root', 'tmc') or die(mysql_error()); mysql_select_db('tgp') or die(mysql_error()); $room= mysql_query("SELECT r_no FROM room WHERE r_no ='$r_type'")or die(mysql_error()); while ($row = mysql_fetch_assoc($room) ) { $room = $row["r_no"]; //ive got error here in this line if(!mysql_query ("INSERT INTO reservation VALUES ('0','$checkin', '$nyt', '$room', '$pac', '$id')")) { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print '<b>reservation failed</b>'; print '</div>'; } else { print '<div style=" width: 450px; background:black;filter:alpha(opacity=75); -moz-opacity:.75;opacity:.75; margin-left: 0; margin-right:0;">'; print 'Your Information has been successfully added to the database.'; print '<br><br>'; $result=mysql_insert_id(); print "Your Reservation No. is <b>$result</b>"; print '</div>'; break; } } mysql_close(); ?> </body> </html> Techie out, head killing now!
-
1. i rarey download members files.. 2. i kinda like to know the "Problem", its not working is kinda lazy,
-
sure.. you could do that.. (manually) (not with a standard php setup) and to have it run automatically would be slower and cost more to run.. and in the long run, probably not easier...
-
Change the password varchar from 10 to 32 (MD5 has 32 chars) <?php include "connect.php"; if (!isset($_POST["user"])) { header("Location: statuscheck.php?check=4"); } if (!isset($_POST["pass"])) { header("Location: statuscheck.php?check=4"); } $username = $_POST["user"]; $password = $_POST["pass"]; $password = MD5($password); $issuchusername = mysql_query("SELECT * FROM members WHERE Gamertag = '$username'"); $usernamelogin = mysql_num_rows($issuchusername); if ($usernamelogin == 1) { $issuchpassword = mysql_query("SELECT * FROM members WHERE Gamertag = '$username' AND Password = '$password'"); $passwordlogin = mysql_num_rows($issuchpassword); if ($passwordlogin == 1) { $time = time(); $cookie_data = $username.'-'.$password; if(setcookie ("cookie_info",$cookie_data, $time+1800)==TRUE) { } else { echo "You computer does not support cookies. <BR> To view other pages after logged in you need to have cookies enabled.<BR>"; } } else { echo "your password/username is incorrect"; exit; } } else { echo header("Location: statuscheck.php?check=5"); exit; } ?>