oni-kun
Members-
Posts
1,984 -
Joined
-
Last visited
-
Days Won
1
Everything posted by oni-kun
-
Header error... found solution, but curious if proper, Please help.
oni-kun replied to blesseld's topic in PHP Coding Help
If you're using header() than it will terminate the script, there is nothing more to be outputted. So there is no need to use ob_end_flush unless you require the output buffer to do something other than header();. -
Header error... found solution, but curious if proper, Please help.
oni-kun replied to blesseld's topic in PHP Coding Help
Yes, the output buffer (ob) is the only method to send a header after the page has been outputted. But note you have to place ob_start() at the TOP of your script before anything is outputted. Your sessions does not, but it is better practise or you will end up with problems along the road.. <?php ob_start(); //Start output buffer include 'tbnl-functions.php'; session_start(); ob_start -
Yes, in the body of the message you can place variables or whatever you'd like, PHP will parse the variables for you and send the message, the client would see the HTML and the variable that PHP sent through the mail() function.
-
The video is around 20mbs I'd assume? Change your max execution time to 200 seconds and see if it does this again, but here's an example youtube php downloaders source code you could look into.... http://www.sizlopedia.com/wp-content/uploads/files/youtube-download.txt etc.
-
Have you thought about reading said posts? lol
-
You should use Linux's built in ping program, to save coding and time. $address = 'www.phpfreaks.com'; //Can be IP or server. $ping = system("ping $address"); echo '<pre>'; echo $ping; Note you can use regex to extract what you want from the results.. txt2re.com should be a simple option if you don't know regex.
-
PASSING/ACCESSING VARIABLE THRU COOKIE PROBLEM
oni-kun replied to king94@'s topic in PHP Coding Help
Try this for your page two.. <?php ob_start(); //Start output buffer for the header() to work. if ($_POST['pref']=='y') { setcookie('font', $_POST['font'], time()+60*20); setcookie('size', $_POST['size'], time()+60*20); setcookie('color', $_POST['color'], time()+60*20); setcookie('inputtext', $_POST['inputtext'], time()+60*20); header('page3.php'); } And then make a page 3 just to test your cookies out: <?php echo "<font face='"; echo $_COOKIE['font']; echo "' size='"; echo $_COOKIE['size']; echo "' color='"; echo $_COOKIE['color']; echo "'>"; echo $_COOKIE['inputtext']; echo "</font>"; ?> -
PASSING/ACCESSING VARIABLE THRU COOKIE PROBLEM
oni-kun replied to king94@'s topic in PHP Coding Help
I don't know why you're using the else with sessions.. now that I look over your code, yes, you do not need to use '$_COOKIE['font'] = $_POST['font']'.. setcookie() does that for you. When you set the cookie, note you cannot display it on the same page as you're doing. You must use header() or similar to redirect the page saying that the preferences are updated, then you can list the cookie. -
PASSING/ACCESSING VARIABLE THRU COOKIE PROBLEM
oni-kun replied to king94@'s topic in PHP Coding Help
Your code might work, you did a simple mistake on using quotes. setcookie('font', '$_POST['font'], time()+60); setcookie('size', '$_POST['size'], time()+60); setcookie('color', '$_POST['color'], time()+60); setcookie('inputtext', '$_POST['inputtext'], time()+60); Should be: setcookie('font', $_POST['font'], time()+60); setcookie('size', $_POST['size'], time()+60); setcookie('color', $_POST['color'], time()+60); setcookie('inputtext', $_POST['inputtext'], time()+60); Note your +60 is only 60 seconds before expiring, if you're sure that's the length you want. -
Things may seem simpler than they seem.. $buffer = getPage($url); If you look in his code, it says 'return $html', so the function would naturally be assumed to return the pages contents, such as you wanted.
-
'Heur' means Heuristics, meaning it has not found a trojan, it has found something on your web page that has matched a pattern used by trojans on malware sites. Check your FTP with an anti-virus just in case, and all the files on your site. If this does not remedy it, something in your code is throwing off a false positive, especially if you use iframes or SSL includes that you or something put on there.
-
Yes, for example you've built the class and now you need to place it into an object! $form = new Form('form.php', 'Submit!'); //Create new object with constructor $form->addfield('this','that'); //Use a object function $form->addfield('$date', '$time') $form->displayForm(); //Use object's class function to display form Code is only an example, but as you see you call the functions within the class, and instantiate it from an object.
-
[SOLVED] How to remove \ (forward slash) in a string.
oni-kun replied to Eggzorcist's topic in PHP Coding Help
Yes, I don't get why you're using str_replace when you could use something such as stripslashes(); that was meant to fix escaped variables. Is there something else we're missing? -
I'm not sure what you mean. If you're meaning to execute an executable and output it in PHP you'd use something like this.. forgot the exact code.. $cal = @exec('cal'); echo '<pre>The date is:'; echo $cal; echo '</pre>'
-
Why does no one understand this? OP, you mean using mail() to send HTML inside the subject? <?php //define the receiver of the email $to = 'youraddress@example.com'; //define the subject of the email $subject = 'Test email'; //define the message to be sent. Each line should be separated with \n $message = "Hello World!\n\nThis is my first mail.<img src=\"http://img.com/img.jpg\"/> <b> I am html! </b> "; //define the headers we want passed. Note that they are separated with \r\n $headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com\r\n MIME-Version: 1.0"; //send the email $mail_sent = @mail( $to, $subject, $message, $headers ); //if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" echo $mail_sent ? "Mail sent" : "Mail failed"; ?> And that should allow you to send HTML in an e-mail, mime set.. messy but correct example.
-
Whoops, misworded the function. It's file_get_contents(). // contents of index.php <?php $awayfull01 = file_get_contents('./vote/week-01/01-away-full.php'); ?> <p><img src="images/team/<?php echo $awayfull01; ?>.jpg" /></p>
-
I get your problem. You'll have to use something such as this. include() would basically be the same as shoving that color into the form and not have it parse as a variable. $color = get_file_contents('./color.php'); And you're set!
-
Try this then: <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } else { die('$v1 is NOT set'); } ?> That'll stop the script if $v1 isn't set.. therefor not letting your IF statement echo anything, for testing purposes. If it's not echo'ing, then obviously your =1 isn't working..
-
Try this code, forgot to add the ;.. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>'; } ?>
-
You can use file_exists() alongside it to check, it'll be kinda fun writing that function actually.
-
The IF has its own scope and can't touch any variables outside, unless you're using globals (safe type). You can do these.. if (mysql_query($query2)){ echo "done"; //Just echo it where needed. } if (mysql_query($query2)){ $GLOBALS['done'] = "done"; //Set global $done as 'done', as you wanted }
-
Does it give you an error? Echo tokens variable before and after your changing code, I can't seem to parse your 1000 lines to see what it does, debugging is a must!
-
What? That's code is written poorly.. look up the echo and you'll note the construct formatting you should be doing with your if statements etc. <?php If ($v1=="1") { echo '<div class="overlay" id="overlay1"> <a class="player" href="http://localhost/clips/'. $vid1 . '"> </a> </div>' } Else { echo ""; //No need for this Else really.. } ?> Should work.. Note you can only store double quotes ( " ) in a single quote.. such as echo ' This " are "" quotes "" '; , anything else will fail.
-
"Cannot connect to DataBase: vvoyvwd_auctions Reason: Access denied for user 'vvoyvwd'@'localhost' (using password: YES)" That simply means you are denied access to the database with the username vvoyvwd.. If that is not your username, then someone has obviously uploaded .. poorly, a database which would probably contain something bad within it, you're lucky it comes up as an error. You mentioned you had cPanel? Well, Go check your cpanel logs etc! Edit: was that your database? I doubt it's a hacker problem then, go check with your staff support to see if SQL servers are up.....
-
Sounds weird, Try doing something like so: <?php $handle = open('grep stringtofind /path/to/apache/logs/access', 'r'); $output = utf8_encode(fread($handle, 1000000)); pclose($handle); echo($output); ?> And set a meta tag to show it's UTF-8. Your log could be in iso-latin1, your page may think it's utf, and your php doesn't know what's going on, so your browser will display the ? incorrectly in utf as latin-1 etc....