
cunoodle2
Members-
Posts
602 -
Joined
-
Last visited
Never
Everything posted by cunoodle2
-
which page are you accessing via the URL? header.php? If so I don't see the init.php being included in it.
-
echo $query; ???
-
To me often a plus represents a space. I would do a dash as that seems to be the most common. The underscore is probably sufficient too but not as often used.
-
PHP/JavaScript contact form validation
cunoodle2 replied to IronicallyMaiden's topic in PHP Coding Help
Likely the issue is on line 13 of your code. -
Its all from this page. Very strange.. http://www.myspace.com/mobsters_emailadds/blog/526750016
-
I need help on css table and how best to code this in. What I am looking for is a table that fills up the entire page (100% width). In that I need to have 3 columns. Column A: This is the left most column and I want to specify a designated width (I.E. 150 pixels or something similar) Column B: This is the center column and I want it to flex in size based upon the user's monitor resolution. On big monitors it will be very wide. On small monitors it will be very small. Column C: This is the right most column and I want to specify a designated width (I.E. 100 pixels or something similar) Is this possible to do? I will try to draw it out here to try to clarify.. <--------------Table that is 100% of the screen width -------------> <Column A: 150 pixels> <Column B: FLEX width> <Column C: 100 pixels> Thank you again for your help =)
-
The issue is with your SELECT statement. $query = "SELECT * from `users`"; That is incorrect for 2 reasons... #1.. NEVER EVER do "Select *" Its generally sloppy and you should specify colums names. IE "Select `first`, `last`, `level` FROM `users`... #2. You NEED to add a "WHERE clause to the end. Right now you are just selecting ALL columns and ALL users. You have no idea WHICH user's "level" you are looking at. Try instead to do something like.. Select `first`, `last`, `level` FROM `users`WHERE `id` = $var; Note that my code will NOT work on your site. It depends on what the name of your primary key field is or whatever method you are using to search.
-
AyKay47 had the correct answer. What output, if any are you getting? Can you put it on it's OWN page as I am betting that you have other script on the page that is causing issues.
-
login to a speciic page based on unsername
cunoodle2 replied to site-spin's topic in PHP Coding Help
what does your login in source look like? That would be a good place for us to start -
Check your php code on line #7.
-
You could use fopen or php curl to read in the pages. From there you could use strpos or a variety of other items to get the text you want. Here is the code you could use for a twitter feed.. <?php $twitter_name = "phpfreaks"; $twitter_max = 5; $doc = new DOMDocument(); $doc->load('http://twitter.com/statuses/user_timeline.rss?screen_name='.$twitter_name); $twitter_counter = 0; foreach ($doc->getElementsByTagName('item') as $node) { //get the title and url of the twitter post $title = $node->getElementsByTagName('title')->item(0)->nodeValue; $url = $node->getElementsByTagName('link')->item(0)->nodeValue; $twitter_search_name = $twitter_name.": "; $pos = strpos($title, $twitter_search_name); //verify that the twitter post contains if ($pos !== false) { if ($pos == 0) { if ($twitter_counter < $twitter_max) { $title = str_replace($twitter_search_name,"", $title); echo "<a href=\"$url\" target=\"_blank\">$title</a><br />\n"; $twitter_counter++; } } } if ($twitter_counter >= $twitter_max) break; } ?>
-
I think the issue with your page is on line 27 of the code in header_template.php.
-
What error messages, if any are you getting? Here is how You could try formatting the code if you like.. echo '<tr class="$class">'; echo "<td>".$row["firstname"]." ".$row["firstname"]." thinks that this will happen on ".$row["date"]."</td>"; echo "</tr>"; Does that work?
-
how would i generate a string like "A3B34" OR "D56AB"
cunoodle2 replied to jasonc's topic in PHP Coding Help
How about this order of operations.. 1) Using a random number generator to get 3 letters. I believe this is code for that.. <?php echo base_convert(3, 10, 36); ?> 2) Then store all 3 of these items into an array "Temp_pass". The first character will be the beginning of your new string which I will call "secure_pass". Remove the first character of the array "Temp_pass" which will now just contain 2 letters. 3) After that generate 3 random integers and append them to the end of the array "Temp_pass." 4) Then use a random number generator (1-5) to determine which element is go next in the string of "secure_pass" Remove this element from the array and append it to the end of "secure_pass" 5) Then use a random number generator (1-4) to determine which element is go next in the string of "secure_pass" Remove this element from the array and append it to the end of "secure_pass" etc... -
Backup of Database PHP MYSQL (HELP REQUIRED)
cunoodle2 replied to radiations3's topic in PHP Coding Help
I was trying to get something like this that would automatically email out the backup but I could never get it to work. You can see my post on that item here.. http://www.phpfreaks.com/forums/index.php?topic=338431 -
Can you have an "overall standing" column in your table? Basically a running total that tracks where everything stands. "0" means that the company and employee are even. -200 means that the employee "owes" the company $200. If overall_standing < 0 { Amount of pay is monthly_pay - overall_standing; Overall_standing = 0; } That work???
-
Yeah, Its a linux server on a shared hosting environment so I really don't have much options in terms of configuration of the server itself. Anyone else have any suggestions on how to make this work better? All I'm looking for is a daily db backup to be emailed out. Everything I search for on google suggests installing Pear and using mail.php... unfortunately I don't have that option.
-
I'm using a script that I found on-line and have modified it a little but am running in to an issue here. Objective: To create a DB backup, attached to an email and then send the email to a gmail account. This will be called via a cron job nightly. For now here is the code that I have.. <?php $string = `mysqldump –user=user_name –password=pass db_name | gzip -9`; // Email the mysqldump output as an attachment. // Create an attachment filename that is datestamped. $filename = "db_backup_" . date('Y-m-d') . ".sql.gz"; // Designate email addresses, names, etc. $mailto = "[email protected]"; $from_name = "DB Backup"; $from_mail = "[email protected]"; $replyto= "[email protected]"; $subject = "Daily Database Backup"; $message = "DO NOT DELETE!!!"; // This next line takes our mysqldump output and encodes it // for our use an as email attachment. $content = chunk_split(base64_encode($string)); // We need a unique identifier for the attachment boundary // within the email. $uid = md5(uniqid(time())); // Build the email header. $header = "From: " . $from_name . " <" . $from_mail . ">\r\n"; $header .= "Reply-To: " . $replyto . "\r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n"; $header .= "This is a multi-part message in MIME format.\r\n"; $header .= "–" . $uid . "\r\n"; $header .= "Content-type:text/plain; charset=iso-8859-1\r\n"; $header .= "Content-Transfer-Encoding: 7bit\r\n\r\n"; $header .= $message . "\r\n\r\n"; $header .= "–" . $uid . "\r\n"; // We need to use a valid Content-Type entry here for the attachment. // You can see a list at http://en.wikipedia.org/wiki/Internet_media_type $header .= "Content-Type: application/x-gzip; name=\"" . $filename . "\"\r\n"; $header .= "Content-Transfer-Encoding: base64\r\n"; $header .= "Content-Disposition: attachment; filename=\"" . $filename . "\"\r\n\r\n"; $header .= $content . "\r\n\r\n"; $header .= "–" . $uid. "–"; // OK, let’s email the attachment and exit. mail($mailto, $subject, "", $header); exit(0); ?> The Issue: When I receive the email at the gmail account it contains no attachment and the body of the email looks like this.. Do you see anything that would cause this to happen? I figured this line had the issue $header .= "Content-Type: multipart/mixed; boundary=\"" . $uid . "\"\r\n\r\n"; but that did not seem to do the trick. Any help would be greatly appreciated.
-
Can you store a session variable and then check it to verify that only a person with proper permission can view said page?
-
Well first thing that you need to do is to get the location of the ".com" in the string. You would do that like this.. <?php $pos = strpos($string, '.com', 1); ?> From there you could use the substring function to get the remaining letters like this.. <?php //right now the value of "$pos" is beginning of the '.com' //we need to increase it by 5 to adjust for the length of the .com as well as scrapping the 1st letter like you requested $pos = $pos +5; $result = substr($string, $pos, 3); echo $result; ?>
-
You never actually execute the query. See the manual on this .. http://php.net/manual/en/function.mysql-query.php
-
Here is some code that I had used in the past. I had 3 secure fields in the DB and I needed to verify that no users had the exact same SETS of all 3 security fields. Here was my code.. <?php //set up a query to check for security codes $stmt = $read->prepare("SELECT `Key1` FROM `User` where Key1 = ?, Key2 = ? AND Key3 = ?;"); do{ //get three random numbers to be used for security tracking in database $key1 = RandPass(); $key2 = RandPass(); $key3 = RandPass(); //execute query and extract information $stmt->execute(array($key1, $key2, $key3)); $result = $stmt->fetch(PDO::FETCH_ASSOC); } while ($key1 == $result["Key1"]); ?> Basically it would keep generating random keys until the key1 did NOT match. You should be able to use something like this. My other thought is to just build a table of RMA's with 2 colums (ID and rand#). Have this table already built (like possibly in the middle of the night to prevent load during busy times) and then when the user needs an RMA they just get the next one in said table that has yet to be used. So again, build the entire table of like 3,000 RMAs and then just pull values from there. Once you get over 2000 RMAS then build another table. You will be totally fine.
-
Regarding the error: Use of undefined constant
cunoodle2 replied to sandhya's topic in PHP Coding Help
The errors you are getting are from the code on line #44 in your .php files