-
Posts
149 -
Joined
-
Last visited
Never
Everything posted by elis
-
No, where the server is physically located as a different time zone than you. Try this: $hourplus = "4"; $adjusteddate = date("l, d F Y h:i a",time() + ($hourplus * 3600)); print ("$adjusteddate");
-
I want a script to run and only pull data that was updated in the last seven days based on the date attached to the field. Here's my script so far $query="select *,DATE_FORMAT(date, '%M %d, %Y') AS updated from member_entries where validated > 0"; $showresult = mysql_query($query) if(!$showresult) { usererror();} I don't know how to pull data that was updated within the last seven days based on $query[updated] field. I tried using MKtime() but that seems as if it's based on today and I want it to based on the last designated pull day (ie last Sunday) so that it's not reupdating each day and only once a week. Would this work better as a cron?
-
Oh, okay. Thank you, my mistake.
-
That's weird. I found it by mistake here: http://us3.php.net/manual/en/function.mysql-real-escape-string.php In the user comments several people mentioned the function but like you said, it seems like doesn't exist. Here's a sample code somebody posted <?php function sanitize($input){ if(is_array($input)){ foreach($input as $k=>$i){ $output[$k]=sanitize($i); } I'm still learning PHP so the chances that I misunderstood this is extremely high.
-
Could somebody please explain the sanitize(); function and whether it's wise to use it in adjacent to $valude = mysql_real_escape_string(strip_tags(trim($_POST['value']))); in regards to security? I've tried searching for the function on PHP.net and through Google but came up short.
-
I have something similar on my site. It updates the "lastloggin" field of the member's table to show the date he/she last logged in. $updatelastloggin = mysql_query("UPDATE usr_members SET lastloggin = now() WHERE userid = '$password[userid]' LIMIT 1"); This is set under the login code. I suppose, if you set a similar function where the user also logs out and then perform a simple math equation on the two, you should receive the total time the user has been logged in.
-
Okay, thank you. I'll add the bottom code in for radio boxes and so fourth. So the top code should suffice for all the $_post[value]?
-
Also, should this be done with all form fields, even if they're dropdown or radio?
-
I have a fairly quick question. I'm still working learning PHP security features and though I've visited several of websites about the issue. However, I'm still slightly confused. My question is this, if I use: $value = trim(htmlentities(strip_tags(mysql_real_escape_string($_POST['value'])))); Is this correct? If not could you please point me in the right direction.
-
You will need to set specific article ID's or some sort of tag that identifies a particular article. You can then set the comment script to pull comments relating to the appropriate article tag or id. Edited: Since you're new to coding, you should take a look at this script http://www.daydreamgraphics.com/d/tutorial/list/235/2: It seems similar to what you're looking for and only small modifications are likely to be needed.
-
If I'm understanding you correctly, after a form is submitted you want another process with the same data started? You can easily do this. I don't know your exact coding, so I'm running on a whim here but try: if (isset($_POST['submit'])) {include("includes/emailcode.php");} else { finish form code
-
I figured it out, it was a matter of correctly rearranging the positioning of the coding like, I originally thought. Some tweaking and head-banging on my keyboard straightened it. Thank you for your help.
-
Does anyone have any suggestions, please?
-
I've tried that but in order to do that I'd prefer the WHERE clause to be based on the auto_increment id, which for someone reason I'm having trouble grabbing. If I use another WHERE element, then I run the risk of updating multiple tables, if for some reason somebody decides to submit the form more than one time with the exact same information.
-
I'm not even sure if this is achievable but I'll try to explain what I want done: In the below code snippet: else { $send = "INSERT INTO advt_apps (appid,name,website,pay_email,pay_emailconf,email,emailconf,banner_image,text_link,comments,ad_length,ad_type,ad_total) VALUES ('','$name','$website','$pay_email','$pay_emailconf','$email','$emailconf','$banner_image','$text_link','$comments','$ad_length ','$ad_type','$ad_total') AND SE"; $sent = mysql_query($send) or die("Query setup failed".mysql_error()); $appc="SELECT * FROM advt_settings WHERE id = 1"; $go=mysql_query($appc); $res=mysql_fetch_array($go); if($ad_type=="text ad") $ad_amount=$res[price_text]; elseif($ad_type=="small banner") $ad_amount=$res[price_banner_small]; elseif($ad_type=="large banner") $ad_amount=$res[price_banner_large]; elseif($ad_type=="inquire") $ad_amount="0"; if($ad_length=="one month") $ad_time=1; elseif($ad_length=="three months") $ad_time=3; elseif($ad_length=="six months") $ad_time=6; elseif($ad_length=="one year") $ad_time="12"; elseif($ad_length=="custom length") $ad_time="0"; $ad_total=$ad_amount * $ad_time; I'm trying to insert the last line of the code "$ad_total" into the MYSQL table. However, if I rearrange the coding so that the below snippet is before the insert query, the "$ad_total" field is not read nor calculated (it's supposed to be two other numerical fields multiplied each other to receive the latter) if($ad_type=="text ad") $ad_amount=$res[price_text]; elseif($ad_type=="small banner") $ad_amount=$res[price_banner_small]; elseif($ad_type=="large banner") $ad_amount=$res[price_banner_large]; elseif($ad_type=="inquire") $ad_amount="0"; if($ad_length=="one month") $ad_time=1; elseif($ad_length=="three months") $ad_time=3; elseif($ad_length=="six months") $ad_time=6; elseif($ad_length=="one year") $ad_time="12"; elseif($ad_length=="custom length") $ad_time="0"; $ad_total=$ad_amount * $ad_time; I'm thinking that if I could select the auto_increment id, which in this case is "appid" as the tables are being inserted, then I could immediately update those tables,based on the "appid", to add the $ad_total field after the insert. I hope my ramblings made sense, I'm not the best at explaining things. To sum everything up, I'm trying to get the $ad_total field added to the MYSQL table, but because of their positioning within the code, it's not being read - if I change the posistion then the leading "else" statement is thrown off.
-
I have the following code: if(!$username==""){ $qCheck = "select * from .... (I didn't put the full code, because I didn't think it was vital - if anyone thinks it is let me know, and I'll add it.) ($username is a $_post[...] field from an input box) Which is for if the $username field isn't empty, to run a a check on it and output a specific result. However, when the $username field is empty, the script stops running. Is there any way I can get the script to ignore if the $username field is empty, and continue running?
-
Ah, thank you. I will look into that.
-
I'm actually looking for what this is called, I plan to do the research for it myself, but that's a bit difficult without a keyword to go on. My goal is for my login script to automatically delete a user who hasn't logged in a set number of days, only I'm not sure what a code example, name, anything would be called for the "set number of days" part. I already have a function that notes the users last login, I just need to...I'm not sure of the word I'm looking for, 'compare' it to the above. I'm thinking (note this was written on a whim, so obviously there's no actual functunality) if(!$login<30[d]) I'm sorry if this isn't explained well.
-
At the moment, it seems like your best bet is to use a prewritten install code, and piggyback off that. Try downloading any sample file from hotscripts and editing their installation file to suit your needs.
-
This is a little off topic to your initial question, but you may also,if you already haven't, check the legalities behind running an mp3 store. There's definitely a lot of redtape that goes a long with that.
-
$phpFile = "yourfile.php"; $run = fopen($phpFile, 'w') or die("Can't open the file"); $Data = "YOUR TEXT\n"; fwrite($run, $Data); fclose($run); This is only if I understood what you were trying to do correctly, I may have misinterpretted you.
-
Thank you, Apparently your very mystical relevant questions were useless, as I suspected and stated in my imaginary post, I was missing an id field in the html.
-
You immature haughty attitiude is not needed, what part of "I forgot to add the code" are you not comprehending? Do me a favor and just stop replying, I'll look for help else where.
-
I assure you, there is an insert query... I did forget to post it. [quote]$send = "INSERT INTO appl_user (tid,pid,username,name,date,loc,posistion,exp,sam_w,sam_s,coms,email) VALUES ('','$uidded','$username','$name','$date','$loc','$posistion','$exp','$samw','$sams','$coms','$email')"; $sent = mysql_query($send) or die("Query setup failed".mysql_error()); [/quote] Nor is this "solved". I'd appreciate being asked whether it is instead of assumptions being made in the future.