jalmz
Members-
Posts
25 -
Joined
-
Last visited
Everything posted by jalmz
-
Hi guys, What is the best script or code to upload .txt file in mysql database? using php.. Thanks inside the text file.. and I would like to insert it n my existing database. "0202011328","Icore 3","3092.16","1/4/2013","Japan" "0101072497","Icore 4","80.57","1/14/2013","philippines" "0101020340","Amd athlon","2246.96","1/7/2013","USA" and the txt file consist 27 + of rows. thanks
-
Hi guys, do you have any idea on how to sanitize this code? using FILTER_SANITIZE_STRING; FILTER_VALIDATE_IP and ect? Thanks <form action="rnrequest.php" method="POST"> <table class="txt2"> <tr><td >Song title: </td><td><input type="text" name="song" value="" class=".texta"></td></tr> <tr><td>Artist: </td><td><input type="text" name="artist" value=""></td></tr> <tr><td>Your name: </td><td><input type="text" name="name" value=""></td></tr> <tr><td>Greetings: </td><td><textarea name="greetings"></textarea></td></tr> </table> <input type="submit" name="submit" value="Send"> </form> </div> <?php if (isset($_POST['submit'])) { if (empty($_POST['name'])) { echo "Sorry, you haven't supplied your name<br />"; $reg = "no"; } $sql = "SELECT COUNT(*) FROM request_song WHERE ip='{$ip}'"; $result = mysql_query($sql); if (mysql_result($result, 0) > 0) { echo "Sorry, You already wished for one song, you cannot request for another until the DJ's have seen your request..<br />"; $reg = "no"; } if ($reg == "yes") { $dt2=date("Y-m-d H:i:s"); $sql = "INSERT INTO request_song(song, artist, name, greetings, ip, date) VALUES('{$_POST['song']}', '{$_POST['artist']}', '{$_POST['name']}', '{$_POST['greetings']}','{$ip}', '$dt2')"; mysql_query($sql); } } ?>
-
Thank you WebStyles! It works like a charm.. =)
-
Thanks guys, but im comfuse on how to implement with the code above... ".$line["title"]."
-
Hi guys, I would like to ask your help on how to trim the output (title). for example the title is "php freaks rocks" it should be "php freaks..." Thanks.. <?php $Url_Path = ""; $data_dir = "" ; $images_dir =$Url_Path."/images/"; $rel_dir = ""; //Database Setting //You must change these values in order to run this script //These value are not visible in the output page source $host = ""; //Server Name $user= ""; //Username $password= ""; //Password $database=""; //Photopost database name or forum database name //Display Setting (Changes to fit your page) $q_switch = "latest"; // "random" or "most_views" or "latest" $limit = 3; //number of image to show // CSS Setting (optional) $class_photopost = ""; $class_gallery = "gallery"; // ************************************************************************* // ************************************************************************* ///////////don't edit below this line if you are too afraid to kill the code////////////// // ---------------------- THESE FUNCS FROM pp-inc ----------------- function mysql_query_eval( $query, $database ) { global $Globals; $mysql_eval_error=""; $mysql_eval_result = mysql_query($query, $database) or $mysql_eval_error = mysql_error(); if ($mysql_eval_error) { if ( $Globals{'debug'} == 1 ) { $letter = "An error was encountered during execution of the query:\n\n"; $letter .= $query."\n\n"; $letter .="The query returned with an errorcode of: \n\n$mysql_eval_error\n\n"; $letter .= "If you need assistence or feel this is a 'bug'; please report it to our "; $letter .= "support forums at: http://www.techimo.com/forum/f27/index.html\n\n"; $letter .= "To turn off these emails, set \$debug=0 in your config-inc.php file."; $email = $Globals{'adminemail'}; $email_from = "From: ".$Globals{'adminemail'}; $subject="Subject: ".$Globals{'webname'}." MySQL Error Report"; $subject=trim($subject); mail( $email, $subject, $letter, $email_from ); } elseif ( $Globals{'debug'} == 2 ) { dieWell( "MySQL error reported!<p>Query: $query<p>Result: $mysql_eval_error<p>Database handle: $database" ); exit; } return FALSE; } else { return $mysql_eval_result; } } function get_ext( $filename ) { $photolen = strlen($filename); $RetVal = substr( $filename, $photolen-3, $photolen); return $RetVal; } function get_filename($filename) { // strip off the last 4 $len = strlen( $filename )-4; $RetVal = substr( $filename, 0, $len); return $RetVal; } // ---------------------- THESE FUNCS FROM pp-inc ----------------- // Connecting, selecting database $link = mysql_connect ("$host", "$user", "$password") or die ('I cannot connect to the database.'); mysql_select_db ("$database")or die("Could not select database"); // Here is the hacked up display_gallery($q_switch) $catquery=""; if ( IsSet($cat) ) { $querya="SELECT catname FROM photopost_categories WHERE id=$cat"; $catq = mysql_query_eval($querya,$link); $catr = mysql_fetch_array($catq); $catname = $catr['catname']; mysql_free_result($catq); $queryb = "SELECT id FROM photopost_categories WHERE parent='$cat' ORDER BY catorder ASC"; $boards = mysql_query_eval($queryb,$link); $cnt=0; while ( $row = mysql_fetch_array($boards, MYSQL_ASSOC)) { $catqid = $row['id']; if ( $cnt == 0 ) { $cnt=1; $catquery .= "$catqid"; } else { $catquery .= ",$catqid"; } } mysql_free_result($boards); } // Connecting, selecting database // Selecting method and Perform SQL query switch ($q_switch) { case "most_views": if ( !IsSet($cat) ) { $group_title = "Most Popular Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY views DESC LIMIT $limit"; } else { $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY views DESC LIMIT $limit"; $group_title = "Most Popular Images - $catname"; } break; case "latest": if ( !IsSet($cat) ) { $group_title = "Most Recent Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY date DESC LIMIT $limit"; break; } else { $group_title = "Most Recent Images - $catname"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY date DESC LIMIT $limit"; break; } break; default: if ( !IsSet($cat) ) { $group_title = "Random Images - All Categories"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat ORDER BY RAND() DESC LIMIT $limit"; break; } else { $group_title = "Random Images - $catname"; $query = "SELECT id,user,userid,cat,title,bigimage,views FROM photopost_photos WHERE bigimage!='' AND approved='1' $exclude_cat AND cat in ($catquery) ORDER BY RAND() DESC LIMIT $limit"; break; } break; } $i = 1; $e = 2; $col_val = $column; $result = mysql_query_eval($query,$link) or die("Query failed"); print "<ul class=\"".$class_gallery."\"> "; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { $photo_name = get_filename( $line['bigimage'] ); print "<li>"; $theext = get_ext( $line['bigimage'] ); $thecat = $line['cat']; $temp_user = ($line["userid"]); $filepath = "$data_dir"."$thecat/thumbs/$photo_name.$theext"; $image_stats = getimagesize( $filepath ); $width = $image_stats[0]; $height = $image_stats[1]; $rel_path = "$rel_dir"."$thecat/thumbs/$photo_name.$theext"; print "<a class=\"".$class_photopost."\" href=\"$Url_Path"."showphoto.php?photo=".$line['id']. "\" title=\"".$line["title"]."\">"; if ( file_exists( $rel_path ) ) print "<img src='$filepath' alt='$filepath' width='$width' height='$height' /></a>"; else print "<img src='".$images_dir."nothumb.gif' alt='$filepath' width='$width' height='$height' /></a>"; if ($q_switch == "most_views") { print "<br />".$line["title"]."<br />".$line["views"]." views"; print "</a>"; } else { print "<br /> <a class=\"".$class_photopost."\" href=\"$Url_Path"."showphoto.php?photo=".$line['id']. "\" title=\"".$line["title"]." ".$line["views"]." views\"> ".$line["title"]."<br />".$line["views"]." views"; print "</a></li>"; } } print " </ul> "; // Closing connection mysql_close($link); // mysql_close($db_link); ?>
-
Hi guys, im having problem in sending email using this code.. <?php if(isset($_POST['submitted'])) { if($_POST['emailTo'] == '') { $emailToError = 'You forgot to enter the email address to send to.'; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $_POST['emailTo'])) { $emailToError = 'Enter a valid email address to send to.'; } if($_POST['emailFrom'] == '') { $emailFromError = 'You forgot to enter the email address to send from.'; } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $_POST['emailFrom'])) { $emailFromError = 'Enter a valid email address to send from.'; } if($_POST['subject'] == '') { $subjectError = 'You forgot to enter the subject.'; } if($_POST['message'] == '') { $messageError = 'You forgot to enter the message.'; } if(!isset($emailToError) && !isset($emailFromError) && !isset($subjectError) && !isset($messageError)) { include('sendemail.php'); include('thanks.php'); } } ?> <form action="[color=red]sendemail.php[/color]" method="post" id="sendEmail"> <h1>Send An Email</h1> <p class="alert">* All fields are required</p> <ol class="forms"> <li><label for="emailTo">To</label><input type="text" name="emailTo" id="emailTo" value="<?= $_POST['emailTo']; ?>" /><?php if(isset($emailToError)) echo '<span class="error">'.$emailToError.'</span>'; ?></li> <li><label for="emailFrom">From</label><input type="text" name="emailFrom" id="emailFrom" value="<?= $_POST['emailFrom']; ?>" /><?php if(isset($emailFromError)) echo '<span class="error">'.$emailFromError.'</span>'; ?></li> <li><label for="subject">Subject</label><input type="text" name="subject" id="subject" value="<?= $_POST['subject']; ?>" /><?php if(isset($subjectError)) echo '<span class="error">'.$subjectError.'</span>'; ?></li> <li><label for="message">Message</label><textarea name="message" id="message"><?= $_POST['message']; ?></textarea><?php if(isset($messageError)) echo '<span class="error">'.$messageError.'</span>'; ?></li> <li class="buttons"><button type="submit" id="submit">Send Email ยป</button><input type="hidden" name="submitted" id="submitted" value="true" /></li> </ol> </form> sendemail.php <?php $to = "myemail@mymail.com"; $mailFrom = $_POST['emailFrom']; $subject = $_POST['subject']; $message = $_POST['message']; mail($to, $subject, $message); ?> thanks.php <h1>Success</h1> <p>Your email was sent.</p> <div class="clearing"></div> </div> </body> </html> <?php exit(); ?> in the email form, im comfused.. <form action="sendemail.php" method="post" id="sendEmail"> what is the exact code of form action? thanks
-
anyone?
-
wow.. Thank you neil.. just one last question.. what about this code... that uses Unix Time Stamp? $time_now = time(); $week = $time_now + 86400; $time_tom = $time_now + 518400; if ($result = mysql_query ("SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from BETWEEN '$week' AND '$time_tom' ORDER BY dateline_from LIMIT 7")) { if (mysql_num_rows($result)) { $return = ''; while ($row = mysql_fetch_array( $result )) { $return .= "<a href='/forum/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=1' title='". $row['title'] . "' style='font-size:11px;'>" . $row['title'] . "</a> (". date("D", $row['dateline_from']+54000)."), "; } echo rtrim($return, ', '); } else { echo "No events currently listed"; } } The result of this code is todays date + 3 days.. How can I display Todays Date + 7 days For this Month of April. Again, thank you
-
Thanks for the reply it works perfectly.. what about today's date + 7. For example today is April 13, 2011. I will display the event beginning on April 20 to the end of this month.. thank you
-
Hi guys, Im having problem on how to achieved this one.. I would like to get the all event of this month (April ) Starting todays date.. $now = gmdate("Y-m-d", mktime(gmdate("H")+8, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d")+8, gmdate("Y"))); $week = gmdate("Y-m-d", mktime(gmdate("H")+8, gmdate("i"), gmdate("s"), gmdate("m"), gmdate("d")+30, gmdate("Y"))); if ($result = mysql_query("SELECT * FROM fiesta WHERE sta_date BETWEEN '$now' AND '$week' ORDER BY sta_date LIMIT 10")){ if (mysql_num_rows($result)) { $return = ''; while ($row = mysql_fetch_array( $result )) { $date = date("D",strtotime($row["sta_date"])); $return .= "<a href='sta.php' style='font-size:11px;' title='" . $row['fiesta_brgy'] . " " . $row['fiesta_town'] . "'>" . $row['fiesta_brgy'] . " " . $row['fiesta_town'] . "</a> ($date), "; } echo rtrim($return, ', '); } } The result of this query will include the events on May.. How can i display only the event on this month(April)? starting todays date. Thank you
-
Fetch recent event in Vbulletin Calendar? Todays event
jalmz replied to jalmz's topic in Applications
Solved.. =) SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from BETWEEN '$day_before' AND '$time_now' ORDER BY dateline_from LIMIT 5 -
Fetch recent event in Vbulletin Calendar? Todays event
jalmz replied to jalmz's topic in Applications
ok it uses UNIX TIME STAMP $day_before 1302533714 04 / 11 / 11 @ 9:55:14am EST $time_now 1302620114 04 / 12 / 11 @ 9:55:14am EST PhpFreaks birthday dateline 1302605672 04 / 12 / 11 @ 5:54:32am EST dateline_from 1302566400 04 / 11 / 11 @ 7:00:00pm EST -
Fetch recent event in Vbulletin Calendar? Todays event
jalmz replied to jalmz's topic in Applications
when i echo $day_before 1302533714 then $time_now 1302620114 PhpFreaks birthday dateline 1302605672 dateline_from 1302566400 -
Fetch recent event in Vbulletin Calendar? Todays event
jalmz replied to jalmz's topic in Applications
ok.. in the Vbulletin table.. table vb_event eventid userid event title allowsmilies recurring recuroption calendarid customfields visible dateline (1201165110) utc (0.00) dateline_from (1202169600) dateline_to dst if our query is dateline_from = 1201165110 , then now how to get this variable (1201165110)? -
Hi guys, I would like to get the event for today's date. For Example the date today is April 12, 2011 then in my event calendar i have PhpFreaks birthday - April 12, 2011 Digitalpoint birthday - April 15, 2011 $time_now = time(); $day_before = $time_now - 86400; if ($result = mysql_query ("SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from >= '$day_before' ORDER BY dateline_from LIMIT 5")) { if (mysql_num_rows($result)) { $return = ''; while ($row = mysql_fetch_array( $result )) { $return .= "<a href='/forum/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=1' title='". $row['title'] . "' style='font-size:11px;'>" . $row['title'] . "</a>, "; } echo rtrim($return, ', '); } } The result of this code is PhpFreaks birthday - April 12, 2011, Digitalpoint birthday - April 15, 2011 I would like to display only the todays event. PhpFreaks birthday - April 12, 2011 Thank you
-
ok.. The power of modulo.. Thank you..
-
what about using CSS class? alt1 alt2
-
Thank you ! it works like a charm! How can we give points to the contributors of this website?
-
Hi guys, I would like to know on How to alternate table row colors in Php Mysql result? CSS or Html? Thanks <? $result = mysql_query("SELECT * FROM tbl_sta WHERE fiesta_date > '$now' ORDER BY sta_date LIMIT 5"); echo "<table id='table1' cellspacing='1' cellpadding='3'> <tr> <th>Upcoming Fiesta</th> </tr>"; while($row = mysql_fetch_array($result)){ $date = date("l, F j ",strtotime($row["sta_date"])); echo "<tr>"; echo "<td><a href='fiestasd.php' style='font-size:12px;font-weight:bold;'>" . $row['fiesta_brgy'] . " " . $row['fiesta_town'] . "</a> <br /> $date </td>"; echo "</tr>"; } echo "</table>"; ?> Thank you.. more power phpfreaks!
-
wow.. it works like a charm Thank you!
-
Thank you for the quick reply.. but still the result is theres a comma in the end.. Digitalpoint, phpfreaks, adsense,
-
Hi guys I'm having problem on how to display my php mysql result like this.. Digitalpoint, phpfreaks, adsense here's my code $result = mysql_query ("SELECT dateline, dateline_from, eventid, title FROM vb_event WHERE calendarid = 1 AND dateline_from >= '$day_before' ORDER BY dateline_from LIMIT 2"); while($row = mysql_fetch_array( $result )) { echo "<a href='/forum/calendar.php?do=getinfo&e=" . $row['eventid'] . "&c=1' title='". $row['title'] . "' style='font-size:12px;'>" . $row['title'] . "</a> " ; } the result is Digitalpoint, phpfreaks, adsense, how to remove the "," in the end? it should be like this.. Digitalpoint, phpfreaks, adsense with no , comma in the end.. Thank you..
-
heres the output.. <?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>eJalmz Feed</title> <link>http://#####</link> <description>eJalmz RSS Feed</description> <pubDate>Thu, 24 Feb 2011 01:17:14 +0000</pubDate> <item> <title>Nikon D200</title> <link>http://###</link> <guid>http://####</guid> <description>Pro-level D-SLR featuring a high performance 10.2-MP DX-format CCD, Nikon's exclusive Image Processing Engine and continuous...</description> <pubDate>Sat, 19 Feb 2011 07:28:08 +0000</pubDate> </item> <item> <title>Nexus S from Google</title> <link>http://#####</link> <guid>http://#####</guid> <description>Android 2.3 OS (Gingerbread) Gingerbread is the most advanced Android operating system available. In Google's ongoing quest...</description> <pubDate>Sat, 19 Feb 2011 07:18:13 +0000</pubDate> </item> <item> <title>Apple iphone 4 Black (16GB)</title> <link>http://#####</link> <guid>http://#####</guid> <description>At just 9.3mm, the iPhone 4 is thin as a rake but the front and back are 30 times stronger than the usual plastic. Reason -...</description> <pubDate>Wed, 16 Feb 2011 17:06:35 +0000</pubDate> </item> </channel> </rss>
-
Hi guys, im having problem on how to insert this code ... <atom:link href="######" rel="self" type="application/rss+xml" /> <?php /** A.R.A Class RSS Builder (c) 2007 Denis Sureau http://www.scriptol.com/rss/ API for creating RSS 2.0 feeds Licence GNU GPL 2. */ // Create a feed // Returns the XML document class ara { public $doc; public $rss; public $channel; function ARAMakeTag($tagname, $str) { $tag= $this->doc->createElement($tagname); $data= $this->doc->createTextNode($str); $tag->appendChild($data); return $tag; } public function ARAFeed($title, $link, $desc, $date) { $this->doc = new DOMDocument("1.0", "UTF-8"); $this->doc->formatOutput = true; $this->rss = $this->doc->createElement("rss"); $this->rss->setAttribute("version", "2.0"); $this->rss->setAttribute("xmlns:atom", "http://www.w3.org/2005/Atom"); $this->doc->appendChild($this->rss); $this->channel = $this->doc->createElement("channel"); $this->rss->appendChild($this->channel); $this->channel->appendChild($this->ARAMakeTag("title", $title)); $this->channel->appendChild($this->ARAMakeTag("link", $link)); $this->channel->appendChild($this->ARAMakeTag("description", $desc)); $this->channel->appendChild($this->ARAMakeTag("pubDate", $date)); } public function ARAItem( $title, $id, $cid, $desc, $date) { $item = $this->doc->createElement("item"); $item->appendChild($this->ARAMakeTag("title", $title)); $item->appendChild($this->ARAMakeTag("link", "####")); $item->appendChild($this->ARAMakeTag("guid", "#####")); $item->appendChild($this->ARAMakeTag("description", $desc)); $item->appendChild($this->ARAMakeTag("pubDate", $date)); $this->channel->appendChild($item); } public function save($fname) { $this->doc->save($fname); } public function saveXML() { return $this->doc->saveXML(); } } ?> i would like to add this code to validate my rss feed.. <atom:link href="http://dallas.example.com/rss.xml" rel="self" type="application/rss+xml" /> thanks in advance guys..