PHP - Save Link Url As Variable
Hi.
I have a sort of security script which checks a few things, how can i save the url of the link that was clicked, so i can pass it through the script then if all is good, continue on to the url, if not send them somewhere else let me try to explain better with a little text picture user clicks link ----------------------> link goes to my security script --------------------> if the check passes, continue to original links url so basically i just need to know how to save the links url as a variable Similar TutorialsHi!
I have this code above:
// Submit Data to ncbi. // Sends form's data to classController.php function NCBI_submit_data() { $formData = $('#blastx_form').serialize(); $php_method = 'ncbi_request'; $finalData = $formData + "&php_method=" + $php_method; $aR = ajaxReq('POST','../../classes/classController.php',$finalData,'json'); console.log($aR); } // General Ajax function function ajaxReq($method,$url,$data,$dataType) { $.ajax({ type: $method, url: $url, async: 'false', data: $data, dataType: $dataType, success: function(json, textStatus, jqXHR) { return json; }, error: function(jqXHR, textStatus, errorThrown) { console.log('Ajax call error: '+jqXHR.status+' '+errorThrown) } }); }Server returns a json object and i want to save it in aR variable. But console.log($aR); returns undefined Any idea on how to fix it ? I have seen a couple of other threads relatively similar but I still find my problem unique so I hope you guys give me a chance.
What I want to do: use proxy to bypass same origin policy and to save these values (that changes and need to be checked by timer) into variables that can be modified.
A server contains data.asp which looks something like this and updates from time to time (although with a bit more data):
{ "Title":"Tile of song" ,"Artist":"The artist" ,"Album":"The album" ,"CDCover":"/covers/randomcover.jpg" }The method I have tried is like the one on http://qnimate.com/s...Policy_for_AJAX. In case you guys don't want to follow the link I've posted the data here as well. <script> function loadXMLDoc() { var xmlhttp; if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://www.qnimate.com/ajaxdata.php",true); xmlhttp.send(); } </script> </head> <body> <button type="button" onclick="loadXMLDoc()">Request data</button> <div id="myDiv"></div>And the proxy file: <?php echo file_get_contents('http://www.qscutter.com/ajaxdata.txt'); ?>So what I want to do is store the data into variables that I can alter, not show it inside a div using innerHTML. Preferably check this ever so often for changes as well. Suggestions? I can add that I have the permission from the server owner to retrieve the information and to use it but no possibility to add script to their server, hence the proxy bypass attempt. Is there anyway of saving data to phpmyadmin, and linking it to another page with one button. I can do it separately but I can't seem to do it using one button. Does anyone has any ideas! Hey guys! I have the following script to create an excel file, the thing is that I dont want to be asked if I want to open or save the file when accessing the php file...I just want the php file directly to save the excel file. Heres the code: $filename = "test.xls"; $contents = "testdata1 \ntestdata2 \ntestdata3 \n"; header('Content-type: application/vnd.ms-excel'); header('Content-Disposition: attachment; filename='.$filename); echo $contents; Is there a way instead of using the header function, use something like: fopen, fwrite, fclose ? Thanks in advance! Cheers, Hi, I will start off trying to explain what I am trying to make the best I can. What I want to create is a script that gets the gold value from this website: http://www.lbma.org.uk/pages/index.cfm?page_id=46&title=current_statistics and then save it to a variable which I will use to calculate values of different gold karats. Here is the content in bold I need on the website I linked: Quote LONDON GOLD FIXING USD GBP EUR AM 1588.00 1005.127 1251.083 PM 1589.50 1004.741 1249.803 So what help do I need? Well, I don't expect you to figure out the calculating part for me but some help how to get that content pointed out above and save it to a variable is what I would appreciate getting some help with. I don't know much PHP, only some and I have been trying to figure this out for a day now without any success. I suppose php get contents and/or curl should be used here but I don't know how really. I would very much appreciate the help I can get on this. Thank you! Hy, How can I put a link to a variable without doing like: Code: [Select] <a href='#'>$var</a> I heard that can be other ways. Thanks Hi guys, I want to find the most efficient way of setting a php variable through a link.
What I'm trying to achieve is to allow the user to select a category and their location and store the two variables to update my database results. I first used the GET method, but since the page refreshes when the user selects any other Get variable, so it ends up reseting the variables. Currently I have the category and locations as drop down menu with links to each of the options. I'll appreciate any help. Thank you. :]
I have this link "https://localhost/what/index.php?album=parent%2Fsubalbum&image=1coffee.jpg" Am trying to insert a variable(eid=86) so that it comes before all other variables to read thus "https://localhost/what/index.php?eid=86&album=parent%2Fsubalbum&image=1coffee.jpg" Regards ive done a page that works fine but id like to add links to the results so i can view the models. working page here http://sts.hostei.com/dsgi/list_records.php in the make column i want a link that will only show the make clicked. if this was a fixed page i no how to do it but i cannot figure out to make it from the way ive discribed. i know i have to alter this line <td><div align="center"><?php echo $rows['make']; php?></div></td> but no idea how to do this. do i create a new page for the query? if so how do i pass the $var? is it possable to do this from the same page? ie appear undr the main table. Thanks <?php include("config.php"); // Connect to server and select database. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql = "SELECT make, COUNT(*) AS total, SUM(IF(comments = \'pass\', 1, 0)) AS withComments FROM dsgi_serval GROUP BY make ORDER BY COUNT(*) DESC"; $result=mysql_query($sql); php?> <table width="319" border="1"><tr> <td colspan="4"><font size="4" face="Verdana"> <strong><div align="center">Validation Total's </div></strong></font> </td> </tr> <tr> <td width="137" align="center"><strong>Make</strong></td> <td width="85" align="center"><strong>Total</strong></td> <td width="75" align="center"><strong>Validated</strong></td> </tr> <?php while($rows=mysql_fetch_array($result)){ php?> <tr> <td><div align="center"><?php echo $rows['make']; php?></div></td> <td><div align="center"><?php echo $rows['total']; php?></div></td> <td><div align="center"><?php echo $rows['withComments']; php?></div></td> </tr> <?php } php?> <tr> <td><div align="center">Totals</div></td> <td> <div align="center"> <?php // counts all rows $query = "SELECT make, COUNT(make) FROM dsgi_serval "; $result1 = mysql_query($query) or die(mysql_error()); // Print out result while($row1 = mysql_fetch_array($result1)){ echo $row1['COUNT(make)']; } ?> </div></td> <td><div align="center"> <?php // counts passes $query = "SELECT make, COUNT(make) FROM dsgi_serval where comments like 'pass'"; $result2 = mysql_query($query) or die(mysql_error()); while($row2 = mysql_fetch_array($result2)){ echo $row2['COUNT(make)']; } ?> </div></td> </tr> </table> <?php mysql_close(); php?> trying to post a link to the database Code: [Select] $amessage ="<a href="link.php">this is a link </a>"; then return that link later on another page. I have a page that lists out some basic information about each quiz this particular student has taken (call it "quiz summary"). I am creating another page that will have all details of a particular quiz by itself (call it "quiz detail"). If I have a link for each quiz on the "quiz summary" page, how do I tell the "quiz detail' page which link they clicked on? Or which quiz they have selected. I was thinking it would work if I assigned a session variable to each link and then the "quiz detail" page could verify which returns true still and show details for that quiz. Would this logic work? Npot sure how to do it anyone though. thanks for any help! Hi everybody,
I want to cloak my affiliate links or mask it so it looks like a pretty url. Also if possible, I want to track the clicked link with Google Analytics so I think I need a page where I can log the click.
I found lots of information but not for the situation I have. I get my links from my database like this:
echo '<a href="'.$info['url'].'">the link</a>';How can I accomplish this? So I need a url like www.mydomain.com/click and when a user click on the link the get a new page with a tracking code and a redirect script to the right url. Thanks so much for the help! Kind regards, Mark Hey, I'm trying to save a MySQL-Link source as an instance variable in my query class. The problem is that MySQL sees it as an invalid MySQL-Link (supplied argument is not a valid MySQL-Link resource). What I'm I doing wrong? //Walle Code: [Select] private $connection; //Construct public function __construct(&$connection) { $this->connection = $connection; } //Where the error occurs public function exe_query($sql) { $result = mysql_query($sql, $this->connection); if(!$result) { throw new Exception(mysql_error()); } return $result; } This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=359149.0 Hi everyone, first of all let me thank you for this wonderful forum I come back here always when i need help... i'm trying to learn so soon i hope, i'll be helping others... I have a question for now, i have a code which goes like this: Code: [Select] <? $b = time (); $date1 =date( "Y-m-d;h:i:s" , mktime(date("h")+6, date("i"), date("s"), date("m") , date("d"), date("Y"))); $str_time = "&receivedtimestamp="; $str_msg = "&msg=bkt"; $str_from = "from="; ?> <a href="http://testext.i-movo.com/api/receivesms.aspx?<?echo $str_from;?><?=$getuser[0]['phone'];?><?echo $str_time;?><?echo $date1;?><?echo $str_msg;?>">Get a Cupon</a> What i need is that when the URL is generated, one of those variables to be hidden, for example the $str_from to be in the link but not visible... I must tell you that the link on the Get Cupon goes to an external link so i don't know if i can do it with .httpaccess as i've heard... I have to put a link that can be clicked around the first name and last name variables in the echo statement below. I also need to add a variable from the Select query to the link such as: 'www.phpfreaks.com/admin/customers.php?page=1&cID="VARIABLE HERE" &action=edit' I've tried a bunch of things and none seem to work. while($row = mysql_fetch_array($result)){ echo '<tr><td>' . $row['customers_firstname'] . " " . $row['customers_lastname'] . '</td><td>' . date("M. d, Y", strtotime($row['date'])) . '</td><td>' . $row['plan_id'] . '</td></tr>'; David Hi, I know it is probely not a regex question but I don't know the right category. I have 2 variables like $variable1 and $ variable2 which are placed in a loop now I want the $variable to be echo't in a link like <a href="http://exampe.com/$variable1"/> On this dynamicly generated page I want to output the $varible1 of this link and $variable2 while($row = mysql_fetch_assoc($result)) { echo " <tr>"; echo " <td>" . $row["variable1"] . "</td>"; echo " <td>" . $row["variable2"] . "</td>"; echo " </tr>"; Hello all! I am somewhat new to PHP and SQL, but I think I have a basic understanding of how the language works. I have read through a million different websites and forums, and have tried a million different ways but am just not getting anywhere! This is what I am trying to do... I have a text link that I want to click through to an outside URL from my website. This outside URL was already entered into an SQL database, and I just cant seem to get the text link to bring up the outside URL from the database. This is what I have so far... 1.) My webpage that I am working on is www.mywebsite.com/articles.php 2.) I want the text "Read more..." on this webpage to click through to an outside URL, like "http://www.google.com", which was already entered into an SQL database under the title of "article_link" in a new window 3.) So I would like for "Read more..." to click through the outside URL that was entered into "article_link" in the database Code: [Select] <?php echo <p><a href="\' . $article_link . '\" target="_blank">Read more...</a></p>; ?> Nothing I have tried has worked so far, nothing clicks through to the outside URL in the "article_link" entry from the database. Sorry if I am being redundant, I have been at this all day! Please help and thank you in advance!! Hi All, I'm sending an email with a link to a web page with a form on. Code: [Select] <tr style="padding:10px;"> <td align="center"> <a style="text-decoration:none;" href="http://www.foo.co.uk/bar.php?id=123"> <img src="/header.jpg" border="0" style="display: block;" width="380" height="64" alt="Logo" /> </a> </td> </tr> I currently GET the id from the URL and add it to a hidden field in the form which then sends the ID to the database on submit so I know from which email the user came from to fill out the form. This doesn't always work as I guess some people move from the form page to look at other pages on my site then come back to fill in the form. I think I need to use SESSION to keep the id 'active' but cannot figure out how to GET the id from the URL and put it into a SESSION, alas I am struggling to even start and finish a basic SESSION. Thanks in advance, Ben. $link = ?><a href="post?id=<?php echo $id; ?>&title=<?php echo $slug_title; ?>"><?php echo $title; ?></a><?phpBasically what I am trying to do is get a url link of a current page that I'll be sending in an email. I have all the $_GET variables I need to duplicate the current url. For some reason it's giving me an error. Can you please fix what is shown above into something that'll work? Thanks. Edited by man5, 15 July 2014 - 07:09 PM. |