Jump to content

corbeeresearch

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Everything posted by corbeeresearch

  1. Hi, I'm trying to theme dynamically, but I can't seem to get to fit the sidebars and content to be aligned with each other. What am I doing wrong? here is my code. css #content-wrapper{ width: 922; background-color: #FFFFFF; } /* Content */ #content { /*float: left; color: #333; font-size: 14px; background: #FFF; margin: 0px 0px 0px 0px; padding: 10px; height: auto; width: auto; */ display:inline; float:left; position:relative; text-align:left; } /* sidebar */ #leftcolumn{ /* color: #333; margin: 0px 0px 0px 0px; padding: 10px; height: auto; width: 150px; font-size:11px; */ float: left; border-right: 1px solid #000; background: #FFF; display:inline; position:relative; } #rightcolumn { /* color: #333; margin: 0px 0px 0px 0px; padding: 10px; height: auto; width: 150px; font-size:11px; */ float: left; border-left: 1px solid #000; background: #FFF; display:inline; position:relative; } html <div id="content-wrapper"> <?php if ($page['sidebar_first']): ?> <div id="leftcolumn"><div class="section"> <?php print render($page['sidebar_first']); ?> </div></div> <?php endif; ?> <div id="content" class="column"><div class="section"> <?php if ($breadcrumb): ?> <div id="breadcrumb"><?php print $breadcrumb; ?></div> <?php endif; ?> <?php print render($title_prefix); ?> <?php if ($title): ?> <h1 class="title" id="page-title"> <?php print $title; ?> </h1> <?php endif; ?> <?php print render($title_suffix); ?> <?php if ($tabs): ?> <div class="tabs"> <?php print render($tabs); ?> </div> <?php endif; ?> <?php if ($action_links): ?> <ul class="action-links"> <?php print render($action_links); ?> </ul> <?php endif; ?> <?php print render($page['content']); ?> <?php print $feed_icons; ?> </div></div> <?php if ($page['sidebar_second']): ?> <div id="rightcolumn"><div class="section"> ?php print render($page['sidebar_second']); ?> </div></div> <?php endif; ?> <span> </span><br/> </div>
  2. Hi, After successfully creating a cron job that runs a php script to update the database. I thought everything was okay until I saw that outside public_html there are LOTS of duplicates of cron.php.n Where n are numbers. I suspect cron jobs are causing these. Does anyone knows why this is happening? and Is there something I could do to stop the system from generating something like this? I also a lot of dbn.sdb I'm not sure if this is related too.
  3. Nevermind, I did it again from scratch and it appears to work
  4. Hi This part of code `FK_user_project` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; Won't work in the following code. CREATE TABLE IF NOT EXISTS `tbl_issue` ( `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, `name` varchar(256) NOT NULL, `description` varchar(2000), `project_id` INTEGER, `type_id` INTEGER, `status_id` INTEGER, `owner_id` INTEGER, `requester_id` INTEGER, `create_time` DATETIME, `create_user_id` INTEGER, `update_time` DATETIME, `update_user_id` INTEGER ) ENGINE = InnoDB ; CREATE TABLE IF NOT EXISTS `tbl_user` ( `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, `email` Varchar(256) NOT NULL, `username` Varchar(256), `password` Varchar(256), `last_login_time` Datetime, `create_time` DATETIME, `create_user_id` INTEGER, `update_time` DATETIME, `update_user_id` INTEGER ) ENGINE = InnoDB ; CREATE TABLE IF NOT EXISTS `tbl_project_user_assignment` ( `project_id` Int(11) NOT NULL, `user_id` Int(11) NOT NULL, `create_time` DATETIME, `create_user_id` INTEGER, `update_time` DATETIME, `update_user_id` INTEGER, PRIMARY KEY (`project_id`,`user_id`) ) ENGINE = InnoDB ; -- The Relationships ALTER TABLE `tbl_issue` ADD CONSTRAINT `FK_issue_project` FOREIGN KEY (`project_id`) REFERENCES `tbl_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `tbl_issue` ADD CONSTRAINT `FK_issue_owner` FOREIGN KEY (`owner_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `tbl_issue` ADD CONSTRAINT `FK_issue_requester` FOREIGN KEY (`requester_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `tbl_project_user_assignment` ADD CONSTRAINT `FK_project_user` FOREIGN KEY (`project_id`) REFERENCES `tbl_project` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `tbl_project_user_assignment` ADD CONSTRAINT `FK_user_project` FOREIGN KEY (`user_id`) REFERENCES `tbl_user` (`id`) ON DELETE CASCADE ON UPDATE RESTRICT; -- Insert some seed data so we can just begin using the database INSERT INTO `tbl_user` (`email`, `username`, `password`) VALUES ('test1@notanaddress.com','Test_User_One', MD5('test1')), ('test2@notanaddress.com','Test_User_Two', MD5('test2')) ; Where did I go wrong? Thanks
  5. Actually two type of website first site is largely pure article information plus voting, contact form, flash movie, download of mp3's. The login is strictly for administrative purpose. expected numbers of visitors per day would be 15,000. 2nd site is a private social networking with something like project planning, journals, forums, and some sort of complicated journal that connects all other journals like a wiki. users would probably less than a hundred. In addition to this, if it at a distant future the first site reached millions of visits and the second site thousands of users, how large should I increase the ram and process power?
  6. Hi, if ever I'm planning to build a typical web 2.0 php website. How much RAM should I choose and how many processing power do I need? Thanks
  7. Hi, It's my first time encountering a php.ini in a public_html folder. and the problem is that when you do a www.example.com/php.ini you will see the configuration. Is this safe? how do you make it safe? Thanks
  8. Nevermind, I realized that I'm overwriting the loop. Thanks for everyones time.
  9. First of all, I'm not used to using database without codeigniter, though it is working fine, I kept receiving a warning message. Warning: mysql_fetch_array() expects parameter 1 to be resource, string given in XXXXXXX on line 69 result: 6Error, message already sent What am I doing wrong to prompt this warning? this is my code <?php include('config.php'); $nineyesterday =date( 'Y-m-d H:i:s', mktime(date("H") - (date("H") + 3), date("i") - date("i"), date("s") - date("s"), date("m") , date("d"), date("Y")) ); $ny10pm =date( 'Y-m-d H:i:s', mktime(date("H") - (date("H") + 3), date("i") - date("i") + 10, date("s") - date("s"), date("m") , date("d"), date("Y")) ); $now = date('Y-m-d H:i:s'); $nineam = date('Y-m-d 09:00:00'); $ninepm = date('Y-m-d 21:00:00'); $nine10am = date('Y-m-d 09:10:00'); $nine10pm = date('Y-m-d 21:10:00'); echo '9pm yesterday: '.$nineyesterday; echo '<br/>'; echo '9am: '.$nineam; echo '<br/>'; echo '9pm: '.$ninepm; echo '<br/>'; echo 'now: '.$now; echo '<br/>'; /** * If statement inside if statement, check if record exists in the database, * if not available, insert and send email * if exists do nothing. * * */ if ((strtotime($now) > strtotime($ny10pm)) && (strtotime($now) <= strtotime($nine10am))) { //count the answers by yes or no echo 'yesterday at 9pm till today at 9am '.'<br/>'; //query the date if doesn't exist insert the date and do the query $date = "SELECT count(date) FROM t_date WHERE date = '".$nineam."'"; $istrue = mysql_query($date); while($row = mysql_fetch_array($istrue)) { $istrue = $row['count(date)']; } echo "result: ".$istrue; if ($istrue == 0) { $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date BETWEEN '".$nineyesterday."' AND '".$nineam."' GROUP BY opt desc "; $subject = "Confessions from ".$nineyesterday." to ".$nineam; $flagdate = mysql_query("INSERT INTO t_date(date) values('".$nineam."')"); echo "<br/> successful <br/>"; } else { exit('Error, message already sent'); } // else exits } elseif ((strtotime($now) > strtotime($nine10am)) && (strtotime($now) <= strtotime($nine10pm))) { //count the answers by yes or no echo 'today at 9am to 9pm'.'<br/>'; //query the date if doesn't exist insert the date and do the query $date = "SELECT count(date) FROM t_date WHERE date = '".$ninepm."'"; $istrue = mysql_query($date); while($row = mysql_fetch_array($istrue)) { $istrue = $row['count(date)']; } echo "result: ".$istrue; if ($istrue == 0) { $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date BETWEEN '".$nineam."' AND '".$ninepm."' GROUP BY opt desc "; $subject = "Confessions from ".$nineam." to ".$ninepm; $flagdate = mysql_query("INSERT INTO t_date(date) values('".$ninepm."')"); echo "<br/> successful <br/>"; } else { exit('Error, message already sent'); } exit; } Thanks in advance
  10. Nevermind, that's because it's today after 9pm.
  11. Hi, I'm preparing a code for an automated email, but the date time is not working correctly. I wanted to do a cron scheduler that emails people twice a day - 9am and 9pm. 9am sends email about records logged starting 9pm yesterday to 9am, while 9pm sends email about records logged from 9:01am to 9:00pm. The database uses date/time, so I was doing an if statement of date time, but I wasn't getting the result I wanted. Sometimes the $now time is not within the yesterday 9pm to the 9pm today range. I don't know what I'm doing wrong, but I'm sure that it has something to do with the if statement, as the some of the $now time enters the else statement Here is my code: <?php $today = date('Y-m-d 00:00:00'); $nineyesterday = date('Y-m-d H:i:s', mktime(date("H") - (date("H") + 6), date("i") - date("i"), date("s") - date("s"), date("m") , date("d"), date("Y"))); $now = date('Y-m-d H:i:s', mktime(date("H") + 13, date("i"), date("s"), date("m") , date("d"), date("Y"))); $nineam = date('Y-m-d 09:00:00'); $nine30 = date('Y-m-d 09:30:00'); $ninepm = date('Y-m-d 18:00:00'); echo '9pm yesterday: '.$nineyesterday; echo '<br/>'; echo '9am: '.$nineam; echo '<br/>'; echo '9pm: '.$ninepm; echo '<br/>'; echo 'now: '.$now; echo '<br/>'; if ((strtotime($now) > strtotime($nineyesterday)) and (strtotime($now) <= strtotime($nineam))) { //count the answers by yes or no echo 'am'; } elseif ((strtotime($now) > strtotime($nineam)) and (strtotime($now) <= strtotime($ninepm))) { //count the answers by yes or no echo 'pm'; } else { echo 'error'; } ?> Thanks in advance
  12. I'm don't really much understand the 1st and 2nd digit of the chmod I know that 3rd means everyone. Owner means that only cpanel can control it right? how about group? do you need some php function to let chmod know it is a group? Thanks
  13. I found that the cause is the if statement, but I'm not sure what to replace with it if ((strtotime($now) >= strtotime($today)) && (strtotime($now) <= strtotime($nineam))) { } elseif ((strtotime($now) >= strtotime($nineam)) && (strtotime($now) <= strtotime($ninepm))) { }
  14. create a select statement query before the foreach statement to compare. if it match, then skip the foreach
  15. I'm not sure how actionscript bridge with php, but to create a variable use $ e.g. $variable = flashdb to print it out use echo $variable
  16. I don't understand: when I do this query in phpmyadmin, "SELECT opt ,date FROM `plus_poll_ans` WHERE date BETWEEN '2010-11-07 18:00:00' AND '2010-11-08 09:00:00' " I get result: Yes 2010-11-07 22:49:52 but when I do it in php if ((strtotime($now) > strtotime($nineyesterday)) && (strtotime($now) < strtotime($nineam))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date BETWEEN '".$nineyesterday."' AND '".$nineam."' GROUP BY opt desc "; } elseif ((strtotime($now) > strtotime($nineam)) && (strtotime($now) < strtotime($ninepm))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date BETWEEN '".$nineam."' AND '".$ninepm."' GROUP BY opt desc "; } $q = mysql_query($q) or die(mysql_error()); I get nothing
  17. You're right. I fixed the code, unfortunately, I got no query results <?php include('config.php'); $today = date('Y-m-d 00:00:00'); $nineyesterday = date('Y-m-d H:i:s', mktime(date("H") - (date("H") + 6), date("i") - date("i"), date("s") - date("s"), date("m") , date("d"), date("Y"))); $now = date('Y-m-d H:i:s'); $nineam = date('Y-m-d 9:00:00'); $ninepm = date('Y-m-d 18:00:00'); echo '9pm yesterday: '.$nineyesterday; echo '<br/>'; echo '9am: '.$nineam; echo '<br/>'; echo 'now: '.$now; $dif= strtotime($nineam) - strtotime($now); echo '<br/>'; echo $dif; echo '<br/>'; if ((strtotime($now) >= strtotime($today)) && (strtotime($now) <= strtotime($nineam))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date>'".$nineyesterday."' AND date<'".$nineam."' GROUP BY opt desc "; } elseif ((strtotime($now) >= strtotime($nineam)) && (strtotime($now) < strtotime($ninepm))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date<'".$nineam."' AND date>='".$ninepm."' GROUP BY opt desc "; } $q = mysql_query($q) or die(mysql_error()); //separate the results while($row = mysql_fetch_array($q)) { $total_opt[] = $row['count(opt)']; } mysql_freeresult($q); $yes = intval($total_opt[0]); $no = intval($total_opt[1]); $total = $yes + $no; ?> my output is 9pm yesterday: 2010-11-07 18:00:00 9am: 2010-11-08 9:00:00 now: 2010-11-08 22:57:12 -50232 Query was empty
  18. Hi, I'm trying to get the date, using this code <?php include('config.php'); $today = date('Y-m-d 00:00:00'); $nineyesterday = date('Y-m-d H:i:s', mktime(date("H") - (date("H") + 6), date("i") - date("i"), date("s") - date("s"), date("m") , date("d"), date("Y"))); $now = date('Y-m-d H:i:s'); $nineam = date('Y-m-d 9:00:00'); $ninepm = date('Y-m-d 18:00:00'); if ((strtotime($now) >= strtotime($today)) && (strtotime($now) <= strtotime($nineam))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date<='".$nineyesterday."' AND date>='".$nineam."' GROUP BY opt desc "; } elseif ((strtotime($now) >= strtotime($nineam)) && (strtotime($now) <= strtotime($ninepm))) { //count the answers by yes or no $q = "SELECT opt, count(opt) FROM plus_poll_ans WHERE date<'".$nineam."' AND date>='".$ninepm."' GROUP BY opt desc "; } $q = mysql_query($q) or die(mysql_error()); //separate the results while($row = mysql_fetch_array($q)) { $total_opt[] = $row['count(opt)']; } mysql_freeresult($q); $yes = intval($total_opt[0]); $no = intval($total_opt[1]); $total = $yes + $no; echo $total."<br/>"; echo $yes."<br/>"; echo $no."<br/>"; ?> but it didn't work, why isn't it working? Thanks
  19. Hi, I'm using XAMPP server I did the ff code <?php echo date('Y-m-d H:i:s'); ?> the time was 9:01pm, but I get 2010-11-08 13:01:18 in the code. What's causing it to display inaccurately? Thanks
  20. Hi, is it possible to make a php script only executable by cpanel's cron job and not by anyone else. I was thinking chmod, but what's the correct chmod to make it only executable by server and not just by anyone, or does anyone know how to prevent a visitor(hacker) from running a script that is designed to be only used by cron? Thanks
×
×
  • 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.