PHP - Hiding Or Encrypting The Url Source
I'd like to play music in the background of a page, but don't want to display the url of the music files in the source code or encrypt it. Is that possible to do using php?
Similar TutorialsHi I am trying to hide the image filepath and found this tutorial http://www.bounmis.com/en/PHP/How_To_Hide_Image_Source.html which I am currently using. It works but I need an additional security here so this script parses images only if the user is logged in to wordpress here's what i have so far: <?php include('wp-config.php'); $wp->init(); $wp->parse_request(); $wp->query_posts(); $wp->register_globals(); Header('Content-type: image/jpeg'); $exp=GMDate('D, d M Y H:i:s',time()+999); Header('Expires: $exp GMT'); $image_path = 'pathtoimages/'; $file=$image_path . $_GET["img"]; // getting image name and your image path if ( is_user_logged_in() ) { $file=$image_path.'authorized.jpg'; } else { $file=$image_path.'notauthorized.jpg'; }; if (file_exists($file)){ $info=getimagesize($file); $width=$info[0]; $height=$info[1]; if ($info[2]==1){ $img=@imagecreatefromgif($file); } else if ($info[2]==2){ $img=@imagecreatefromjpeg($file); } else if ($info[2]==3){ $img=@imagecreatefrompng($file); } else { $width=800; $height=600; $file = 'notauthorized.jpg'; // if there is not such image, it will show default image $img=@imagecreatefrompng($file); } ImageJpeg($img); imagedestroy($img); } ?> the script doesnt work. I think it's because i set headers Header('Content-type: image/jpeg'); What can I do to make it work? Please help thanks So I am trying to encrypt my web form and I have no idea where I put MD5 and where do I put it in MSQLADM <?php session_start(); include "common.php"; $message = $_GET['message']; //COLLECT POST data $formValue=array(); foreach ($_POST as $key => $value) { $formValue[$key] = strip_tags($value); //Lets register some POST Backs //This will allow us to repopulate form fields in the future if needed $_SESSION['post_vars'][$key] = $value; }//close for loop $myform = $_GET['CreateRecord']; if($myform==1){ //echo "test"; //Check for empty fields if($formValue['FirstName']=="" || $formValue['Surname']=="" || $formValue['UserName']=="" || $formValue['Email']=="" || $formValue['PassWord']=="" ){ $message = "missing form data, please check" ; header("Location: register.php?message=$message"); }else{ //Carry on with routine DBConnect(); $Link = mysql_connect($Host, $User, $Password); //$agentID = $_SESSION['userID']; $agentID = "1"; $Query = "INSERT INTO $Table_2 VALUES ('0', '".mysql_escape_string($formValue["FirstName"])."', '".mysql_escape_string($formValue["Surname"])."', '".mysql_escape_string($formValue["UserName"])."', '".mysql_escape_string($formValue["Email"])."', '".mysql_escape_string($formValue["PassWord"])."')"; if(mysql_db_query ($DBName, $Query, $Link)){ $message = "Successfully Registered!"; header("Location: login.php?message=$message"); }else{ $message = "Error Inserting!"; header("Location: register.php?message=$message"); }//close db query conditional }//close form validation conditional }//close form submit conditional ?> Thanks in advance Hi So I'm very new to php, and I've got a POST form with credit card information. Can anyone please explain to me in simple terms or give me a code to encrypt the data sent on the form and decrypt it so that when I get it in my email inbox I can understand it? Thank you! Whats the best way to encrypt passwords? Would something like this work? Code: [Select] crypt(sha1($salt.md5($salt).'hello'.sha1($salt)), $salt) Hello All, I have created a web application. Unfortunately at development time I forgot to encrypt my query parameter. So generally my apply URL shown like : http://mysite.com/myprofile.php?userId=2 So here any user can guess some other Ids because User Ids are not encrypted in URL. Is there any simple way to do it. I have more than 100 php pages and implementing ecry/decry logic on each page is time consuming So is there any way around? Regards, Prateek Hi, I am trying to create .htaccess and .htpasswd files in PHP using fopen and fwrite. But I don't think I'm encrypting the password correctly for the .htpasswd file. When I enter the username and password on the protected page, I am asked to enter them again. My error logs say "Password Mismatch". I have tried encrypting with: $encrypwd = crypt($pwd); and $encrypwd = md5($pwd); my username, password and create .htpasswd code $name = "6"; $pwd = "6"; $hpfile = $name."/private/.htpasswd"; $fh2 = fopen($hpfile, 'w') or die("can't open file"); $stringData = $name.":".$encrypwd; fwrite($fh2, $stringData); fclose($fh2); When I create a .htpasswd manually (entering the username and using an online htpasswd generator for the encrypted password) I am successful. I am using Xampp Lite, Windows 7, PHP Version 5.3.1 In case it matters Thanks I'm using PHP and MySQL. I have an application where I'd like to keep certain database (character) fields encrypted when added to the database and stored, but when I need to display them at the appropriate time, I can call a function and quickly decrypt them for display. Does anyone know of a simple way to do this? Thanks! Hi people! I have this code: if ($_POST['remember'] == true) { // COOKIES ON! $time = time() + 20000; setcookie(user, $username, $time); setcookie(pass, $password, $time); header("Location: index.php"); echo "<h1 class='welcome'>Welcome ".$_COOKIE['user']." |</h1>"; echo "<div id='divlogin' style='visibility:hidden'></div>"; echo "<a href='logout.php'><h1 class='logout'><b>Logout</b></h1></a>"; }elseif ($_POST['remember'] == false){ echo "<div id='divlogin' style='visibility:hidden'></div>"; echo "Div hidden!"; } "remember" - is a checkbox. So, if the checkbox is checked then I will activate the cookies and hide the divlogin (till now everything is fine), but if the checkbox isn't checked, I will just hide the divlogin (and this don't happen), however, the echo "Div hidden!" works nicely. The code detects if the checkbox is checked or not, the only problem is that if isn't checked the div doens't hide. Any ideas? Thanks Hi! I have got an array which contains messages for different types of errors on my website (for login errors and such). My problem is however, that when the array is empty it still shows the message box (the CSS). here is the code I am using: Code: [Select] public function showMessages() { if (count($this->_messages > 0)) { echo '<div id="messages">'; foreach ($this->_messages as $msg) { echo $msg . '<br />'; } echo '</div>'; } } I am starting to think that I need to be doing this in JavaScript. I would prefer to do it using PHP only, if it is possible though. Thanks for the help! Hello, What if I wanted to publish a php program but want to hide the code so that even buyers would not get a look at it despite having the program fully functioning on their servers, is there a means through which I can hide the code so that it won't be shown even when the .php files are opened in a text editor? Hi all I have a website which has a payment system on it, I use sagepay, paypal and a few others. They all have relatively similar forms, in which the total amount to be paid is passed in a hidden form field, such as <input type="hidden" name="amount" value="25"> all the payment gateways I use have the same or similar method to send the total amount (ie: 25) for example, my paypal form is like <form action="https://www.paypal.com/cgi-bin/webscr" name="paypal_form" method="post">"> <input type="hidden" name="cmd" value="_xclick"> <input type="hidden" name="item_name" value="items"> <input type="hidden" name="currency_code" value="GBP"> <input type="hidden" name="notify_url" value="complete.php"> <input type="hidden" name="return" value="complete.php"> <input type="hidden" name="cancel_return" value="complete.php"> <input type="submit" name="submit" value="PayPal" /> </form> this is all fine, apart from the user can use things like "firebug" to alter the total to be paid, so they can change $25 to $4 for example. So my question is, is there anyway with PHP to send over these form values are hidden variables. My idea was to post my form fields apart from the "cost" to a PHP script, then get PHP to grab the total from the database and dump the value in cost field and send it along with the other posted values. So really, is there anyway to get PHP to process a form data in a hidden enviroment, so my payment form URL is something like process.php and then process.php on my server deals with the sending of the paypal form data, but in a way that the user cannot see this data, so they basically never get to see the paypal form and any of its contents. Hopefully that kind of makes sense I have tried so many ideas, but cannot seem to find a solution, although when I do, hopefully the same method can be used on all my payment forms. Thanks tons in advance When I display my database entries, I want to hide some of the data. As you can see in this example: http://www.beat-the-spread.net/week1.php What I'd like to do is leave all the cells blank where the spread is zero. Here's the code I'm using: Code: [Select] while($row = mysql_fetch_array( $result )) { $i=1; if ($row['game_id']='$i') { echo "<tr><td>"; echo $row['date']; echo "</td><td>"; echo $row['team_name']; echo "</td><td>"; echo $row['owner']; echo "</td><td>"; echo $row['pt_spread']; echo "</td><td>"; echo $row['team_pts']; echo "</td><td>"; echo $row['team_bet']; echo "</td><td>"; echo $row['team_cover']; echo "</td><td>"; echo $row['owner_pts']; echo "</td></tr>"; if ($table_row_count % 2 && $table_row_count != 0) { echo ' <tr style="height: 8px"></tr> '; } $table_row_count++; } $i++; } echo "</table>"; I've been fooling with this for a couple hours and can't seem to find a decent way to do this. Can anybody help with this? Thanks. Hey, im trying to hide a form for a upload script. but it will just look like this (see picture). its for a school project, here is the code Code: [Select] <div class="brick-left"> <?php $brugernavn = $_SESSION['brugernavn']; if ($_SESSION['brugernavn']) { $result = mysql_query("SELECT * FROM bruger WHERE brugernavn='$brugernavn'"); while ($row = mysql_fetch_array($result)) { $admin = $row['admin']; } if ($admin == 1){ echo"<center>"; echo"<form action=" . print $_SERVER["PHP_SELF"] . "method='post' enctype='multipart/form-data'>"; echo"<p><input type='hidden' name='contxt' value='upload'>"; echo"<input type='hidden' name='userId' value='123'>"; echo"<input type='file' name='upFile'></p>"; echo"<p><button type='submit'>Upload</button></p>"; echo"</form>"; } } ?> <?php print $message ?> </center> </div> Hi I want to hide the login box's of my webpage once you login. I have thought of two ways of doing it but which one would you say is better practice? 1. use a PHP if statement to echo 'Display: none on css' - when viewing source code it still shows the form but not displayed on page itself 2. use a PHP if statement around the whole <form></form> so it physically doesnt write the html if already logged in? Or if anyone has a better way it would be appreciated if you would share it? Thanks in advance I am building a member-based website, and I've got a bunch of buttons that lead from page to page. The links for these buttons are generated based on user ID and subsequent pages receive this variable as well. So, if you hover over the buttons, you get a link like this: http://www.mysite.com?id=423 How can I hide the last part? The '?id=423'? I must use this format of variable, and cannot resort to session variables. Is there a way to hide this portion of the links?? Ok so I have a website with two types of photo gallerys. Model Cars and Model Planes. The galleries are becoming so big that I need to add an archive link to the galleries, but it's messy to have the archive link there until we actually enable the archived photos. So what I want to do is show the DIV with the archive link in it if the page can find database a 1 in the model_pictures.car_gallery AND model_pictures.archive. How would I achieve this? The page is already connected to the database as it's pulling the images and information for the gallery. I need it to scan the entire 'archive' column in the database and also the 'car_gallery' and if it finds 1's in there AND the car_gallery then to show the link. What I would like to avoid, as I have two galleries, is having the archive link show on the car gallery when it finds a 1 in the archives column, but that archive is for a plane_gallery photo. Hence why I would like to have check both car_gallery + archive and then plane_gallery + archive. Any help would be greatly appreciated. Hi there, Is it possible to hide text on a page using PHP? For example, hide the word "hello" every time it appears on the page? Or have it display in a different color? Hi all, I am going to be offering downloads on my site to members. However i want to somehow hide the download link so that they are unable to copy and paste and give it to their friends. IE, they have to be logged into my site to be able to download it else its not possible. Any ideas? Thanks Jake! PS. Not sure if this is the correct forum. Hi all, I'm new to php (and the forum) and I'm trying to figure out something I feel should be relatively easy but can't figure out. I am wanting to parse the source of multiple web pages to get a list of classes. Here is what I've kind of tried to follow, with the help of the internet: Code: [Select] $buffer = file_get_contents("http://catalog.utk.edu/content.php?catoid=5&navoid=386&cpage=1"); $regex = '/ something something /'; preg_match($regex,$buffer,$match); var_dump($match); echo $match[1]; } I'm trying to extract the course number and name from part of the source that looks like this: Code: [Select] <td width="15">  </td> <td width="100%">•  <a href="preview_course_nopop.php?catoid=1&coid=32666" onClick="showCourse('1', '32666',this, 'a:2:{s:8:~location~;s:8:~template~;s:28:~course_program_display_field~;N;}'); return false;" target="_blank">ACCT 200 - Foundations of Accounting</a> </td> </tr> Now, here's the thing, beside the fact that I can't use regex properly, I want to be able to put this into a loop for multiple courses per page of source. I am pretty fluent in c++, but this is throwing me for a serious loop (pun intended) As a side note, I want to be able to do this for multiple pages as well, the only thing that changes in the page URL is the page=# part, so would it be possible to automate it for all 33 pages? Thanks for any help. jiat Not wanting to 'hijack' another thread, but curious about the error of my ways. Why specifically (and very very clearly as I am OLD fart and totally self taught in php/mysql), why will this not suffice to determine form where POSTED data came? page 1 - form start session create and store a hashed session variable 'who_is_it' (ie hash 1Q9zFrEd) display the form submit to page 2 page 2 start session create a hashed variable $is_it-me (ie hash 1Q9zFrEd) compare $is_it_me with the session variable 'who_is_it' if the camparison == each other obtain, validate, cleanse and store data ELSE not from a vaild source |