premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
It is because you have a default value in for the email and the name, remove that default value or check if the name is empty or is equal to that default value.
-
Write into a file without erasing previous recordings
premiso replied to g_p_java's topic in PHP Coding Help
$output = $ip." ".$newString . "\n"; -
<?php $var = explode(';',$explodedVar); $cnt = count($var); for ($i=0; $i<$cnt; $i++) { list($id, $size) = explode(", ", $var[$i]); echo "ID is $id and Size is $size <br />"; } ?> There is an example of how it will be done.
-
How is data being entered into your DB? To fix the problem we need to see that, as it will continue to do it unless you fix it at it's source. There is a half-assed way around it with str_replace, but I would recommend fixing the actual problem at it's source. Post the code where it get's entered into the DB if you want further assistance to fix the actual issue.
-
[SOLVED] help me please with save listing / save search
premiso replied to work_it_work's topic in PHP Coding Help
<?php if (isset($_COOKIE['saved_announcement'])) { $newCookie = $_COOKIE['saved_announcement'] . ", " . $_GET['id']; setcookie('saved_announcement', $newCookie, time()+3600, "/", "yourdomain.com"); }else { setcookie('saved_announcement', $_GET['id'], time()+3600, "/", "yourdomain.com"); } echo "Cookie Contains: " . $_COOKIE['saved_announcement']; die(); ?> Doing that outputs this after I ran that for id=1 and id=2 and id=3 Cookie Contains: 1, 2, 3 I do not know where your script is messing up, possible at the setcookie function, notice I added the path and domain to that. -
Sort of. To access the elements you would do: <?php $textAreas = $_POST['message']; foreach ($textAreas as $id => $message) { echo "ID: $id has $message for a message.<br />"; } ?> <textarea name="message[<?php echo $id; ?>]"> Also notice I changed the <? $id; ?> portion too.
-
Well the content-disposition is what causes the file to be available to download, if you want it inline you would have to remove that and it should show up in the browser. I am not sure if this is what you are looking for or not, but maybe there is a function in fpdf that you can set to "not download" or something similar like that. I am not familiar with it, so I cannot tell you honestly if it is possible.
-
[SOLVED] help me please with save listing / save search
premiso replied to work_it_work's topic in PHP Coding Help
It may be worth a try to follow this: http://www.aeonity.com/frost/php-setcookie-localhost-apache It describes how to setcookies while using localhost since they are touchier. And I am not sure how accurate the temp files will be, but yea. -
[SOLVED] help me please with save listing / save search
premiso replied to work_it_work's topic in PHP Coding Help
Remember, cookies cannot be accessed till a page reload to show the new version. Also remember to use the domain and path parameters in setcookie also to get accurate results each time. You may try unsetting the original cookie then resetting the new like so: <?php //adding another announcement $new_a_id = $_GET['id']; $year = (60*60*24*365); if(isset($_COOKIE['saved_announcements'])){ $a_ids = explode(",", $_COOKIE['saved_announcements']); forech($a_isd as $a_id_check) { if($new_a_id == trim($a_id_check)) { header("Location: a-page-because-that-announcement-is-already-saved.php"); exit; } } $new_a_array = $_COOKIE['saved_announcements'].", $new_a_id"; setcookie("saved_announcement", $new_a_array, time()-$year); setcookie("saved_announcement", $new_a_array, time()+$year); } else { setcookie("saved_announcement", $new_a_id, time()+$year); ?> And see if that helps out. -
I am not sure how your pdf class works, but it should be doable to embed, it may be a setting in the class, but there is a header call that makes it downloadable, removing that header or making it not get called if a variable is set is your best bet. I cannot recall which header it is, but look at header to find out.
-
Use a script that supports mass mailing. PEAR Mailer is a good one, you might even consider PHPMailer (not sure if that supports mass mailing). Pear::Mail is your best bet imo. Your other option is to do it in stages, limit the query to 50 emails send. Or use set_time_limit and change the execution time to be more than 30 seconds, however if accessing from a browser the browser may time out. So yea. Look into Pear::Mail for mass mailing
-
If the script is in the same file as the images folder, this would work: $temp1 = '\prodinitial\copimage.jpg'; $temp2 = '\prodinitial\copimage_1.jpg'; rename($temp1,$temp2); If you want to use the paths you would need to use the full paths and should look at $_SERVER['DOCUMENT_ROOT'] for that.
-
Do a print_r on that value and see what the index should be.
-
Then $line and $getuserprofile['club'] have seemingly different values. If you want it to work they need to be exactly the same. Maybe print them both out for debugging and see where there is a difference, vardump may help also to verify each type also.
-
You code the DB stuff in message.php That is a page on it's own and it works independently of the frameset page.
-
Yes, you can set the session timeout in the php.ini config. If you are using this in the db for the currently logged, however, you want that DB entry to expire also like runnerjp said. So, what you do, is create a CRON job or Scheduled Task and run it every 5-10 minutes checking db values. If there is a DB value of lastseen that is more than 15 minutes long you can expire that user in the DB entry. This will not kill their session, without the session timeout. But this will show them as offline if after 15 minutes of inactivity. Hope that makes sense. what do you mean using this in teh db? you mean if i have a row, etc to specify something like runnerjp stated? Right, you will have to create a new table or add a column to the user row. So a new table you would have, userid, lastseen each time a page is called you update that entry to keep the user alive. Then running a background script you can check for inactive/no longer logged in users and delete that row out of the DB if it is > x minutes. That way only users present in that table are shown as being logged in. http://www.google.com/search?hl=en&sa=X&oi=spell&resnum=1&ct=result&cd=1&q=php+who%27s+online&spell=1 There are a lot of scripts already made and tutorials on this subject.
-
http://www.w3schools.com/HTML/html_frames.asp Not quite. <frameset cols="25%,*"> <frame src="navigation.php"> <frame src="message.php"> </frameset> That would probably work, given that you have a navigation.php and message.php and your php server is running.
-
You have to do that, bottom left hand corner above the "Quick Reply".
-
Yes, you can set the session timeout in the php.ini config. If you are using this in the db for the currently logged, however, you want that DB entry to expire also like runnerjp said. So, what you do, is create a CRON job or Scheduled Task and run it every 5-10 minutes checking db values. If there is a DB value of lastseen that is more than 15 minutes long you can expire that user in the DB entry. This will not kill their session, without the session timeout. But this will show them as offline if after 15 minutes of inactivity. Hope that makes sense.
-
I am an idiot, sorry about that. <?php $lines = file('runningclubs.txt'); echo '<select id="club" name="club">'; foreach($lines as $line) { $rline = $line; if ($line == $getuserprofile['club']) $line = 'value="' . $line . '" SELECTED'; else $line = 'value="' . $line . '"'; echo '<option ' . $line . '>'.$rline.'</option>'; } echo '</select>'; ?> Should work.
-
If you have code, post the code. I am willing to help you if you actually tried first. Just dont expect me to write everything for you.
-
Yea, that would make sense...actually...weird? lol. But it still seems like a security flaw, imo. But I guess doing it that way, you could create a unique salt for each user, you just have to strip the first x characters off the string and re-use that salt. Now that would probably be securer then using the same salt for everyone...interesting.
-
That is true, when browser is closed so is the session. The question you need to ask yourself, is that ok? Let's say that someone is at a public computer in a library, they leave the computer running with the browser open to your site. They essentially created a loop hole, if after 30 minutes another user comes and sees, they will just use that account if they are not nice. However, you may not care to be honest. Most sites that contain shopping carts etc, timeout after 15-20 minutes for this reason. If you do not have sensitive information used for that user, I would say leaving them in until they close the browser is fine.