Jump to content

phpcode

Members
  • Posts

    62
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

phpcode's Achievements

Member

Member (2/5)

0

Reputation

  1. Can anyone tell me how I would show and hide a text box depending on what the user has selected in the list box? So if the user selected the option "Other" it should show a text box under the list and if they chosen something else it would hide the text box.
  2. mail($to,$subject,$body,"From: $headers"); I want to create a mailing list for my members and make my code get each email from a text file. The emails in the text file will be like this: Could someone show me how I could make it go through each email?
  3. Thanks mikesta I'm trying to list about 10 shows and I want to know if there is any better way in doing this? This is what I've got now: <?php function get_between ($text, $s1, $s2) { $mid_url = ""; $pos_s = strpos($text,$s1); $pos_e = strpos($text,$s2); for ( $i=$pos_s+strlen($s1) ; ( ( $i < ($pos_e)) && $i < strlen($text) ) ; $i++ ) { $mid_url .= $text[$i]; } return $mid_url; } function get_time ($string) { $time = end(explode('@', $string)); $time = strtotime($time); $now = time(); $timeLeft = $time - $now; $secsInDay = 60*60*24;//60 seconds in a min * 60 mins in an hour * 24 hours in a day //day sleft $daysLeft = (int)($timeLeft / $secsInDay); $timeLeft %= $secsInDay; $secsInHour = 60*60; //hours left $hoursLeft = (int)($timeLeft / $secsInHour); $timeLeft %= $secsInHour; //minutes left; $minutesLeft = (int)($timeLeft / 60);//60 secs in a minute $timeLeft %= 60; //secs left is timeLeft $secsLeft = $timeLeft; echo "$daysLeft days $hoursLeft hours $minutesLeft minutes and $secsLeft seconds<BR><BR>"; } $rs2 = file_get_contents("http://services.tvrage.com/tools/quickinfo.php?show=lost&exact=1"); $between = get_between($rs2, "RFC3339", "GMT+0"); get_time($between); $rs2 = file_get_contents("http://services.tvrage.com/tools/quickinfo.php?show=dexter&exact=1"); $between = get_between($rs2, "RFC3339", "GMT+0"); get_time($between); ?>
  4. I'm trying to make a countdown page by getting the information from this websites api but I need to know how I would get it to display how many hours and minutes left. The URL is http://services.tvrage.com/tools/quickinfo.php?show=dexter&exact=1 The part I'm working on is: RFC3339@2009-12-06T21:00:00 Does anyone know how?
  5. I'm trying to create a news system and I want it to display the three latest news post on the front page but I'm not sure how All the news is arranged by an ID number that starts from 0 for the oldest to how ever many news post there is. I also have a date field so if there's a way to arrange by date could someone tell me?
  6. Hi is it possible to write to a certain part of a file? I want to make a script that would add text between <form> and </form> is it possible?
  7. <? mysql_connect ("localhost", "root", "lllllll"); mysql_select_db ("db"); $usernameF = $_POST['usernameF']; $action = $_POST['action']; if ($usernameF != "" and $action == "Lost Password") { $SQLquery = "select name from userslist where instr(email,'$usernameF') > 0 and length(email) = length('$usernameF')"; $result = mysql_query ($SQLquery) or die ("Query failed"); if (mysql_num_rows($result) > 0) { for ($n = mysql_num_rows ($result) - 1; $n >=0; $n--) { if (!mysql_data_seek ($result, $n)) { printf ("Cannot seek to row %d\n", $n); continue; } if(!($row = mysql_fetch_object ($result))) echo "t1"; continue; } $passwordF = strtoupper(substr(ereg_replace("[^A-Z0-9]", "", crypt(time())) . ereg_replace("[^A-Z0-9]", "", crypt(time())) . ereg_replace("[^A-Z0-9]", "", crypt(time())), 0, ); $SQLquery = "update userslist set passwd = '".crypt($passwordF,substr($usernameF,0,2))."' where instr(email,'$usernameF') > 0 and length(email) = length('$usernameF') and name = '$row->name'"; $result = mysql_query ($SQLquery) or die ("Query2 failed"); $recipient = $usernameF; $subject = "Login Details"; mail($recipient, "$subject", "Your password has been changed to :- $passwordF", "From: info@nodomainyet.com\nContent-Type: text/html; charset=iso-8859-1\n", "-finfo@nodomainyet.com"); echo " <script> location.href='?display=Member%20Password%20Sent&menu=nonmenu'; </script>"; } } ?> When I run this code it stops but doesn't tell me why. I checked the error log but nothing is there and I have changed the error reporting. Can anyone see whats wrong?
  8. Nope I want it all done in PHP.
  9. This code is meant to insert the users info into the database called accounts but it doesn't and I don't get any errors. $dbhost = 'localhost'; $dbname = 'site'; $dbuser = 'root'; $dbpass = ''; $dbtable = 'accounts'; $db = mysql_connect($dbhost, $dbuser, $dbpass) or die (mysql_error()); if (!mysql_select_db($dbname)) { exit('<strong>Error: </strong>Couldn\'t select MySQL Database.<br />'.mysql_errno().': '.mysql_error()); } $db = mysql_query("SELECT * FROM $dbtable"); if (@mysql_num_rows($db) != 0) { while ($row = mysql_fetch_array($db)) { if ($username == $row['username']) { $error .= "Username already registered"; } } } $keys = '`username`,`password`,`email`'; $values = "'$username','$password','$email'"; $db = mysql_query("INSERT INTO $dbtable ($keys) VALUES ($values)"); if (!$db) { exit('<strong>Error: </strong>Couldn\'t insert into MySQL Database.<br />'.mysql_errno().': '.mysql_error()); } else { echo "Thanks for registering " . $username . "! An email has been sent to you containing an activation link. You must click it before you can login."; } } Can anyone see anything wrong?
  10. Does anyone know how I would print text onto an animated image? I've seen people use it for their captcha.
  11. I've created a .htaccess file but when I goto a php page I get an internal server error. I've got it to work for protecting directorys but it wont work for this: <FilesMatch "^.*.png"> SetHandler application/x-httpd-php </FilesMatch> It worked in http.conf but I just want it to run in 1 directory not all of them. Can anyone tell me why it's giving me an error?
×
×
  • 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.